TopoDS_Shape::NbChildren() - new method has been introduced.
TopoDS_Shape.lxx, TopoDS_TShape.lxx - inline methods have been moved to hxx.
TopoDS_TShape_Flags has been redeclared as enumeration instead of preprocessor macros.
Cyclic dependency between headers TopoDS_Shape.hxx and TopoDS_TShape.hxx eliminated.
Places where TopoDS_Iterator is used only for calculation of number of sub-shapes are updated to use NbChildren() instead
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
-#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <StdSelect_DisplayMode.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS_Iterator.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_Shape,AIS_InteractiveObject)
aPrs->SetDisplayPriority(TheType+2);
}
// Shape vide -> Assemblage vide.
- if (myshape.ShapeType() == TopAbs_COMPOUND) {
- TopoDS_Iterator anExplor (myshape);
-
- if (!anExplor.More()) {
- return;
- }
+ if (myshape.ShapeType() == TopAbs_COMPOUND && myshape.NbChildren() == 0)
+ {
+ return;
}
if (IsInfinite())
}
case TopAbs_COMPOUND:
{
- TopoDS_Iterator anExplor (theShape);
- if (!anExplor.More())
+ if (theShape.NbChildren() == 0)
{
return;
}
const Standard_Integer aMode)
{
if(myshape.IsNull()) return;
- if (myshape.ShapeType() == TopAbs_COMPOUND) {
- TopoDS_Iterator anExplor (myshape);
-
- if (!anExplor.More()) // empty Shape -> empty Assembly.
- return;
+ if (myshape.ShapeType() == TopAbs_COMPOUND && myshape.NbChildren() == 0)
+ {
+ // empty Shape -> empty Assembly.
+ return;
}
TopAbs_ShapeEnum TypOfSel = AIS_Shape::SelectionType(aMode);
const Bnd_Box& AIS_Shape::BoundingBox()
{
- if (myshape.ShapeType() == TopAbs_COMPOUND) {
- TopoDS_Iterator anExplor (myshape);
-
- if (!anExplor.More()) { // empty Shape -> empty Assembly.
- myBB.SetVoid();
- return myBB;
- }
+ if (myshape.ShapeType() == TopAbs_COMPOUND && myshape.NbChildren() == 0)
+ {
+ // empty Shape -> empty Assembly.
+ myBB.SetVoid ();
+ return myBB;
}
if(myCompBB) {
#include <SelectMgr_Selection.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_Type.hxx>
-#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Solid.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Compound.hxx>
//
BOPTools_AlgoTools::CorrectShapeTolerances(aRFaces, aMEmpty, Standard_False);
//
theFaces = aRFaces;
- TopoDS_Iterator aItF(theFaces);
- return aItF.More();
+ return theFaces.NbChildren() > 0;
}
//=======================================================================
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <BRep_TEdge.hxx>
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
-#include <TopoDS_TShape.hxx>
+#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRep_TEdge,TopoDS_TEdge)
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
#include <TopLoc_Location.hxx>
-#include <TopoDS_TShape.hxx>
+#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRep_TFace,TopoDS_TFace)
#include <gp_Pnt.hxx>
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
-#include <TopoDS_TShape.hxx>
+#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRep_TVertex,TopoDS_TVertex)
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Wire.hxx>
//=======================================================================
gp_Pln& thePlane,
Standard_Boolean& IsSingular)
{
- Standard_Integer N = 40, nedges = 0;
-
- TopoDS_Iterator iter( aWire );
- for (; iter.More(); iter.Next())
- nedges++;
+ Standard_Integer N = 40;
+ Standard_Integer nedges = aWire.NbChildren();
TColgp_Array1OfPnt Pnts( 1, nedges*N );
Standard_Integer ind = 1, i;
- for (iter.Initialize(aWire); iter.More(); iter.Next())
+ for (TopoDS_Iterator iter (aWire); iter.More(); iter.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge( iter.Value() );
BRepAdaptor_Curve aCurve(anEdge);
}
BF.Load(F);
- TopoDS_Iterator aWIter(F);
- Standard_Boolean IsNatRestr = !aWIter.More();
+ Standard_Boolean IsNatRestr = (F.NbChildren() == 0);
if(!IsNatRestr) BD.Init(F);
if(Eps < 1.0) {
G.Perform(BF, BD, Eps);
if (isFwd || isRvs){
BF.Load(F);
- TopoDS_Iterator aWIter(F);
- Standard_Boolean IsNatRestr = !aWIter.More();
+ Standard_Boolean IsNatRestr = (F.NbChildren () == 0);
if(!IsNatRestr) BD.Init(F);
if(Eps < 1.0) {
G.Perform(BF, BD, Eps);
if (isFwd || isRvs){
aPropFace.Load(aFace);
- TopoDS_Iterator aWIter(aFace);
- Standard_Boolean IsNatRestr = !aWIter.More();
+ Standard_Boolean IsNatRestr = (aFace.NbChildren () == 0);
if(IsNatRestr)
aLocalError = aVProps.Perform(aPropFace, aTol, CGFlag, IFlag);
else {
if (isFwd || isRvs){
aPropFace.Load(aFace);
- TopoDS_Iterator aWIter(aFace);
- Standard_Boolean IsNatRestr = !aWIter.More();
+ Standard_Boolean IsNatRestr = (aFace.NbChildren () == 0);
if(IsNatRestr)
aLocalError = aVProps.Perform(aPropFace, thePln, aTol, CGFlag, IFlag);
else {
//
const Standard_Integer NumSubs = SUBS_POWER;
const TopoDS_Face& aF = theSurface.GetFace();
- TopoDS_Iterator aWIter(aF);
- const Standard_Boolean isNaturalRestriction = !aWIter.More(); //theSurface.NaturalRestriction();
+ const Standard_Boolean isNaturalRestriction = (aF.NbChildren () == 0); //theSurface.NaturalRestriction();
Standard_Real CIx, CIy, CIz, CIxy, CIxz, CIyz;
Standard_Real CDim[2], CIxx[2], CIyy[2], CIzz[2];
}
}
}
- TopoDS_Iterator anIt(Sol);
- Standard_Boolean SolIsNull = !anIt.More();
+ Standard_Integer nbs = Sol.NbChildren();
+ Standard_Boolean SolIsNull = (nbs == 0);
//Checking solid
- if(!SolIsNull)
+ if (nbs > 1)
{
- Standard_Integer nbs = 0;
- while(anIt.More()) {anIt.Next(); ++nbs;}
- if(nbs > 1)
+ BRepCheck_Analyzer aCheck (Sol, Standard_False);
+ if (!aCheck.IsValid ())
{
- BRepCheck_Analyzer aCheck(Sol, Standard_False);
- if(!aCheck.IsValid())
+ TopTools_ListOfShape aSolList;
+ CorrectSolid (Sol, aSolList);
+ if (!aSolList.IsEmpty ())
{
- TopTools_ListOfShape aSolList;
- CorrectSolid(Sol, aSolList);
- if(!aSolList.IsEmpty())
+ BB.Add (NC, Sol);
+ TopTools_ListIteratorOfListOfShape aSLIt (aSolList);
+ for (; aSLIt.More (); aSLIt.Next ())
{
- BB.Add(NC, Sol);
- TopTools_ListIteratorOfListOfShape aSLIt(aSolList);
- for(; aSLIt.More(); aSLIt.Next())
- {
- BB.Add(NC, aSLIt.Value());
- }
- SolIsNull = Standard_True;
+ BB.Add (NC, aSLIt.Value ());
}
+ SolIsNull = Standard_True;
}
}
}
//
- anIt.Initialize(NC);
- Standard_Boolean NCIsNull = !anIt.More();
+ Standard_Boolean NCIsNull = (NC.NbChildren() == 0);
if((!SolIsNull) && (!NCIsNull))
{
BB.Add(NC, Sol);
}
}
}
- TopoDS_Iterator anIt(Sol);
- Standard_Boolean SolIsNull = !anIt.More();
+ Standard_Integer nbs = Sol.NbChildren();
+ Standard_Boolean SolIsNull = (nbs == 0);
//Checking solid
- if(!SolIsNull)
+ if (nbs > 1)
{
- Standard_Integer nbs = 0;
- while(anIt.More()) {anIt.Next(); ++nbs;}
- if(nbs > 1)
+ BRepCheck_Analyzer aCheck (Sol, Standard_False);
+ if (!aCheck.IsValid ())
{
- BRepCheck_Analyzer aCheck(Sol, Standard_False);
- if(!aCheck.IsValid())
+ TopTools_ListOfShape aSolList;
+ CorrectSolid (Sol, aSolList);
+ if (!aSolList.IsEmpty ())
{
- TopTools_ListOfShape aSolList;
- CorrectSolid(Sol, aSolList);
- if(!aSolList.IsEmpty())
+ B.Add (NC, Sol);
+ TopTools_ListIteratorOfListOfShape aSLIt (aSolList);
+ for (; aSLIt.More (); aSLIt.Next ())
{
- B.Add(NC, Sol);
- TopTools_ListIteratorOfListOfShape aSLIt(aSolList);
- for(; aSLIt.More(); aSLIt.Next())
- {
- B.Add(NC, aSLIt.Value());
- }
- SolIsNull = Standard_True;
+ B.Add (NC, aSLIt.Value ());
}
+ SolIsNull = Standard_True;
}
}
}
- anIt.Initialize(NC);
- Standard_Boolean NCIsNull = !anIt.More();
+ Standard_Boolean NCIsNull = (NC.NbChildren() == 0);
if((!SolIsNull) && (!NCIsNull))
{
B.Add(NC, Sol);
{
// For possible removal of the block:
// 1. There should be more than just one face in the block
- TopoDS_Iterator aItF(theCB);
- aItF.Next();
- if (!aItF.More()) {
+ if (theCB.NbChildren() < 2) {
return Standard_False;
}
//
if (Georges.IsDegeneratedFirstSection())
IndFirstSec = 2;
TopoDS_Shape aWorkingSection = WorkingSections(IndFirstSec);
- TopoDS_Iterator itw(aWorkingSection);
- for (; itw.More(); itw.Next())
- myNbEdgesInSection++;
+ myNbEdgesInSection += aWorkingSection.NbChildren();
for (Standard_Integer ii = 1; ii <= myWires.Length(); ii++)
{
TopExp_Explorer Explo(myWires(ii), TopAbs_EDGE);
{
const TopoDS_Edge& aNewEdge = TopoDS::Edge(itl.Value());
Standard_Integer inde = 1;
- for (itw.Initialize(aWorkingSection); itw.More(); itw.Next(),inde++)
+ for (TopoDS_Iterator itw (aWorkingSection); itw.More(); itw.Next(), inde++)
{
const TopoDS_Shape& aWorkingEdge = itw.Value();
if (aWorkingEdge.IsSame(aNewEdge))
#include <TopExp_Explorer.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopoDS_CompSolid.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>
// Check the number of edges in the wire, not to
// miss the wires containing one edge only
- Standard_Boolean SingleEdge = Standard_True;
+ if (aW.NbChildren() == 0)
{
- TopoDS_Iterator itE(aW);
- if (!itE.More())
- continue;
- itE.Next();
- SingleEdge = !itE.More();
+ continue;
}
+ Standard_Boolean SingleEdge = (aW.NbChildren() == 1);
TopoDS_Edge aPrevEdge, aCurrEdge;
TNaming_Builder Builder (ResultLabel);
TopoDS_Shape aResult = MS.Shape();
if (aResult.ShapeType() == TopAbs_COMPOUND) {
- Standard_Integer nbSubResults = 0;
- TopoDS_Iterator itr(aResult);
- for (; itr.More(); itr.Next()) nbSubResults++;
- if (nbSubResults == 1) {
- itr.Initialize(aResult);
+ if (aResult.NbChildren() == 1) {
+ TopoDS_Iterator itr (aResult);
if (itr.More()) aResult = itr.Value();
}
}
if (theMkOpe.IsDone() && !theMkOpe.Shape().IsNull()) {
if (theMkOpe.Shape().ShapeType() == TopAbs_COMPOUND) {
- TopoDS_Iterator anItr(theMkOpe.Shape());
- if(!anItr.More()) {
+ if (theMkOpe.Shape().NbChildren() == 0) {
theFunction->SetFailure(NULL_RESULT);
return Standard_False;
}
TopoDS_Shape aResult = theMkFillet.Shape();
if (aResult.ShapeType() == TopAbs_COMPOUND) {
- Standard_Integer nbSubResults = 0;
- TopoDS_Iterator itr(aResult);
- for (; itr.More(); itr.Next()) nbSubResults++;
- if (nbSubResults == 1) {
- itr.Initialize(aResult);
+ if (aResult.NbChildren() == 1) {
+ TopoDS_Iterator itr (aResult);
if (itr.More()) aResult = itr.Value();
}
}
#include <gp_Circ.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopExp_Explorer.hxx>
-#include <TopoDS_Iterator.hxx>
#include <gp_Ax3.hxx>
#include <gp_Pln.hxx>
#include <DrawTrSurf.hxx>
+
#ifdef _MSC_VER
#include <stdio.h>
#endif
+
//=======================================================================
//function : DrawDim_DISTANCE
//purpose :
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
#include <XSAlgo.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>
TopoDS_Shape anOcctShape = myShape->GetShape();
- if (anOcctShape.ShapeType() == TopAbs_COMPOUND)
+ if (anOcctShape.ShapeType() == TopAbs_COMPOUND && anOcctShape.NbChildren() == 0)
{
- TopoDS_Iterator anExplor (anOcctShape);
- if (!anExplor.More()) // Shape empty -> go away
- {
- return;
- }
+ // Shape empty -> go away
+ return;
}
TopAbs_ShapeEnum aTypeOfSel = AIS_Shape::SelectionType (theMode);
TopoDS_Shape anOcctShape = myShape->GetShape();
- if (anOcctShape.ShapeType() == TopAbs_COMPOUND)
+ if (anOcctShape.ShapeType() == TopAbs_COMPOUND && anOcctShape.NbChildren() == 0)
{
- TopoDS_Iterator anExplor (anOcctShape);
- if (!anExplor.More())
- { // Shape empty -> nothing to do
- myBndBox.SetVoid();
- return myBndBox;
- }
+ // Shape empty -> nothing to do
+ myBndBox.SetVoid ();
+ return myBndBox;
}
if (myBndBox.IsVoid())
#include <StepVisual_SurfaceStyleUsage.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_Binder.hxx>
#include <TransferBRep.hxx>
#include <StepShape_ShapeRepresentation.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TopLoc_Location.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_Binder.hxx>
#include <Transfer_SimpleBinderOfTransient.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
BRep_Builder B;
B.MakeCompound ( C );
- Standard_Integer aShapeCount = 0;
- {
- for (TopoDS_Iterator it(SF); it.More(); it.Next()) ++aShapeCount;
- }
-
+ Standard_Integer aShapeCount = SF.NbChildren();
Message_ProgressSentry aPSentry(aProgress, "Applying Modifier For Solids", 0, aShapeCount, 1);
for ( TopoDS_Iterator it(SF); it.More() && aPSentry.More(); it.Next(), aPSentry.Next() ) {
TopoDS_Shape shape = it.Value();
}
// If there are no elements in the new shell, return null shape
- if (!TopoDS_Iterator (aNewShell).More())
+ if (aNewShell.NbChildren() == 0)
return TopoDS_Shape();
return aNewShell;
Standard_Integer savFixSameParameterMode = myFixSameParameterMode;
myFixSameParameterMode = Standard_False;
myFixVertexTolMode = Standard_False;
- Standard_Integer aShapesNb = 0;
- for ( TopoDS_Iterator anIter(S); anIter.More(); anIter.Next() )
- ++aShapesNb;
+ Standard_Integer aShapesNb = S.NbChildren();
// Open progress indication scope for sub-shape fixing
Message_ProgressSentry aPSentrySubShape(theProgress, "Fixing sub-shape", 0, aShapesNb, 1);
TopoDS_Shape S = Context()->Apply(myShell);
// Get the number of faces for progress indication
- Standard_Integer aNbFaces = 0;
- for ( TopExp_Explorer aFaceExp(S, TopAbs_FACE); aFaceExp.More(); aFaceExp.Next() )
- ++aNbFaces;
+ Standard_Integer aNbFaces = S.NbChildren();
// Start progress scope (no need to check if progress exists -- it is safe)
Message_ProgressSentry aPSentry(theProgress, "Fixing face", 0, aNbFaces, 1);
S.Orientation(TopAbs_FORWARD);
S.Location(TopLoc_Location());
// Count the number of <sub-shape> of the Shape's TShape
- Standard_Integer nbElem = 0;
- TopoDS_Iterator anItCount(S);
- while (anItCount.More()) {
- ++nbElem;
- anItCount.Next();
- }
-
+ Standard_Integer nbElem = S.NbChildren();
if (nbElem > 0)
{
Handle(StdLPersistent_HArray1OfPersistent) aShapes =
#include <ShapeProcess_ShapeContext.hxx>
#include <ShapeProcessAPI_ApplySequence.hxx>
#include <TCollection_AsciiString.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
for (TopExp_Explorer aFaceIter (theShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
{
const TopoDS_Face& aFace = TopoDS::Face (aFaceIter.Current());
- TopoDS_Iterator aSubShapeIter (aFace);
- if (!aSubShapeIter.More())
+ if (aFace.NbChildren() == 0)
{
// handle specifically faces without boundary definition (triangulation-only)
StdPrs_WFShape::AddEdgesOnTriangulation (aSeqPntsExtra, aFace, Standard_False);
aBuilder.MakeCompound (anOpened);
ExploreSolids (theShape, aBuilder, aClosed, anOpened, Standard_True);
- TopoDS_Iterator aShapeIter (aClosed);
- if (aShapeIter.More())
+ if (aClosed.NbChildren() > 0)
{
shadeFromShape (aClosed, thePrs, theDrawer,
theHasTexels, theUVOrigin, theUVRepeat, theUVScale, true);
}
- aShapeIter.Initialize (anOpened);
- if (aShapeIter.More())
+ if (anOpened.NbChildren() > 0)
{
shadeFromShape (anOpened, thePrs, theDrawer,
theHasTexels, theUVOrigin, theUVRepeat, theUVScale, false);
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
-#include <TopoDS_Iterator.hxx>
#include <Transfer_TransientProcess.hxx>
//=======================================================================
#include <TNaming_UsedShapes.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#ifdef OCCT_DEBUG_INT
cout <<"Kept: indxE = " << indxE <<" maxENum = " << nbE << " indxW = " <<indxW << " nbW = " <<nbW<<endl;
#endif
- Standard_Integer aNbW(0), aCaseW(0);
- TopoDS_Iterator it2(aS);
- for (;it2.More();it2.Next()) aNbW++;
+ Standard_Integer aCaseW(0);
+ Standard_Integer aNbW = aS.NbChildren();
if(aNbW == nbW) aCaseW = 1;//exact solution for wire (nb of wires is kept)
else aCaseW = 2; // indefinite description ==> compound which can include expected wire
if(aCaseW == 1) {
TopoDS_Shape aWire;
- Standard_Integer i(1);
- it2.Initialize(aS);
- for (;it2.More();it2.Next(),i++) {
+ Standard_Integer i = 1;
+ for (TopoDS_Iterator it2 (aS); it2.More(); it2.Next(), i++)
+ {
if(indxW == i) {
aWire = it2.Value();
break;
}
}
- Standard_Integer aNbE(0), aCaseE(0);
- it2.Initialize(aWire);
- for (;it2.More();it2.Next()) aNbE++;
+ Standard_Integer aCaseE(0);
+ Standard_Integer aNbE = aWire.NbChildren();
if(aNbE == nbE) aCaseE = 1;//exact solution for edge
else aCaseE = 2;
if(aCaseE == 1) {
i=1;
TopoDS_Shape anEdge;
- it2.Initialize(aWire);
- for (;it2.More();it2.Next(),i++) {
+ for (TopoDS_Iterator it2 (aWire); it2.More(); it2.Next(), i++) {
if(indxE == i) {
anEdge = it2.Value();
break;
for(; tdi.More(); tdi.Next()) {
nbe++;
const TopoDS_Shape& ed = tdi.Value();
- Standard_Integer nbv = 0;
- TopoDS_Iterator tdie(ed, Standard_False, Standard_False);
- for(; tdie.More(); tdie.Next()) {
- nbv++;
- }
+ Standard_Integer nbv = ed.NbChildren();
// cout << "Edge " << nbe << " : " << nbv << endl;
if(nbv <= 1) {
// cout << "Remove bad edge" << endl;
TopoDS_LockedShape.hxx
TopoDS_Shape.cxx
TopoDS_Shape.hxx
-TopoDS_Shape.lxx
TopoDS_Shell.hxx
TopoDS_Shell.lxx
TopoDS_Solid.hxx
TopoDS_TFace.lxx
TopoDS_TShape.cxx
TopoDS_TShape.hxx
-TopoDS_TShape.lxx
TopoDS_TShell.cxx
TopoDS_TShell.hxx
TopoDS_TShell.lxx
const unsigned int iS=(unsigned int)aShape.ShapeType();
//
if ((aTb[iC] & (1<<iS)) != 0) {
- TopoDS_ListOfShape& L = aShape.TShape()->ChangeShapes();
+ TopoDS_ListOfShape& L = aShape.TShape()->myShapes;
L.Append(aComponent);
TopoDS_Shape& S = L.Last();
//
S.Reverse();
S.Location(S.Location().Predivided(aShape.Location()));
- TopoDS_ListOfShape& L = aShape.TShape()->ChangeShapes();
+ TopoDS_ListOfShape& L = aShape.TShape()->myShapes;
TopoDS_ListIteratorOfListOfShape It(L);
while (It.More()) {
if (It.Value() == S) {
myOrientation = S.Orientation();
else
myOrientation = TopAbs_FORWARD;
- myShapes.Initialize(S.TShape()->Shapes());
+ myShapes.Initialize(S.TShape()->myShapes);
if (More()) {
myShape = myShapes.Value();
myShape.Orientation(TopAbs::Compose(myOrientation,myShape.Orientation()));
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <TopoDS_Shape.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_TypeMismatch.hxx>
#include <TopLoc_Location.hxx>
-#include <TopoDS_Shape.hxx>
#include <TopoDS_TShape.hxx>
//=======================================================================
#ifndef _TopoDS_Shape_HeaderFile
#define _TopoDS_Shape_HeaderFile
-#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-
-#include <TopLoc_Location.hxx>
+#include <TopAbs.hxx>
#include <TopAbs_Orientation.hxx>
-#include <Standard_Boolean.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-#include <Standard_Integer.hxx>
-class TopoDS_TShape;
+#include <TopLoc_Location.hxx>
+#include <TopoDS_TShape.hxx>
// resolve name collisions with X11 headers
#ifdef Convex
DEFINE_STANDARD_ALLOC
-
//! Creates a NULL Shape referring to nothing.
- TopoDS_Shape();
-
+ TopoDS_Shape() : myOrient (TopAbs_EXTERNAL) {}
+
//! Returns true if this shape is null. In other words, it
//! references no underlying shape with the potential to
//! be given a location and an orientation.
- Standard_Boolean IsNull() const;
-
+ Standard_Boolean IsNull() const { return myTShape.IsNull(); }
+
//! Destroys the reference to the underlying shape
//! stored in this shape. As a result, this shape becomes null.
- void Nullify();
-
+ void Nullify() { myTShape.Nullify(); }
+
//! Returns the shape local coordinate system.
- const TopLoc_Location& Location() const;
-
+ const TopLoc_Location& Location() const { return myLocation; }
+
//! Sets the shape local coordinate system.
- void Location (const TopLoc_Location& Loc);
-
+ void Location (const TopLoc_Location& theLoc) { myLocation = theLoc; }
+
//! Returns a shape similar to <me> with the local
//! coordinate system set to <Loc>.
- TopoDS_Shape Located (const TopLoc_Location& Loc) const;
-
+ TopoDS_Shape Located (const TopLoc_Location& theLoc) const
+ {
+ TopoDS_Shape aShape (*this);
+ aShape.Location (theLoc);
+ return aShape;
+ }
+
//! Returns the shape orientation.
- TopAbs_Orientation Orientation() const;
-
+ TopAbs_Orientation Orientation() const { return myOrient; }
+
//! Sets the shape orientation.
- void Orientation (const TopAbs_Orientation Orient);
-
+ void Orientation (TopAbs_Orientation theOrient) { myOrient = theOrient; }
+
//! Returns a shape similar to <me> with the
//! orientation set to <Or>.
- TopoDS_Shape Oriented (const TopAbs_Orientation Or) const;
-
- const Handle(TopoDS_TShape)& TShape() const;
-
+ TopoDS_Shape Oriented (TopAbs_Orientation theOrient) const
+ {
+ TopoDS_Shape aShape (*this);
+ aShape.Orientation (theOrient);
+ return aShape;
+ }
+
+ //! Returns a handle to the actual shape implementation.
+ const Handle(TopoDS_TShape)& TShape() const { return myTShape; }
+
//! Returns the value of the TopAbs_ShapeEnum
//! enumeration that corresponds to this shape, for
//! example VERTEX, EDGE, and so on.
//! Exceptions
//! Standard_NullObject if this shape is null.
- TopAbs_ShapeEnum ShapeType() const;
-
+ TopAbs_ShapeEnum ShapeType() const { return myTShape->ShapeType(); }
+
//! Returns the free flag.
- Standard_Boolean Free() const;
-
+ Standard_Boolean Free() const { return myTShape->Free(); }
+
//! Sets the free flag.
- void Free (const Standard_Boolean F);
-
+ void Free (Standard_Boolean theIsFree) { myTShape->Free (theIsFree); }
+
//! Returns the locked flag.
- Standard_Boolean Locked() const;
-
+ Standard_Boolean Locked() const { return myTShape->Locked(); }
+
//! Sets the locked flag.
- void Locked (const Standard_Boolean F);
-
+ void Locked (Standard_Boolean theIsLocked) { myTShape->Locked (theIsLocked); }
+
//! Returns the modification flag.
- Standard_Boolean Modified() const;
-
+ Standard_Boolean Modified() const { return myTShape->Modified(); }
+
//! Sets the modification flag.
- void Modified (const Standard_Boolean M);
-
+ void Modified (Standard_Boolean theIsModified) { myTShape->Modified (theIsModified); }
+
//! Returns the checked flag.
- Standard_Boolean Checked() const;
-
+ Standard_Boolean Checked() const { return myTShape->Checked(); }
+
//! Sets the checked flag.
- void Checked (const Standard_Boolean C);
-
+ void Checked (Standard_Boolean theIsChecked) { myTShape->Checked (theIsChecked); }
+
//! Returns the orientability flag.
- Standard_Boolean Orientable() const;
-
+ Standard_Boolean Orientable() const { return myTShape->Orientable(); }
+
//! Sets the orientability flag.
- void Orientable (const Standard_Boolean C);
-
+ void Orientable (const Standard_Boolean theIsOrientable) { myTShape->Orientable (theIsOrientable); }
+
//! Returns the closedness flag.
- Standard_Boolean Closed() const;
-
+ Standard_Boolean Closed() const { return myTShape->Closed(); }
+
//! Sets the closedness flag.
- void Closed (const Standard_Boolean C);
-
+ void Closed (Standard_Boolean theIsClosed) { myTShape->Closed (theIsClosed); }
+
//! Returns the infinity flag.
- Standard_Boolean Infinite() const;
-
+ Standard_Boolean Infinite() const { return myTShape->Infinite(); }
+
//! Sets the infinity flag.
- void Infinite (const Standard_Boolean C);
-
+ void Infinite (Standard_Boolean theIsInfinite) { myTShape->Infinite (theIsInfinite); }
+
//! Returns the convexness flag.
- Standard_Boolean Convex() const;
-
+ Standard_Boolean Convex() const { return myTShape->Convex(); }
+
//! Sets the convexness flag.
- void Convex (const Standard_Boolean C);
-
- //! Multiplies the Shape location by <position>.
- void Move (const TopLoc_Location& position);
-
- //! Returns a shape similar to <me> with a location
- //! multiplied by <position>.
- TopoDS_Shape Moved (const TopLoc_Location& position) const;
-
+ void Convex (Standard_Boolean theIsConvex) { myTShape->Convex (theIsConvex); }
+
+ //! Multiplies the Shape location by thePosition.
+ void Move (const TopLoc_Location& thePosition) { myLocation = thePosition * myLocation; }
+
+ //! Returns a shape similar to <me> with a location multiplied by thePosition.
+ TopoDS_Shape Moved (const TopLoc_Location& thePosition) const
+ {
+ TopoDS_Shape aShape (*this);
+ aShape.Move (thePosition);
+ return aShape;
+ }
+
//! Reverses the orientation, using the Reverse method
//! from the TopAbs package.
- void Reverse();
-
+ void Reverse() { myOrient = TopAbs::Reverse (myOrient); }
+
//! Returns a shape similar to <me> with the
//! orientation reversed, using the Reverse method
//! from the TopAbs package.
- TopoDS_Shape Reversed() const;
-
+ TopoDS_Shape Reversed() const
+ {
+ TopoDS_Shape aShape (*this);
+ aShape.Reverse();
+ return aShape;
+ }
+
//! Complements the orientation, using the Complement
//! method from the TopAbs package.
- void Complement();
-
+ void Complement() { myOrient = TopAbs::Complement (myOrient); }
+
//! Returns a shape similar to <me> with the
//! orientation complemented, using the Complement
//! method from the TopAbs package.
- TopoDS_Shape Complemented() const;
-
- //! Updates the Shape Orientation by composition with
- //! <Orient>, using the Compose method from the TopAbs
- //! package.
- void Compose (const TopAbs_Orientation Orient);
-
+ TopoDS_Shape Complemented() const
+ {
+ TopoDS_Shape aShape (*this);
+ aShape.Complement();
+ return aShape;
+ }
+
+ //! Updates the Shape Orientation by composition with theOrient,
+ //! using the Compose method from the TopAbs package.
+ void Compose (TopAbs_Orientation theOrient) { myOrient = TopAbs::Compose (myOrient, theOrient); }
+
//! Returns a shape similar to <me> with the
- //! orientation composed with <Orient>, using the
+ //! orientation composed with theOrient, using the
//! Compose method from the TopAbs package.
- TopoDS_Shape Composed (const TopAbs_Orientation Orient) const;
-
+ TopoDS_Shape Composed (TopAbs_Orientation theOrient) const
+ {
+ TopoDS_Shape aShape (*this);
+ aShape.Compose (theOrient);
+ return aShape;
+ }
+
+ //! Returns the number of direct sub-shapes (children).
+ //! @sa TopoDS_Iterator for accessing sub-shapes
+ Standard_Integer NbChildren() const { return myTShape.IsNull() ? 0 : myTShape->NbChildren(); }
+
//! Returns True if two shapes are partners, i.e. if
//! they share the same TShape. Locations and
//! Orientations may differ.
- Standard_Boolean IsPartner (const TopoDS_Shape& other) const;
-
+ Standard_Boolean IsPartner (const TopoDS_Shape& theOther) const { return (myTShape == theOther.myTShape); }
+
//! Returns True if two shapes are same, i.e. if they
//! share the same TShape with the same Locations.
//! Orientations may differ.
- Standard_Boolean IsSame (const TopoDS_Shape& other) const;
-
+ Standard_Boolean IsSame (const TopoDS_Shape& theOther) const
+ {
+ return myTShape == theOther.myTShape
+ && myLocation == theOther.myLocation;
+ }
+
//! Returns True if two shapes are equal, i.e. if they
//! share the same TShape with the same Locations and
//! Orientations.
- Standard_Boolean IsEqual (const TopoDS_Shape& other) const;
- Standard_Boolean operator == (const TopoDS_Shape& other) const
-{
- return IsEqual(other);
-}
+ Standard_Boolean IsEqual (const TopoDS_Shape& theOther) const
+ {
+ return myTShape == theOther.myTShape
+ && myLocation == theOther.myLocation
+ && myOrient == theOther.myOrient;
+ }
+
+ Standard_Boolean operator == (const TopoDS_Shape& theOther) const { return IsEqual (theOther); }
//! Negation of the IsEqual method.
- Standard_Boolean IsNotEqual (const TopoDS_Shape& other) const;
- Standard_Boolean operator != (const TopoDS_Shape& other) const
-{
- return IsNotEqual(other);
-}
-
+ Standard_Boolean IsNotEqual (const TopoDS_Shape& theOther) const { return !IsEqual (theOther); }
+ Standard_Boolean operator != (const TopoDS_Shape& theOther) const { return IsNotEqual (theOther); }
+
//! Returns a hashed value denoting <me>. This value
//! is in the range 1..<Upper>. It is computed from
//! the TShape and the Location. The Orientation is
//! not used.
Standard_EXPORT Standard_Integer HashCode (const Standard_Integer Upper) const;
-
+
//! Replace <me> by a new Shape with the same
//! Orientation and Location and a new TShape with the
//! same geometry and no sub-shapes.
- void EmptyCopy();
-
+ void EmptyCopy() { myTShape = myTShape->EmptyCopy(); }
+
//! Returns a new Shape with the same Orientation and
//! Location and a new TShape with the same geometry
//! and no sub-shapes.
- TopoDS_Shape EmptyCopied() const;
-
- void TShape (const Handle(TopoDS_TShape)& T);
-
-
-
-
-protected:
-
-
-
+ TopoDS_Shape EmptyCopied() const
+ {
+ TopoDS_Shape aShape (*this);
+ aShape.EmptyCopy();
+ return aShape;
+ }
+ void TShape (const Handle(TopoDS_TShape)& theTShape) { myTShape = theTShape; }
private:
-
-
Handle(TopoDS_TShape) myTShape;
TopLoc_Location myLocation;
TopAbs_Orientation myOrient;
-
};
-
-#include <TopoDS_Shape.lxx>
-
-
-
inline Standard_Integer HashCode(const TopoDS_Shape& me,const Standard_Integer Upper) {
return me.HashCode(Upper);
}
-
-
#endif // _TopoDS_Shape_HeaderFile
+++ /dev/null
-// Created on: 1991-03-20
-// Created by: Remi Lequette
-// Copyright (c) 1991-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <TopoDS_TShape.hxx>
-#include <TopAbs.hxx>
-
-
-//=======================================================================
-//function : TopoDS_Shape
-//purpose : Constructor Null Shape
-//=======================================================================
-
-inline TopoDS_Shape::TopoDS_Shape ()
- : myOrient(TopAbs_EXTERNAL)
-{
-}
-
-//=======================================================================
-//function : IsNull
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_Shape::IsNull () const
-{
- return myTShape.IsNull();
-}
-
-//=======================================================================
-//function : Nullify
-//purpose : clear the TShape
-//=======================================================================
-
-inline void TopoDS_Shape::Nullify ()
-{
- myTShape.Nullify();
-}
-
-//=======================================================================
-//function : Location
-//purpose :
-//=======================================================================
-
-inline const TopLoc_Location& TopoDS_Shape::Location () const
-{
- return myLocation;
-}
-
-//=======================================================================
-//function : Location
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::Location (const TopLoc_Location& Loc)
-{
- myLocation = Loc;
-}
-
-//=======================================================================
-//function : Located
-//purpose :
-//=======================================================================
-
-inline TopoDS_Shape TopoDS_Shape::Located (const TopLoc_Location& Loc) const
-{
- TopoDS_Shape S(*this);
- S.Location(Loc);
- return S;
-}
-
-//=======================================================================
-//function : Orientation
-//purpose :
-//=======================================================================
-
-inline TopAbs_Orientation TopoDS_Shape::Orientation () const
-{
- return myOrient;
-}
-
-//=======================================================================
-//function : Orientation
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::Orientation (const TopAbs_Orientation Orient)
-{
- myOrient = Orient;
-}
-
-//=======================================================================
-//function : Oriented
-//purpose :
-//=======================================================================
-
-inline TopoDS_Shape TopoDS_Shape::Oriented (const TopAbs_Orientation Or) const
-{
- TopoDS_Shape S(*this);
- S.Orientation(Or);
- return S;
-}
-
-//=======================================================================
-//function : TShape
-//purpose :
-//=======================================================================
-
-inline const Handle(TopoDS_TShape)& TopoDS_Shape::TShape () const
-{
- return myTShape;
-}
-
-//=======================================================================
-//function : ShapeType
-//purpose :
-//=======================================================================
-
-inline TopAbs_ShapeEnum TopoDS_Shape::ShapeType() const
-{
- return myTShape->ShapeType();
-}
-
-//=======================================================================
-//function : Free
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_Shape::Free () const
-{
- return myTShape->Free();
-}
-
-//=======================================================================
-//function : Free
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::Free (const Standard_Boolean B)
-{
- myTShape->Free(B);
-}
-
-//=======================================================================
-//function : Locked
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_Shape::Locked () const
-{
- return myTShape->Locked();
-}
-
-//=======================================================================
-//function : Locked
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::Locked (const Standard_Boolean B)
-{
- myTShape->Locked(B);
-}
-
-//=======================================================================
-//function : Modified
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_Shape::Modified () const
-{
- return myTShape->Modified();
-}
-
-//=======================================================================
-//function : Modified
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::Modified (const Standard_Boolean B)
-{
- myTShape->Modified(B);
-}
-
-//=======================================================================
-//function : Checked
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_Shape::Checked () const
-{
- return myTShape->Checked();
-}
-
-//=======================================================================
-//function : Checked
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::Checked (const Standard_Boolean B)
-{
- myTShape->Checked(B);
-}
-
-//=======================================================================
-//function : Orientable
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_Shape::Orientable () const
-{
- return myTShape->Orientable();
-}
-
-//=======================================================================
-//function : Orientable
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::Orientable (const Standard_Boolean B)
-{
- myTShape->Orientable(B);
-}
-
-//=======================================================================
-//function : Closed
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_Shape::Closed () const
-{
- return myTShape->Closed();
-}
-
-//=======================================================================
-//function : Closed
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::Closed (const Standard_Boolean B)
-{
- myTShape->Closed(B);
-}
-
-//=======================================================================
-//function : Infinite
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_Shape::Infinite () const
-{
- return myTShape->Infinite();
-}
-
-//=======================================================================
-//function : Infinite
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::Infinite (const Standard_Boolean B)
-{
- myTShape->Infinite(B);
-}
-
-//=======================================================================
-//function : Convex
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_Shape::Convex () const
-{
- return myTShape->Convex();
-}
-
-//=======================================================================
-//function : Convex
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::Convex (const Standard_Boolean B)
-{
- myTShape->Convex(B);
-}
-
-//=======================================================================
-//function : Move
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::Move (const TopLoc_Location& position)
-{
- myLocation = position * myLocation;
-}
-
-//=======================================================================
-//function : Moved
-//purpose :
-//=======================================================================
-
-inline TopoDS_Shape TopoDS_Shape::Moved
- (const TopLoc_Location& position) const
-{
- TopoDS_Shape S(*this);
- S.Move(position);
- return S;
-}
-
-//=======================================================================
-//function : Reverse
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::Reverse()
-{
- myOrient = TopAbs::Reverse(myOrient);
-}
-
-//=======================================================================
-//function : Reversed
-//purpose :
-//=======================================================================
-
-inline TopoDS_Shape TopoDS_Shape::Reversed() const
-{
- TopoDS_Shape S(*this);
- S.Reverse();
- return S;
-}
-
-//=======================================================================
-//function : Complement
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::Complement()
-{
- myOrient = TopAbs::Complement(myOrient);
-}
-
-//=======================================================================
-//function : Complemented
-//purpose :
-//=======================================================================
-
-inline TopoDS_Shape TopoDS_Shape::Complemented() const
-{
- TopoDS_Shape S(*this);
- S.Complement();
- return S;
-}
-
-//=======================================================================
-//function : Compose
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::Compose(const TopAbs_Orientation Orient)
-{
- myOrient = TopAbs::Compose(myOrient,Orient);
-}
-
-//=======================================================================
-//function : Composed
-//purpose :
-//=======================================================================
-
-inline TopoDS_Shape TopoDS_Shape::Composed
- (const TopAbs_Orientation Orient) const
-{
- TopoDS_Shape S(*this);
- S.Compose(Orient);
- return S;
-}
-
-//=======================================================================
-//function : IsPartner
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_Shape::IsPartner (const TopoDS_Shape& other) const
-{
- return (myTShape == other.myTShape);
-}
-
-//=======================================================================
-//function : IsSame
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_Shape::IsSame (const TopoDS_Shape& other) const
-{
- return (myTShape == other.myTShape) &&
- (myLocation == other.myLocation);
-}
-
-//=======================================================================
-//function : IsEqual
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_Shape::IsEqual (const TopoDS_Shape& other) const
-{
- return (myTShape == other.myTShape) &&
- (myLocation == other.myLocation) &&
- (myOrient == other.myOrient);
-}
-
-//=======================================================================
-//function : IsNotEqual
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_Shape::IsNotEqual (const TopoDS_Shape& other) const
-{
- return !IsEqual(other);
-}
-
-//=======================================================================
-//function : EmptyCopy
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::EmptyCopy()
-{
- myTShape = myTShape->EmptyCopy();
-}
-
-//=======================================================================
-//function : EmptyCopied
-//purpose :
-//=======================================================================
-
-inline TopoDS_Shape TopoDS_Shape::EmptyCopied() const
-{
- TopoDS_Shape S(*this);
- S.EmptyCopy();
- return S;
-}
-
-//=======================================================================
-//function : TShape
-//purpose :
-//=======================================================================
-
-inline void TopoDS_Shape::TShape (const Handle(TopoDS_TShape)& TS)
-{
- myTShape = TS;
-}
-
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
#include <TopoDS_TCompSolid.hxx>
-#include <TopoDS_TShape.hxx>
+#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(TopoDS_TCompSolid,TopoDS_TShape)
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
#include <TopoDS_TCompound.hxx>
-#include <TopoDS_TShape.hxx>
+#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(TopoDS_TCompound,TopoDS_TShape)
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
#include <TopoDS_TEdge.hxx>
+#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(TopoDS_TEdge,TopoDS_TShape)
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
#include <TopoDS_TFace.hxx>
-#include <TopoDS_TShape.hxx>
+#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(TopoDS_TFace,TopoDS_TShape)
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
-#include <Standard_ConstructionError.hxx>
-#include <Standard_Type.hxx>
-#include <TopoDS_Builder.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_TShape.hxx>
+#include <TopoDS_Shape.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(TopoDS_TShape,Standard_Transient)
\ No newline at end of file
+IMPLEMENT_STANDARD_RTTIEXT(TopoDS_TShape,Standard_Transient)
#ifndef _TopoDS_TShape_HeaderFile
#define _TopoDS_TShape_HeaderFile
-#include <Standard.hxx>
#include <Standard_Type.hxx>
-
-#include <TopoDS_ListOfShape.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Boolean.hxx>
+#include <TopAbs.hxx>
#include <TopAbs_ShapeEnum.hxx>
+#include <TopoDS_ListOfShape.hxx>
class TopoDS_Iterator;
class TopoDS_Builder;
#undef Convex
#endif
-class TopoDS_TShape;
-DEFINE_STANDARD_HANDLE(TopoDS_TShape, Standard_Transient)
-
//! A TShape is a topological structure describing a
//! set of points in a 2D or 3D space.
//!
public:
-
//! Returns the free flag.
- Standard_Boolean Free() const;
-
+ Standard_Boolean Free() const { return ((myFlags & TopoDS_TShape_Flags_Free) != 0); }
+
//! Sets the free flag.
- void Free (const Standard_Boolean F);
-
+ void Free (Standard_Boolean theIsFree) { setFlag (TopoDS_TShape_Flags_Free, theIsFree); }
+
//! Returns the locked flag.
- Standard_Boolean Locked() const;
-
+ Standard_Boolean Locked() const { return ((myFlags & TopoDS_TShape_Flags_Locked) != 0); }
+
//! Sets the locked flag.
- void Locked (const Standard_Boolean F);
-
+ void Locked (Standard_Boolean theIsLocked) { setFlag (TopoDS_TShape_Flags_Locked, theIsLocked); }
+
//! Returns the modification flag.
- Standard_Boolean Modified() const;
-
+ Standard_Boolean Modified() const { return ((myFlags & TopoDS_TShape_Flags_Modified) != 0); }
+
//! Sets the modification flag.
- void Modified (const Standard_Boolean M);
-
+ void Modified (Standard_Boolean theIsModified)
+ {
+ setFlag (TopoDS_TShape_Flags_Modified, theIsModified);
+ if (theIsModified)
+ {
+ setFlag (TopoDS_TShape_Flags_Checked, false); // when a TShape is modified it is also unchecked
+ }
+ }
+
//! Returns the checked flag.
- Standard_Boolean Checked() const;
-
+ Standard_Boolean Checked() const { return ((myFlags & TopoDS_TShape_Flags_Checked) != 0); }
+
//! Sets the checked flag.
- void Checked (const Standard_Boolean C);
-
+ void Checked (Standard_Boolean theIsChecked) { setFlag (TopoDS_TShape_Flags_Checked, theIsChecked); }
+
//! Returns the orientability flag.
- Standard_Boolean Orientable() const;
-
+ Standard_Boolean Orientable() const { return ((myFlags & TopoDS_TShape_Flags_Orientable) != 0); }
+
//! Sets the orientability flag.
- void Orientable (const Standard_Boolean C);
-
+ void Orientable (Standard_Boolean theIsOrientable) { setFlag (TopoDS_TShape_Flags_Orientable, theIsOrientable); }
+
//! Returns the closedness flag.
- Standard_Boolean Closed() const;
-
+ Standard_Boolean Closed() const { return ((myFlags & TopoDS_TShape_Flags_Closed) != 0); }
+
//! Sets the closedness flag.
- void Closed (const Standard_Boolean C);
-
+ void Closed (Standard_Boolean theIsClosed) { setFlag (TopoDS_TShape_Flags_Closed, theIsClosed); }
+
//! Returns the infinity flag.
- Standard_Boolean Infinite() const;
-
+ Standard_Boolean Infinite() const { return ((myFlags & TopoDS_TShape_Flags_Infinite) != 0); }
+
//! Sets the infinity flag.
- void Infinite (const Standard_Boolean C);
-
+ void Infinite (Standard_Boolean theIsInfinite) { setFlag (TopoDS_TShape_Flags_Infinite, theIsInfinite); }
+
//! Returns the convexness flag.
- Standard_Boolean Convex() const;
-
+ Standard_Boolean Convex() const { return ((myFlags & TopoDS_TShape_Flags_Convex) != 0); }
+
//! Sets the convexness flag.
- void Convex (const Standard_Boolean C);
-
+ void Convex (Standard_Boolean theIsConvex) { setFlag (TopoDS_TShape_Flags_Convex, theIsConvex); }
+
//! Returns the type as a term of the ShapeEnum enum :
//! VERTEX, EDGE, WIRE, FACE, ....
Standard_EXPORT virtual TopAbs_ShapeEnum ShapeType() const = 0;
//! Returns a copy of the TShape with no sub-shapes.
Standard_EXPORT virtual Handle(TopoDS_TShape) EmptyCopy() const = 0;
+ //! Returns the number of direct sub-shapes (children).
+ //! @sa TopoDS_Iterator for accessing sub-shapes
+ Standard_Integer NbChildren() const { return myShapes.Size(); }
friend class TopoDS_Iterator;
friend class TopoDS_Builder;
protected:
-
//! Constructs an empty TShape.
//! Free : True
//! Modified : True
//! Closed : False
//! Infinite : False
//! Convex : False
- TopoDS_TShape();
+ TopoDS_TShape()
+ : myFlags (TopoDS_TShape_Flags_Free
+ | TopoDS_TShape_Flags_Modified
+ | TopoDS_TShape_Flags_Orientable) {}
+private:
+ // Defined mask values
+ enum TopoDS_TShape_Flags
+ {
+ TopoDS_TShape_Flags_Free = 0x001,
+ TopoDS_TShape_Flags_Modified = 0x002,
+ TopoDS_TShape_Flags_Checked = 0x004,
+ TopoDS_TShape_Flags_Orientable = 0x008,
+ TopoDS_TShape_Flags_Closed = 0x010,
+ TopoDS_TShape_Flags_Infinite = 0x020,
+ TopoDS_TShape_Flags_Convex = 0x040,
+ TopoDS_TShape_Flags_Locked = 0x080
+ };
+
+ //! Set bit flag.
+ void setFlag (TopoDS_TShape_Flags theFlag,
+ Standard_Boolean theIsOn)
+ {
+ if (theIsOn) myFlags |= (Standard_Integer )theFlag;
+ else myFlags &= ~(Standard_Integer )theFlag;
+ }
private:
-
- const TopoDS_ListOfShape& Shapes() const;
-
- TopoDS_ListOfShape& ChangeShapes();
-
TopoDS_ListOfShape myShapes;
- Standard_Integer myFlags;
-
-
+ Standard_Integer myFlags;
};
-
-#include <TopoDS_TShape.lxx>
-
-
-
-
+DEFINE_STANDARD_HANDLE(TopoDS_TShape, Standard_Transient)
#endif // _TopoDS_TShape_HeaderFile
+++ /dev/null
-// Created on: 1991-03-27
-// Created by: Remi LEQUETTE
-// Copyright (c) 1991-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <TopAbs.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_ListIteratorOfListOfShape.hxx>
-
-// Defined mask values
-#define TopoDS_TShape_Flags_Free (1<<0)
-#define TopoDS_TShape_Flags_Modified (1<<1)
-#define TopoDS_TShape_Flags_Checked (1<<2)
-#define TopoDS_TShape_Flags_Orientable (1<<3)
-#define TopoDS_TShape_Flags_Closed (1<<4)
-#define TopoDS_TShape_Flags_Infinite (1<<5)
-#define TopoDS_TShape_Flags_Convex (1<<6)
-#define TopoDS_TShape_Flags_Locked (1<<7)
-
-
-//=======================================================================
-//function : TopoDS_TShape
-//purpose : Constructor, Empty TShape
-//=======================================================================
-
-inline TopoDS_TShape::TopoDS_TShape()
- : myFlags(TopoDS_TShape_Flags_Free |
- TopoDS_TShape_Flags_Modified |
- TopoDS_TShape_Flags_Orientable)
-{
-}
-
-//=======================================================================
-//function : Free
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_TShape::Free() const
-{
- return ((myFlags & TopoDS_TShape_Flags_Free) != 0);
-}
-
-//=======================================================================
-//function : Free
-//purpose :
-//=======================================================================
-
-inline void TopoDS_TShape::Free(const Standard_Boolean F)
-{
- if (F) myFlags |= TopoDS_TShape_Flags_Free;
- else myFlags &= ~TopoDS_TShape_Flags_Free;
-}
-
-//=======================================================================
-//function : Locked
-//purpose :
-//=======================================================================
-inline Standard_Boolean TopoDS_TShape::Locked() const
-{
- return ((myFlags & TopoDS_TShape_Flags_Locked) != 0);
-}
-
-//=======================================================================
-//function : Locked
-//purpose :
-//=======================================================================
-
-inline void TopoDS_TShape::Locked(const Standard_Boolean F)
-{
- if (F) myFlags |= TopoDS_TShape_Flags_Locked;
- else myFlags &= ~TopoDS_TShape_Flags_Locked;
-}
-
-//=======================================================================
-//function : Modified
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_TShape::Modified() const
-{
- return ((myFlags & TopoDS_TShape_Flags_Modified) != 0);
-}
-
-//=======================================================================
-//function : Modified
-//purpose :
-//=======================================================================
-
-inline void TopoDS_TShape::Modified(const Standard_Boolean M)
-{
- if (M)
- {
- myFlags |= TopoDS_TShape_Flags_Modified;
- // When a TShape is modified it is also unchecked
- myFlags &= ~TopoDS_TShape_Flags_Checked;
- }
- else myFlags &= ~TopoDS_TShape_Flags_Modified;
-}
-
-//=======================================================================
-//function : Checked
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_TShape::Checked() const
-{
- return ((myFlags & TopoDS_TShape_Flags_Checked) != 0);
-}
-
-//=======================================================================
-//function : Checked
-//purpose :
-//=======================================================================
-
-inline void TopoDS_TShape::Checked(const Standard_Boolean M)
-{
- if (M) myFlags |= TopoDS_TShape_Flags_Checked;
- else myFlags &= ~TopoDS_TShape_Flags_Checked;
-}
-
-//=======================================================================
-//function : Orientable
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_TShape::Orientable() const
-{
- return ((myFlags & TopoDS_TShape_Flags_Orientable) != 0);
-}
-
-//=======================================================================
-//function : Orientable
-//purpose :
-//=======================================================================
-
-inline void TopoDS_TShape::Orientable(const Standard_Boolean M)
-{
- if (M) myFlags |= TopoDS_TShape_Flags_Orientable;
- else myFlags &= ~TopoDS_TShape_Flags_Orientable;
-}
-
-//=======================================================================
-//function : Closed
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_TShape::Closed() const
-{
- return ((myFlags & TopoDS_TShape_Flags_Closed) != 0);
-}
-
-//=======================================================================
-//function : Closed
-//purpose :
-//=======================================================================
-
-inline void TopoDS_TShape::Closed(const Standard_Boolean M)
-{
- if (M) myFlags |= TopoDS_TShape_Flags_Closed;
- else myFlags &= ~TopoDS_TShape_Flags_Closed;
-}
-
-//=======================================================================
-//function : Infinite
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_TShape::Infinite() const
-{
- return ((myFlags & TopoDS_TShape_Flags_Infinite) != 0);
-}
-
-//=======================================================================
-//function : Infinite
-//purpose :
-//=======================================================================
-
-inline void TopoDS_TShape::Infinite(const Standard_Boolean M)
-{
- if (M) myFlags |= TopoDS_TShape_Flags_Infinite;
- else myFlags &= ~TopoDS_TShape_Flags_Infinite;
-}
-
-//=======================================================================
-//function : Convex
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TopoDS_TShape::Convex() const
-{
- return ((myFlags & TopoDS_TShape_Flags_Convex) != 0);
-}
-
-//=======================================================================
-//function : Convex
-//purpose :
-//=======================================================================
-
-inline void TopoDS_TShape::Convex(const Standard_Boolean M)
-{
- if (M) myFlags |= TopoDS_TShape_Flags_Convex;
- else myFlags &= ~TopoDS_TShape_Flags_Convex;
-}
-
-//=======================================================================
-//function : Shapes
-//purpose :
-//=======================================================================
-
-inline const TopoDS_ListOfShape& TopoDS_TShape::Shapes() const
-{
- return myShapes;
-}
-
-//=======================================================================
-//function : ChangeShapes
-//purpose :
-//=======================================================================
-
-inline TopoDS_ListOfShape& TopoDS_TShape::ChangeShapes()
-{
- return myShapes;
-}
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
-#include <TopoDS_TShape.hxx>
#include <TopoDS_TShell.hxx>
+#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(TopoDS_TShell,TopoDS_TShape)
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
-#include <TopoDS_TShape.hxx>
#include <TopoDS_TSolid.hxx>
+#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(TopoDS_TSolid,TopoDS_TShape)
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
#include <TopoDS_TVertex.hxx>
+#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(TopoDS_TVertex,TopoDS_TShape)
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
-#include <TopoDS_TShape.hxx>
#include <TopoDS_TWire.hxx>
+#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(TopoDS_TWire,TopoDS_TShape)
#include <StepShape_FacetedBrep.hxx>
#include <StepShape_TopologicalRepresentationItem.hxx>
#include <TCollection_HAsciiString.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDSToStep.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TopoDS.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDSToStep.hxx>
#include <TopoDSToStep_Builder.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDSToStep_MakeStepEdge.hxx>
#include <TopoDSToStep_MakeStepVertex.hxx>
#include <TopoDSToStep_Tool.hxx>
}
#define Nbpt 21
- TopoDS_Iterator It;
Standard_Integer i;
Standard_Real U, U1, U2;
gp_Pnt P;
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDSToStep.hxx>
#include <TopoDSToStep_MakeStepFace.hxx>
#include <TopoDSToStep_MakeStepWire.hxx>
return;
}
- TopoDS_Iterator It;
Standard_Integer i;
//BRepAdaptor_Surface SA = BRepAdaptor_Surface(ForwardFace);
#include <TColStd_SequenceOfTransient.hxx>
#include <TopExp.hxx>
#include <TopoDS.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDSToStep_MakeStepEdge.hxx>
#include <TopoDSToStep_MakeStepVertex.hxx>
return;
}
- TopoDS_Iterator It;
Standard_Integer i;
if (aWire.Orientation() == TopAbs_INTERNAL ||
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_HShape.hxx>
-#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_Binder.hxx>
#include <Transfer_FinderProcess.hxx>
// Compare the number of components in XDE structure with the number of
// components in topological structure. A component may happen to be removed,
// so we have to update the assembly compound
- Standard_Integer aNumTopoComponents = 0;
- for ( TopoDS_Iterator aTopIt(aCurrentRootShape); aTopIt.More(); aTopIt.Next() )
- aNumTopoComponents++;
+ Standard_Integer aNumTopoComponents = aCurrentRootShape.NbChildren();
//
if ( aNumTopoComponents != aComponentLabs.Length() )
isModified = Standard_True;
TopoDS_Shape aSubshape = XCAFDoc_ShapeTool::GetShape (aLabel);
if (aSubshape.ShapeType() == TopAbs_COMPOUND)
{
- const TopoDS_Iterator aShapeIter (aSubshape);
- if (!aShapeIter.More())
+ if (aSubshape.NbChildren() == 0)
{
continue;
}
if (myshape.ShapeType() == TopAbs_COMPOUND)
{
- TopoDS_Iterator anExplor (myshape);
- if (!anExplor.More())
+ if (myshape.NbChildren() == 0)
{
return;
}