From bcc6a77970843e4e7d4de79c742d29dfd781a17c Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 7 Dec 2010 13:24:27 +0000 Subject: [PATCH] Fix problem of displaying sub-objects of the main shape --- src/GEOMClient/GEOM_Client.cxx | 31 ++++++++++++++++++++++--------- src/GEOMClient/GEOM_Client.hxx | 2 ++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/GEOMClient/GEOM_Client.cxx b/src/GEOMClient/GEOM_Client.cxx index 3e047e220..6a89e6893 100644 --- a/src/GEOMClient/GEOM_Client.cxx +++ b/src/GEOMClient/GEOM_Client.cxx @@ -78,7 +78,7 @@ TopoDS_Shape GEOM_Client::Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr a /* get sequence of bytes of resulting brep shape from GEOM server */ TopoDS_Shape S; SALOMEDS::TMPFile_var SeqFile = aShape->GetShapeStream(); - int sizebuf = SeqFile->length(); + /*int sizebuf = */SeqFile->length(); char* buf; buf = (char*) &SeqFile[0]; std::istringstream streamBrep(buf); @@ -102,6 +102,19 @@ GEOM_Client::GEOM_Client() #endif } +//======================================================================= +// function : Create() +// purpose : Copy constructor +//======================================================================= +GEOM_Client::GEOM_Client(const GEOM_Client& client) +{ + myIORs = client.myIORs; + myShapes = client.myShapes; + _myIndexes = client._myIndexes; + _mySubShapes = client._mySubShapes; + pid_client = client.pid_client; +} + //======================================================================= // function : Create() // purpose : @@ -221,20 +234,20 @@ TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_p TopoDS_Shape aMainShape = GetShape (geom, aShape->GetMainShape()); GEOM::ListOfLong_var list = aShape->GetSubShapeIndices(); - TopTools_IndexedMapOfShape anIndices; CORBA::String_var aMainIOR = geom->GetStringFromIOR(aShape->GetMainShape()); TCollection_AsciiString mainIOR = (char*)aMainIOR.in(); //find subshapes only one time if(_mySubShapes.count(mainIOR)==0) + { + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aMainShape, anIndices); + Standard_Integer ii = 1, nbSubSh = anIndices.Extent(); + for (; ii <= nbSubSh; ii++) { - TopExp::MapShapes(aMainShape, anIndices); - Standard_Integer ii = 1, nbSubSh = anIndices.Extent(); - for (; ii <= nbSubSh; ii++) - { - _mySubShapes[mainIOR].push_back(anIndices.FindKey(ii)); - } + _mySubShapes[mainIOR].push_back(anIndices.FindKey(ii)); } + } /* Case of only one subshape */ if (list->length() == 1 && list[0] > 0) { @@ -245,7 +258,7 @@ TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_p TopoDS_Compound aCompound; B.MakeCompound(aCompound); for (int i = 0; i < list->length(); i++) { - if (0 < list[i] && list[i] <= anIndices.Extent()) { + if (0 < list[i] && list[i] <= _mySubShapes[mainIOR].size()) { TopoDS_Shape aSubShape = _mySubShapes[mainIOR][list[i]-1]; B.Add(aCompound, aSubShape); } diff --git a/src/GEOMClient/GEOM_Client.hxx b/src/GEOMClient/GEOM_Client.hxx index d20029719..6b81488ee 100644 --- a/src/GEOMClient/GEOM_Client.hxx +++ b/src/GEOMClient/GEOM_Client.hxx @@ -111,6 +111,8 @@ public: //Standard_EXPORT GEOM_Client(Engines::Container_ptr client); //Standard_EXPORT + GEOM_Client(const GEOM_Client& client); + //Standard_EXPORT Standard_Integer Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S ) ; //Standard_EXPORT Standard_Integer Find( const TopoDS_Shape& S, TCollection_AsciiString& IOR ) ; -- 2.39.2