From: dcq Date: Fri, 16 Apr 2004 12:55:31 +0000 (+0000) Subject: DCQ : Debug GetIndexTopology Method X-Git-Tag: Ecole_Ete_a2~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e0a738327926d3cf78d43eaba9a83dab5f126c52;p=modules%2Fgeom.git DCQ : Debug GetIndexTopology Method --- diff --git a/src/GEOMGUI/GeometryGUI_Swig.cxx b/src/GEOMGUI/GeometryGUI_Swig.cxx index 55727f909..81e1f1b45 100644 --- a/src/GEOMGUI/GeometryGUI_Swig.cxx +++ b/src/GEOMGUI/GeometryGUI_Swig.cxx @@ -40,6 +40,8 @@ using namespace std; #include "OCCViewer_Viewer3d.h" #include #include +#include +#include #include #include #include @@ -47,6 +49,7 @@ using namespace std; #include #include #include +#include #include "VTKViewer_RenderWindowInteractor.h" #include "VTKViewer_ViewFrame.h" @@ -164,17 +167,36 @@ int GEOM_Swig::getIndexTopology(const char* SubIOR, const char* IOR) GEOM::GEOM_Shape_var aSubShape = Geom->GetIORFromString(SubIOR); TopoDS_Shape subshape = ShapeReader.GetShape(Geom, aSubShape); - TopExp_Explorer Exp ( shape, subshape.ShapeType() ); int index = 1; - TopTools_MapOfShape M; - while ( Exp.More() ) { - if ( M.Add(Exp.Current()) ) { - if ( Exp.Current().IsSame(subshape) ) - return index; - index++; - } - Exp.Next(); - } + if(subshape.ShapeType() == TopAbs_COMPOUND) { + TopoDS_Iterator it; + TopTools_ListOfShape CL; + CL.Append(shape); + TopTools_ListIteratorOfListOfShape itC; + 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(); + } + } return -1; }