1 // Created on: 2004-06-10
2 // Created by: Alexander SOLOVYOV
3 // Copyright (c) 2004-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _XSDRAWSTLVRML_DataSource_HeaderFile
17 #define _XSDRAWSTLVRML_DataSource_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
22 #include <TColStd_PackedMapOfInteger.hxx>
23 #include <TColStd_HArray2OfInteger.hxx>
24 #include <TColStd_HArray2OfReal.hxx>
25 #include <MeshVS_DataSource.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Standard_Integer.hxx>
28 #include <TColStd_Array1OfReal.hxx>
29 #include <MeshVS_EntityType.hxx>
30 #include <Standard_Address.hxx>
31 #include <TColStd_Array1OfInteger.hxx>
32 #include <Standard_Real.hxx>
36 class XSDRAWSTLVRML_DataSource;
37 DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DataSource, MeshVS_DataSource)
39 //! The sample DataSource for working with STLMesh_Mesh
40 class XSDRAWSTLVRML_DataSource : public MeshVS_DataSource
47 Standard_EXPORT XSDRAWSTLVRML_DataSource(const Handle(StlMesh_Mesh)& aMesh);
49 //! Returns geometry information about node ( if IsElement is False ) or element ( IsElement is True )
50 //! by co-ordinates. For element this method must return all its nodes co-ordinates in the strict order: X, Y, Z and
51 //! with nodes order is the same as in wire bounding the face or link. NbNodes is number of nodes of element.
52 //! It is recommended to return 1 for node. Type is an element type.
53 Standard_EXPORT Standard_Boolean GetGeom (const Standard_Integer ID, const Standard_Boolean IsElement, TColStd_Array1OfReal& Coords, Standard_Integer& NbNodes, MeshVS_EntityType& Type) const;
55 //! This method is similar to GetGeom, but returns only element or node type. This method is provided for
56 //! a fine performance.
57 Standard_EXPORT Standard_Boolean GetGeomType (const Standard_Integer ID, const Standard_Boolean IsElement, MeshVS_EntityType& Type) const;
59 //! This method returns by number an address of any entity which represents element or node data structure.
60 Standard_EXPORT Standard_Address GetAddr (const Standard_Integer ID, const Standard_Boolean IsElement) const;
62 //! This method returns information about what node this element consist of.
63 Standard_EXPORT virtual Standard_Boolean GetNodesByElement (const Standard_Integer ID, TColStd_Array1OfInteger& NodeIDs, Standard_Integer& NbNodes) const Standard_OVERRIDE;
65 //! This method returns map of all nodes the object consist of.
66 Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllNodes() const;
68 //! This method returns map of all elements the object consist of.
69 Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllElements() const;
71 //! This method calculates normal of face, which is using for correct reflection presentation.
72 //! There is default method, for advance reflection this method can be redefined.
73 Standard_EXPORT virtual Standard_Boolean GetNormal (const Standard_Integer Id, const Standard_Integer Max, Standard_Real& nx, Standard_Real& ny, Standard_Real& nz) const Standard_OVERRIDE;
78 DEFINE_STANDARD_RTTI(XSDRAWSTLVRML_DataSource,MeshVS_DataSource)
88 Handle(StlMesh_Mesh) myMesh;
89 TColStd_PackedMapOfInteger myNodes;
90 TColStd_PackedMapOfInteger myElements;
91 Handle(TColStd_HArray2OfInteger) myElemNodes;
92 Handle(TColStd_HArray2OfReal) myNodeCoords;
93 Handle(TColStd_HArray2OfReal) myElemNormals;
104 #endif // _XSDRAWSTLVRML_DataSource_HeaderFile