0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / XSDRAWSTLVRML / XSDRAWSTLVRML_DataSource.hxx
1 // Created on: 2004-06-10
2 // Created by: Alexander SOLOVYOV
3 // Copyright (c) 2004-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _XSDRAWSTLVRML_DataSource_HeaderFile
17 #define _XSDRAWSTLVRML_DataSource_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
21
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>
33 #include <Poly_Triangulation.hxx>
34
35
36 class XSDRAWSTLVRML_DataSource;
37 DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DataSource, MeshVS_DataSource)
38
39 //! The sample DataSource for working with STLMesh_Mesh
40 class XSDRAWSTLVRML_DataSource : public MeshVS_DataSource
41 {
42
43 public:
44
45   
46   //! Constructor
47   Standard_EXPORT XSDRAWSTLVRML_DataSource(const Handle(Poly_Triangulation)& aMesh);
48   
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 Standard_OVERRIDE;
54   
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 Standard_OVERRIDE;
58   
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 Standard_OVERRIDE;
61   
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;
64   
65   //! This method returns map of all nodes the object consist of.
66   Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllNodes() const Standard_OVERRIDE;
67   
68   //! This method returns map of all elements the object consist of.
69   Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllElements() const Standard_OVERRIDE;
70   
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;
74
75
76
77
78   DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DataSource,MeshVS_DataSource)
79
80 protected:
81
82
83
84
85 private:
86
87
88   Handle(Poly_Triangulation) myMesh;
89   TColStd_PackedMapOfInteger myNodes;
90   TColStd_PackedMapOfInteger myElements;
91   Handle(TColStd_HArray2OfInteger) myElemNodes;
92   Handle(TColStd_HArray2OfReal) myNodeCoords;
93   Handle(TColStd_HArray2OfReal) myElemNormals;
94
95
96 };
97
98
99
100
101
102
103
104 #endif // _XSDRAWSTLVRML_DataSource_HeaderFile