]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
PAL10385: CreateAndDisplayGO does not work properly when reopening a study
authorjfa <jfa@opencascade.com>
Tue, 25 Oct 2005 10:09:35 +0000 (10:09 +0000)
committerjfa <jfa@opencascade.com>
Tue, 25 Oct 2005 10:09:35 +0000 (10:09 +0000)
src/GEOMGUI/GeometryGUI_Swig.cxx

index 9c1ef575f359d90d3b6723aede515f6728116e8c..277f1e4b293f4a82db59d317a4327842cb0e70cf 100644 (file)
@@ -111,13 +111,20 @@ void GEOM_Swig::createAndDisplayGO (const char* Entry)
 
       CORBA::String_var aFatherIOR;
       SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM");
-      aStudyBuilder->DefineComponentInstance(father, Geom);
-      father->ComponentIOR(aFatherIOR);
+      if (father->_is_nil())
+        return;
+      if (!father->ComponentIOR(aFatherIOR)) {
+        aStudyBuilder->LoadWith(father, Geom);
+        father->ComponentIOR(aFatherIOR);
+      }
 
       SALOMEDS::SObject_var fatherSF =
         aStudy->FindObjectID(ActiveStudy->getActiveStudyFrame()->entry());
 
       SALOMEDS::SObject_var obj = aStudy->FindObjectID(myEntry.c_str());
+      if (obj->_is_nil())
+        return;
+
       SALOMEDS::GenericAttribute_var anAttr;
       SALOMEDS::AttributeIOR_var     anIOR;
       // Create new actor
@@ -129,7 +136,7 @@ void GEOM_Swig::createAndDisplayGO (const char* Entry)
       GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(anIORValue);
       TopoDS_Shape Shape = ShapeReader.GetShape(Geom,aShape);
 
-      if (!obj->_is_nil()) {
+      if (!Shape.IsNull()) {
         if (obj->FindAttribute(anAttr, "AttributeName")) {
           SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
           CORBA::String_var aNameValue = aName->Value();