From 1c577b65eb3f53eb9b7d54bcc231d96922612dbd Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 23 Jun 2010 13:38:25 +0000 Subject: [PATCH] Merge from V5_1_4_BR 23/06/2010 --- src/GEOMGUI/GEOMGUI_Selection.cxx | 3 +- src/GEOMGUI/GeometryGUI.cxx | 3 +- src/GEOMImpl/GEOMImpl_IShapesOperations.cxx | 5 + src/GEOM_I/GEOM_Gen_i.cc | 512 +++++++++++--------- 4 files changed, 280 insertions(+), 243 deletions(-) diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx index 3d4920b3e..e30f447a9 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.cxx +++ b/src/GEOMGUI/GEOMGUI_Selection.cxx @@ -129,7 +129,8 @@ int GEOMGUI_Selection::typeId( const int index ) const int aType = -1; GEOM::GEOM_Object_var anObj = getObject( index ); if ( !CORBA::is_nil( anObj ) ) - aType = anObj->GetType(); + //aType = anObj->GetType(); + aType = (int)anObj->GetShapeType(); return aType; } diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 31fb62af8..1edeb1ada 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -1088,7 +1088,8 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->insert( action( GEOMOp::OpDeflection ), -1, -1 ); // deflection mgr->setRule( action( GEOMOp::OpDeflection ), "selcount>0 and isVisible and client='OCCViewer'", QtxPopupMgr::VisibleRule ); mgr->insert( action( GEOMOp::OpPointMarker ), -1, -1 ); // point marker - mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1}" ).arg( GEOM_POINT ), QtxPopupMgr::VisibleRule ); + //mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1}" ).arg(GEOM_POINT ), QtxPopupMgr::VisibleRule ); + mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1}" ).arg(GEOM::VERTEX), QtxPopupMgr::VisibleRule ); mgr->insert( separator(), -1, -1 ); // ----------- mgr->insert( action( GEOMOp::OpAutoColor ), -1, -1 ); // auto color mgr->setRule( action( GEOMOp::OpAutoColor ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule ); diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index 09677608a..520b13680 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -3169,6 +3169,11 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) if( min_l < fabs(aYmax - aYmin) ) min_l = fabs(aYmax - aYmin); if( min_l < fabs(aZmax - aZmin) ) min_l = fabs(aZmax - aZmin); min_l /= dl_l; + // Mantis issue 0020908 BEGIN + if (!Exp_Edge.More()) { + min_l = Precision::Confusion(); + } + // Mantis issue 0020908 END for ( Standard_Integer nbEdge = 0; Exp_Edge.More(); Exp_Edge.Next(), nbEdge++ ) { TopExp_Explorer Exp_Vertex( Exp_Edge.Current(), TopAbs_VERTEX); for ( Standard_Integer nbVertex = 0; Exp_Vertex.More(); Exp_Vertex.Next(), nbVertex++ ) { diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index 639d60159..eb5d2d908 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -18,7 +18,6 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// #ifdef WNT #pragma warning( disable:4786 ) @@ -67,10 +66,10 @@ // purpose : constructor to be called for servant creation. //============================================================================ GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId* contId, - const char* instanceName, - const char* interfaceName) : + PortableServer::POA_ptr poa, + PortableServer::ObjectId* contId, + const char* instanceName, + const char* interfaceName) : Engines_Component_i(orb, poa, contId, instanceName, interfaceName) { _thisObj = this; @@ -113,9 +112,9 @@ GEOM_Gen_i::~GEOM_Gen_i() { // purpose : //============================================================================ char* GEOM_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, - const char* IORString, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII) + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) { GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow(_orb->string_to_object(IORString)); if (!CORBA::is_nil(anObject)) { @@ -132,9 +131,9 @@ char* GEOM_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, // : The IOR (IORName) of object created is returned //============================================================================ char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, - const char* aLocalPersistentID, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII) + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) { SALOMEDS::Study_var aStudy = theSObject->GetStudy(); @@ -163,9 +162,9 @@ bool GEOM_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) // purpose : //============================================================================ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject, - CORBA::Object_ptr theObject, - const char* theName) throw (SALOME::SALOME_Exception) + SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName) throw (SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); SALOMEDS::SObject_var aResultSO; @@ -265,7 +264,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, aPixmap->Destroy(); //if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag()); //else aShapeName = TCollection_AsciiString(CORBA::string_dup(theName)); - + // try to find existed name for current shape bool HasName = false; // recieve current TopoDS shape @@ -306,8 +305,8 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_var obj; TCollection_AsciiString aNewShapeName; do { - aNewShapeName = aShapeName + TCollection_AsciiString(++i); - obj = theStudy->FindObject( aNewShapeName.ToCString() ); + aNewShapeName = aShapeName + TCollection_AsciiString(++i); + obj = theStudy->FindObject( aNewShapeName.ToCString() ); } while ( !obj->_is_nil() ); aShapeName = aNewShapeName; @@ -334,9 +333,9 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::ListOfStrings aListOfVars = aSections[i]; for(int j = 0, m = aListOfVars.length(); j < m; j++) { if(theStudy->IsVariable(aListOfVars[j].in())) - aVars += TCollection_AsciiString(aListOfVars[j].in()); + aVars += TCollection_AsciiString(aListOfVars[j].in()); if(j != m-1) - aVars += ":"; + aVars += ":"; } if(i != n-1) aVars += "|"; @@ -360,12 +359,12 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, // purpose : auxilary for PublishNamedShapesInStudy //============================================================================ void GEOM_Gen_i::CreateAndPublishGroup(SALOMEDS::Study_ptr theStudy, - GEOM::GEOM_Object_var theMainShape, - const TopTools_IndexedMapOfShape& anIndices, - const TopTools_SequenceOfShape& SeqS, - const TColStd_SequenceOfAsciiString& SeqN, - const Standard_CString& GrName, - GEOM::ListOfGO_var aResList) + GEOM::GEOM_Object_var theMainShape, + const TopTools_IndexedMapOfShape& anIndices, + const TopTools_SequenceOfShape& SeqS, + const TColStd_SequenceOfAsciiString& SeqN, + const Standard_CString& GrName, + GEOM::ListOfGO_var aResList) { CORBA::String_var entry = theMainShape->GetEntry(); Handle(GEOM_Object) aMainShape = _impl->GetObject(theMainShape->GetStudyID(), entry); @@ -411,8 +410,8 @@ void GEOM_Gen_i::CreateAndPublishGroup(SALOMEDS::Study_ptr theStudy, //============================================================================ GEOM::ListOfGO* GEOM_Gen_i:: PublishNamedShapesInStudy(SALOMEDS::Study_ptr theStudy, - //SALOMEDS::SObject_ptr theSObject, - CORBA::Object_ptr theObject) + //SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject) { //Unexpect aCatch(SALOME_SalomeException); GEOM::ListOfGO_var aResList = new GEOM::ListOfGO; @@ -441,20 +440,20 @@ GEOM::ListOfGO* GEOM_Gen_i:: if(L.FindAttribute(TDataStd_Name::GetID(),aName)) { TCollection_ExtendedString EName = aName->Get(); if(S.ShapeType()==TopAbs_SOLID) { - SolidSeqS.Append(S); - SolidSeqN.Append(aName->Get()); + SolidSeqS.Append(S); + SolidSeqN.Append(aName->Get()); } else if(S.ShapeType()==TopAbs_FACE) { - FaceSeqS.Append(S); - FaceSeqN.Append(aName->Get()); + FaceSeqS.Append(S); + FaceSeqN.Append(aName->Get()); } else if(S.ShapeType()==TopAbs_EDGE) { - EdgeSeqS.Append(S); - EdgeSeqN.Append(aName->Get()); + EdgeSeqS.Append(S); + EdgeSeqN.Append(aName->Get()); } else if(S.ShapeType()==TopAbs_VERTEX) { - VertSeqS.Append(S); - VertSeqN.Append(aName->Get()); + VertSeqS.Append(S); + VertSeqN.Append(aName->Get()); } } } @@ -463,16 +462,16 @@ GEOM::ListOfGO* GEOM_Gen_i:: TopExp::MapShapes(MainSh, anIndices); CreateAndPublishGroup(theStudy, theMainShape, anIndices, SolidSeqS, SolidSeqN, - "Group_Of_Named_Solids", aResList); + "Group_Of_Named_Solids", aResList); CreateAndPublishGroup(theStudy, theMainShape, anIndices, FaceSeqS, FaceSeqN, - "Group_Of_Named_Faces", aResList); + "Group_Of_Named_Faces", aResList); CreateAndPublishGroup(theStudy, theMainShape, anIndices, EdgeSeqS, EdgeSeqN, - "Group_Of_Named_Edges", aResList); + "Group_Of_Named_Edges", aResList); CreateAndPublishGroup(theStudy, theMainShape, anIndices, VertSeqS, VertSeqN, - "Group_Of_Named_Vertices", aResList); + "Group_Of_Named_Vertices", aResList); return aResList._retn(); } @@ -483,8 +482,8 @@ GEOM::ListOfGO* GEOM_Gen_i:: // purpose : save OCAF/Geom document //============================================================================ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - bool isMultiFile) { + const char* theURL, + bool isMultiFile) { SALOMEDS::TMPFile_var aStreamFile; // Get a temporary directory to store a file std::string aTmpDir = (isMultiFile)?theURL:SALOMEDS_Tool::GetTmpDir(); @@ -528,8 +527,8 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, // purpose : //============================================================================ SALOMEDS::TMPFile* GEOM_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - bool isMultiFile) { + const char* theURL, + bool isMultiFile) { SALOMEDS::TMPFile_var aStreamFile = Save(theComponent, theURL, isMultiFile); return aStreamFile._retn(); } @@ -540,9 +539,9 @@ SALOMEDS::TMPFile* GEOM_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent, // purpose : //============================================================================ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - bool isMultiFile) { + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile) { if (theStream.length() <= 9) { MESSAGE("The TMPFile is too short : " << theStream.length() << " bytes "); @@ -592,9 +591,9 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, // purpose : //============================================================================ CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - bool isMultiFile) { + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile) { return Load(theComponent, theStream, theURL, isMultiFile); } @@ -670,8 +669,8 @@ CORBA::Boolean GEOM_Gen_i::CanPaste(const char* theComponentName, CORBA::Long th // purpose : //============================================================================ SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream, - CORBA::Long theObjectID, - SALOMEDS::SObject_ptr theObject) { + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theObject) { // Find the current Study and StudyBuilder SALOMEDS::Study_var aStudy = theObject->GetStudy(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); @@ -730,9 +729,9 @@ char* GEOM_Gen_i::ComponentDataType() // purpose : //============================================================================ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy (SALOMEDS::Study_ptr theStudy, - GEOM::GEOM_Object_ptr theObject, - const char* theName, - GEOM::GEOM_Object_ptr theFather) + GEOM::GEOM_Object_ptr theObject, + const char* theName, + GEOM::GEOM_Object_ptr theFather) { SALOMEDS::SObject_var aResultSO; if(theObject->_is_nil() || theStudy->_is_nil()) return aResultSO; @@ -778,7 +777,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy (SALOMEDS::Study_ptr theStudy, // To be used from python scripts out of geompy.addToStudy (non-default usage) //============================================================================ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr theStudy, - GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theObject, const GEOM::ListOfGO& theArgs, GEOM::find_shape_method theFindMethod, CORBA::Boolean theInheritFirstArg, @@ -867,11 +866,11 @@ static void addToListOfGO( const GEOM::ListOfGO& theSrcList, // are defined, and does not check, if they correspond to each other. //============================================================================ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy, - GEOM::GEOM_Object_ptr theObject, - SALOMEDS::SObject_ptr theSObject, - const GEOM::ListOfGO& theArgs, - GEOM::find_shape_method theFindMethod, - CORBA::Boolean theInheritFirstArg, + GEOM::GEOM_Object_ptr theObject, + SALOMEDS::SObject_ptr theSObject, + const GEOM::ListOfGO& theArgs, + GEOM::find_shape_method theFindMethod, + CORBA::Boolean theInheritFirstArg, CORBA::Boolean theAddPrefix) { GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; @@ -915,6 +914,13 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy, // set the color of the transformed shape to the color of initial shape theObject->SetColor(aList[0]->GetColor()); + // set the texture + if (theObject->GetShapeType() == GEOM::VERTEX) { + theObject->SetMarkerStd(aList[0]->GetMarkerType(), aList[0]->GetMarkerSize()); + if (aList[0]->GetMarkerType() == GEOM::MT_USER) + theObject->SetMarkerTexture(aList[0]->GetMarkerTexture()); + } + anArgSO->Destroy(); } else { @@ -1004,6 +1010,12 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy, aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString()); // Restore color aSubO->SetColor(anArgO->GetColor()); + // set the texture + if (aSubO->GetShapeType() == GEOM::VERTEX) { + aSubO->SetMarkerStd(anArgO->GetMarkerType(), anArgO->GetMarkerSize()); + if (anArgO->GetMarkerType() == GEOM::MT_USER) + aSubO->SetMarkerTexture(anArgO->GetMarkerTexture()); + } } if (!CORBA::is_nil(anArgSO)) { @@ -1055,6 +1067,12 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy, aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString()); // Restore color aSubO->SetColor(anArgO->GetColor()); + // set the texture + if (aSubO->GetShapeType() == GEOM::VERTEX) { + aSubO->SetMarkerStd(anArgO->GetMarkerType(), anArgO->GetMarkerSize()); + if (anArgO->GetMarkerType() == GEOM::MT_USER) + aSubO->SetMarkerTexture(anArgO->GetMarkerTexture()); + } } } else if (!CORBA::is_nil(aSubSO)) { @@ -1137,10 +1155,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy, // purpose : Private method //============================================================================ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theOldSO, - SALOMEDS::SObject_ptr theNewSO, - GEOM::GEOM_Object_ptr theNewO, - GEOM::find_shape_method theFindMethod, + SALOMEDS::SObject_ptr theOldSO, + SALOMEDS::SObject_ptr theNewSO, + GEOM::GEOM_Object_ptr theNewO, + GEOM::find_shape_method theFindMethod, CORBA::Boolean theAddPrefix) { int i = 0; @@ -1174,135 +1192,147 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr th if (anOldSubSO->FindAttribute(anAttr, "AttributeIOR")) { SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); GEOM::GEOM_Object_var anOldSubO = - GEOM::GEOM_Object::_narrow(_orb->string_to_object(anAttrIOR->Value())); + GEOM::GEOM_Object::_narrow(_orb->string_to_object(anAttrIOR->Value())); if (!CORBA::is_nil(anOldSubO)) { - // Find a sub-shape of theNewO in place of anOldSubO - GEOM::GEOM_Object_var aNewSubO; - switch (theFindMethod) { - case GEOM::FSM_GetInPlace: - { - // Use GetInPlace - aNewSubO = aShapesOp->GetInPlace(theNewO, anOldSubO); - } - break; - case GEOM::FSM_Transformed: - { - // transformation, cannot use GetInPlace, operate with indices - GEOM::ListOfLong_var anIDs = anOldSubO->GetSubShapeIndices(); - if (anIDs->length() > 1) { - // group - aNewSubO = aGroupOp->CreateGroup(theNewO, aGroupOp->GetType(anOldSubO)); - if (!CORBA::is_nil(aNewSubO)) - aGroupOp->UnionIDs(aNewSubO, anIDs); - } - else { - // single sub-shape - aNewSubO = aShapesOp->GetSubShape(theNewO, anIDs[0]); - } - } - break; - case GEOM::FSM_GetSame: - { - // Use GetSame - aNewSubO = aShapesOp->GetSame(theNewO, anOldSubO); - } - break; - case GEOM::FSM_GetShapesOnShape: - { - // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids - aNewSubO = aShapesOp->GetShapesOnShapeAsCompound(anOldSubO, theNewO, - (short)GEOM::SOLID, GEOM::ST_ONIN); - } - break; - case GEOM::FSM_GetInPlaceByHistory: - { - // Use GetInPlaceByHistory - aNewSubO = aShapesOp->GetInPlaceByHistory(theNewO, anOldSubO); - } - break; - default: - {} - } - - if (!CORBA::is_nil(aNewSubO)) { - // add the part to the list - aParts[i] = aNewSubO; - i++; + // Find a sub-shape of theNewO in place of anOldSubO + GEOM::GEOM_Object_var aNewSubO; + switch (theFindMethod) { + case GEOM::FSM_GetInPlace: + { + // Use GetInPlace + aNewSubO = aShapesOp->GetInPlace(theNewO, anOldSubO); + } + break; + case GEOM::FSM_Transformed: + { + // transformation, cannot use GetInPlace, operate with indices + GEOM::ListOfLong_var anIDs = anOldSubO->GetSubShapeIndices(); + if (anIDs->length() > 1) { + // group + aNewSubO = aGroupOp->CreateGroup(theNewO, aGroupOp->GetType(anOldSubO)); + if (!CORBA::is_nil(aNewSubO)) + aGroupOp->UnionIDs(aNewSubO, anIDs); + } + else { + // single sub-shape + aNewSubO = aShapesOp->GetSubShape(theNewO, anIDs[0]); + } + } + break; + case GEOM::FSM_GetSame: + { + // Use GetSame + aNewSubO = aShapesOp->GetSame(theNewO, anOldSubO); + } + break; + case GEOM::FSM_GetShapesOnShape: + { + // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids + aNewSubO = aShapesOp->GetShapesOnShapeAsCompound(anOldSubO, theNewO, + (short)GEOM::SOLID, GEOM::ST_ONIN); + } + break; + case GEOM::FSM_GetInPlaceByHistory: + { + // Use GetInPlaceByHistory + aNewSubO = aShapesOp->GetInPlaceByHistory(theNewO, anOldSubO); + } + break; + default: + {} + } + + if (!CORBA::is_nil(aNewSubO)) { + // add the part to the list + aParts[i] = aNewSubO; + i++; // add to parts list addToListOfGO( aNewSubO, aNewParts ); SALOMEDS::SObject_var aNewSubSO; if (!CORBA::is_nil(theNewSO)) { - // Publish the sub-shape + // Publish the sub-shape TCollection_AsciiString aSubName; if (theAddPrefix) { aSubName = "from_"; } - aSubName += anArgName; - aNewSubSO = aStudyBuilder->NewObject(theNewSO); - aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString()); - // Restore color - aNewSubO->SetColor(anOldSubO->GetColor()); + aSubName += anArgName; + aNewSubSO = aStudyBuilder->NewObject(theNewSO); + aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString()); + // Restore color + aNewSubO->SetColor(anOldSubO->GetColor()); + // set the texture + if (aNewSubO->GetShapeType() == GEOM::VERTEX) { + aNewSubO->SetMarkerStd(anOldSubO->GetMarkerType(), anOldSubO->GetMarkerSize()); + if (anOldSubO->GetMarkerType() == GEOM::MT_USER) + aNewSubO->SetMarkerTexture(anOldSubO->GetMarkerTexture()); + } } - // Restore published sub-shapes of the argument - GEOM::ListOfGO_var aSubParts; - if (theFindMethod == GEOM::FSM_GetInPlaceByHistory) - // pass the main shape as Object, because only it has the history - aSubParts = RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, + // Restore published sub-shapes of the argument + GEOM::ListOfGO_var aSubParts; + if (theFindMethod == GEOM::FSM_GetInPlaceByHistory) + // pass the main shape as Object, because only it has the history + aSubParts = RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, theNewO, theFindMethod, theAddPrefix); - else - aSubParts = RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, + else + aSubParts = RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, aNewSubO, theFindMethod, theAddPrefix); // add to parts list addToListOfGO( aSubParts, aNewParts ); - } - else { // GetInPlace failed, try to build from published parts - SALOMEDS::SObject_var aNewSubSO; + } + else { // GetInPlace failed, try to build from published parts + SALOMEDS::SObject_var aNewSubSO; if (!CORBA::is_nil(theNewSO)) aNewSubSO = aStudyBuilder->NewObject(theNewSO); - // Restore published sub-shapes of the argument - GEOM::ListOfGO_var aSubParts = - RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, + // Restore published sub-shapes of the argument + GEOM::ListOfGO_var aSubParts = + RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, theNewO, theFindMethod, theAddPrefix); // add to parts list addToListOfGO( aSubParts, aNewParts ); - if (aSubParts->length() > 0) { - // try to build an object from a set of its sub-shapes, - // that published and will be reconstructed - if (aSubParts->length() > 1) { - aNewSubO = aShapesOp->MakeCompound(aSubParts); + if (aSubParts->length() > 0) { + // try to build an object from a set of its sub-shapes, + // that published and will be reconstructed + if (aSubParts->length() > 1) { + aNewSubO = aShapesOp->MakeCompound(aSubParts); // add to parts list addToListOfGO( aNewSubO, aNewParts ); - } - else { - aNewSubO = aSubParts[0]; - } - - if (!CORBA::is_nil(aNewSubO)) { - // add the part to the list - aSubParts[i] = aNewSubO; - i++; - - // Publish the sub-shape - if (!CORBA::is_nil(aNewSubSO)) { + } + else { + aNewSubO = aSubParts[0]; + } + + if (!CORBA::is_nil(aNewSubO)) { + // add the part to the list + aSubParts[i] = aNewSubO; + i++; + + // Publish the sub-shape + if (!CORBA::is_nil(aNewSubSO)) { TCollection_AsciiString aSubName; if (theAddPrefix) { aSubName = "from_parts_of_"; } - aSubName += anArgName; - aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString()); - // Restore color - aNewSubO->SetColor(anOldSubO->GetColor()); + aSubName += anArgName; + aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString()); + // Restore color + aNewSubO->SetColor(anOldSubO->GetColor()); + // set the texture + if (aNewSubO->GetShapeType() == GEOM::VERTEX) { + aNewSubO->SetMarkerStd(anOldSubO->GetMarkerType(), anOldSubO->GetMarkerSize()); + if (anOldSubO->GetMarkerType() == GEOM::MT_USER) + aNewSubO->SetMarkerTexture(anOldSubO->GetMarkerTexture()); + } } - } - } - else if (!CORBA::is_nil(aNewSubSO)) { - // remove created aSubSO, because no parts have been found - aStudyBuilder->RemoveObject(aNewSubSO); - } - } // try to build from published parts + } + } + else if (!CORBA::is_nil(aNewSubSO)) { + // remove created aSubSO, because no parts have been found + aStudyBuilder->RemoveObject(aNewSubSO); + } + } // try to build from published parts } } } // iterate on published sub-shapes @@ -1610,7 +1640,7 @@ GEOM::GEOM_IAdvancedOperations_ptr GEOM_Gen_i::GetIAdvancedOperations(CORBA::Lon */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape (GEOM::GEOM_Object_ptr theMainShape, - const GEOM::ListOfLong& theIndices) + const GEOM::ListOfLong& theIndices) { if (CORBA::is_nil(theMainShape) || theIndices.length() < 1) return GEOM::GEOM_Object::_nil(); @@ -1712,7 +1742,7 @@ bool GEOM_Gen_i::hasObjectInfo() char* GEOM_Gen_i::getObjectInfo(CORBA::Long studyId, const char* entry) { GEOM::GEOM_Object_var aGeomObject; - + CORBA::Object_var aSMObject = name_service->Resolve( "/myStudyManager" ); SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject ); SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( studyId ); @@ -1731,7 +1761,7 @@ char* GEOM_Gen_i::getObjectInfo(CORBA::Long studyId, const char* entry) } if (!aSObj->_is_nil() ) aSObj->Destroy(); - + const char* aTypeInfo = "Object"; if ( !aGeomObject->_is_nil() ) { GEOM::GEOM_IKindOfShape::shape_kind aKind; @@ -1744,110 +1774,110 @@ char* GEOM_Gen_i::getObjectInfo(CORBA::Long studyId, const char* entry) if ( anOp->IsDone() ) { switch ( aKind ) { case GEOM::GEOM_IKindOfShape::COMPOUND: - aTypeInfo = "Compound"; - break; + aTypeInfo = "Compound"; + break; case GEOM::GEOM_IKindOfShape::COMPSOLID: - aTypeInfo = "CompSolid"; - break; + aTypeInfo = "CompSolid"; + break; case GEOM::GEOM_IKindOfShape::SHELL: - aTypeInfo = "Shell"; - break; + aTypeInfo = "Shell"; + break; case GEOM::GEOM_IKindOfShape::WIRE: - if ( anInts[0] == 1 ) - aTypeInfo = "Closed Wire"; - else if ( anInts[0] == 2 ) - aTypeInfo = "Opened Wire"; - else - aTypeInfo = "Wire"; - break; - // SOLIDs + if ( anInts[0] == 1 ) + aTypeInfo = "Closed Wire"; + else if ( anInts[0] == 2 ) + aTypeInfo = "Opened Wire"; + else + aTypeInfo = "Wire"; + break; + // SOLIDs case GEOM::GEOM_IKindOfShape::SPHERE: - aTypeInfo = "Sphere"; - break; + aTypeInfo = "Sphere"; + break; case GEOM::GEOM_IKindOfShape::CYLINDER: - aTypeInfo = "Cylinder"; - break; + aTypeInfo = "Cylinder"; + break; case GEOM::GEOM_IKindOfShape::BOX: case GEOM::GEOM_IKindOfShape::ROTATED_BOX: - aTypeInfo = "Box"; - break; + aTypeInfo = "Box"; + break; case GEOM::GEOM_IKindOfShape::TORUS: - aTypeInfo = "Torus"; - break; + aTypeInfo = "Torus"; + break; case GEOM::GEOM_IKindOfShape::CONE: - aTypeInfo = "Cone"; - break; + aTypeInfo = "Cone"; + break; case GEOM::GEOM_IKindOfShape::POLYHEDRON: - aTypeInfo = "Polyhedron"; - break; + aTypeInfo = "Polyhedron"; + break; case GEOM::GEOM_IKindOfShape::SOLID: - aTypeInfo = "Solid"; - break; - // FACEs + aTypeInfo = "Solid"; + break; + // FACEs case GEOM::GEOM_IKindOfShape::SPHERE2D: - aTypeInfo = "Spherical Face"; - break; + aTypeInfo = "Spherical Face"; + break; case GEOM::GEOM_IKindOfShape::CYLINDER2D: - aTypeInfo = "Cylindrical Face"; - break; + aTypeInfo = "Cylindrical Face"; + break; case GEOM::GEOM_IKindOfShape::TORUS2D: - aTypeInfo = "Toroidal Face"; - break; + aTypeInfo = "Toroidal Face"; + break; case GEOM::GEOM_IKindOfShape::CONE2D: - aTypeInfo = "Conical Face"; - break; + aTypeInfo = "Conical Face"; + break; case GEOM::GEOM_IKindOfShape::DISK_CIRCLE: - aTypeInfo = "Disk"; - break; + aTypeInfo = "Disk"; + break; case GEOM::GEOM_IKindOfShape::DISK_ELLIPSE: - aTypeInfo = "Elliptical Face"; - break; + aTypeInfo = "Elliptical Face"; + break; case GEOM::GEOM_IKindOfShape::POLYGON: - aTypeInfo = "Polygon"; - break; + aTypeInfo = "Polygon"; + break; case GEOM::GEOM_IKindOfShape::PLANE: - aTypeInfo = "Plane"; - break; + aTypeInfo = "Plane"; + break; case GEOM::GEOM_IKindOfShape::PLANAR: - aTypeInfo = "Planar Face"; - break; + aTypeInfo = "Planar Face"; + break; case GEOM::GEOM_IKindOfShape::FACE: - aTypeInfo = "Face"; - break; - // EDGEs + aTypeInfo = "Face"; + break; + // EDGEs case GEOM::GEOM_IKindOfShape::CIRCLE: - aTypeInfo = "Circle"; - break; + aTypeInfo = "Circle"; + break; case GEOM::GEOM_IKindOfShape::ARC_CIRCLE: - aTypeInfo = "Arc Circle"; - break; + aTypeInfo = "Arc Circle"; + break; case GEOM::GEOM_IKindOfShape::ELLIPSE: - aTypeInfo = "Ellipse"; - break; + aTypeInfo = "Ellipse"; + break; case GEOM::GEOM_IKindOfShape::ARC_ELLIPSE: - aTypeInfo = "Arc Ellipse"; - break; + aTypeInfo = "Arc Ellipse"; + break; case GEOM::GEOM_IKindOfShape::LINE: - aTypeInfo = "Line"; - break; + aTypeInfo = "Line"; + break; case GEOM::GEOM_IKindOfShape::SEGMENT: - aTypeInfo = "Segment"; - break; + aTypeInfo = "Segment"; + break; case GEOM::GEOM_IKindOfShape::EDGE: - aTypeInfo = "Edge"; - break; + aTypeInfo = "Edge"; + break; case GEOM::GEOM_IKindOfShape::VERTEX: - aTypeInfo = "Vertex"; - break; + aTypeInfo = "Vertex"; + break; default: - break; + break; } } } - + char* anInfo = new char[strlen("Module ") + strlen(ComponentDataType()) + strlen(", ") + strlen(aTypeInfo) + 3]; sprintf(anInfo, "Module %s, %s", ComponentDataType(), aTypeInfo); - + char* ret = CORBA::string_dup(anInfo); delete [] anInfo; return ret; @@ -1862,13 +1892,13 @@ extern "C" GEOM_I_EXPORT PortableServer::ObjectId* GEOMEngine_factory(CORBA::ORB*, PortableServer::POA*, PortableServer::ObjectId*, const char*, const char*); */ - + GEOM_I_EXPORT PortableServer::ObjectId* GEOMEngine_factory(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId* contId, - const char* instanceName, - const char* interfaceName) + PortableServer::POA_ptr poa, + PortableServer::ObjectId* contId, + const char* instanceName, + const char* interfaceName) { GEOM_Gen_i* myGEOM_Gen_i = new GEOM_Gen_i(orb, poa, contId, instanceName, interfaceName); return myGEOM_Gen_i->getId(); -- 2.39.2