Class to manage TopoDS_Shapes along with metadata.
More...
Handles results of BRepBuilderAPI_MakeShape (in particular, boolean operations) by delegating to the arguments' metadata. Also see NEM::GEO::ShapeData
Definition at line 61 of file GeoManager.H.
Classes | |
| struct | ShapeMapHasher_Hash |
| Hasher based on TopTools_ShapeMapHasher, which relies on TopoDS_Shape::IsSame, which is not TopoDS_Shape::operator==. More... | |
| struct | ShapeMapHasher_KeyEqual |
| Equality operator based on TopTools_ShapeMapHasher, which relies on TopoDS_Shape::IsSame, which is not TopoDS_Shape::operator==. More... | |
Public Types | |
| using | MapType = std::unordered_map< TopoDS_Shape, std::shared_ptr< ShapeData >, ShapeMapHasher_Hash, ShapeMapHasher_KeyEqual > |
Public Member Functions | |
| GeoManager (int dim) | |
| Create an empty geometry manager. More... | |
| int | getDim () const |
| Get dimension of geometry. More... | |
| void | setDim (int dim) |
| Set the dimension. More... | |
| std::vector< TopoDS_Shape > | modify (BRepBuilderAPI_MakeShape &op, const std::vector< TopoDS_Shape > &shapes, const std::vector< TopAbs_ShapeEnum > &typesToTraverse={ TopAbs_VERTEX, TopAbs_EDGE, TopAbs_FACE, TopAbs_SOLID}) |
Modify this geoMetadata after a BRepBuilderAPI_MakeShape operation. More... | |
| std::vector< TopoDS_Shape > | modify (BRepBuilderAPI_MakeShape &op, const TopTools_ListOfShape &shapes, const std::vector< TopAbs_ShapeEnum > &typesToTraverse={ TopAbs_VERTEX, TopAbs_EDGE, TopAbs_FACE, TopAbs_SOLID}) |
| std::array< std::vector< TopoDS_Shape >, 2 > | modify (BRepAlgoAPI_BooleanOperation &op, const std::vector< TopAbs_ShapeEnum > &typesToTraverse={ TopAbs_VERTEX, TopAbs_EDGE, TopAbs_FACE, TopAbs_SOLID}) |
| std::vector< TopoDS_Shape > | modify (BRepBuilderAPI_Sewing &op, const std::vector< TopoDS_Shape > &shapes, const std::vector< TopAbs_ShapeEnum > &typesToTraverse={ TopAbs_VERTEX, TopAbs_EDGE, TopAbs_FACE, TopAbs_SOLID}) |
| void | deleteShapes (const TopoDS_Shape &shape) |
| Remove a shape from the map. More... | |
| void | deleteShapes (const std::vector< TopoDS_Shape > &shapes) |
| Delete a set of shapes. More... | |
| TopoDS_Compound | buildCompound () const |
| Create a compound from shapes present in the map that have same dimension as the instance. More... | |
| std::shared_ptr< ShapeData > * | get (const TopoDS_Shape &shape) |
| Get the data from the map. More... | |
| const std::shared_ptr< ShapeData > * | get (const TopoDS_Shape &shape) const |
| Get the data from the map. More... | |
| std::pair< MapType::iterator, bool > | insert (const TopoDS_Shape &shape, std::shared_ptr< ShapeData > shapeData) |
| template<typename T > | |
| std::pair< MapType::iterator, bool > | insertForward (const TopoDS_Shape &shape, T &&shapeData) |
| Helper to insert a shape and data into the map. More... | |
| template<typename T , typename... Args> | |
| std::pair< MapType::iterator, bool > | insertConstruct (const TopoDS_Shape &shape, Args &&...args) |
| Helper to insert a shape and construct data. More... | |
| MapType & | getMap () |
| const MapType & | getMap () const |
| Get the shapes and data. More... | |
Protected Member Functions | |
| bool | isChild (const TopoDS_Shape &shape) const |
| void | modifyImpl (BRepBuilderAPI_MakeShape &op, const TopoDS_Shape &shape, std::vector< TopoDS_Shape > &shapesToRemove) |
Protected Attributes | |
| MapType | map_ |
| int | dim_ |
Inherited by NEM::NUCMESH::NucMeshGeo.
| using NEM::GEO::GeoManager::MapType = std::unordered_map<TopoDS_Shape, std::shared_ptr<ShapeData>, ShapeMapHasher_Hash, ShapeMapHasher_KeyEqual> |
Definition at line 85 of file GeoManager.H.
|
explicit |
| dim | Shapes of this dimension (clipped to be between 1 and 3, inclusive) are treated as first-class citizens, with lower-dimensional shapes assumed to be subshapes. |
Definition at line 46 of file GeoManager.C.
| TopoDS_Compound NEM::GEO::GeoManager::buildCompound | ( | ) | const |
Definition at line 145 of file GeoManager.C.
References isChild(), and map_.
Referenced by NEM::NUCMESH::ShapesArray::basicTransformation(), NEM::NUCMESH::NucMeshGeo::computeMesh(), and NEM::NUCMESH::ShapeBase::mergeGeo().
| void NEM::GEO::GeoManager::deleteShapes | ( | const TopoDS_Shape & | shape | ) |
Note there is no effect if shape's dimension is less than the instance dimension (to avoid removing shapes that are still referenced by other shapes).
| shape | Shape to remove, if present |
Definition at line 127 of file GeoManager.C.
References isChild(), and map_.
Referenced by deleteShapes(), and NEM::NUCMESH::ShapeBase::mergeGeo().
| void NEM::GEO::GeoManager::deleteShapes | ( | const std::vector< TopoDS_Shape > & | shapes | ) |
Note there is no effect if shape's dimension is less than the instance dimension (to avoid removing shapes that are still referenced by other shapes).
| shape | Shape to remove, if present |
| shapes | Shapes to remove, if present |
Definition at line 139 of file GeoManager.C.
References deleteShapes().
| std::shared_ptr< ShapeData > * NEM::GEO::GeoManager::get | ( | const TopoDS_Shape & | shape | ) |
| shape | Shape to query |
Definition at line 162 of file GeoManager.C.
References map_.
| const std::shared_ptr< ShapeData > * NEM::GEO::GeoManager::get | ( | const TopoDS_Shape & | shape | ) | const |
| shape | Shape to query |
Definition at line 171 of file GeoManager.C.
References map_.
| int NEM::GEO::GeoManager::getDim | ( | ) | const |
Definition at line 50 of file GeoManager.C.
References dim_.
Referenced by NEM::NUCMESH::ShapeBase::mergeGeo().
| GeoManager::MapType & NEM::GEO::GeoManager::getMap | ( | ) |
Definition at line 186 of file GeoManager.C.
References map_.
Referenced by NEM::NUCMESH::CopyOverrideShapeData< QuadMeshSurface, GroupData >::updateModified().
| const GeoManager::MapType & NEM::GEO::GeoManager::getMap | ( | ) | const |
| std::pair< GeoManager::MapType::iterator, bool > NEM::GEO::GeoManager::insert | ( | const TopoDS_Shape & | shape, |
| std::shared_ptr< ShapeData > | shapeData | ||
| ) |
Definition at line 181 of file GeoManager.C.
References map_.
Referenced by NEM::NUCMESH::ShapesArray::basicTransformation(), and NEM::NUCMESH::ShapeBase::mergeGeo().
|
inline |
| T | ShapeData type |
| Args | Types of T constructor |
| shape | Shape to insert |
| args | Arguments of T constructor for data to associate with shape |
Definition at line 218 of file GeoManager.H.
|
inline |
| T | ShapeData type |
| shape | Shape to insert |
| shapeData | Data to associate to with |
Definition at line 197 of file GeoManager.H.
|
protected |
Definition at line 190 of file GeoManager.C.
References dim_.
Referenced by buildCompound(), NEM::NUCMESH::NucMeshGeo::computeMesh(), and deleteShapes().
| std::vector< TopoDS_Shape > NEM::GEO::GeoManager::modify | ( | BRepBuilderAPI_MakeShape & | op, |
| const std::vector< TopoDS_Shape > & | shapes, | ||
| const std::vector< TopAbs_ShapeEnum > & | typesToTraverse = { TopAbs_VERTEX, TopAbs_EDGE, TopAbs_FACE, TopAbs_SOLID} |
||
| ) |
| op | Modification of geometry |
| shapes | Geometry objects assumed to be inputs of op. The corresponding values in the map dictate the behavior of the resulting metadata. |
| typesToTraverse | Traverse the subshapes of shapes with these types. An empty list means only shapes will be examined. |
op Definition at line 74 of file GeoManager.C.
References modifyImpl(), and NEM::GEO::modifyTempl().
Referenced by NEM::NUCMESH::ShapeBase::mergeGeo(), and modify().
| std::vector< TopoDS_Shape > NEM::GEO::GeoManager::modify | ( | BRepBuilderAPI_MakeShape & | op, |
| const TopTools_ListOfShape & | shapes, | ||
| const std::vector< TopAbs_ShapeEnum > & | typesToTraverse = { TopAbs_VERTEX, TopAbs_EDGE, TopAbs_FACE, TopAbs_SOLID} |
||
| ) |
Definition at line 84 of file GeoManager.C.
References modifyImpl(), and NEM::GEO::modifyTempl().
| std::array< std::vector< TopoDS_Shape >, 2 > NEM::GEO::GeoManager::modify | ( | BRepAlgoAPI_BooleanOperation & | op, |
| const std::vector< TopAbs_ShapeEnum > & | typesToTraverse = { TopAbs_VERTEX, TopAbs_EDGE, TopAbs_FACE, TopAbs_SOLID} |
||
| ) |
shapes are inferred from
Definition at line 94 of file GeoManager.C.
References modify().
| std::vector< TopoDS_Shape > NEM::GEO::GeoManager::modify | ( | BRepBuilderAPI_Sewing & | op, |
| const std::vector< TopoDS_Shape > & | shapes, | ||
| const std::vector< TopAbs_ShapeEnum > & | typesToTraverse = { TopAbs_VERTEX, TopAbs_EDGE, TopAbs_FACE, TopAbs_SOLID} |
||
| ) |
Definition at line 101 of file GeoManager.C.
References map_, NEM::GEO::modifyTempl(), and NEM::DRV::JSON::shapeType.
|
protected |
| void NEM::GEO::GeoManager::setDim | ( | int | dim | ) |
| dim | dimension (between 1 and 3) |
Definition at line 52 of file GeoManager.C.
References dim_.
Referenced by NEM::NUCMESH::ShapeBase::mergeGeo().
|
protected |
Definition at line 240 of file GeoManager.H.
|
protected |
Definition at line 239 of file GeoManager.H.
Referenced by buildCompound(), NEM::NUCMESH::NucMeshGeo::computeMesh(), deleteShapes(), get(), getMap(), insert(), modify(), and modifyImpl().