20 #ifndef GeomAPI_ShapeHierarchy_H_
21 #define GeomAPI_ShapeHierarchy_H_
24 #include "GeomAPI_Shape.h"
35 typedef std::pair<GeomShapePtr, ListOfShape> ShapeAndSubshapes;
36 typedef std::map<GeomShapePtr, GeomShapePtr, GeomAPI_Shape::Comparator> MapShapeToShape;
37 typedef std::map<GeomShapePtr, size_t, GeomAPI_Shape::Comparator> MapShapeToIndex;
38 typedef std::set<GeomShapePtr, GeomAPI_Shape::Comparator> SetOfShape;
40 ListOfShape myObjects;
41 MapShapeToShape myParent;
44 MapShapeToIndex myParentIndices;
46 std::vector<ShapeAndSubshapes> mySubshapes;
48 SetOfShape myProcessedObjects;
49 MapShapeToShape myModifiedObjects;
53 GEOMAPI_EXPORT
void addObject(
const GeomShapePtr& theObject);
58 GEOMAPI_EXPORT
void addParent(
const GeomShapePtr& theShape,
const GeomShapePtr& theParent);
62 GEOMAPI_EXPORT GeomShapePtr
parent(
const GeomShapePtr& theShape,
bool theMarkProcessed =
true);
65 GEOMAPI_EXPORT GeomShapePtr
root(
const GeomShapePtr& theShape,
bool theMarkProcessed =
true);
68 GEOMAPI_EXPORT
void markProcessed(
const GeomShapePtr& theShape);
70 GEOMAPI_EXPORT
void markProcessed(
const ListOfShape& theShapes);
73 GEOMAPI_EXPORT
void markModified(
const GeomShapePtr& theSource,
const GeomShapePtr& theModified);
76 GEOMAPI_EXPORT
void splitCompound(
const GeomShapePtr& theCompShape,
78 ListOfShape& theNotUsed)
const;
87 GEOMAPI_EXPORT
bool empty()
const;
90 const ListOfShape&
objects()
const {
return myObjects; }
92 GEOMAPI_EXPORT
const ListOfShape&
objects(GeomShapePtr theParent)
const;
94 GEOMAPI_EXPORT
void objectsByType(ListOfShape& theShapesByType, ListOfShape& theOtherShapes,
101 GeomShapePtr collectSubs(
const GeomShapePtr theTopLevelCompound,
102 const SetOfShape& theExcluded = SetOfShape(),
103 const MapShapeToShape& theModified = MapShapeToShape())
const;
106 class iterator :
public std::iterator<std::forward_iterator_tag, GeomShapePtr>
114 void skipAlreadyProcessed();
117 GEOMAPI_EXPORT
bool operator==(
const iterator&)
const;
118 GEOMAPI_EXPORT
bool operator!=(
const iterator&)
const;
120 GEOMAPI_EXPORT
iterator& operator++();
121 GEOMAPI_EXPORT
iterator operator++(
int);
123 GEOMAPI_EXPORT GeomShapePtr operator*()
const;
127 ListOfShape::iterator myObject;
Definition: GeomAPI_ShapeHierarchy.h:107
Storage for the hierarchy of shapes and their parents (compounds or compsolids)
Definition: GeomAPI_ShapeHierarchy.h:34
void objectsByType(ListOfShape &theShapesByType, ListOfShape &theOtherShapes, const GeomAPI_Shape::ShapeType theMinType=GeomAPI_Shape::COMPOUND, const GeomAPI_Shape::ShapeType theMaxType=GeomAPI_Shape::SHAPE) const
Separate objects of the given range of types and all other objects.
Definition: GeomAPI_ShapeHierarchy.cpp:111
void splitCompound(const GeomShapePtr &theCompShape, ListOfShape &theUsed, ListOfShape &theNotUsed) const
Split compound/compsolid shape for subshapes selected for operation and the others.
Definition: GeomAPI_ShapeHierarchy.cpp:136
void markProcessed(const GeomShapePtr &theShape)
Mark the shape as already processed.
Definition: GeomAPI_ShapeHierarchy.cpp:76
bool empty() const
Return true if there is no object in hierarchy.
Definition: GeomAPI_ShapeHierarchy.cpp:159
void topLevelObjects(ListOfShape &theDestination) const
Generates the list of top-level compounds, with modified objects of operation.
Definition: GeomAPI_ShapeHierarchy.cpp:164
void compoundsOfUnusedObjects(ListOfShape &theDestination) const
Generates the list of top-level compounds, which exclude the objects of operation.
Definition: GeomAPI_ShapeHierarchy.cpp:197
void addParent(const GeomShapePtr &theShape, const GeomShapePtr &theParent)
Store link between shape and its parent.
Definition: GeomAPI_ShapeHierarchy.cpp:32
GeomShapePtr parent(const GeomShapePtr &theShape, bool theMarkProcessed=true)
Return parent shape for the given, or empty if it is a high-level shape.
Definition: GeomAPI_ShapeHierarchy.cpp:48
const ListOfShape & objects() const
Return list of objects.
Definition: GeomAPI_ShapeHierarchy.h:90
void markModified(const GeomShapePtr &theSource, const GeomShapePtr &theModified)
Mark the shape as modified and store its image.
Definition: GeomAPI_ShapeHierarchy.cpp:94
void addObject(const GeomShapePtr &theObject)
Add an object of the operation (low-level shape in the hierarchy)
Definition: GeomAPI_ShapeHierarchy.cpp:27
GeomShapePtr root(const GeomShapePtr &theShape, bool theMarkProcessed=true)
Get root shape for the specified sub-shape.
Definition: GeomAPI_ShapeHierarchy.cpp:63
ShapeType
Shape type enum.
Definition: GeomAPI_Shape.h:46