Salome HOME
NPAL16568: Added Approximation parameter in MakeFilling algorithm.
[modules/geom.git] / src / GEOMGUI / GEOMGUI_Selection.cxx
index 87cc9d6304a8a57aaccb231c4cfa2d245f1dcb92..70cb563b5414aa1a3621dd24dd4972a798cb88a2 100644 (file)
@@ -15,7 +15,7 @@
 // License along with this library; if not, write to the Free Software 
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 #include "GEOMGUI_Selection.h"
 
@@ -23,6 +23,7 @@
 #include "GEOM_Displayer.h"
 
 #include <LightApp_DataOwner.h>
+#include <SalomeApp_Application.h>
 #include <SalomeApp_Study.h>
 
 #include <OCCViewer_ViewModel.h>
@@ -66,7 +67,9 @@ GEOMGUI_Selection::~GEOMGUI_Selection()
 QtxValue GEOMGUI_Selection::globalParam( const QString& p ) const
 {
   if ( p == "isOCC" ) return QtxValue( activeViewType() == OCCViewer_Viewer::Type() );
+  if ( p == "selectionmode" ){ 
+    return QtxValue(selectionMode()); 
+  }
   return LightApp_Selection::globalParam( p );
 }
 
@@ -79,6 +82,8 @@ QtxValue GEOMGUI_Selection::param( const int ind, const QString& p ) const
     return QtxValue( typeName( ind ) );
   else if ( p == "displaymode" )
     return QtxValue( displayMode( ind ) );
+  else if ( p == "isAutoColor" )
+    return QtxValue( isAutoColor( ind ) );
   else
     return LightApp_Selection::param( ind, p );
 }
@@ -109,6 +114,14 @@ bool GEOMGUI_Selection::isVisible( const int index ) const
   return false;
 }
 
+bool GEOMGUI_Selection::isAutoColor( const int index ) const
+{
+  GEOM::GEOM_Object_var obj = getObject( index );
+  if ( !CORBA::is_nil( obj ) )
+    return obj->GetAutoColor();
+  return false;
+}
+
 QString GEOMGUI_Selection::displayMode( const int index ) const
 {
   SALOME_View* view = GEOM_Displayer::GetActiveView();
@@ -201,3 +214,26 @@ GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const
   }
   return GEOM::GEOM_Object::_nil();
 }
+
+QString GEOMGUI_Selection::selectionMode() const
+{
+  SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app) {
+    GeometryGUI* aGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
+    if (aGeomGUI) {
+      switch (aGeomGUI->getLocalSelectionMode())
+      {
+       case GEOM_POINT      : return "VERTEX";
+       case GEOM_EDGE       : return "EDGE";
+       case GEOM_WIRE       : return "WIRE";
+       case GEOM_FACE       : return "FACE";
+       case GEOM_SHELL      : return "SHELL";
+       case GEOM_SOLID      : return "SOLID";
+       case GEOM_COMPOUND   : return "COMPOUND";
+       case GEOM_ALLOBJECTS : return "ALL";
+       default: return "";
+      }
+    }
+  }
+  return "";
+}