Salome HOME
Merge remote branch 'origin/V7_dev' into V8_0_0_BR
[modules/geom.git] / src / GEOMBase / GEOMBase_Helper.cxx
index 326b9fb28be2e91a17df61b8786e072154b08138..4693656172db363162607113f95ff084a37392a2 100755 (executable)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -46,6 +46,7 @@
 #include <LightApp_DataOwner.h>
 #include <SalomeApp_Tools.h>
 #include <SALOME_ListIO.hxx>
+#include "utilities.h"
 
 #include <SALOME_Prs.h>
 #include "utilities.h"
@@ -527,6 +528,28 @@ void GEOMBase_Helper::localSelection( GEOM::GEOM_Object_ptr obj, const int mode
   localSelection( obj, modes );
 }
 
+//================================================================
+// Function : localSelection
+// Purpose  : Activate selection of sub-shapes in accordance with mode
+//            modes are from TopAbs_ShapeEnum
+//================================================================
+void GEOMBase_Helper::localSelection( const std::list<int> modes )
+{
+  localSelection( GEOM::GEOM_Object::_nil(), modes );
+}
+
+//================================================================
+// Function : localSelection
+// Purpose  : Activate selection of sub-shapes in accordance with mode
+//            mode is from TopAbs_ShapeEnum
+//================================================================
+void GEOMBase_Helper::localSelection( const int mode )
+{
+  std::list<int> modes;
+  modes.push_back( mode );
+  localSelection( modes );
+}
+
 //================================================================
 // Function : globalSelection
 // Purpose  : Activate selection of sub-shapes. Set selection filters
@@ -859,6 +882,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;
@@ -920,6 +944,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
@@ -1185,6 +1211,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
@@ -1355,6 +1392,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