42cf5bc1 |
1 | // Created on: 1993-07-19 |
2 | // Created by: Remi LEQUETTE |
3 | // Copyright (c) 1993-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _BRepTools_ShapeSet_HeaderFile |
18 | #define _BRepTools_ShapeSet_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <BRep_Builder.hxx> |
25 | #include <GeomTools_SurfaceSet.hxx> |
26 | #include <GeomTools_CurveSet.hxx> |
27 | #include <GeomTools_Curve2dSet.hxx> |
28 | #include <TColStd_IndexedMapOfTransient.hxx> |
29 | #include <Standard_Boolean.hxx> |
30 | #include <TopTools_ShapeSet.hxx> |
31 | #include <Standard_OStream.hxx> |
32 | #include <Standard_IStream.hxx> |
33 | #include <TopAbs_ShapeEnum.hxx> |
34 | class BRep_Builder; |
35 | class TopoDS_Shape; |
36 | |
37 | |
38 | //! Contains a Shape and all its subshapes, locations |
39 | //! and geometries. |
40 | //! |
41 | //! The topology is inherited from TopTools. |
42 | class BRepTools_ShapeSet : public TopTools_ShapeSet |
43 | { |
44 | public: |
45 | |
46 | DEFINE_STANDARD_ALLOC |
47 | |
48 | |
49 | //! Builds an empty ShapeSet. |
50 | //! Parameter <isWithTriangles> is added for XML Persistence |
51 | Standard_EXPORT BRepTools_ShapeSet(const Standard_Boolean isWithTriangles = Standard_True); |
52 | |
53 | //! Builds an empty ShapeSet. |
54 | //! Parameter <isWithTriangles> is added for XML Persistence |
55 | Standard_EXPORT BRepTools_ShapeSet(const BRep_Builder& B, const Standard_Boolean isWithTriangles = Standard_True); |
56 | |
57 | //! Clears the content of the set. |
58 | Standard_EXPORT virtual void Clear() Standard_OVERRIDE; |
59 | |
60 | //! Stores the goemetry of <S>. |
61 | Standard_EXPORT virtual void AddGeometry (const TopoDS_Shape& S) Standard_OVERRIDE; |
62 | |
63 | //! Dumps the geometry of me on the stream <OS>. |
64 | Standard_EXPORT virtual void DumpGeometry (Standard_OStream& OS) const Standard_OVERRIDE; |
65 | |
66 | //! Writes the geometry of me on the stream <OS> in a |
67 | //! format that can be read back by Read. |
68 | Standard_EXPORT virtual void WriteGeometry (Standard_OStream& OS) Standard_OVERRIDE; |
69 | |
70 | //! Reads the geometry of me from the stream <IS>. |
71 | Standard_EXPORT virtual void ReadGeometry (Standard_IStream& IS) Standard_OVERRIDE; |
72 | |
73 | //! Dumps the geometry of <S> on the stream <OS>. |
74 | Standard_EXPORT virtual void DumpGeometry (const TopoDS_Shape& S, Standard_OStream& OS) const Standard_OVERRIDE; |
75 | |
76 | //! Writes the geometry of <S> on the stream <OS> in a |
77 | //! format that can be read back by Read. |
78 | Standard_EXPORT virtual void WriteGeometry (const TopoDS_Shape& S, Standard_OStream& OS) const Standard_OVERRIDE; |
79 | |
80 | //! Reads the geometry of a shape of type <T> from the |
81 | //! stream <IS> and returns it in <S>. |
82 | Standard_EXPORT virtual void ReadGeometry (const TopAbs_ShapeEnum T, Standard_IStream& IS, TopoDS_Shape& S) Standard_OVERRIDE; |
83 | |
84 | //! Inserts the shape <S2> in the shape <S1>. This |
85 | //! method must be redefined to use the correct |
86 | //! builder. |
87 | Standard_EXPORT virtual void AddShapes (TopoDS_Shape& S1, const TopoDS_Shape& S2) Standard_OVERRIDE; |
88 | |
89 | Standard_EXPORT virtual void Check (const TopAbs_ShapeEnum T, TopoDS_Shape& S) Standard_OVERRIDE; |
90 | |
91 | //! Reads the 3d polygons of me |
92 | //! from the stream <IS>. |
93 | Standard_EXPORT void ReadPolygon3D (Standard_IStream& IS); |
94 | |
95 | //! Writes the 3d polygons |
96 | //! on the stream <OS> in a format that can |
97 | //! be read back by Read. |
98 | Standard_EXPORT void WritePolygon3D (Standard_OStream& OS, const Standard_Boolean Compact = Standard_True) const; |
99 | |
100 | //! Dumps the 3d polygons |
101 | //! on the stream <OS>. |
102 | Standard_EXPORT void DumpPolygon3D (Standard_OStream& OS) const; |
103 | |
104 | //! Reads the triangulation of me |
105 | //! from the stream <IS>. |
106 | Standard_EXPORT void ReadTriangulation (Standard_IStream& IS); |
107 | |
108 | //! Writes the triangulation |
109 | //! on the stream <OS> in a format that can |
110 | //! be read back by Read. |
111 | Standard_EXPORT void WriteTriangulation (Standard_OStream& OS, const Standard_Boolean Compact = Standard_True) const; |
112 | |
113 | //! Dumps the triangulation |
114 | //! on the stream <OS>. |
115 | Standard_EXPORT void DumpTriangulation (Standard_OStream& OS) const; |
116 | |
117 | //! Reads the polygons on triangulation of me |
118 | //! from the stream <IS>. |
119 | Standard_EXPORT void ReadPolygonOnTriangulation (Standard_IStream& IS); |
120 | |
121 | //! Writes the polygons on triangulation |
122 | //! on the stream <OS> in a format that can |
123 | //! be read back by Read. |
124 | Standard_EXPORT void WritePolygonOnTriangulation (Standard_OStream& OS, const Standard_Boolean Compact = Standard_True) const; |
125 | |
126 | //! Dumps the polygons on triangulation |
127 | //! on the stream <OS>. |
128 | Standard_EXPORT void DumpPolygonOnTriangulation (Standard_OStream& OS) const; |
129 | |
130 | |
131 | |
132 | |
133 | protected: |
134 | |
135 | |
136 | |
137 | |
138 | |
139 | private: |
140 | |
141 | |
142 | |
143 | BRep_Builder myBuilder; |
144 | GeomTools_SurfaceSet mySurfaces; |
145 | GeomTools_CurveSet myCurves; |
146 | GeomTools_Curve2dSet myCurves2d; |
147 | TColStd_IndexedMapOfTransient myPolygons2D; |
148 | TColStd_IndexedMapOfTransient myPolygons3D; |
149 | TColStd_IndexedMapOfTransient myTriangulations; |
150 | TColStd_IndexedMapOfTransient myNodes; |
151 | Standard_Boolean myWithTriangles; |
152 | |
153 | |
154 | }; |
155 | |
156 | |
157 | |
158 | |
159 | |
160 | |
161 | |
162 | #endif // _BRepTools_ShapeSet_HeaderFile |