X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_Gen_i_1.cxx;h=c3123b3f5a79293b2f7b5fd0c563799bbdb73615;hb=e5ed5aa5ac8420179aa37e3bf3a175e22ef3f69a;hp=a001e6a83d4513286831cadd7bfcda906e9f1e4d;hpb=fc90840855ae0a8d07420bf32f15b38e9de9a6d5;p=modules%2Fsmesh.git diff --git a/src/SMESH_I/SMESH_Gen_i_1.cxx b/src/SMESH_I/SMESH_Gen_i_1.cxx index a001e6a83..c3123b3f5 100644 --- a/src/SMESH_I/SMESH_Gen_i_1.cxx +++ b/src/SMESH_I/SMESH_Gen_i_1.cxx @@ -210,8 +210,10 @@ GEOM::GEOM_Object_ptr SMESH_Gen_i::ShapeToGeomObject (const TopoDS_Shape& theSha GEOM_Client* aClient = GetShapeReader(); TCollection_AsciiString IOR; if ( aClient && aClient->Find( theShape, IOR )) - aShapeObj = GEOM::GEOM_Object::_narrow - ( GetORB()->string_to_object( IOR.ToCString() ) ); + { + CORBA::Object_var obj = GetORB()->string_to_object( IOR.ToCString() ); + aShapeObj = GEOM::GEOM_Object::_narrow ( obj ); + } } return aShapeObj._retn(); } @@ -262,7 +264,8 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy, } if ( thePixMap ) { anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributePixMap" ); - SALOMEDS::AttributePixMap::_narrow( anAttr )->SetPixMap( thePixMap ); + SALOMEDS::AttributePixMap_var pm = SALOMEDS::AttributePixMap::_narrow( anAttr ); + pm->SetPixMap( thePixMap ); } if ( !theSelectable ) { anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeSelectable" ); @@ -368,9 +371,9 @@ static void addReference (SALOMEDS::Study_ptr theStudy, //============================================================================= SALOMEDS::SObject_ptr SMESH_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject, - CORBA::Object_ptr theIOR, - const char* theName) + SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theIOR, + const char* theName) throw (SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); @@ -465,9 +468,9 @@ static long findMaxChildTag( SALOMEDS::SObject_ptr theSObject ) if ( !aStudy->_is_nil() ) { SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( theSObject ); for ( ; anIter->More(); anIter->Next() ) { - long nTag = anIter->Value()->Tag(); - if ( nTag > aTag ) - aTag = nTag; + long nTag = anIter->Value()->Tag(); + if ( nTag > aTag ) + aTag = nTag; } } } @@ -518,13 +521,12 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishMesh (SALOMEDS::Study_ptr theStudy, // Publish global hypotheses - SMESH::ListOfHypothesis * hypList = theMesh->GetHypothesisList( aShapeObject ); - if ( hypList ) - for ( int i = 0; i < hypList->length(); i++ ) { - SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( (*hypList)[ i ]); - PublishHypothesis( theStudy, aHyp ); - AddHypothesisToShape( theStudy, theMesh, aShapeObject, aHyp ); - } + SMESH::ListOfHypothesis_var hypList = theMesh->GetHypothesisList( aShapeObject ); + for ( int i = 0; i < hypList->length(); i++ ) { + SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( hypList[ i ]); + PublishHypothesis( theStudy, aHyp ); + AddHypothesisToShape( theStudy, theMesh, aShapeObject, aHyp ); + } } // Publish submeshes @@ -674,8 +676,8 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishGroup (SALOMEDS::Study_ptr theStudy } int aType = (int)theGroup->GetType(); const char* aRootNames[] = { - "Compound Groups", "Groups of Nodes", "Group of 0D Elements", - "Groups of Edges", "Groups of Faces", "Groups of Volumes" }; + "Compound Groups", "Groups of Nodes", "Groups of Edges", + "Groups of Faces", "Groups of Volumes", "Groups of 0D Elements" }; // Currently, groups with heterogenous content are not supported if ( aType != SMESH::ALL ) { @@ -747,6 +749,9 @@ SALOMEDS::SObject_ptr SetName( aHypSO, theName, aHypName ); } + if( SMESH_Hypothesis_i* aServant = dynamic_cast( GetServant( theHyp ).in() ) ) + aServant->UpdateStringAttribute(); + if(MYDEBUG) MESSAGE("PublishHypothesis--END") return aHypSO._retn(); } @@ -883,101 +888,3 @@ bool SMESH_Gen_i::RemoveHypothesisFromShape(SALOMEDS::Study_ptr theStudy } return true; } - -//======================================================================= -//function : UpdateParameters -//purpose : -//======================================================================= -void SMESH_Gen_i::UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters) -{ - - if(VARIABLE_DEBUG) - cout<<"UpdateParameters : "<_is_nil() || CORBA::is_nil(theObject)) - return; - - SALOMEDS::SObject_var aSObj = ObjectToSObject(aStudy,theObject); - if(aSObj->_is_nil()) - return; - - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - - SALOMEDS::GenericAttribute_var aFindAttr; - bool hasAttr = aSObj->FindAttribute(aFindAttr, "AttributeString"); - if(VARIABLE_DEBUG) - cout<<"Find Attribute "<FindOrCreateAttribute( aSObj, "AttributeString"); - SALOMEDS::AttributeString_var aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr); - - TCollection_AsciiString aNewParams; - TCollection_AsciiString aOldParameters(aStringAttr->Value()); - TCollection_AsciiString anInputParams(ParseParameters(theParameters)); - - if(!hasAttr) - aNewParams = anInputParams; - else - aNewParams = aOldParameters+"|"+anInputParams; - - if(VARIABLE_DEBUG) - { - cout<<"Input Parameters : "<SetValue( aNewParams.ToCString() ); -} - -//======================================================================= -//function : ParseParameters -//purpose : -//======================================================================= -char* SMESH_Gen_i::ParseParameters(const char* theParameters) -{ - const char* aParameters = CORBA::string_dup(theParameters); - TCollection_AsciiString anInputParams; - SALOMEDS::Study_ptr aStudy = GetCurrentStudy(); - if( !aStudy->_is_nil() ) { - SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters); - for(int j=0;jlength();j++) { - SALOMEDS::ListOfStrings aVars= aSections[j]; - for(int i=0;iIsVariable(aVars[i].in()) ? - TCollection_AsciiString(aVars[i].in()) : TCollection_AsciiString(""); - if(i != aVars.length()-1) - anInputParams+=":"; - } - if(j!=aSections->length()-1) - anInputParams+="|"; - } - } - return CORBA::string_dup(anInputParams.ToCString()); -} - -//======================================================================= -//function : GetParameters -//purpose : -//======================================================================= -char* SMESH_Gen_i::GetParameters(CORBA::Object_ptr theObject) -{ - TCollection_AsciiString aResult; - - SALOMEDS::Study_ptr aStudy = GetCurrentStudy(); - SALOMEDS::SObject_var aSObj = ObjectToSObject(aStudy,theObject); - - if(!aStudy->_is_nil() && - !CORBA::is_nil(theObject) && - !aSObj->_is_nil()){ - - SALOMEDS::GenericAttribute_var anAttr; - if ( aSObj->FindAttribute(anAttr, "AttributeString")) { - aResult = TCollection_AsciiString(SALOMEDS::AttributeString::_narrow(anAttr)->Value()); - } - } - - return CORBA::string_dup( aResult.ToCString() ); -}