0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / XSDRAWSTLVRML / XSDRAWSTLVRML_DataSource3D.hxx
1 // Created on: 2014-08-04
2 // Created by: Artem NOVIKOV
3 // Copyright (c) 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_DataSource3D_HeaderFile
17 #define _XSDRAWSTLVRML_DataSource3D_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
21
22 #include <TColStd_PackedMapOfInteger.hxx>
23 #include <TColStd_HArray1OfInteger.hxx>
24 #include <TColStd_HArray2OfReal.hxx>
25 #include <TColStd_HArray2OfInteger.hxx>
26 #include <MeshVS_DataSource.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <Standard_Integer.hxx>
29 #include <TColStd_Array1OfReal.hxx>
30 #include <MeshVS_EntityType.hxx>
31 #include <MeshVS_HArray1OfSequenceOfInteger.hxx>
32 #include <Standard_Address.hxx>
33 #include <TColStd_Array1OfInteger.hxx>
34 #include <Standard_Real.hxx>
35
36
37 class XSDRAWSTLVRML_DataSource3D;
38 DEFINE_STANDARD_HANDLE(XSDRAWSTLVRML_DataSource3D, MeshVS_DataSource)
39
40 //! The sample DataSource3D for working with STLMesh_Mesh
41 class XSDRAWSTLVRML_DataSource3D : public MeshVS_DataSource
42 {
43
44 public:
45
46   
47   //! Constructor
48   Standard_EXPORT XSDRAWSTLVRML_DataSource3D();
49   
50   //! Returns geometry information about node ( if IsElement is False ) or element ( IsElement is True )
51   //! by co-ordinates. For element this method must return all its nodes co-ordinates in the strict order: X, Y, Z and
52   //! with nodes order is the same as in wire bounding the face or link. NbNodes is number of nodes of element.
53   //! It is recommended to return 1 for node. Type is an element type.
54   Standard_EXPORT Standard_Boolean GetGeom (const Standard_Integer theID, const Standard_Boolean theIsElement, TColStd_Array1OfReal& theCoords, Standard_Integer& theNbNodes, MeshVS_EntityType& theType) const Standard_OVERRIDE;
55   
56   //! This method returns topology information about 3D-element
57   //! Returns false if element with ID isn't 3D or because other troubles
58   Standard_EXPORT virtual Standard_Boolean Get3DGeom (const Standard_Integer theID, Standard_Integer& theNbNodes, Handle(MeshVS_HArray1OfSequenceOfInteger)& theData) const Standard_OVERRIDE;
59   
60   //! This method is similar to GetGeom, but returns only element or node type. This method is provided for
61   //! a fine performance.
62   Standard_EXPORT Standard_Boolean GetGeomType (const Standard_Integer theID, const Standard_Boolean theIsElement, MeshVS_EntityType& theType) const Standard_OVERRIDE;
63   
64   //! This method returns by number an address of any entity which represents element or node data structure.
65   Standard_EXPORT Standard_Address GetAddr (const Standard_Integer theID, const Standard_Boolean theIsElement) const Standard_OVERRIDE;
66   
67   //! This method returns information about what node this element consist of.
68   Standard_EXPORT virtual Standard_Boolean GetNodesByElement (const Standard_Integer theID, TColStd_Array1OfInteger& theNodeIDs, Standard_Integer& theNbNodes) const Standard_OVERRIDE;
69   
70   //! This method returns map of all nodes the object consist of.
71   Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllNodes() const Standard_OVERRIDE;
72   
73   //! This method returns map of all elements the object consist of.
74   Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllElements() const Standard_OVERRIDE;
75   
76   //! This method calculates normal of face, which is using for correct reflection presentation.
77   //! There is default method, for advance reflection this method can be redefined.
78   Standard_EXPORT virtual Standard_Boolean GetNormal (const Standard_Integer theID, const Standard_Integer theMax, Standard_Real& theNx, Standard_Real& theNy, Standard_Real& theNz) const Standard_OVERRIDE;
79
80
81
82
83   DEFINE_STANDARD_RTTIEXT(XSDRAWSTLVRML_DataSource3D,MeshVS_DataSource)
84
85 protected:
86
87
88
89
90 private:
91
92
93   TColStd_PackedMapOfInteger myNodes;
94   TColStd_PackedMapOfInteger myElements;
95   Handle(TColStd_HArray1OfInteger) myElemNbNodes;
96   Handle(TColStd_HArray2OfReal) myNodeCoords;
97   Handle(TColStd_HArray2OfInteger) myElemNodes;
98
99
100 };
101
102
103
104
105
106
107
108 #endif // _XSDRAWSTLVRML_DataSource3D_HeaderFile