dd370fa35a86f006871eb285b8e652165b6fa2ff
[occt.git] / src / BRepTools / BRepTools_ShapeSet.hxx
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
35 class BRep_Builder;
36 class TopoDS_Shape;
37
38
39 //! Contains a Shape and all  its subshapes, locations
40 //! and geometries.
41 //!
42 //! The topology is inherited from TopTools.
43 class BRepTools_ShapeSet  : public TopTools_ShapeSet
44 {
45 public:
46
47   DEFINE_STANDARD_ALLOC
48
49   
50   //! Builds an empty ShapeSet.
51   //! Parameter <isWithTriangles> is added for XML Persistence
52   Standard_EXPORT BRepTools_ShapeSet (const Standard_Boolean isWithTriangles = Standard_True);
53   
54   //! Builds an empty ShapeSet.
55   //! Parameter <isWithTriangles> is added for XML Persistence
56   Standard_EXPORT BRepTools_ShapeSet (const BRep_Builder& B,
57                                       const Standard_Boolean isWithTriangles = Standard_True);
58   
59   //! Clears the content of the set.
60   Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
61   
62   //! Stores the goemetry of <S>.
63   Standard_EXPORT virtual void AddGeometry (const TopoDS_Shape& S) Standard_OVERRIDE;
64   
65   //! Dumps the geometry of me on the stream <OS>.
66   Standard_EXPORT virtual void DumpGeometry (Standard_OStream& OS) const Standard_OVERRIDE;
67   
68   //! Writes the geometry of  me  on the stream <OS> in a
69   //! format that can be read back by Read.
70   Standard_EXPORT virtual void WriteGeometry
71     (Standard_OStream& OS,
72      const Handle(Message_ProgressIndicator) &theProgress = NULL) Standard_OVERRIDE;
73   
74   //! Reads the geometry of me from the  stream  <IS>.
75   Standard_EXPORT virtual void ReadGeometry
76     (Standard_IStream& IS,
77      const Handle(Message_ProgressIndicator) &theProgress = NULL) Standard_OVERRIDE;
78   
79   //! Dumps the geometry of <S> on the stream <OS>.
80   Standard_EXPORT virtual void DumpGeometry
81     (const TopoDS_Shape& S, Standard_OStream& OS) const Standard_OVERRIDE;
82   
83   //! Writes the geometry of <S>  on the stream <OS> in a
84   //! format that can be read back by Read.
85   Standard_EXPORT virtual void WriteGeometry
86     (const TopoDS_Shape& S, Standard_OStream& OS) const Standard_OVERRIDE;
87   
88   //! Reads the geometry of a shape of type <T> from the
89   //! stream <IS> and returns it in <S>.
90   Standard_EXPORT virtual void ReadGeometry
91     (const TopAbs_ShapeEnum T, Standard_IStream& IS, TopoDS_Shape& S) Standard_OVERRIDE;
92   
93   //! Inserts  the shape <S2> in  the  shape <S1>.  This
94   //! method must be   redefined  to  use   the  correct
95   //! builder.
96   Standard_EXPORT virtual void AddShapes (TopoDS_Shape& S1, const TopoDS_Shape& S2) Standard_OVERRIDE;
97   
98   Standard_EXPORT virtual void Check (const TopAbs_ShapeEnum T, TopoDS_Shape& S) Standard_OVERRIDE;
99   
100   //! Reads the 3d polygons  of me
101   //! from the  stream  <IS>.
102   Standard_EXPORT void ReadPolygon3D
103     (Standard_IStream& IS,
104      const Handle(Message_ProgressIndicator) &theProgress = NULL);
105   
106   //! Writes the 3d polygons
107   //! on the stream <OS> in a format that can
108   //! be read back by Read.
109   Standard_EXPORT void WritePolygon3D
110     (Standard_OStream& OS, 
111      const Standard_Boolean Compact = Standard_True,
112      const Handle(Message_ProgressIndicator) &theProgress = NULL) const;
113   
114   //! Dumps the 3d polygons
115   //! on the stream <OS>.
116   Standard_EXPORT void DumpPolygon3D (Standard_OStream& OS) const;
117   
118   //! Reads the triangulation of me
119   //! from the  stream  <IS>.
120   Standard_EXPORT void ReadTriangulation
121     (Standard_IStream& IS,
122      const Handle(Message_ProgressIndicator) &theProgress = NULL);
123   
124   //! Writes the triangulation
125   //! on the stream <OS> in a format that can
126   //! be read back by Read.
127   Standard_EXPORT void WriteTriangulation
128     (Standard_OStream& OS, 
129      const Standard_Boolean Compact = Standard_True, 
130      const Handle(Message_ProgressIndicator) &theProgress = NULL) const;
131   
132   //! Dumps the triangulation
133   //! on the stream <OS>.
134   Standard_EXPORT void DumpTriangulation (Standard_OStream& OS) const;
135   
136   //! Reads the polygons on triangulation of me
137   //! from the  stream  <IS>.
138   Standard_EXPORT void ReadPolygonOnTriangulation
139     (Standard_IStream& IS,
140      const Handle(Message_ProgressIndicator) &theProgress = NULL);
141   
142   //! Writes the polygons on triangulation
143   //! on the stream <OS> in a format that can
144   //! be read back by Read.
145   Standard_EXPORT void WritePolygonOnTriangulation
146     (Standard_OStream& OS, 
147      const Standard_Boolean Compact = Standard_True,
148      const Handle(Message_ProgressIndicator) &theProgress = NULL) const;
149   
150   //! Dumps the polygons on triangulation
151   //! on the stream <OS>.
152   Standard_EXPORT void DumpPolygonOnTriangulation (Standard_OStream& OS) const;
153
154 private:
155
156   BRep_Builder myBuilder;
157   GeomTools_SurfaceSet mySurfaces;
158   GeomTools_CurveSet myCurves;
159   GeomTools_Curve2dSet myCurves2d;
160   TColStd_IndexedMapOfTransient myPolygons2D;
161   TColStd_IndexedMapOfTransient myPolygons3D;
162   TColStd_IndexedMapOfTransient myTriangulations;
163   TColStd_IndexedMapOfTransient myNodes;
164   Standard_Boolean myWithTriangles;
165
166 };
167
168 #endif // _BRepTools_ShapeSet_HeaderFile