Salome HOME
Prevent processing SHAPERSTUDY objects`
authoreap <eap@opencascade.com>
Thu, 7 May 2020 16:49:06 +0000 (19:49 +0300)
committereap <eap@opencascade.com>
Thu, 7 May 2020 16:49:06 +0000 (19:49 +0300)
15 files changed:
src/EntityGUI/EntityGUI.cxx
src/EntityGUI/EntityGUI_FieldDlg.cxx
src/EntityGUI/EntityGUI_SubShapeDlg.cxx
src/GEOMBase/GEOMBase.cxx
src/GEOMGUI/GEOMGUI_AnnotationMgr.h
src/GEOMGUI/GEOMGUI_Selection.cxx
src/GEOMGUI/GEOM_Displayer.cxx
src/GEOMGUI/GeometryGUI.cxx
src/GEOMGUI/GeometryGUI.h
src/GEOMToolsGUI/GEOMToolsGUI.cxx
src/GEOMToolsGUI/GEOMToolsGUI_1.cxx
src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx
src/GEOM_SWIG_WITHIHM/GEOM_Swig_LocalSelector.cxx
src/GroupGUI/GroupGUI_GroupDlg.cxx
src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx

index 9a6ad4dabd136ac0daddc00136f30e58efc6982d..5d470125c1ef0d0d2d714462de62b7c0834eec95 100644 (file)
@@ -141,14 +141,16 @@ bool EntityGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
     GEOM::GEOM_FieldStep_var step;
 
     SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
-    if ( aList.Extent() > 0 && study ) {
+    if ( study )
       for ( ; anIter.More(); anIter.Next() )
       {
         Handle(SALOME_InteractiveObject) anIObj = anIter.Value();
         if ( !anIObj.IsNull() && anIObj->hasEntry() )
-          if ( _PTR(SObject) obj = study->studyDS()->FindObjectID( anIObj->getEntry() ))
+        {
+          _PTR(SObject) obj = study->studyDS()->FindObjectID( anIObj->getEntry() );
+          if ( GeometryGUI::IsInGeomComponent( obj ))
           {
-            CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( obj );
+            CORBA::Object_var   corbaObj = GeometryGUI::ClientSObjectToObject( obj );
             GEOM::GEOM_BaseObject_var bo = GEOM::GEOM_BaseObject::_narrow( corbaObj );
             GEOM::GEOM_Field_var     f;
             GEOM::GEOM_FieldStep_var s;
@@ -173,9 +175,8 @@ bool EntityGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
               field = f;
             }
           }
+        }
       }
-    }
-
     if ( !field->_is_nil()) {
       int stepID;
       if ( !step->_is_nil() ) {
index 4113d18452b635e89b63d9fba2fa82206dc56c6b..d3efa0a7ba5187f3c50abd4dd3ba56368f2bd7e8 100644 (file)
@@ -1478,6 +1478,7 @@ int EntityGUI_FieldDlg::getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMa
         _PTR(Study) aStudy = appStudy->studyDS();
 
         _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toUtf8().constData()));
+        if ( ! GeometryGUI::IsInGeomComponent( aSObj )) continue;
         GEOM::GEOM_Object_var aGeomObj =
           GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
         TopoDS_Shape aShape;
@@ -1773,20 +1774,21 @@ void EntityGUI_FieldDlg::highlightSubShapes()
     CORBA::String_var aMainEntry = myShape->GetStudyEntry();
     _PTR(SObject) aSObj = aStudy->FindObjectID( aMainEntry.in() );
     _PTR(ChildIterator) anIt = aStudy->NewChildIterator(aSObj);
-    for (anIt->InitEx(true); anIt->More(); anIt->Next()) {
-      GEOM::GEOM_Object_var aChild =
-        GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(anIt->Value()));
-      if (!CORBA::is_nil(aChild)) {
-        int index = aLocOp->GetSubShapeIndex(myShape, aChild);
-        if ( anIds.Contains( index )) {
-          CORBA::String_var aChildEntry = aChild->GetStudyEntry();
-          //childsMap.insert(index, aChildEntry.in());
+    if ( GeometryGUI::IsInGeomComponent( aSObj ))
+      for (anIt->InitEx(true); anIt->More(); anIt->Next()) {
+        GEOM::GEOM_Object_var aChild =
+          GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(anIt->Value()));
+        if (!CORBA::is_nil(aChild)) {
+          int index = aLocOp->GetSubShapeIndex(myShape, aChild);
+          if ( anIds.Contains( index )) {
+            CORBA::String_var aChildEntry = aChild->GetStudyEntry();
+            //childsMap.insert(index, aChildEntry.in());
             Handle(SALOME_InteractiveObject) tmpIO =
               new SALOME_InteractiveObject( aChildEntry.in(), "GEOM", "TEMP_IO");
             aSelList.Append(tmpIO);
+          }
         }
       }
-    }
   }
 
   AIS_ListIteratorOfListOfInteractive ite (List);
index 0e5a265d6068c281e6195c70f8bcc640e29166a2..541581d0e7071a9c68e1fd7c79be30237827f7f4 100644 (file)
@@ -694,6 +694,7 @@ int EntityGUI_SubShapeDlg::getSelectedSubshapes (TColStd_IndexedMapOfInteger& th
         _PTR(Study) aStudy = appStudy->studyDS();
 
         _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toUtf8().constData()));
+        if ( ! GeometryGUI::IsInGeomComponent( aSObj )) continue;
         GEOM::GEOM_Object_var aGeomObj =
           GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
         TopoDS_Shape aShape;
index 13e293060329e5ef8364440ecc77471e8065b63e..3b96a53315f40022c1ebace1df1d4f632d8c98e1 100644 (file)
@@ -450,12 +450,11 @@ GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_Inter
     SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
     if ( study ) {
       _PTR(Study) studyDS = study->studyDS();
-      _PTR(SObject) obj( studyDS->FindObjectID( IO->getEntry() ) );
-      if ( obj ) {
-        CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( obj );
-        if ( !CORBA::is_nil( corbaObj ) )
+      _PTR(SObject)   obj = studyDS->FindObjectID( IO->getEntry() );
+      if ( GeometryGUI::IsInGeomComponent( obj )) {
+          CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( obj );
           object = GEOM::GEOM_Object::_narrow( corbaObj );
-      }
+        }
     }
   }
   return object._retn();
@@ -489,7 +488,6 @@ void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& IObjects,
   }
 }
 
-
 //=================================================================================
 // function : CreateArrowForLinearEdge()
 // purpose  : Create a cone topology to be used to display an arrow in the middle
index bf79aa7b4916c643cb0ea2b882f93e68a7644c41..30a92ee4b4f8c0c60a55872e022a3b35ee456746 100644 (file)
@@ -38,7 +38,7 @@ class GEOM_Annotation;
 class GEOM_Displayer;
 
 /*!
- * \brief A help class to process visualizatin of annotation presentations.
+ * \brief A help class to process visualization of annotation presentations.
  * It contains a map of presentations shown in each viewer.
  * and correct 2D position persistent properties of annotations of active viewer.
  * When the viewer is closed, information about the viewer is removed from the manager 
index 32eaabf8744443b250fe3740fcf2dc4ea4eb03ae..64193d83d965e03b318324c56ead0ae2c36446f8 100644 (file)
@@ -132,7 +132,7 @@ void GEOMGUI_Selection::init( const QString& context, LightApp_SelectionMgr* sel
       QString anEntry = entry( idx );
       if ( study && !anEntry.isEmpty() ) {
         _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
-        if ( aSO ) {
+        if ( GeometryGUI::IsInGeomComponent( aSO )) {
           CORBA::Object_var varObj = GeometryGUI::ClientSObjectToObject( aSO );
           myObjects[idx] = GEOM::GEOM_BaseObject::_narrow( varObj );
         }
index 5c9236b76eebf13d4cb08e7974d3db8ab3159908..f311ea4dca14e60f98bf3f11e14d768da97fbb6b 100644 (file)
@@ -1765,7 +1765,7 @@ SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry,
         if ( getStudy() )
         {
           _PTR(SObject) SO ( getStudy()->studyDS()->FindObjectID( theIO->getEntry() ) );
-          if ( SO )
+          if ( SO ) //GeometryGUI::IsInGeomComponent( SO ))
           {
             // get CORBA reference to data object
             CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
@@ -2377,6 +2377,7 @@ void GEOM_Displayer::setFieldStepInfo( const GEOM::field_data_type theFieldDataT
 bool GEOM_Displayer::canBeDisplayed( const QString& entry, const QString& viewer_type ) const
 {
   _PTR(SObject) anObj = getStudy()->studyDS()->FindObjectID( (const char*)entry.toUtf8() );
+  //if ( ! GeometryGUI::IsInGeomComponent( anObj )) return false;
   GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of GEOM objects
   GEOM::GEOM_FieldStep_var aFieldStepObj = GEOM::GEOM_FieldStep::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of GEOM field steps
   GEOM::GEOM_Gen_var aCompObj = GEOM::GEOM_Gen::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of whole GEOM component
@@ -2538,7 +2539,7 @@ PropMap GEOM_Displayer::getObjectProperties( const QString& entry,
       if ( !entry.isEmpty() ) {
         // get CORBA reference to geom object
         _PTR(SObject) SO( getStudy()->studyDS()->FindObjectID( entry.toStdString() ) );
-        if ( SO ) {
+        if ( SO ) { //GeometryGUI::IsInGeomComponent( SO )) {
           CORBA::Object_var object = GeometryGUI::ClientSObjectToObject( SO );
           if ( !CORBA::is_nil( object ) ) {
             GEOM::GEOM_Object_var geomObject = GEOM::GEOM_Object::_narrow( object );
index b4eb41733dabc70dcdf88cffca48e93fce9acdb0..c92b77b6d46662326fd8600ca3fdb2d30c578a61 100644 (file)
@@ -176,6 +176,17 @@ CORBA::Object_var GeometryGUI::ClientSObjectToObject (_PTR(SObject) theSObject)
   }
   return anObj._retn();
 }
+//=================================================================================
+// function : IsInGeomComponent
+// purpose  : Check if an SObject is under GEOM component
+//=================================================================================
+bool GeometryGUI::IsInGeomComponent( _PTR(SObject) sobject )
+{
+  if ( sobject )
+    if ( _PTR(SComponent) aComp = sobject->GetFatherComponent() )
+      return aComp->ComponentDataType() == "GEOM";
+  return false;
+}
 
 //=======================================================================
 // function : GetStudy
@@ -2128,7 +2139,7 @@ void GeometryGUI::updateCreationInfo()
     Handle(SALOME_InteractiveObject) io = selIt.Value();
     if ( !io->hasEntry() ) continue;
     _PTR(SObject) sobj = study->FindObjectID( io->getEntry() );
-    if ( !sobj ) continue;
+    if ( !GeometryGUI::IsInGeomComponent( sobj )) continue;
     CORBA::Object_var          obj = GeometryGUI::ClientSObjectToObject( sobj );
     GEOM::GEOM_BaseObject_var gobj = GEOM::GEOM_BaseObject::_narrow( obj );
     if ( !gobj->_is_nil() )
index 514293af444ab739f072527a634d87feeb7e7cc4..e2efd421f53d64db9f716cc7c5ac73847909c5fb 100644 (file)
@@ -89,9 +89,10 @@ public:
 
   static bool                 InitGeomGen();
 
-  static  GEOM::GEOM_Gen_var  GetGeomGen();
+  static GEOM::GEOM_Gen_var   GetGeomGen();
 
   static CORBA::Object_var    ClientSObjectToObject (_PTR(SObject) theSObject);
+  static bool                 IsInGeomComponent( _PTR(SObject) theSObject );
   static SALOMEDS::Study_var  getStudyServant();
 
   static void                 Modified( bool = true );
index 4894ccf3e9e53ee9e2bf58e67564d868373569eb..5be561172ab10b72c5a8934f9023326cc4c609da 100644 (file)
@@ -94,7 +94,7 @@ static bool inUse( const QString& component, const QMap<QString,QString>& object
   for ( oit = objects.begin(); oit != objects.end(); ++oit )
   {
     _PTR(SObject) so = study->FindObjectID( oit.key().toUtf8().data() );
-    if ( !so )
+    if ( !GeometryGUI::IsInGeomComponent( so ))
       continue;
     aSelectedSO.push_back(so);
     CORBA::Object_var        corbaObj_rem = GeometryGUI::ClientSObjectToObject( so );
index ec61696f9544cf0b4b40152bea4a1f847628a10c..42790af114df8cd1170abb5eb9e39db57f680bf5 100644 (file)
@@ -160,7 +160,7 @@ void GEOMToolsGUI::OnAutoColor()
   _PTR(Study) aStudy = appStudy->studyDS();
   _PTR(SObject) aMainSObject(aStudy->FindObjectID(anIObject->getEntry()));
   GEOM::GEOM_Object_var aMainObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aMainSObject));
-  if (CORBA::is_nil(aMainObject)) return;
+  if (CORBA::is_nil(aMainObject) || !GeometryGUI::IsInGeomComponent( aMainSObject )) return;
 
   aMainObject->SetAutoColor( true );
 
@@ -229,7 +229,7 @@ void GEOMToolsGUI::OnDisableAutoColor()
   _PTR(Study) aStudy = appStudy->studyDS();
   _PTR(SObject) aMainSObject( aStudy->FindObjectID( anIObject->getEntry() ) );
   GEOM::GEOM_Object_var aMainObject =  GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aMainSObject));
-  if( CORBA::is_nil( aMainObject ) )
+  if( CORBA::is_nil( aMainObject ) || !GeometryGUI::IsInGeomComponent( aMainSObject ))
     return;
 
   aMainObject->SetAutoColor( false );
index 1af76cae138435c22c7382a358c401b5f7887b0a..ee1d7a17dbf88a1db059eedfa5a0a6f0931c388a 100644 (file)
@@ -220,7 +220,7 @@ void GEOMToolsGUI_MarkerDlg::accept()
             _PTR(SObject) aSObject( study->FindObjectID( it.Value()->getEntry() ) );
             GEOM::GEOM_Object_var anObject =
               GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( aSObject ) );
-            if ( !anObject->_is_nil() ) {
+            if ( !anObject->_is_nil() && GeometryGUI::IsInGeomComponent( aSObject )) {
               if ( myWGStack->currentIndex() == 0 ) {
                 anObject->SetMarkerStd( getMarkerType(), getStandardMarkerScale() );
                 QString aMarker = "%1%2%3";
@@ -296,7 +296,7 @@ void GEOMToolsGUI_MarkerDlg::init()
           _PTR(SObject) aSObject( study->FindObjectID( it.Value()->getEntry() ) );
           GEOM::GEOM_Object_var anObject =
             GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( aSObject ) );
-          if ( !anObject->_is_nil() ) {
+          if ( !anObject->_is_nil() && GeometryGUI::IsInGeomComponent( aSObject )) {
             GEOM::marker_type mtype = anObject->GetMarkerType();
             if ( aType == -1 )
               aType = mtype;
index a243872c67e20ba261f4d1e5e998fc7c3a136e1d..df299aede7fa99c09cb6e30bbac51d98c2c48c18 100644 (file)
@@ -41,20 +41,20 @@ GEOM_Swig_LocalSelector::GEOM_Swig_LocalSelector(QWidget* parent, SUIT_ViewWindo
 
   SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(SUIT_Session::session()->activeApplication()->activeStudy());
   if (study)
+  {
+    _PTR(Study) studyDS = study->studyDS();
+    _PTR(SObject) obj( studyDS->FindObjectID( shapeEntry ) );
+    if ( GeometryGUI::IsInGeomComponent( obj ))
     {
-      _PTR(Study) studyDS = study->studyDS();
-      _PTR(SObject) obj( studyDS->FindObjectID( shapeEntry ) );
-      if (obj)
-        {
-          CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(obj);
-          if (!CORBA::is_nil(corbaObj))
-            {
-              myObject = GEOM::GEOM_Object::_narrow(corbaObj);
-              shapeName = myObject->GetName();
-              MESSAGE("shapeName: " << shapeName);
-            }
-        }
+      CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(obj);
+      if (!CORBA::is_nil(corbaObj))
+      {
+        myObject = GEOM::GEOM_Object::_narrow(corbaObj);
+        shapeName = myObject->GetName();
+        MESSAGE("shapeName: " << shapeName);
+      }
     }
+  }
 
   std::list<int> modes;
   modes.push_back(mode);
index 7c7dc925ddea96295049f39c940ac7ad4d783286..6f8f529eaa4609cc41d4bf4e11fb3ed154ea402a 100644 (file)
@@ -876,6 +876,7 @@ int GroupGUI_GroupDlg::getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMap
         _PTR(Study) aStudy = appStudy->studyDS();
 
         _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toUtf8().constData()));
+        if ( ! GeometryGUI::IsInGeomComponent( aSObj )) continue;
         GEOM::GEOM_Object_var aGeomObj =
           GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
         TopoDS_Shape aShape;
index 67710eb7323c04d1b8737148d0f97688b6b448fd..52cd67b7bd8cbe12b99b4ef53f4f10db5b001f98 100644 (file)
@@ -224,6 +224,7 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument()
         QString anEntry = anIO->getEntry();
 
         _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toUtf8().constData()));
+        if ( ! GeometryGUI::IsInGeomComponent( aSObj )) continue;
         GEOM::GEOM_Object_var aGeomObj =
           GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
         TopoDS_Shape aShape;