Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-26 09:17:56

0001 // Created on: 2004-06-10
0002 // Created by: Alexander SOLOVYOV
0003 // Copyright (c) 2004-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _XSDRAWSTL_DataSource_HeaderFile
0017 #define _XSDRAWSTL_DataSource_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 
0021 #include <TColStd_HArray2OfInteger.hxx>
0022 #include <TColStd_HArray2OfReal.hxx>
0023 #include <MeshVS_DataSource.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <TColStd_Array1OfReal.hxx>
0026 #include <MeshVS_EntityType.hxx>
0027 #include <TColStd_Array1OfInteger.hxx>
0028 #include <Poly_Triangulation.hxx>
0029 
0030 class XSDRAWSTL_DataSource;
0031 DEFINE_STANDARD_HANDLE(XSDRAWSTL_DataSource, MeshVS_DataSource)
0032 
0033 //! The sample DataSource for working with STLMesh_Mesh
0034 class XSDRAWSTL_DataSource : public MeshVS_DataSource
0035 {
0036 
0037 public:
0038   //! Constructor
0039   Standard_EXPORT XSDRAWSTL_DataSource(const Handle(Poly_Triangulation)& aMesh);
0040 
0041   //! Returns geometry information about node (if IsElement is False) or element (IsElement is True)
0042   //! by coordinates. For element this method must return all its nodes coordinates in the strict
0043   //! order: X, Y, Z and with nodes order is the same as in wire bounding the face or link. NbNodes
0044   //! is number of nodes of element. It is recommended to return 1 for node. Type is an element
0045   //! type.
0046   Standard_EXPORT Standard_Boolean GetGeom(const Standard_Integer ID,
0047                                            const Standard_Boolean IsElement,
0048                                            TColStd_Array1OfReal&  Coords,
0049                                            Standard_Integer&      NbNodes,
0050                                            MeshVS_EntityType&     Type) const Standard_OVERRIDE;
0051 
0052   //! This method is similar to GetGeom, but returns only element or node type. This method is
0053   //! provided for a fine performance.
0054   Standard_EXPORT Standard_Boolean GetGeomType(const Standard_Integer ID,
0055                                                const Standard_Boolean IsElement,
0056                                                MeshVS_EntityType&     Type) const Standard_OVERRIDE;
0057 
0058   //! This method returns by number an address of any entity which represents element or node data
0059   //! structure.
0060   Standard_EXPORT Standard_Address
0061     GetAddr(const Standard_Integer ID, const Standard_Boolean IsElement) const Standard_OVERRIDE;
0062 
0063   //! This method returns information about what node this element consist of.
0064   Standard_EXPORT virtual Standard_Boolean GetNodesByElement(const Standard_Integer   ID,
0065                                                              TColStd_Array1OfInteger& NodeIDs,
0066                                                              Standard_Integer&        NbNodes) const
0067     Standard_OVERRIDE;
0068 
0069   //! This method returns map of all nodes the object consist of.
0070   Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllNodes() const Standard_OVERRIDE;
0071 
0072   //! This method returns map of all elements the object consist of.
0073   Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllElements() const Standard_OVERRIDE;
0074 
0075   //! This method calculates normal of face, which is using for correct reflection presentation.
0076   //! There is default method, for advance reflection this method can be redefined.
0077   Standard_EXPORT virtual Standard_Boolean GetNormal(const Standard_Integer Id,
0078                                                      const Standard_Integer Max,
0079                                                      Standard_Real&         nx,
0080                                                      Standard_Real&         ny,
0081                                                      Standard_Real& nz) const Standard_OVERRIDE;
0082 
0083   DEFINE_STANDARD_RTTIEXT(XSDRAWSTL_DataSource, MeshVS_DataSource)
0084 
0085 protected:
0086 private:
0087   Handle(Poly_Triangulation)       myMesh;
0088   TColStd_PackedMapOfInteger       myNodes;
0089   TColStd_PackedMapOfInteger       myElements;
0090   Handle(TColStd_HArray2OfInteger) myElemNodes;
0091   Handle(TColStd_HArray2OfReal)    myNodeCoords;
0092   Handle(TColStd_HArray2OfReal)    myElemNormals;
0093 };
0094 
0095 #endif // _XSDRAWSTL_DataSource_HeaderFile