1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

0029814: Modeling Data - add method TopoDS_Shape::NbChildren() for simple check of sub-shapes number

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
This commit is contained in:
kgv
2018-05-24 18:06:37 +03:00
committed by bugmaster
parent e67e482d99
commit b2d1851c43
68 changed files with 321 additions and 1090 deletions

View File

@@ -48,7 +48,6 @@
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>

View File

@@ -65,8 +65,6 @@
#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)
@@ -112,12 +110,9 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
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())
@@ -227,8 +222,7 @@ void AIS_Shape::computeHlrPresentation (const Handle(Prs3d_Projector)& theProjec
}
case TopAbs_COMPOUND:
{
TopoDS_Iterator anExplor (theShape);
if (!anExplor.More())
if (theShape.NbChildren() == 0)
{
return;
}
@@ -293,11 +287,10 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
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);
@@ -982,13 +975,11 @@ void AIS_Shape::LoadRecomputable(const Standard_Integer TheMode)
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) {

View File

@@ -46,7 +46,6 @@
#include <SelectMgr_Selection.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_Type.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>