Hide menu
Loading...
Searching...
No Matches
cadex::ModelData_Shape::Iterator Class Reference

Iterates over subshapes in a shape. More...

#include <cadex/ModelData_Shape.hxx>

Inherits cadex::internal::Base_NoCopy.

Public Member Functions

 Iterator (const ModelData_Shape &theShape)
 Constructor.
 
 Iterator (const ModelData_Shape &theShape, ModelData_ShapeType theType)
 Constructor.
 
 ~Iterator ()
 Destructor.
 
bool HasNext () const
 
ModelData_Shape Next ()
 

Detailed Description

Iterates over subshapes in a shape.

Iterator supports two usage scenario:

  • iteration over direct children;
  • iteration over subshapes of a specified type.

Exploration of Direct Children

To retrive direct children of a shape, ModelData_Shape::Iterator should be used as follows:

ModelData_Wire aWire = ...;
while (i.HasNext()) {
const ModelData_Shape& aChild = i.Next(); //edge
ModelData_Type aType = aChild.Type();
assert (aType == ModelData_ST_Edge);
}
Iterates over subshapes in a shape.
Definition: ModelData_Shape.hxx:41
Base class of topological shapes.
Definition: ModelData_Shape.hxx:37
ModelData_ShapeType Type() const
Returns a shape type.
Definition: ModelData_Shape.cxx:358
Defines a connected set of edges.
Definition: ModelData_Wire.hxx:31

Exploration of particular types

To retrive children of a particular type, ModelData_Shape::Iterator should be used by specifying a type of interest as follows:

ModelData_Solid aSolid = ...;
ModelData_Shape::Iterator i (aSolid, ModelData_ST_Edge); //iterate over edges in the solid
while (i.HasNext()) {
ModelData_Shape aChild = i.Next();
const ModelData_Edge& anEdge = static_cast<const ModelData_Edge&> (aChild); //edge
...
}
Defines an edge.
Definition: ModelData_Edge.hxx:36
Defines a topological solid.
Definition: ModelData_Solid.hxx:31

When using the latter approach exploration is done traversing the graph of subshapes in a depth-first manner. Each subshape will be found as many times as it is registered in the parent subshape. For instance, a seam-edge will be encountered twice, with forward and reversed orientations.

The order of returned subshapes is deterministic and corresponds to the order in which the subshapes were added during construction.

Examples
MTKConverter/main.cxx, advgeom/brepsimplify/Program.cs, advgeom/brepsimplify/main.cxx, exploring/brepgeometry/Program.cs, exploring/brepgeometry/main.cxx, exploring/breprepresentation/Program.cs, exploring/breprepresentation/main.cxx, helpers/shape_processor.hxx, machining/dfm_analyzer/main.cxx, machining/feature_recognizer/main.cxx, meshing/visualizationmesher/Program.cs, meshing/visualizationmesher/main.cxx, modeling/assembly/Program.cs, modeling/assembly/main.cxx, modeling/metadata/Program.cs, modeling/metadata/main.cxx, sheet_metal/dfm_analyzer/main.cxx, sheet_metal/feature_recognizer/main.cxx, sheet_metal/unfolder/main.cxx, and wall_thickness/visualization/main.cxx.