0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / TopOpeBRepDS / TopOpeBRepDS_DataStructure.hxx
CommitLineData
42cf5bc1 1// Created on: 1993-06-23
2// Created by: Jean Yves LEBEY
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 _TopOpeBRepDS_DataStructure_HeaderFile
18#define _TopOpeBRepDS_DataStructure_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Integer.hxx>
25#include <TopOpeBRepDS_MapOfSurface.hxx>
26#include <TopOpeBRepDS_MapOfCurve.hxx>
27#include <TopOpeBRepDS_MapOfPoint.hxx>
28#include <TopOpeBRepDS_MapOfShapeData.hxx>
29#include <TopTools_IndexedMapOfShape.hxx>
30#include <TopOpeBRepDS_ListOfInterference.hxx>
31#include <TopTools_ListOfShape.hxx>
32#include <TopoDS_Shape.hxx>
33#include <TopOpeBRepDS_Point.hxx>
34#include <TopOpeBRepDS_Surface.hxx>
35#include <TopOpeBRepDS_Curve.hxx>
36#include <TopOpeBRepDS_ShapeSurface.hxx>
37#include <Standard_Boolean.hxx>
38#include <TopOpeBRepDS_IndexedDataMapOfShapeWithState.hxx>
39#include <TopOpeBRepDS_Config.hxx>
40#include <TopOpeBRepDS_ListIteratorOfListOfInterference.hxx>
41class Geom_Surface;
42class TopOpeBRepDS_SurfaceExplorer;
43class TopOpeBRepDS_CurveExplorer;
44class TopOpeBRepDS_PointExplorer;
45class TopOpeBRepDS_Surface;
46class TopOpeBRepDS_Curve;
47class TopOpeBRepDS_Point;
48class TopoDS_Shape;
49class TopoDS_Edge;
50class TopOpeBRepDS_Interference;
51class TopOpeBRepDS_ShapeWithState;
52
53
54//! The DataStructure stores :
55//!
56//! New geometries : points, curves, and surfaces.
57//! Topological shapes : vertices, edges, faces.
58//! The new geometries and the topological shapes have interferences.
59class TopOpeBRepDS_DataStructure
60{
61public:
62
63 DEFINE_STANDARD_ALLOC
64
65
66 Standard_EXPORT TopOpeBRepDS_DataStructure();
67
68 //! reset the data structure
69 Standard_EXPORT void Init();
70
71 //! Insert a new surface. Returns the index.
72 Standard_EXPORT Standard_Integer AddSurface (const TopOpeBRepDS_Surface& S);
73
74 Standard_EXPORT void RemoveSurface (const Standard_Integer I);
75
76 Standard_EXPORT Standard_Boolean KeepSurface (const Standard_Integer I) const;
77
78 Standard_EXPORT Standard_Boolean KeepSurface (TopOpeBRepDS_Surface& S) const;
79
80 Standard_EXPORT void ChangeKeepSurface (const Standard_Integer I, const Standard_Boolean FindKeep);
81
82 Standard_EXPORT void ChangeKeepSurface (TopOpeBRepDS_Surface& S, const Standard_Boolean FindKeep);
83
84 //! Insert a new curve. Returns the index.
85 Standard_EXPORT Standard_Integer AddCurve (const TopOpeBRepDS_Curve& S);
86
87 Standard_EXPORT void RemoveCurve (const Standard_Integer I);
88
89 Standard_EXPORT Standard_Boolean KeepCurve (const Standard_Integer I) const;
90
91 Standard_EXPORT Standard_Boolean KeepCurve (const TopOpeBRepDS_Curve& C) const;
92
93 Standard_EXPORT void ChangeKeepCurve (const Standard_Integer I, const Standard_Boolean FindKeep);
94
95 Standard_EXPORT void ChangeKeepCurve (TopOpeBRepDS_Curve& C, const Standard_Boolean FindKeep);
96
97 //! Insert a new point. Returns the index.
98 Standard_EXPORT Standard_Integer AddPoint (const TopOpeBRepDS_Point& PDS);
99
100 //! Insert a new point. Returns the index.
101 Standard_EXPORT Standard_Integer AddPointSS (const TopOpeBRepDS_Point& PDS, const TopoDS_Shape& S1, const TopoDS_Shape& S2);
102
103 Standard_EXPORT void RemovePoint (const Standard_Integer I);
104
105 Standard_EXPORT Standard_Boolean KeepPoint (const Standard_Integer I) const;
106
107 Standard_EXPORT Standard_Boolean KeepPoint (const TopOpeBRepDS_Point& P) const;
108
109 Standard_EXPORT void ChangeKeepPoint (const Standard_Integer I, const Standard_Boolean FindKeep);
110
111 Standard_EXPORT void ChangeKeepPoint (TopOpeBRepDS_Point& P, const Standard_Boolean FindKeep);
112
113 //! Insert a shape S. Returns the index.
114 Standard_EXPORT Standard_Integer AddShape (const TopoDS_Shape& S);
115
116 //! Insert a shape S which ancestor is I = 1 or 2. Returns the index.
117 Standard_EXPORT Standard_Integer AddShape (const TopoDS_Shape& S, const Standard_Integer I);
118
119 Standard_EXPORT Standard_Boolean KeepShape (const Standard_Integer I, const Standard_Boolean FindKeep = Standard_True) const;
120
121 Standard_EXPORT Standard_Boolean KeepShape (const TopoDS_Shape& S, const Standard_Boolean FindKeep = Standard_True) const;
122
123 Standard_EXPORT void ChangeKeepShape (const Standard_Integer I, const Standard_Boolean FindKeep);
124
125 Standard_EXPORT void ChangeKeepShape (const TopoDS_Shape& S, const Standard_Boolean FindKeep);
126
127 Standard_EXPORT void InitSectionEdges();
128
129 Standard_EXPORT Standard_Integer AddSectionEdge (const TopoDS_Edge& E);
130
131 Standard_EXPORT const TopOpeBRepDS_ListOfInterference& SurfaceInterferences (const Standard_Integer I) const;
132
133 Standard_EXPORT TopOpeBRepDS_ListOfInterference& ChangeSurfaceInterferences (const Standard_Integer I);
134
135 Standard_EXPORT const TopOpeBRepDS_ListOfInterference& CurveInterferences (const Standard_Integer I) const;
136
137 Standard_EXPORT TopOpeBRepDS_ListOfInterference& ChangeCurveInterferences (const Standard_Integer I);
138
139 Standard_EXPORT const TopOpeBRepDS_ListOfInterference& PointInterferences (const Standard_Integer I) const;
140
141 Standard_EXPORT TopOpeBRepDS_ListOfInterference& ChangePointInterferences (const Standard_Integer I);
142
143 Standard_EXPORT const TopOpeBRepDS_ListOfInterference& ShapeInterferences (const TopoDS_Shape& S, const Standard_Boolean FindKeep = Standard_True) const;
144
145 Standard_EXPORT TopOpeBRepDS_ListOfInterference& ChangeShapeInterferences (const TopoDS_Shape& S);
146
147 Standard_EXPORT const TopOpeBRepDS_ListOfInterference& ShapeInterferences (const Standard_Integer I, const Standard_Boolean FindKeep = Standard_True) const;
148
149 Standard_EXPORT TopOpeBRepDS_ListOfInterference& ChangeShapeInterferences (const Standard_Integer I);
150
151 Standard_EXPORT const TopTools_ListOfShape& ShapeSameDomain (const TopoDS_Shape& S) const;
152
153 Standard_EXPORT TopTools_ListOfShape& ChangeShapeSameDomain (const TopoDS_Shape& S);
154
155 Standard_EXPORT const TopTools_ListOfShape& ShapeSameDomain (const Standard_Integer I) const;
156
157 Standard_EXPORT TopTools_ListOfShape& ChangeShapeSameDomain (const Standard_Integer I);
158
159 Standard_EXPORT TopOpeBRepDS_MapOfShapeData& ChangeShapes();
160
161 Standard_EXPORT void AddShapeSameDomain (const TopoDS_Shape& S, const TopoDS_Shape& SSD);
162
163 Standard_EXPORT void RemoveShapeSameDomain (const TopoDS_Shape& S, const TopoDS_Shape& SSD);
164
165 Standard_EXPORT Standard_Integer SameDomainRef (const Standard_Integer I) const;
166
167 Standard_EXPORT Standard_Integer SameDomainRef (const TopoDS_Shape& S) const;
168
169 Standard_EXPORT void SameDomainRef (const Standard_Integer I, const Standard_Integer Ref);
170
171 Standard_EXPORT void SameDomainRef (const TopoDS_Shape& S, const Standard_Integer Ref);
172
173 Standard_EXPORT TopOpeBRepDS_Config SameDomainOri (const Standard_Integer I) const;
174
175 Standard_EXPORT TopOpeBRepDS_Config SameDomainOri (const TopoDS_Shape& S) const;
176
177 Standard_EXPORT void SameDomainOri (const Standard_Integer I, const TopOpeBRepDS_Config Ori);
178
179 Standard_EXPORT void SameDomainOri (const TopoDS_Shape& S, const TopOpeBRepDS_Config Ori);
180
181 Standard_EXPORT Standard_Integer SameDomainInd (const Standard_Integer I) const;
182
183 Standard_EXPORT Standard_Integer SameDomainInd (const TopoDS_Shape& S) const;
184
185 Standard_EXPORT void SameDomainInd (const Standard_Integer I, const Standard_Integer Ind);
186
187 Standard_EXPORT void SameDomainInd (const TopoDS_Shape& S, const Standard_Integer Ind);
188
189 Standard_EXPORT Standard_Integer AncestorRank (const Standard_Integer I) const;
190
191 Standard_EXPORT Standard_Integer AncestorRank (const TopoDS_Shape& S) const;
192
193 Standard_EXPORT void AncestorRank (const Standard_Integer I, const Standard_Integer Ianc);
194
195 Standard_EXPORT void AncestorRank (const TopoDS_Shape& S, const Standard_Integer Ianc);
196
197 Standard_EXPORT void AddShapeInterference (const TopoDS_Shape& S, const Handle(TopOpeBRepDS_Interference)& I);
198
199 Standard_EXPORT void RemoveShapeInterference (const TopoDS_Shape& S, const Handle(TopOpeBRepDS_Interference)& I);
200
201 Standard_EXPORT void FillShapesSameDomain (const TopoDS_Shape& S1, const TopoDS_Shape& S2, const Standard_Boolean refFirst = Standard_True);
202
203 Standard_EXPORT void FillShapesSameDomain (const TopoDS_Shape& S1, const TopoDS_Shape& S2, const TopOpeBRepDS_Config c1, const TopOpeBRepDS_Config c2, const Standard_Boolean refFirst = Standard_True);
204
205 Standard_EXPORT void UnfillShapesSameDomain (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
206
207 Standard_EXPORT Standard_Integer NbSurfaces() const;
208
209 Standard_EXPORT Standard_Integer NbCurves() const;
210
211 Standard_EXPORT void ChangeNbCurves (const Standard_Integer N);
212
213 Standard_EXPORT Standard_Integer NbPoints() const;
214
215 Standard_EXPORT Standard_Integer NbShapes() const;
216
217 Standard_EXPORT Standard_Integer NbSectionEdges() const;
218
219 //! Returns the surface of index <I>.
220 Standard_EXPORT const TopOpeBRepDS_Surface& Surface (const Standard_Integer I) const;
221
222 //! Returns the surface of index <I>.
223 Standard_EXPORT TopOpeBRepDS_Surface& ChangeSurface (const Standard_Integer I);
224
225 //! Returns the Curve of index <I>.
226 Standard_EXPORT const TopOpeBRepDS_Curve& Curve (const Standard_Integer I) const;
227
228 //! Returns the Curve of index <I>.
229 Standard_EXPORT TopOpeBRepDS_Curve& ChangeCurve (const Standard_Integer I);
230
231 //! Returns the point of index <I>.
232 Standard_EXPORT const TopOpeBRepDS_Point& Point (const Standard_Integer I) const;
233
234 //! Returns the point of index <I>.
235 Standard_EXPORT TopOpeBRepDS_Point& ChangePoint (const Standard_Integer I);
236
237 //! returns the shape of index I stored in
238 //! the map myShapes, accessing a list of interference.
239 Standard_EXPORT const TopoDS_Shape& Shape (const Standard_Integer I, const Standard_Boolean FindKeep = Standard_True) const;
240
241 //! returns the index of shape <S> stored in
242 //! the map myShapes, accessing a list of interference.
243 //! returns 0 if <S> is not in the map.
244 Standard_EXPORT Standard_Integer Shape (const TopoDS_Shape& S, const Standard_Boolean FindKeep = Standard_True) const;
245
246 Standard_EXPORT const TopoDS_Edge& SectionEdge (const Standard_Integer I, const Standard_Boolean FindKeep = Standard_True) const;
247
248 Standard_EXPORT Standard_Integer SectionEdge (const TopoDS_Edge& E, const Standard_Boolean FindKeep = Standard_True) const;
249
250 Standard_EXPORT Standard_Boolean IsSectionEdge (const TopoDS_Edge& E, const Standard_Boolean FindKeep = Standard_True) const;
251
252 //! Returns True if <S> has new geometries, i.e :
253 //! True si :
254 //! HasShape(S) True
255 //! S a une liste d'interferences non vide.
256 //! S = SOLID, FACE, EDGE : true/false
257 //! S = SHELL, WIRE, VERTEX : false.
258 Standard_EXPORT Standard_Boolean HasGeometry (const TopoDS_Shape& S) const;
259
260 //! Returns True if <S> est dans myShapes
261 Standard_EXPORT Standard_Boolean HasShape (const TopoDS_Shape& S, const Standard_Boolean FindKeep = Standard_True) const;
262
263 Standard_EXPORT void SetNewSurface (const TopoDS_Shape& F, const Handle(Geom_Surface)& S);
264
265 Standard_EXPORT Standard_Boolean HasNewSurface (const TopoDS_Shape& F) const;
266
267 Standard_EXPORT const Handle(Geom_Surface)& NewSurface (const TopoDS_Shape& F) const;
268
269 Standard_EXPORT void Isfafa (const Standard_Boolean isfafa);
270
271 Standard_EXPORT Standard_Boolean Isfafa() const;
272
273 Standard_EXPORT TopOpeBRepDS_IndexedDataMapOfShapeWithState& ChangeMapOfShapeWithStateObj();
274
275 Standard_EXPORT TopOpeBRepDS_IndexedDataMapOfShapeWithState& ChangeMapOfShapeWithStateTool();
276
277 Standard_EXPORT TopOpeBRepDS_IndexedDataMapOfShapeWithState& ChangeMapOfShapeWithState (const TopoDS_Shape& aShape, Standard_Boolean& aFlag);
278
279 Standard_EXPORT const TopOpeBRepDS_ShapeWithState& GetShapeWithState (const TopoDS_Shape& aShape) const;
280
281 Standard_EXPORT TopTools_IndexedMapOfShape& ChangeMapOfRejectedShapesObj();
282
283 Standard_EXPORT TopTools_IndexedMapOfShape& ChangeMapOfRejectedShapesTool();
284
285
286friend class TopOpeBRepDS_SurfaceExplorer;
287friend class TopOpeBRepDS_CurveExplorer;
288friend class TopOpeBRepDS_PointExplorer;
289
290
291protected:
292
293
294
295
296
297private:
298
299
300 Standard_EXPORT Standard_Boolean FindInterference (TopOpeBRepDS_ListIteratorOfListOfInterference& IT, const Handle(TopOpeBRepDS_Interference)& I) const;
301
302
303 Standard_Integer myNbSurfaces;
304 TopOpeBRepDS_MapOfSurface mySurfaces;
305 Standard_Integer myNbCurves;
306 TopOpeBRepDS_MapOfCurve myCurves;
307 Standard_Integer myNbPoints;
308 TopOpeBRepDS_MapOfPoint myPoints;
309 TopOpeBRepDS_MapOfShapeData myShapes;
310 TopTools_IndexedMapOfShape mySectionEdges;
311 TopOpeBRepDS_ListOfInterference myEmptyListOfInterference;
312 TopTools_ListOfShape myEmptyListOfShape;
313 TopoDS_Shape myEmptyShape;
314 TopOpeBRepDS_Point myEmptyPoint;
315 TopOpeBRepDS_Surface myEmptySurface;
316 TopOpeBRepDS_Curve myEmptyCurve;
317 Handle(Geom_Surface) myEmptyGSurface;
318 TopOpeBRepDS_ShapeSurface myNewSurface;
319 Standard_Boolean myIsfafa;
320 Standard_Integer myI;
321 TopOpeBRepDS_IndexedDataMapOfShapeWithState myMapOfShapeWithStateObj;
322 TopOpeBRepDS_IndexedDataMapOfShapeWithState myMapOfShapeWithStateTool;
323 TopTools_IndexedMapOfShape myMapOfRejectedShapesObj;
324 TopTools_IndexedMapOfShape myMapOfRejectedShapesTool;
325
326
327};
328
329
330
331
332
333
334
335#endif // _TopOpeBRepDS_DataStructure_HeaderFile