Salome HOME
0022377: EDF 2752 GEOM: Add a preference in order to automatically unpublished parent...
[modules/geom.git] / src / GEOMBase / GEOMBase_Helper.cxx
index d94eed0cd67815dd08f50f16aa1ec71025fa2f4c..1e795376c1d81c110281701254f967b8be914357 100755 (executable)
@@ -860,6 +860,7 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction, b
         showError();
       }
       else {
+        QList<GEOM::GeomObjPtr> anObjectList = getSourceObjects( );
         addSubshapesToStudy(); // add Sub-shapes if local selection
         const int nbObjs = objects.size();
         QStringList anEntryList;
@@ -921,6 +922,8 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction, b
             }
             anApp->putInfo( QObject::tr("GEOM_PRP_DONE") );
           }
+          if ( anObjectList.count() > 0 )
+            hideSourceObjects( anObjectList );
           result = true;
         }
         else
@@ -1186,6 +1189,17 @@ void GEOMBase_Helper::addSubshapesToStudy()
   //Impemented in Dialogs, called from Accept method
 }
 
+//================================================================
+// Function : getSourceObjects
+// Purpose  : Virtual method to get source objects
+//================================================================
+QList<GEOM::GeomObjPtr> GEOMBase_Helper::getSourceObjects()
+{
+  //Impemented in Dialogs, called from Accept method
+  QList<GEOM::GeomObjPtr> res;
+  return res;
+}
+
 //================================================================
 // Function : getSelected
 // Purpose  : Get selected object by specified type
@@ -1356,6 +1370,19 @@ QList<GEOM::GeomObjPtr> GEOMBase_Helper::getSelected( const QList<TopAbs_ShapeEn
   }
   return result;
 }
+//================================================================
+// Function : hideSourceObject
+// Purpose  :
+//================================================================
+void GEOMBase_Helper::hideSourceObjects( QList<GEOM::GeomObjPtr> theObject )
+{
+  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+  if ( resMgr->booleanValue( "Geometry", "hide_input_object", true) ) {
+    GEOM_Displayer* aDisplayer = getDisplayer();
+    for ( int i = 0; i < theObject.count(); i++ )
+      aDisplayer->Erase( theObject[i].get() );
+  }
+}
 
 //================================================================
 // Function : setIsApplyAndClose