X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMClient%2FGEOM_Client.cxx;h=2659f6209b4f5a38bba8e62f6932f59d71aa854c;hb=6943eea1c391def14848539900c0705d0e3f66e9;hp=208f52e0eb08251f1375ac7cda09da63359b7854;hpb=f931ebe5b663153f8e276d607d870aa401a91048;p=modules%2Fgeom.git diff --git a/src/GEOMClient/GEOM_Client.cxx b/src/GEOMClient/GEOM_Client.cxx index 208f52e0e..2659f6209 100644 --- a/src/GEOMClient/GEOM_Client.cxx +++ b/src/GEOMClient/GEOM_Client.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -28,6 +28,8 @@ #include +#include + #include #include "GEOM_Client.hxx" @@ -196,47 +198,46 @@ unsigned int GEOM_Client::BufferLength() // function : GetShape() // purpose : //======================================================================= +TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape ) +{ + TopoDS_Shape S; + TCollection_AsciiString IOR = geom->GetStringFromIOR(aShape); + Standard_Integer anIndex = Find(IOR, S); -TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape ) -{ - TopoDS_Shape S; - TCollection_AsciiString IOR = geom->GetStringFromIOR(aShape); - Standard_Integer anIndex = Find(IOR, S); - - if (anIndex !=0 ) return S ; + if (anIndex != 0) return S; - /******* in case of a MAIN GEOM::SHAPE ********/ - if (aShape->IsMainShape()) { - S = Load(geom, aShape); - Bind(IOR, S); - return S; - } + /******* in case of a MAIN GEOM::SHAPE ********/ + if (aShape->IsMainShape()) { + S = Load(geom, aShape); + Bind(IOR, S); + return S; + } - /******* in case of SUB GEOM::SHAPE ***********/ - // Load and Explore the Main Shape - TopoDS_Shape aMainShape = GetShape (geom, aShape->GetMainShape()); - GEOM::ListOfLong_var list = aShape->GetSubShapeIndices(); + /******* in case of SUB GEOM::SHAPE ***********/ + // Load and Explore the Main Shape + TopoDS_Shape aMainShape = GetShape (geom, aShape->GetMainShape()); + GEOM::ListOfLong_var list = aShape->GetSubShapeIndices(); TopTools_IndexedMapOfShape anIndices; TopExp::MapShapes(aMainShape, anIndices); - /* Case of only one subshape */ - if (list->length() == 1) - { - S = anIndices.FindKey(list[0]); - } + /* Case of only one subshape */ + if (list->length() == 1) { + S = anIndices.FindKey(list[0]); + } else { BRep_Builder B; TopoDS_Compound aCompound; B.MakeCompound(aCompound); - for(int i=0; ilength(); i++) { - TopoDS_Shape aSubShape = anIndices.FindKey(list[i]); - B.Add(aCompound, aSubShape); + for (int i = 0; i < list->length(); i++) { + if (0 < list[i] && list[i] <= anIndices.Extent()) { + TopoDS_Shape aSubShape = anIndices.FindKey(list[i]); + B.Add(aCompound, aSubShape); + } } S = aCompound; } - Bind(IOR, S); - return S; -} - + Bind(IOR, S); + return S; +}