Version: 9.12.0
GEOMAlgo_Extractor.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // File: GEOMAlgo_Extractor.hxx
24 // Author: Sergey KHROMOV
25 
26 #ifndef _GEOMAlgo_Extractor_HeaderFile
27 #define _GEOMAlgo_Extractor_HeaderFile
28 
29 
30 #include <GEOMAlgo_Algo.hxx>
31 
32 #include <NCollection_List.hxx>
33 #include <TopoDS_Shape.hxx>
34 #include <TopTools_DataMapOfShapeListOfShape.hxx>
35 #include <TopTools_ListOfShape.hxx>
36 #include <TopTools_MapOfShape.hxx>
37 #include <TopTools_IndexedMapOfShape.hxx>
38 
39 
45 {
46 public:
47 
51  Standard_EXPORT GEOMAlgo_Extractor();
52 
56  Standard_EXPORT virtual ~GEOMAlgo_Extractor();
57 
63  Standard_EXPORT void SetShape(const TopoDS_Shape &theShape);
64 
70  const TopoDS_Shape &GetShape() const
71  { return myShape; }
72 
79  Standard_EXPORT void SetShapesToRemove
80  (const TopTools_ListOfShape &theSubShapes);
81 
88  const TopTools_ListOfShape &GetShapesToRemove() const
89  { return mySubShapes; }
90 
94  Standard_EXPORT virtual void Perform();
95 
101  Standard_EXPORT const TopoDS_Shape &GetResult() const;
102 
108  const TopTools_ListOfShape &GetRemoved() const
109  { return myRemoved; }
110 
116  const TopTools_ListOfShape &GetModified() const
117  { return myModified; }
118 
125  const TopTools_ListOfShape &GetNew() const
126  { return myNew; }
127 
128 private:
129 
133  void clear();
134 
138  void checkData();
139 
147  void makeMapShapeAncestors(const TopoDS_Shape &theShape);
148 
152  void markShapes();
153 
160  void markRemoved(const TopoDS_Shape &theShape);
161 
168  void markAncestorsModified(const TopoDS_Shape &theShape);
169 
176  void processShapes(const TopAbs_ShapeEnum &theType);
177 
183  void processEdge(const TopoDS_Shape &theEdge);
184 
190  void processWire(const TopoDS_Shape &theWire);
191 
197  void processFOrSo(const TopoDS_Shape &theFOrSo);
198 
204  void processShOrCS(const TopoDS_Shape &theShOrCS);
205 
211  void processCompound(const TopoDS_Shape &theCompound);
212 
219  void removeBoundsOnFOrSo(const TopAbs_ShapeEnum theType);
220 
228  TopoDS_Shape oriented(const TopoDS_Shape &theShape,
229  const TopoDS_Shape &theContext);
230 
239  TopoDS_Shape makeShape(const TopoDS_Shape &theShape,
240  const TopTools_ListOfShape &theSubShapes);
241 
251  TopoDS_Shape getShapeFromSubShapes(const TopoDS_Shape &theShape,
252  const TopTools_ListOfShape &theSubShapes);
253 
262  TopoDS_Shape makeResult(const TopoDS_Shape &theShape);
263 
272  void makeHistory(const TopoDS_Shape &theShape,
273  TopTools_MapOfShape &theMapFence);
274 
285  Standard_Boolean removeCommonEdges
286  (const TopoDS_Shape &theWire,
287  const TopTools_IndexedMapOfShape &theMapEdgesToRm,
288  TopTools_ListOfShape &theNewWires);
289 
300  Standard_Boolean removeCommonFaces
301  (const TopoDS_Shape &theShell,
302  const TopTools_IndexedMapOfShape &theMapFacesToRm,
303  TopTools_ListOfShape &theNewShells);
304 
313  void makeWires(const TopoDS_Shape &theWire,
314  NCollection_List<TopTools_ListOfShape> &theListListEdges,
315  TopTools_ListOfShape &theWires);
316 
328  void groupViaBounds(const TopoDS_Shape &theShape,
329  const TopTools_ListOfShape &theSubShapes,
330  TopTools_ListOfShape &theNewShapes);
331 
343  void getModified(const TopoDS_Shape &theShape,
344  TopTools_ListOfShape &theModifShapes,
345  const TopAbs_ShapeEnum theShapeType = TopAbs_SHAPE);
346 
347 protected:
348 
349  TopoDS_Shape myShape;
350  TopoDS_Shape myResult;
351  TopTools_ListOfShape mySubShapes;
352  TopTools_ListOfShape myRemoved;
353  TopTools_ListOfShape myModified;
354  TopTools_ListOfShape myNew;
355  TopTools_DataMapOfShapeListOfShape myMapShapeAnc;
356  TopTools_MapOfShape myMapRemoved;
357  TopTools_DataMapOfShapeListOfShape myMapModified;
358  TopTools_DataMapOfShapeListOfShape myMapNewShapeAnc;
359 
360 };
361 
362 #endif
Definition: GEOMAlgo_Algo.hxx:41
This class encapsulates an algorithm of extraction of sub-shapes from the main shape.
Definition: GEOMAlgo_Extractor.hxx:45
void clear()
This method reinitializes the shape.
Definition: GEOMAlgo_Extractor.cxx:154
void markAncestorsModified(const TopoDS_Shape &theShape)
This method marks ancestors of theShape to be modified.
Definition: GEOMAlgo_Extractor.cxx:363
const TopTools_ListOfShape & GetShapesToRemove() const
This method returns the list of sub-shapes to be removed from the main shape.
Definition: GEOMAlgo_Extractor.hxx:88
Standard_Boolean removeCommonFaces(const TopoDS_Shape &theShell, const TopTools_IndexedMapOfShape &theMapFacesToRm, TopTools_ListOfShape &theNewShells)
This method removes faces that are in theMapFacesToRm from theShell and re-creates one or more shells...
Definition: GEOMAlgo_Extractor.cxx:1188
void processEdge(const TopoDS_Shape &theEdge)
This method performs computation of a modified edge.
Definition: GEOMAlgo_Extractor.cxx:438
TopTools_ListOfShape myNew
Definition: GEOMAlgo_Extractor.hxx:354
void makeHistory(const TopoDS_Shape &theShape, TopTools_MapOfShape &theMapFence)
This method fills the lists of shapes myRemoved, myModified and myNew with removed,...
Definition: GEOMAlgo_Extractor.cxx:1086
void groupViaBounds(const TopoDS_Shape &theShape, const TopTools_ListOfShape &theSubShapes, TopTools_ListOfShape &theNewShapes)
This method collects the shapes in theShapes via common bounds.
Definition: GEOMAlgo_Extractor.cxx:1268
TopoDS_Shape getShapeFromSubShapes(const TopoDS_Shape &theShape, const TopTools_ListOfShape &theSubShapes)
This method returns the shape from the list of sub-shapes if there is any shape created already with ...
Definition: GEOMAlgo_Extractor.cxx:931
TopTools_DataMapOfShapeListOfShape myMapModified
Definition: GEOMAlgo_Extractor.hxx:357
const TopTools_ListOfShape & GetModified() const
This method returns the sub-shapes modified in the main shape.
Definition: GEOMAlgo_Extractor.hxx:116
void processWire(const TopoDS_Shape &theWire)
This method performs computation of a modified wire.
Definition: GEOMAlgo_Extractor.cxx:472
const TopoDS_Shape & GetShape() const
This method returns the main shape.
Definition: GEOMAlgo_Extractor.hxx:70
Standard_EXPORT void SetShape(const TopoDS_Shape &theShape)
This method sets the main shape.
Definition: GEOMAlgo_Extractor.cxx:70
TopTools_DataMapOfShapeListOfShape myMapShapeAnc
Definition: GEOMAlgo_Extractor.hxx:355
void makeMapShapeAncestors(const TopoDS_Shape &theShape)
This method fills the map of shapes and ancestors for the whole sub-shapes of theShape.
Definition: GEOMAlgo_Extractor.cxx:272
void makeWires(const TopoDS_Shape &theWire, NCollection_List< TopTools_ListOfShape > &theListListEdges, TopTools_ListOfShape &theWires)
This method creates wires from the list of list of edges.
Definition: GEOMAlgo_Extractor.cxx:1219
TopoDS_Shape oriented(const TopoDS_Shape &theShape, const TopoDS_Shape &theContext)
Returns theShape with an orientation composed with theContext's orientation.
Definition: GEOMAlgo_Extractor.cxx:876
void getModified(const TopoDS_Shape &theShape, TopTools_ListOfShape &theModifShapes, const TopAbs_ShapeEnum theShapeType=TopAbs_SHAPE)
This method returns the list of modified shapes obtained from theShape.
Definition: GEOMAlgo_Extractor.cxx:1396
TopTools_ListOfShape myRemoved
Definition: GEOMAlgo_Extractor.hxx:352
TopoDS_Shape myResult
Definition: GEOMAlgo_Extractor.hxx:350
TopoDS_Shape makeResult(const TopoDS_Shape &theShape)
This method makes the result for the given shape.
Definition: GEOMAlgo_Extractor.cxx:1039
TopoDS_Shape makeShape(const TopoDS_Shape &theShape, const TopTools_ListOfShape &theSubShapes)
This method makes a shape as an empty copy of theShape adding subshapes to it.
Definition: GEOMAlgo_Extractor.cxx:893
TopTools_DataMapOfShapeListOfShape myMapNewShapeAnc
Definition: GEOMAlgo_Extractor.hxx:358
void processFOrSo(const TopoDS_Shape &theFOrSo)
This method performs computation of a modified face or solid.
Definition: GEOMAlgo_Extractor.cxx:543
TopTools_ListOfShape myModified
Definition: GEOMAlgo_Extractor.hxx:353
void markRemoved(const TopoDS_Shape &theShape)
This method marks theShape to be removed.
Definition: GEOMAlgo_Extractor.cxx:326
void processShapes(const TopAbs_ShapeEnum &theType)
This method performs computation of modified shapes of the provided type.
Definition: GEOMAlgo_Extractor.cxx:387
const TopTools_ListOfShape & GetRemoved() const
This method returns the sub-shapes removed from the main shape.
Definition: GEOMAlgo_Extractor.hxx:108
Standard_EXPORT const TopoDS_Shape & GetResult() const
This method returns the result of the algorithm.
Definition: GEOMAlgo_Extractor.cxx:145
void removeBoundsOnFOrSo(const TopAbs_ShapeEnum theType)
This method removes hanging edges (faces) built for faces (solids) if they lie on created faces (soli...
Definition: GEOMAlgo_Extractor.cxx:779
void processCompound(const TopoDS_Shape &theCompound)
This method performs computation of a modified compound.
Definition: GEOMAlgo_Extractor.cxx:734
Standard_EXPORT void SetShapesToRemove(const TopTools_ListOfShape &theSubShapes)
This method sets the list of sub-shapes to be removed from the main shape.
Definition: GEOMAlgo_Extractor.cxx:82
void processShOrCS(const TopoDS_Shape &theShOrCS)
This method performs computation of a modified shell or comp-solid.
Definition: GEOMAlgo_Extractor.cxx:671
virtual Standard_EXPORT void Perform()
This method performs computation of the extracted shape.
Definition: GEOMAlgo_Extractor.cxx:92
TopoDS_Shape myShape
Definition: GEOMAlgo_Extractor.hxx:349
TopTools_MapOfShape myMapRemoved
Definition: GEOMAlgo_Extractor.hxx:356
Standard_Boolean removeCommonEdges(const TopoDS_Shape &theWire, const TopTools_IndexedMapOfShape &theMapEdgesToRm, TopTools_ListOfShape &theNewWires)
This method removes edges that are in theMapEdgesToRm from theWire and re-creates one or more wires f...
Definition: GEOMAlgo_Extractor.cxx:1140
Standard_EXPORT GEOMAlgo_Extractor()
Empty constructor.
Definition: GEOMAlgo_Extractor.cxx:54
TopTools_ListOfShape mySubShapes
Definition: GEOMAlgo_Extractor.hxx:351
const TopTools_ListOfShape & GetNew() const
This method returns the newly created sub-shapes in the result shape.
Definition: GEOMAlgo_Extractor.hxx:125
void markShapes()
This method marks shapes to be removed and to be modified.
Definition: GEOMAlgo_Extractor.cxx:303
virtual Standard_EXPORT ~GEOMAlgo_Extractor()
Virtual destructor.
Definition: GEOMAlgo_Extractor.cxx:62
void checkData()
This method checks the input data.
Definition: GEOMAlgo_Extractor.cxx:171