b311480e |
1 | -- Created on: 2004-05-11 |
2 | -- Created by: Sergey ZARITCHNY <szy@opencascade.com> |
973c2be1 |
3 | -- Copyright (c) 2004-2014 OPEN CASCADE SAS |
b311480e |
4 | -- |
973c2be1 |
5 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
6 | -- |
973c2be1 |
7 | -- This library is free software; you can redistribute it and / or modify it |
8 | -- under the terms of the GNU Lesser General Public 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. |
b311480e |
12 | -- |
973c2be1 |
13 | -- Alternatively, this file may be used under the terms of Open CASCADE |
14 | -- commercial license or contractual agreement. |
7fd59977 |
15 | |
16 | class ShapeSet from BinTools |
17 | |
18 | ---Purpose: Writes topology in OStream in binary format |
19 | |
20 | uses |
21 | Shape from TopoDS, |
22 | IndexedMapOfShape from TopTools, |
23 | ShapeEnum from TopAbs, |
24 | Builder from BRep, |
25 | ShapeEnum from TopAbs, |
26 | LocationSet from BinTools, |
27 | SurfaceSet from BinTools, |
28 | CurveSet from BinTools, |
29 | Curve2dSet from BinTools, |
30 | IndexedMapOfTransient from TColStd |
31 | |
32 | |
33 | is |
34 | |
35 | |
36 | Create(isWithTriangles: Boolean from Standard = Standard_False) |
37 | returns ShapeSet from BinTools; |
38 | ---Purpose: Builds an empty ShapeSet. |
39 | -- Parameter <isWithTriangles> is added for XML Persistence |
40 | |
41 | Delete(me:out) is virtual; |
42 | ---C++: alias "Standard_EXPORT virtual ~BinTools_ShapeSet(){Delete() ; }" |
43 | |
44 | SetFormatNb(me : out; theFormatNb : Integer) is static; |
45 | |
46 | FormatNb(me) returns Integer is static; |
47 | ---Purpose: two formats available for the moment: |
48 | -- First: does not write CurveOnSurface UV Points into the file |
49 | -- on reading calls Check() method. |
50 | -- Second: stores CurveOnSurface UV Points. |
51 | -- On reading format is recognized from Version string. |
52 | |
53 | Clear(me : in out) |
54 | ---Purpose: Clears the content of the set. |
55 | is virtual; |
56 | |
57 | Add(me : in out; S : Shape from TopoDS) returns Integer |
58 | ---Purpose: Stores <S> and its sub-shape. Returns the index of <S>. |
59 | -- The method AddGeometry is called on each sub-shape. |
60 | is static; |
61 | |
62 | Shape(me; I : Integer) returns Shape from TopoDS |
63 | ---Purpose: Returns the sub-shape of index <I>. |
64 | -- |
65 | ---C++: return const & |
66 | is static; |
67 | |
68 | Index(me; S : Shape from TopoDS) returns Integer |
69 | ---Purpose: Returns the index of <S>. |
70 | is static; |
71 | |
72 | Locations(me) returns LocationSet from BinTools |
73 | ---C++: return const & |
74 | is static; |
75 | |
76 | ChangeLocations(me : in out) returns LocationSet from BinTools |
77 | ---C++: return & |
78 | is static; |
79 | |
80 | NbShapes(me) returns Integer; |
81 | ---Purpose:Returns number of shapes read from file. |
82 | |
83 | Write(me; OS : in out OStream) |
84 | ---Purpose: Writes the content of me on the stream <OS> in binary |
85 | -- format that can be read back by Read. |
86 | -- |
87 | -- Writes the locations. |
88 | -- |
89 | -- Writes the geometry calling WriteGeometry. |
90 | -- |
91 | -- Dumps the shapes from last to first. |
92 | -- For each shape : |
93 | -- Write the type. |
94 | -- calls WriteGeometry(S). |
95 | -- Write the flags, the subshapes. |
96 | is virtual; |
97 | |
98 | Read(me : in out; IS : in out IStream) |
99 | ---Purpose: Reads the content of me from the binary stream <IS>. me |
100 | -- is first cleared. |
101 | -- |
102 | -- Reads the locations. |
103 | -- |
104 | -- Reads the geometry calling ReadGeometry. |
105 | -- |
106 | -- Reads the shapes. |
107 | -- For each shape |
108 | -- Reads the type. |
109 | -- calls ReadGeometry(T,S). |
110 | -- Reads the flag, the subshapes. |
111 | is virtual; |
112 | |
113 | Write(me; S : Shape from TopoDS; OS : in out OStream) |
114 | ---Purpose: Writes on <OS> the shape <S>. Writes the |
115 | -- orientation, the index of the TShape and the index |
116 | -- of the Location. |
117 | is virtual; |
118 | |
119 | WriteGeometry(me; OS : in out OStream) |
120 | ---Purpose: Writes the geometry of me on the stream <OS> in a |
121 | -- binary format that can be read back by Read. |
122 | is virtual; |
123 | |
124 | ReadGeometry(me : in out; IS : in out IStream) |
125 | ---Purpose: Reads the geometry of me from the stream <IS>. |
126 | is virtual; |
127 | |
128 | Read(me; S : in out Shape from TopoDS; IS : in out IStream; |
129 | NbShapes : Integer) |
130 | ---Purpose: Reads from <IS> a shape and returns it in S. |
131 | -- <NbShapes> is the number of tshapes in the set. |
132 | is virtual; |
133 | |
134 | WriteGeometry(me; S : Shape from TopoDS; OS : in out OStream) |
135 | ---Purpose: Writes the geometry of <S> on the stream <OS> in a |
136 | -- binary format that can be read back by Read. |
137 | is virtual; |
138 | |
139 | ReadGeometry(me : in out; T : ShapeEnum from TopAbs; |
140 | IS : in out IStream; |
141 | S : out Shape from TopoDS) |
142 | ---Purpose: Reads the geometry of a shape of type <T> from the |
143 | -- stream <IS> and returns it in <S>. |
144 | is virtual; |
145 | |
146 | AddGeometry(me : in out; S : Shape from TopoDS) |
147 | ---Purpose: Stores the goemetry of <S>. |
148 | is virtual; |
149 | |
150 | -- WriteLocations(me; OS: in out OStream from Standard) is static; |
151 | |
152 | -- ReadLocations(me: in out; OS: in out IStream from Standard) is static; |
153 | |
154 | AddShapes(me : in out; S1 : in out Shape from TopoDS; |
155 | S2 : Shape from TopoDS) |
156 | ---Purpose: Inserts the shape <S2> in the shape <S1>. |
157 | is virtual; |
158 | |
159 | ReadPolygon3D(me: in out; IS: in out IStream) |
160 | ---Purpose: Reads the 3d polygons of me |
161 | -- from the stream <IS>. |
162 | is static; |
163 | |
164 | WritePolygon3D(me; OS: in out OStream) |
165 | ---Purpose: Writes the 3d polygons |
166 | -- on the stream <OS> in a format that can |
167 | -- be read back by Read. |
168 | is static; |
169 | |
170 | ReadTriangulation(me: in out; IS: in out IStream) |
171 | ---Purpose: Reads the triangulation of me |
172 | -- from the stream <IS>. |
173 | is static; |
174 | |
175 | WriteTriangulation(me; OS: in out OStream) |
176 | ---Purpose: Writes the triangulation |
177 | -- on the stream <OS> in a format that can |
178 | -- be read back by Read. |
179 | is static; |
180 | |
181 | ReadPolygonOnTriangulation(me: in out; IS: in out IStream) |
182 | ---Purpose: Reads the polygons on triangulation of me |
183 | -- from the stream <IS>. |
184 | is static; |
185 | |
186 | WritePolygonOnTriangulation(me; OS: in out OStream) |
187 | ---Purpose: Writes the polygons on triangulation |
188 | -- on the stream <OS> in a format that can |
189 | -- be read back by Read. |
190 | is static; |
191 | |
192 | fields |
193 | myShapes : IndexedMapOfShape from TopTools; |
194 | myLocations : LocationSet from BinTools; |
195 | myFormatNb : Integer from Standard; -- jfa 26.09.2001 |
196 | myBuilder : Builder from BRep; |
197 | mySurfaces : SurfaceSet from BinTools; |
198 | myCurves : CurveSet from BinTools; |
199 | myCurves2d : Curve2dSet from BinTools; |
200 | myPolygons2D: IndexedMapOfTransient from TColStd; |
201 | myPolygons3D: IndexedMapOfTransient from TColStd; |
202 | myTriangulations: IndexedMapOfTransient from TColStd; |
203 | myNodes : IndexedMapOfTransient from TColStd; |
204 | myWithTriangles: Boolean from Standard; |
205 | end ShapeSet; |