DCQ : Debug GetIndexTopology Method

This commit is contained in:
dcq 2004-04-16 12:55:31 +00:00
parent a8fbf7298a
commit e0a7383279

View File

@ -40,6 +40,8 @@ using namespace std;
#include "OCCViewer_Viewer3d.h" #include "OCCViewer_Viewer3d.h"
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BRepAdaptor_Surface.hxx> #include <BRepAdaptor_Surface.hxx>
#include <BRepAdaptor_Curve.hxx> #include <BRepAdaptor_Curve.hxx>
#include <GeomAbs_CurveType.hxx> #include <GeomAbs_CurveType.hxx>
@ -47,6 +49,7 @@ using namespace std;
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TopoDS_Edge.hxx> #include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx> #include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include "VTKViewer_RenderWindowInteractor.h" #include "VTKViewer_RenderWindowInteractor.h"
#include "VTKViewer_ViewFrame.h" #include "VTKViewer_ViewFrame.h"
@ -164,16 +167,35 @@ int GEOM_Swig::getIndexTopology(const char* SubIOR, const char* IOR)
GEOM::GEOM_Shape_var aSubShape = Geom->GetIORFromString(SubIOR); GEOM::GEOM_Shape_var aSubShape = Geom->GetIORFromString(SubIOR);
TopoDS_Shape subshape = ShapeReader.GetShape(Geom, aSubShape); TopoDS_Shape subshape = ShapeReader.GetShape(Geom, aSubShape);
TopExp_Explorer Exp ( shape, subshape.ShapeType() );
int index = 1; int index = 1;
TopTools_MapOfShape M; if(subshape.ShapeType() == TopAbs_COMPOUND) {
while ( Exp.More() ) { TopoDS_Iterator it;
if ( M.Add(Exp.Current()) ) { TopTools_ListOfShape CL;
if ( Exp.Current().IsSame(subshape) ) CL.Append(shape);
return index; TopTools_ListIteratorOfListOfShape itC;
index++; for(itC.Initialize(CL); itC.More(); itC.Next()) {
for(it.Initialize(itC.Value()); it.More(); it.Next()) {
if (it.Value().ShapeType() == TopAbs_COMPOUND) {
if (it.Value().IsSame(subshape))
return index;
else
index++;
CL.Append(it.Value());
}
}
}
}
else {
TopExp_Explorer Exp(shape, subshape.ShapeType());
TopTools_MapOfShape M;
while(Exp.More()) {
if(M.Add(Exp.Current())) {
if(Exp.Current().IsSame(subshape))
return index;
index++;
}
Exp.Next();
} }
Exp.Next();
} }
return -1; return -1;
} }