Salome HOME
IPAL20696 5x regression of fixed nodes ids selection for smoothing dialog
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Selection.cxx
index 6f6151218a72b546d84e05695da1f2843fbd6ff2..4711f1d10fc8d5f557bc86c98da643bd1b055592 100644 (file)
 //function : SMESHGUI_Selection
 //purpose  : 
 //=======================================================================
-SMESHGUI_Selection::SMESHGUI_Selection( const QString& client, LightApp_SelectionMgr* mgr )
-: LightApp_Selection( client, mgr )
+SMESHGUI_Selection::SMESHGUI_Selection()
+: LightApp_Selection()
 {
+}
+
+//=======================================================================
+//function : ~SMESHGUI_Selection
+//purpose  : 
+//=======================================================================
+SMESHGUI_Selection::~SMESHGUI_Selection()
+{
+}
+
+//=======================================================================
+//function : init
+//purpose  : 
+//=======================================================================
+void SMESHGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr )
+{
+  LightApp_Selection::init( client, mgr );
+
   if( mgr && study() )
   {
     SalomeApp_Study* aSStudy = dynamic_cast<SalomeApp_Study*>(study());
@@ -63,14 +81,6 @@ SMESHGUI_Selection::SMESHGUI_Selection( const QString& client, LightApp_Selectio
   }
 }
 
-//=======================================================================
-//function : ~SMESHGUI_Selection
-//purpose  : 
-//=======================================================================
-SMESHGUI_Selection::~SMESHGUI_Selection()
-{
-}
-
 //=======================================================================
 //function : processOwner
 //purpose  : 
@@ -104,6 +114,8 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
   else if ( p=="displayMode" )   val = QVariant( displayMode( ind ) );
   else if ( p=="isComputable" )  val = QVariant( isComputable( ind ) );
   else if ( p=="hasReference" )  val = QVariant( hasReference( ind ) );
+  else if ( p=="isImported" )    val = QVariant( isImported( ind ) );
+  else if ( p=="facesOrientationMode" ) val = QVariant( facesOrientationMode( ind ) );
 
   if( val.isValid() )
     return val;
@@ -119,7 +131,7 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
 SMESH_Actor* SMESHGUI_Selection::getActor( int ind ) const
 {
   if( ind >= 0 && ind < count() )
-    return myActors.at( ind );
+    return myActors.isEmpty() ? 0 : myActors.at( ind );
   else
     return 0;
 }
@@ -243,6 +255,22 @@ QString SMESHGUI_Selection::controlMode( int ind ) const
   return "eNone";
 }
 
+//=======================================================================
+//function : facesOrientationMode
+//purpose  : 
+//=======================================================================
+
+QString SMESHGUI_Selection::facesOrientationMode( int ind ) const
+{
+  SMESH_Actor* actor = getActor( ind );
+  if ( actor ) {
+    if ( actor->GetFacesOriented() )
+      return "IsOriented";
+    return "IsNotOriented";
+  }
+  return "Unknown";
+}
+
 //=======================================================================
 //function : isAutoColor
 //purpose  : 
@@ -476,3 +504,22 @@ QString SMESHGUI_Selection::typeName( const int t )
     return "Unknown";
   }
 }
+
+bool SMESHGUI_Selection::isImported( const int ind ) const
+{
+  QString e = entry( ind );
+  _PTR(SObject) SO = SMESH::GetActiveStudyDocument()->FindObjectID( e.toLatin1().constData() );
+  bool res = false;
+  /*
+  if( SO )
+  {
+    SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( SO ) );
+    if( !aMesh->_is_nil() )
+    {
+      SALOME_MED::MedFileInfo* inf = aMesh->GetMEDFileInfo();
+      res = strlen( (char*)inf->fileName ) > 0;
+    }
+  }
+  */
+  return res;
+}