Salome HOME
Restore change of mesh icon depending on its status
authoreap <eap@opencascade.com>
Tue, 10 Jul 2018 14:41:10 +0000 (17:41 +0300)
committereap <eap@opencascade.com>
Tue, 10 Jul 2018 14:41:10 +0000 (17:41 +0300)
    now icons are updated on the engine side

+ Remove deprecated smesh.py

20 files changed:
src/SMESH/SMESH_Mesh.cxx
src/SMESH/SMESH_Mesh.hxx
src/SMESH/SMESH_subMesh.hxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_ComputeDlg.cxx
src/SMESHGUI/SMESHGUI_Hypotheses.cxx
src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx
src/SMESHGUI/SMESHGUI_MeshOrderOp.cxx
src/SMESHGUI/SMESHGUI_Utils.cxx
src/SMESHGUI/SMESHGUI_Utils.h
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Gen_i.hxx
src/SMESH_I/SMESH_Gen_i_1.cxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx
src/SMESH_I/SMESH_PythonDump.cxx
src/SMESH_SWIG/CMakeLists.txt
src/SMESH_SWIG/smesh.py [deleted file]
src/SMESH_SWIG/smeshBuilder.py
src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx

index b9b510451fd360af423f2185336421aa3c2ba9bb..afefed35a9f660365e0443e00de9c2d45c66bbbe 100644 (file)
@@ -1336,6 +1336,41 @@ bool SMESH_Mesh::HasModificationsToDiscard() const
   return false;
 }
 
+//=============================================================================
+/*!
+ * \brief Return true if all sub-meshes are computed OK - to update an icon
+ */
+//=============================================================================
+
+bool SMESH_Mesh::IsComputedOK()
+{
+  if ( NbNodes() == 0 )
+    return false;
+
+  if ( !HasShapeToMesh() )
+    return true;
+
+  if ( SMESH_subMesh* mainSM = GetSubMeshContaining( 1 ))
+  {
+    SMESH_subMeshIteratorPtr smIt = mainSM->getDependsOnIterator(/*includeSelf=*/true);
+    while ( smIt->more() )
+    {
+      const SMESH_subMesh* sm = smIt->next();
+      if ( !sm->IsAlwaysComputed() )
+        switch ( sm->GetComputeState() )
+        {
+        case SMESH_subMesh::NOT_READY:
+        case SMESH_subMesh::COMPUTE_OK:
+          continue; // ok
+        case SMESH_subMesh::FAILED_TO_COMPUTE:
+        case SMESH_subMesh::READY_TO_COMPUTE:
+          return false;
+        }
+    }
+  }
+  return true;
+}
+
 //================================================================================
 /*!
  * \brief Check if any groups of the same type have equal names
index 78681c396fd8679bf750f210d5fd36b0ec893e81..57c26d63a6f5485c9b8005447491887bc4055c6a 100644 (file)
@@ -235,6 +235,11 @@ class SMESH_EXPORT SMESH_Mesh
    */
   bool HasModificationsToDiscard() const;
 
+  /*!
+   * \brief Return true if all sub-meshes are computed OK - to update an icon
+   */
+  bool IsComputedOK();
+
   /*!
    * \brief Return data map of descendant to ancestor shapes
    */
index 3d26972411c1d608281f2d65ebcbad36789f47e5..9db6348cdf056c034efe4d9447c8473b2184a741 100644 (file)
@@ -261,7 +261,7 @@ public:
    *        none mesh entity is bound to it
    */
   void SetIsAlwaysComputed(bool isAlCo);
-  bool IsAlwaysComputed() { return _alwaysComputed; }
+  bool IsAlwaysComputed() const { return _alwaysComputed; }
 
   bool SubMeshesComputed(bool * isFailedToCompute=0) const;
 
index 2956e818f2233298276e8288beb9efe0b38022be..82aaf6581b499911a53051168011a0d8a97a52c6 100644 (file)
@@ -1942,10 +1942,6 @@ void SMESHGUI::OnEditDelete()
     else if ( !aSubMesh->_is_nil() ) {                   // DELETE SUBMESH
       SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
       aMesh->RemoveSubMesh( aSubMesh );
-
-      _PTR(SObject) aMeshSO = SMESH::FindSObject(aMesh);
-      if (aMeshSO)
-        SMESH::ModifiedMesh(aMeshSO, false, aMesh->NbNodes()==0);
     }
     else {
       Handle(SALOME_InteractiveObject) IObject = new SALOME_InteractiveObject
@@ -3331,7 +3327,6 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
         if ( aMesh->NbNodes() == 0 ) // imported mesh is not empty
           SMESH::RemoveVisualObjectWithActors(IOS->getEntry(), true);
         _PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh);
-        SMESH::ModifiedMesh( aMeshSObj, false, true);
         // hide groups and submeshes
         _PTR(ChildIterator) anIter =
           SMESH::getStudy()->NewChildIterator( aMeshSObj );
index e4b23363e053429e8052ec490e72aca4cd42a12d..3770920835dc6e97c9b3790b420f76cdaff8eef3 100644 (file)
@@ -925,10 +925,6 @@ void SMESHGUI_BaseComputeOp::computeMesh()
 
     // NPAL16631: if ( !memoryLack )
     {
-      _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID(myIObject->getEntry());
-      SMESH::ModifiedMesh( sobj,
-                           !computeFailed && aHypErrors.isEmpty(),
-                           myMesh->NbNodes() == 0);
       update( UF_ObjBrowser | UF_Model );
 
       // SHOW MESH
index b00ac68d7f51508f4d0718035857194e5fa91185..257cb657c30fcdea74830fa724786f274f826c64 100644 (file)
@@ -317,7 +317,6 @@ void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
         if( !aSubMesh->_is_nil() )
           aMesh = aSubMesh->GetFather();
         _PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
-        SMESH::ModifiedMesh( meshSO, false, aMesh->NbNodes()==0);
         SMESH_Actor* actor = SMESH::FindActorByEntry( meshSO->GetID().c_str() );
         if( actor && actor->GetVisibility() )
           actor->Update();
index 2ca363488847649e42c35757030ac7491573d710..3ddfb47dc80d34508d1b253f2ffaef4ea71e4512 100644 (file)
@@ -631,12 +631,6 @@ namespace SMESH
       try {
         CORBA::String_var error;
         res = aMesh->AddHypothesis(aShapeObject, aHyp, error.out());
-        if (res < SMESH::HYP_UNKNOWN_FATAL) {
-          _PTR(SObject) aSH = SMESH::FindSObject(aHyp);
-          if (SM && aSH) {
-            SMESH::ModifiedMesh(SM, false, aMesh->NbNodes()==0);
-          }
-        }
         if (res > SMESH::HYP_OK) {
           wc.suspend();
           processHypothesisStatus(res, aHyp, true, error.in() );
@@ -668,11 +662,6 @@ namespace SMESH
         {
           CORBA::String_var error;
           res = aMesh->AddHypothesis( aShapeObject, aHyp, error.out() );
-          if (res < SMESH::HYP_UNKNOWN_FATAL)  {
-            _PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
-            if (meshSO)
-              SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0);
-          }
           if (res > SMESH::HYP_OK) {
             wc.suspend();
             processHypothesisStatus( res, aHyp, true, error.in() );
@@ -763,9 +752,6 @@ namespace SMESH
           }
           if ( _PTR(SObject) meshSO = SMESH::FindSObject(aMesh) )
           {
-            if ( res < SMESH::HYP_UNKNOWN_FATAL )
-              SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0);
-
             if ( SMESH_Actor* actor = SMESH::FindActorByEntry( meshSO->GetID().c_str() ))
               if( actor->GetVisibility() )
                 actor->Update();
index 1f7c71067b9ac6fd0a03ca3072a5d144523d3a52..dc2e34e9868bd6396b1cd3774dfe3c4074363ca6 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 
 // SALOME GUI includes
@@ -139,7 +140,10 @@ bool SMESHGUI_MeshOrderOp::onApply()
   bool res = myMgr ? myMgr->SetMeshOrder() : false;
 
   if( res )
+  {
     SMESHGUI::Modified();
+    SMESH::UpdateView();
+  }
 
   delete myMgr;
   myMgr = 0;
@@ -300,11 +304,6 @@ bool SMESHGUI_MeshOrderMgr::SetMeshOrder( const  ListListId& theListListIds )
     }
   }
 
-  // is it enough to set modified attribute on root mesh objects only?
-  //  it is seems that modifcation flag will be set on child submeshes 
-  //  automatically  (see SMESH::ModifiedMesh for details)
-  SMESH::ModifiedMesh( aMeshSObj, false, false );
-
   SMESH::submesh_array_array_var meshOrder = new SMESH::submesh_array_array();
   meshOrder->length(theListListIds.count() );
   ListListId::const_iterator it = theListListIds.constBegin();
index e6fdb1c157d7aa469158bd37b1e59ea8dd56259c..70e4686c6c469d9dd271cfe0c9bc07117c7c9a9d 100644 (file)
@@ -257,83 +257,6 @@ namespace SMESH
     return theSObject->GetFather();
   }
 
-  void ModifiedMesh (_PTR(SObject) theSObject, bool theIsNotModif, bool isEmptyMesh)
-  {
-    _PTR(Study) aStudy = getStudy();
-    if ( !aStudy || aStudy->GetProperties()->IsLocked())
-      return;
-
-    _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
-    _PTR(GenericAttribute) anAttr =
-      aBuilder->FindOrCreateAttribute(theSObject,"AttributePixMap");
-    _PTR(AttributePixMap) aPixmap = anAttr;
-
-    std::string pmName;
-    if (theIsNotModif)
-      pmName = "ICON_SMESH_TREE_MESH";
-    else if ( isEmptyMesh )
-      pmName = "ICON_SMESH_TREE_MESH_WARN";
-    else
-      pmName = "ICON_SMESH_TREE_MESH_PARTIAL";
-    aPixmap->SetPixMap( pmName );
-
-    _PTR(ChildIterator) anIter = aStudy->NewChildIterator(theSObject);
-    for ( ; anIter->More(); anIter->Next() ) {
-      _PTR(SObject) aSObj = anIter->Value();
-      if ( aSObj->Tag() >= SMESH::Tag_FirstSubMesh )
-      {
-        _PTR(ChildIterator) anIter1 = aStudy->NewChildIterator(aSObj);
-        for ( ; anIter1->More(); anIter1->Next())
-        {
-          _PTR(SObject) aSObj1 = anIter1->Value();
-          _PTR(SObject) aSObjectRef;
-          if (aSObj1->ReferencedObject(aSObjectRef))
-            continue; // reference to an object
-
-          anAttr = aBuilder->FindOrCreateAttribute(aSObj1, "AttributePixMap");
-          aPixmap = anAttr;
-
-          std::string entry = aSObj1->GetID();
-          int objType = SMESHGUI_Selection::type( entry.c_str() );
-          if ( objType == SMESH::HYPOTHESIS || objType == SMESH::ALGORITHM )
-            continue;
-
-          SMESH::SMESH_IDSource_var idSrc = SObjectToInterface<SMESH::SMESH_IDSource>( aSObj1 );
-          if ( !idSrc->_is_nil() )
-          {
-            SMESH::SMESH_GroupOnFilter_var gof =
-              SObjectToInterface<SMESH::SMESH_GroupOnFilter>( aSObj1 );
-            const bool isGroupOnFilter = !gof->_is_nil();
-
-            bool isEmpty = false;
-            if ( !isGroupOnFilter ) // GetTypes() can be very long on GroupOnFilter!
-            {
-              SMESH::array_of_ElementType_var elemTypes = idSrc->GetTypes();
-              isEmpty = ( elemTypes->length() == 0 );
-            }
-            if ( isEmpty )
-              aPixmap->SetPixMap("ICON_SMESH_TREE_MESH_WARN");
-            else if ( objType != GROUP )
-              aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" );
-            else if ( isGroupOnFilter )
-              aPixmap->SetPixMap( "ICON_SMESH_TREE_GROUP_ON_FILTER" );
-            else
-              aPixmap->SetPixMap( "ICON_SMESH_TREE_GROUP" );
-          }
-          else // is it necessary?
-          {
-            if ( !theIsNotModif )
-              aPixmap->SetPixMap( pmName );
-            else if ( objType == GROUP )
-              aPixmap->SetPixMap( "ICON_SMESH_TREE_GROUP" );
-            else
-              aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" );
-          }
-        }
-      }
-    }
-  }
-
   void ShowHelpFile (const QString& theHelpFileName)
   {
     LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
index 4a1a1c600fbf7659f3b90103df606f4782854be7..6ff20e8a2fe2c65c7bade362f1ef5b38285555b7 100644 (file)
@@ -158,9 +158,6 @@ SMESHGUI_EXPORT
 SMESHGUI_EXPORT
   _PTR(SObject) GetMeshOrSubmesh( _PTR(SObject) );
 
-SMESHGUI_EXPORT
-  void ModifiedMesh( _PTR(SObject), bool, bool = false );
-
 SMESHGUI_EXPORT
   void ShowHelpFile( const QString& );
 
index d1d80774140a60474b92ab33940ac33bc5f7c498..3a575aa0a20e5997b409d47dbbb376c5297631e1 100644 (file)
@@ -1947,6 +1947,7 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
       bool ok = myGen.Compute( myLocMesh, myLocShape, how );
       meshServant->CreateGroupServants(); // algos can create groups (issue 0020918)
       myLocMesh.GetMeshDS()->Modified();
+      UpdateIcons( theMesh );
       return ok;
     }
   }
index 1cc0ae4aa44d5172994d06c617c222c5d1064b1a..dc0f27f957426dc32891c7db677c47cfb66125ca 100644 (file)
@@ -58,7 +58,7 @@ class SMESH_Mesh_i;
 class SALOME_LifeCycleCORBA;
 
 // ===========================================================
-// Study context - stores study-connected objects references
+// Study context - store study-connected objects references
 // ==========================================================
 class SMESH_I_EXPORT StudyContext
 {
@@ -67,58 +67,22 @@ class SMESH_I_EXPORT StudyContext
 public:
   // constructor
   StudyContext() {}
-
   // register object in the internal map and return its id
-  int addObject( std::string theIOR )
-  {
-    int nextId = getNextId();
-    mapIdToIOR.Bind( nextId, theIOR );
-    return nextId;
-  }
+  int         addObject( const std::string& theIOR );
   // find the object id in the internal map by the IOR
-  int findId( std::string theIOR )
-  {
-    TInt2StringMap::iterator imap;
-    for ( imap = mapIdToIOR.begin(); imap != mapIdToIOR.end(); ++imap ) {
-      if ( *imap == theIOR )
-        return imap.Iterator().Key();
-    }
-    return 0;
-  }
+  int         findId( const std::string& theIOR );
   // get object's IOR by id
-  std::string getIORbyId( const int theId )
-  {
-    if ( mapIdToIOR.IsBound( theId ) )
-      return mapIdToIOR( theId );
-    return std::string();
-  }
+  std::string getIORbyId( const int theId );
   // get object's IOR by old id
-  std::string getIORbyOldId( const int theOldId )
-  {
-    if ( mapIdToId.IsBound( theOldId ) )
-      return getIORbyId( mapIdToId( theOldId ));
-    return std::string();
-  }
+  std::string getIORbyOldId( const int theOldId );
   // maps old object id to the new one (used when restoring data)
-  void mapOldToNew( const int oldId, const int newId ) {
-    mapIdToId.Bind( oldId, newId );
-  }
+  void        mapOldToNew( const int oldId, const int newId );
   // get old id by a new one
-  int getOldId( const int newId ) {
-    TInt2IntMap::iterator imap;
-    for ( imap = mapIdToId.begin(); imap != mapIdToId.end(); ++imap ) {
-      if ( *imap == newId )
-        return imap.Iterator().Key();
-    }
-    return 0;
-  }
+  int         getOldId( const int newId );
 
 private:
   // get next free object identifier
-  int getNextId()
-  {
-    return mapIdToIOR.Extent() + 1;
-  }
+  int         getNextId() { return mapIdToIOR.Extent() + 1; }
 
   TInt2StringMap mapIdToIOR; // persistent-to-transient map
   TInt2IntMap    mapIdToId;  // to translate object from persistent to transient form
@@ -151,7 +115,7 @@ public:
   // Get the SALOMEDS::SObject corresponding to a CORBA object
   static SALOMEDS::SObject_ptr ObjectToSObject(CORBA::Object_ptr theObject);
   // Get the SALOMEDS::Study from naming service
-  static SALOMEDS::Study_ptr getStudyServant();
+  static SALOMEDS::Study_var getStudyServant();
   // Get GEOM Object corresponding to TopoDS_Shape
   GEOM::GEOM_Object_ptr ShapeToGeomObject (const TopoDS_Shape& theShape );
   // Get TopoDS_Shape corresponding to GEOM_Object
@@ -534,6 +498,7 @@ public:
                                       SMESH::SMESH_GroupBase_ptr theGroup,
                                       GEOM::GEOM_Object_ptr  theShapeObject,
                                       const char*            theName = 0);
+  void UpdateIcons(SMESH::SMESH_Mesh_ptr theMesh);
   bool AddHypothesisToShape(SMESH::SMESH_Mesh_ptr       theMesh,
                             GEOM::GEOM_Object_ptr       theShapeObject,
                             SMESH::SMESH_Hypothesis_ptr theHyp);
index e1499f8a7ccc4e05c2221cb710382efe092d0c7f..dc21b915cd32f6004ffd9ad9220fec1df464efd9 100644 (file)
@@ -208,7 +208,7 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::ObjectToSObject(CORBA::Object_ptr theObject)
 //function : GetStudyPtr
 //purpose  : Get study from naming service
 //=======================================================================
-SALOMEDS::Study_ptr SMESH_Gen_i::getStudyServant()
+SALOMEDS::Study_var SMESH_Gen_i::getStudyServant()
 {
   return SALOMEDS::Study::_duplicate(KERNEL::getStudyServant());
 }
@@ -396,7 +396,7 @@ void SMESH_Gen_i::SetName(SALOMEDS::SObject_ptr theSObject,
 void SMESH_Gen_i::SetPixMap(SALOMEDS::SObject_ptr theSObject,
                             const char*           thePixMap)
 {
-  if ( !theSObject->_is_nil() && thePixMap && strlen( thePixMap ))
+  if ( !theSObject->_is_nil() && thePixMap && thePixMap && thePixMap[0] )
   {
     SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
     SALOMEDS::GenericAttribute_wrap anAttr =
@@ -859,14 +859,87 @@ SALOMEDS::SObject_ptr
   return aHypSO._retn();
 }
 
+//=======================================================================
+//function : UpdateIcons
+//purpose  : update icons of a mesh and its children upon mesh modification
+//=======================================================================
+
+void SMESH_Gen_i::UpdateIcons( SMESH::SMESH_Mesh_ptr theMesh )
+{
+  SMESH_Mesh_i* mesh_i = SMESH::DownCast< SMESH_Mesh_i* >( theMesh );
+  if ( ! mesh_i )
+    return;
+
+  SALOMEDS::SObject_wrap so = ObjectToSObject( theMesh );
+  if ( so->_is_nil() )
+    return;
+
+  // set icon of the mesh
+  if ( mesh_i->NbNodes() == 0 )
+    SetPixMap( so, "ICON_SMESH_TREE_MESH_WARN" );
+  else if ( mesh_i->IsComputedOK() )
+    SetPixMap( so, "ICON_SMESH_TREE_MESH" );
+  else
+    SetPixMap( so, "ICON_SMESH_TREE_MESH_PARTIAL" );
+
+  // set icons of sub-objects
+  SALOMEDS::Study_var         study = getStudyServant();
+  SALOMEDS::ChildIterator_wrap iter = study->NewChildIterator( so );
+  for ( ; iter->More(); iter->Next() )
+  {
+    so = iter->Value(); // 1st level child - root of algos, hyps, sub-meshes or groups
+    if ( so->Tag() < SMESH::Tag_FirstSubMesh )
+      continue;
+
+    SALOMEDS::ChildIterator_wrap subIter = study->NewChildIterator( so );
+    for ( ; subIter->More(); subIter->Next() )
+    {
+      so = subIter->Value(); // 2nd level child - a sub-mesh or group
+
+      CORBA::Object_var           obj = SObjectToObject( so );
+      SMESH::SMESH_IDSource_var idSrc = SMESH::SMESH_IDSource::_narrow( obj );
+      if ( idSrc->_is_nil() )
+        continue;
+
+      SMESH::SMESH_GroupBase_var     grp = SMESH::SMESH_GroupBase::_narrow( obj );
+      SMESH::SMESH_GroupOnFilter_var gof = SMESH::SMESH_GroupOnFilter::_narrow( obj );
+      const bool         isGroup = !grp->_is_nil();
+      const bool isGroupOnFilter = !gof->_is_nil();
+
+      bool isEmpty = ( mesh_i->NbNodes() == 0 );
+      if ( !isEmpty )
+      {
+        if ( isGroupOnFilter ) // GetTypes() can be very long on GroupOnFilter!
+        {
+          SMESH::long_array_var nbByType = mesh_i->GetNbElementsByType();
+          isEmpty = ( nbByType[ grp->GetType() ] == 0 );
+        }
+        else
+        {
+          SMESH::array_of_ElementType_var elemTypes = idSrc->GetTypes();
+          isEmpty = ( elemTypes->length() == 0 );
+        }
+      }
+      if ( isEmpty )
+        SetPixMap( so, "ICON_SMESH_TREE_MESH_WARN");
+      else if ( !isGroup )
+        SetPixMap( so, "ICON_SMESH_TREE_MESH" );
+      else if ( isGroupOnFilter )
+        SetPixMap( so, "ICON_SMESH_TREE_GROUP_ON_FILTER" );
+      else
+        SetPixMap( so, "ICON_SMESH_TREE_GROUP" );
+    }
+  }
+}
+
 //=======================================================================
 //function : GetMeshOrSubmeshByShape
 //purpose  : 
 //=======================================================================
 
 SALOMEDS::SObject_ptr
-  SMESH_Gen_i::GetMeshOrSubmeshByShape (SMESH::SMESH_Mesh_ptr theMesh,
-                                        GEOM::GEOM_Object_ptr theShape)
+SMESH_Gen_i::GetMeshOrSubmeshByShape (SMESH::SMESH_Mesh_ptr theMesh,
+                                      GEOM::GEOM_Object_ptr theShape)
 {
   if(MYDEBUG) MESSAGE("GetMeshOrSubmeshByShape")
   SALOMEDS::SObject_wrap aMeshOrSubMesh;
@@ -1232,3 +1305,85 @@ char* SMESH_Gen_i::GetParameters(CORBA::Object_ptr theObject)
   }
   return aResult._retn();
 }
+
+
+
+// ==============
+// Study context
+// ==============
+
+//=======================================================================
+//function : addObject
+//purpose  : register object in the internal map and return its id
+//=======================================================================
+
+int StudyContext::addObject( const std::string& theIOR )
+{
+  int nextId = getNextId();
+  mapIdToIOR.Bind( nextId, theIOR );
+  return nextId;
+}
+
+//=======================================================================
+//function : findId
+//purpose  : find the object id in the internal map by the IOR
+//=======================================================================
+
+int StudyContext::findId( const std::string& theIOR )
+{
+  TInt2StringMap::iterator imap;
+  for ( imap = mapIdToIOR.begin(); imap != mapIdToIOR.end(); ++imap ) {
+    if ( *imap == theIOR )
+      return imap.Iterator().Key();
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : getIORbyId
+//purpose  : get object's IOR by id
+//=======================================================================
+
+std::string StudyContext::getIORbyId( const int theId )
+{
+  if ( mapIdToIOR.IsBound( theId ) )
+    return mapIdToIOR( theId );
+  return std::string();
+}
+
+//=======================================================================
+//function : getIORbyOldId
+//purpose  : get object's IOR by old id
+//=======================================================================
+
+std::string StudyContext::getIORbyOldId( const int theOldId )
+{
+  if ( mapIdToId.IsBound( theOldId ) )
+    return getIORbyId( mapIdToId( theOldId ));
+  return std::string();
+}
+
+//=======================================================================
+//function : mapOldToNew
+//purpose  : maps old object id to the new one (used when restoring data)
+//=======================================================================
+
+void StudyContext::mapOldToNew( const int oldId, const int newId )
+{
+  mapIdToId.Bind( oldId, newId );
+}
+
+//=======================================================================
+//function : getOldId
+//purpose  : get old id by a new one
+//=======================================================================
+
+int StudyContext::getOldId( const int newId )
+{
+  TInt2IntMap::iterator imap;
+  for ( imap = mapIdToId.begin(); imap != mapIdToId.end(); ++imap ) {
+    if ( *imap == newId )
+      return imap.Iterator().Key();
+  }
+  return 0;
+}
index 5110e337b95d197036ca1b839bcb45e9755dbf33..c7c3f54eb8afbf3141ccf486d8393ad359b51c5c 100644 (file)
@@ -299,6 +299,9 @@ void SMESH_Mesh_i::Clear() throw (SALOME::SALOME_Exception)
   }
 
   TPythonDump() <<  SMESH::SMESH_Mesh_var(_this()) << ".Clear()";
+
+  SMESH::SMESH_Mesh_var mesh = _this();
+  _gen_i->UpdateIcons( mesh );
 }
 
 //================================================================================
@@ -594,6 +597,7 @@ SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Object_ptr       aSubShape,
   if ( !SMESH_Hypothesis::IsStatusFatal(status) )
   {
     _gen_i->AddHypothesisToShape( mesh, aSubShape, anHyp );
+    _gen_i->UpdateIcons( mesh );
   }
   if(MYDEBUG) MESSAGE( " AddHypothesis(): status = " << status );
 
@@ -679,6 +683,7 @@ SMESH::Hypothesis_Status SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Object_ptr aS
   if ( !SMESH_Hypothesis::IsStatusFatal(status) )
   {
     _gen_i->RemoveHypothesisFromShape( mesh, aSubShape, anHyp );
+    _gen_i->UpdateIcons( mesh );
   }
   // Update Python script
   if(_impl->HasShapeToMesh())
@@ -2705,6 +2710,9 @@ void SMESH_Mesh_i::onHypothesisModified()
 {
   if ( _preMeshInfo )
     _preMeshInfo->ForgetOrLoad();
+
+  SMESH::SMESH_Mesh_var mesh = _this();
+  _gen_i->UpdateIcons( mesh );
 }
 
 //=============================================================================
@@ -4991,6 +4999,17 @@ void SMESH_Mesh_i::CreateGroupServants()
   }
 }
 
+//=============================================================================
+/*!
+ * \brief Return true if all sub-meshes are computed OK - to update an icon
+ */
+//=============================================================================
+
+bool SMESH_Mesh_i::IsComputedOK()
+{
+  return _impl->IsComputedOK();
+}
+
 //=============================================================================
 /*!
  * \brief Return groups cantained in _mapGroups by their IDs
@@ -5968,6 +5987,9 @@ TListOfListOfInt SMESH_Mesh_i::findConcurrentSubMeshes()
   mesh.SetMeshOrder( subMeshOrder );
   res = true;
   
+  SMESH::SMESH_Mesh_var me = _this();
+  _gen_i->UpdateIcons( me );
+
   return res;
 }
 
index 8cddc28e2e01fba19373a9fb01d5ad4b61354bda..9fdde438ccfa330a8b0a52b0b128c6d7bdad421c 100644 (file)
@@ -396,8 +396,11 @@ public:
                                                      const char* theGroupName)
     throw (SALOME::SALOME_Exception);
 
+  // ===================================================
   // Internal methods not available through CORBA
   // They are called by corresponding interface methods
+  // ===================================================
+
   SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Object_ptr       aSubShape,
                                                     SMESH::SMESH_Hypothesis_ptr anHyp,
                                                     std::string*                anErrorText=0);
@@ -455,6 +458,16 @@ public:
    */
   void CreateGroupServants();
 
+  /*!
+   * \brief Return true if all sub-meshes are computed OK - to update an icon
+   */
+  bool IsComputedOK();
+
+
+  // ====================================
+  // SMESH_Mesh interface (continuation)
+  // ====================================
+
   /*!
    * \brief Return groups cantained in _mapGroups by their IDs
    */
@@ -649,10 +662,11 @@ public:
    * happen if mesh data is not yet fully loaded from the file of study.
    */
   bool IsMeshInfoCorrect();
-   /*!
-    * Returns mesh unstructed grid information.
-    */
-   virtual SALOMEDS::TMPFile* GetVtkUgStream();
+  /*!
+   * Returns mesh unstructed grid information.
+   */
+  virtual SALOMEDS::TMPFile* GetVtkUgStream();
+
 
   std::map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
   std::map<int, ::SMESH_subMesh*> _mapSubMesh;   //NRI
index 0828fc5e4c3f0df88770c7575551f0faae0b9c17..cd2e6ba3aab658c0c610afd23c9ba6587b46c43f 100644 (file)
@@ -349,7 +349,6 @@ namespace SMESH
   {
     if ( CORBA::is_nil( theArg ) )
       return *this << "None";
-    SMESH_Gen_i*          aSMESHGen = SMESH_Gen_i::GetSMESHGen();
     SALOMEDS::SObject_wrap aSObject = SMESH_Gen_i::ObjectToSObject(theArg);
     if(!aSObject->_is_nil())
     {
index b57d2b4df013123244a214cd3778232480c501b2..826decc6010251ba2c1e150de518139851a7b36b 100644 (file)
@@ -21,7 +21,6 @@
 
 # scripts / static
 SET(_bin_SCRIPTS
-  smesh.py
   ex00_all.py
   ex01_cube2build.py
   ex02_cube2primitive.py
diff --git a/src/SMESH_SWIG/smesh.py b/src/SMESH_SWIG/smesh.py
deleted file mode 100644 (file)
index 92a88aa..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-#  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2016  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
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# 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/ or email : webmaster.salome@opencascade.com
-#
-
-#  File   : smesh.py
-#  Author : Francis KLOSS, OCC
-#  Module : SMESH
-#
-"""@package smesh
- \brief Module smesh
-"""
-
-import inspect
-import salome
-from salome import *
-
-import geompy
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-
-# retrieve SMESH engine in try/except block
-# to avoid problems in some cases, e.g. when generating documentation
-try:
-    # get instance of class smeshBuilder
-    engineSmesh = salome.lcc.FindOrLoadComponent( "FactoryServer", "SMESH" )
-    smesh = smeshBuilder.New(True,engineSmesh)
-except:
-    print("exception in smesh.py: instance creation failed")
-    smesh = None
-    pass
-
-# load plugins and add dynamically generated methods to Mesh class,
-# the same for global variables declared by plug-ins
-from salome.smesh.smeshBuilder import *
-from salome.smesh.smeshBuilder import Mesh, algoCreator
-for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ):
-    #
-    #print "pluginName: ", pluginName
-    pluginBuilderName = pluginName + "Builder"
-    try:
-        exec( "from salome.%s.%s import *" % (pluginName, pluginBuilderName))
-    except Exception as e:
-        from salome_utils import verbose
-        if verbose(): print("Exception while loading %s: %s" % ( pluginBuilderName, e ))
-        continue
-    exec( "from salome.%s import %s" % (pluginName, pluginBuilderName))
-    plugin = eval( pluginBuilderName )
-
-    # add methods creating algorithms to Mesh
-    for k in dir( plugin ):
-        if k[0] == '_': continue
-        algo = getattr( plugin, k )
-        if inspect.isclass(algo) and hasattr(algo, "meshMethod"):
-            if not hasattr( Mesh, algo.meshMethod ):
-                setattr( Mesh, algo.meshMethod, algoCreator() )
-                pass
-            getattr( Mesh, algo.meshMethod ).add( algo )
-            pass
-        pass
-    pass
-del pluginName
-
-# export the methods of smeshBuilder
-if smesh:
-    for k in dir( smesh ):
-        if k[0] == '_': continue
-        globals()[k] = getattr( smesh, k )
-    del k
-    pass
-
-print("""
-===============================================================================
-WARNING:
-Usage of smesh.py is deprecated in SALOME V7.2!
-smesh.py will be removed in a future version!
-TODO:
-The following changes in your scripts are required to avoid this message:
-
-replace
--------
-
-import smesh, SMESH
-
-with
-----
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-you also need to modify some lines where smeshBuilder is used instead of smesh
-
-algo=smesh.xxxx  ==> algo=smeshBuilder.xxxx
-
-See also SMESH User's Guide for more details
-
-WARNING:
-The smesh.py module works correctly only in the first created study.
-It does not work in the second, third, etc studies!
-
-===============================================================================
-""")
index 38fba8060ecffc4cd6cf3d0107a21dd8c083def9..8706efa1b39ab8500192c7de92ba09a80b3ff338 100644 (file)
@@ -1823,9 +1823,6 @@ class Mesh(metaclass = MeshMeta):
             pass
         if salome.sg.hasDesktop():
             if not isinstance( refresh, list): # not a call from subMesh.Compute()
-                smeshgui = salome.ImportComponentGUI("SMESH")
-                smeshgui.Init()
-                smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), ok, (self.NbNodes()==0) )
                 if refresh: salome.sg.updateObjBrowser()
 
         return ok
@@ -1971,9 +1968,6 @@ class Mesh(metaclass = MeshMeta):
 
         self.mesh.Clear()
         if ( salome.sg.hasDesktop() ):
-            smeshgui = salome.ImportComponentGUI("SMESH")
-            smeshgui.Init()
-            smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True )
             if refresh: salome.sg.updateObjBrowser()
 
     def ClearSubMesh(self, geomId, refresh=False):
@@ -1987,9 +1981,6 @@ class Mesh(metaclass = MeshMeta):
 
         self.mesh.ClearSubMesh(geomId)
         if salome.sg.hasDesktop():
-            smeshgui = salome.ImportComponentGUI("SMESH")
-            smeshgui.Init()
-            smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True )
             if refresh: salome.sg.updateObjBrowser()
 
     def AutomaticTetrahedralization(self, fineness=0):
@@ -6903,9 +6894,6 @@ class submeshProxy(SMESH._objref_SMESH_subMesh):
         ok = self.mesh.Compute( self.GetSubShape(),refresh=[] )
 
         if salome.sg.hasDesktop():
-            smeshgui = salome.ImportComponentGUI("SMESH")
-            smeshgui.Init()
-            smeshgui.SetMeshIcon( salome.ObjectToID( self ), ok, (self.GetNumberOfElements()==0) )
             if refresh: salome.sg.updateObjBrowser()
             pass
 
index e33be0832b5da788eca00d87adb5f6801fea479f..f44a29d9046baa1ab4d765c8e6da018da6071159 100644 (file)
@@ -144,9 +144,9 @@ namespace
       _PTR(Study) study = SMESH::getStudy();
       if ( study )
       {
-       sobject = study->FindObjectID( uid );
-       if ( !sobject )
-         sobject = study->FindObjectIOR( uid );
+        sobject = study->FindObjectID( uid );
+        if ( !sobject )
+          sobject = study->FindObjectIOR( uid );
       }
     }
     return sobject;
@@ -168,26 +168,26 @@ namespace
     {
       if ( uid )
       {
-       ViewManagerList vms = app->viewManagers();
-       for ( int i = 0; i < vms.count() && !window; i++ )
-       {
-         SUIT_ViewManager* vm = vms[i];
-         QVector<SUIT_ViewWindow*> vws = vm->getViews();
-         for ( int j = 0; j < vws.count() && !window; j++)
-         {
-           SUIT_ViewWindow* vw = vws[0];
-           if ( uid == vw->getId() )
-             window = dynamic_cast<SALOME_View*>( vm->getViewModel() );
-         }
-       }
+        ViewManagerList vms = app->viewManagers();
+        for ( int i = 0; i < vms.count() && !window; i++ )
+        {
+          SUIT_ViewManager* vm = vms[i];
+          QVector<SUIT_ViewWindow*> vws = vm->getViews();
+          for ( int j = 0; j < vws.count() && !window; j++)
+          {
+            SUIT_ViewWindow* vw = vws[0];
+            if ( uid == vw->getId() )
+              window = dynamic_cast<SALOME_View*>( vm->getViewModel() );
+          }
+        }
       }
       else
       {
-       SUIT_ViewManager* vm = app->getViewManager( SVTK_Viewer::Type(), create );
-       if ( vm )
-       { 
-         window = dynamic_cast<SALOME_View*>( vm->getViewModel() );
-       }
+        SUIT_ViewManager* vm = app->getViewManager( SVTK_Viewer::Type(), create );
+        if ( vm )
+        
+          window = dynamic_cast<SALOME_View*>( vm->getViewModel() );
+        }
       }
     }
     return window;
@@ -209,11 +209,11 @@ namespace
       foreach( SUIT_ViewManager* vm, vms )
       {
         if ( vm && vm->getType() == SVTK_Viewer::Type() )
-       {
+        {
           SALOME_View* view = dynamic_cast<SALOME_View*>( vm->getViewModel() );
           if ( view )
-           views << view;
-       }
+            views << view;
+        }
       }
     }
     return views;
@@ -255,44 +255,44 @@ namespace
     if ( actor )
     {
       actor->GetNodeColor( props.nodeColor.r,
-                          props.nodeColor.g,
-                          props.nodeColor.b );
+                           props.nodeColor.g,
+                           props.nodeColor.b );
       props.markerType = actor->GetMarkerType();
       props.markerScale = actor->GetMarkerScale();
       
       actor->GetEdgeColor( props.edgeColor.r,
-                          props.edgeColor.g,
-                          props.edgeColor.b );
+                           props.edgeColor.g,
+                           props.edgeColor.b );
       props.edgeWidth = qMax( (int)actor->GetLineWidth(), 1 );
       
       actor->GetSufaceColor( props.surfaceColor.r,
-                            props.surfaceColor.g,
-                            props.surfaceColor.b,
-                            props.surfaceColor.delta );
+                             props.surfaceColor.g,
+                             props.surfaceColor.b,
+                             props.surfaceColor.delta );
       
       actor->GetVolumeColor( props.volumeColor.r,
-                            props.volumeColor.g,
-                            props.volumeColor.b,
-                            props.volumeColor.delta );
+                             props.volumeColor.g,
+                             props.volumeColor.b,
+                             props.volumeColor.delta );
       
       actor->Get0DColor( props.elem0dColor.r,
-                        props.elem0dColor.g,
-                        props.elem0dColor.b );
+                         props.elem0dColor.g,
+                         props.elem0dColor.b );
       props.elem0dSize = qMax( (int)actor->Get0DSize(), 1 );
       
       actor->GetBallColor( props.ballColor.r,
-                          props.ballColor.g,
-                          props.ballColor.b );
+                           props.ballColor.g,
+                           props.ballColor.b );
       props.ballScale = qMax( actor->GetBallScale(), 1e-2 );
       
       actor->GetOutlineColor( props.outlineColor.r,
-                             props.outlineColor.g,
-                             props.outlineColor.b );
+                              props.outlineColor.g,
+                              props.outlineColor.b );
       props.outlineWidth = qMax( (int)actor->GetOutlineWidth(), 1 );
       
       actor->GetFacesOrientationColor( props.orientationColor.r,
-                                      props.orientationColor.g,
-                                      props.orientationColor.b );
+                                       props.orientationColor.g,
+                                       props.orientationColor.b );
       props.orientationScale = actor->GetFacesOrientationScale();
       props.orientation3d = actor->GetFacesOrientation3DVectors();
       
@@ -316,44 +316,44 @@ namespace
     if ( actor )
     {
       actor->SetNodeColor( props.nodeColor.r,
-                          props.nodeColor.g,
-                          props.nodeColor.b );
+                           props.nodeColor.g,
+                           props.nodeColor.b );
       if ( props.markerType != VTK::MT_USER )
-       actor->SetMarkerStd( props.markerType, props.markerScale );
+        actor->SetMarkerStd( props.markerType, props.markerScale );
       
       actor->SetEdgeColor( props.edgeColor.r,
-                          props.edgeColor.g,
-                          props.edgeColor.b );
+                           props.edgeColor.g,
+                           props.edgeColor.b );
       actor->SetLineWidth( qMax( (double)props.edgeWidth, 1. ) );
       
       actor->SetSufaceColor( props.surfaceColor.r,
-                            props.surfaceColor.g,
-                            props.surfaceColor.b,
-                            props.surfaceColor.delta );
+                             props.surfaceColor.g,
+                             props.surfaceColor.b,
+                             props.surfaceColor.delta );
       
       actor->SetVolumeColor( props.volumeColor.r,
-                            props.volumeColor.g,
-                            props.volumeColor.b,
-                            props.volumeColor.delta );
+                             props.volumeColor.g,
+                             props.volumeColor.b,
+                             props.volumeColor.delta );
       
       actor->Set0DColor( props.elem0dColor.r,
-                        props.elem0dColor.g,
-                        props.elem0dColor.b );
+                         props.elem0dColor.g,
+                         props.elem0dColor.b );
       actor->Set0DSize( qMax( (double)props.elem0dSize, 1. ) );
       
       actor->SetBallColor( props.ballColor.r,
-                          props.ballColor.g,
-                          props.ballColor.b );
+                           props.ballColor.g,
+                           props.ballColor.b );
       actor->SetBallScale( qMax( props.ballScale, 1e-2 ) );
       
       actor->SetOutlineColor( props.outlineColor.r,
-                             props.outlineColor.g,
-                             props.outlineColor.b );
+                              props.outlineColor.g,
+                              props.outlineColor.b );
       actor->SetOutlineWidth( qMax( (double)props.outlineWidth, 1. ) );
       
       actor->SetFacesOrientationColor( props.orientationColor.r,
-                                      props.orientationColor.g,
-                                      props.orientationColor.b );
+                                       props.orientationColor.g,
+                                       props.orientationColor.b );
       actor->SetFacesOrientationScale( props.orientationScale );
       actor->SetFacesOrientation3DVectors( props.orientation3d );
       
@@ -559,7 +559,7 @@ void SMESH_Swig::init()
       SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
 
       if ( !SMESHGUI::GetSMESHGUI() )
-       app->loadModule( "Mesh" );
+        app->loadModule( "Mesh" );
     }
   };
 
@@ -584,13 +584,13 @@ const char* SMESH_Swig::publish(const char* ior, const char* name)
   if ( !CORBA::is_nil( object ) )
     {
       SALOMEDS::SObject_var sobject =
-       SMESHGUI::GetSMESHGen()->PublishInStudy( SALOMEDS::SObject::_nil(),
-                                                object.in(),
-                                                name );
+        SMESHGUI::GetSMESHGen()->PublishInStudy( SALOMEDS::SObject::_nil(),
+                                                 object.in(),
+                                                 name );
       if ( !CORBA::is_nil( sobject ) )
-       {
-         uid = sobject->GetID();
-       }
+        {
+          uid = sobject->GetID();
+        }
       sobject->UnRegister();
     }
 
@@ -634,7 +634,7 @@ void SMESH_Swig::display(const char* uid, int viewUid, bool updateViewer)
     {
       SALOME_View* view = uid2wnd( myViewUid, true ); // create view if it's not present
       if ( view )
-       LightApp_Displayer::FindDisplayer( "Mesh", true )->Display( myUid, myIsUpdate, view );
+        LightApp_Displayer::FindDisplayer( "Mesh", true )->Display( myUid, myIsUpdate, view );
     }
   };
 
@@ -668,15 +668,15 @@ void SMESH_Swig::erase(const char* uid, int viewUid, bool updateViewer)
     {
       if ( myViewUid == -1 )
       {
-       QList<SALOME_View*> views = windows();
-       foreach( SALOME_View* view, views )
-         LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view );
+        QList<SALOME_View*> views = windows();
+        foreach( SALOME_View* view, views )
+          LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view );
       }
       else
       {
-       SALOME_View* view = uid2wnd( myViewUid );
-       if ( view )
-         LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view );
+        SALOME_View* view = uid2wnd( myViewUid );
+        if ( view )
+          LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view );
       }
     }
   };
@@ -703,7 +703,7 @@ void SMESH_Swig::update(const char* uid)
     virtual void Execute()
     {
       Handle(SALOME_InteractiveObject) io = 
-       new SALOME_InteractiveObject( myUid, "SMESH", "" );
+        new SALOME_InteractiveObject( myUid, "SMESH", "" );
       SMESH::Update( io, true );
     }
   };
@@ -775,7 +775,7 @@ public:
       QList<SALOME_View*> views = windows();
       foreach( SALOME_View* view, views )
       {
-       setProperties( view, myUid, myProps );
+        setProperties( view, myUid, myProps );
       }
     }
     else
@@ -867,7 +867,7 @@ public:
     {
       actor->SetPointsLabeled( myNumbering );
       if ( view )
-       view->Repaint();
+        view->Repaint();
     }
   }
 };
@@ -954,7 +954,7 @@ public:
     {
       actor->SetCellsLabeled( myNumbering );
       if ( view )
-       view->Repaint();
+        view->Repaint();
     }
   }
 };
@@ -1040,7 +1040,7 @@ public:
     {
       actor->SetRepresentation( myMode );
       if ( view )
-       view->Repaint();
+        view->Repaint();
     }
   }
 };
@@ -1125,11 +1125,11 @@ public:
     if ( actor )
     {
       if ( myShrink )
-       actor->SetShrink();
+        actor->SetShrink();
       else
-       actor->UnShrink();
+        actor->UnShrink();
       if ( view )
-       view->Repaint();
+        view->Repaint();
     }
   }
 };
@@ -1215,7 +1215,7 @@ public:
     {
       actor->SetOpacity( myOpacity );
       if ( view )
-       view->Repaint();
+        view->Repaint();
     }
   }
 };
@@ -1301,7 +1301,7 @@ public:
     {
       actor->SetFacesOriented( myShown );
       if ( view )
-       view->Repaint();
+        view->Repaint();
     }
   }
 };
@@ -1387,7 +1387,7 @@ public:
     {
       actor->SetEntityMode( myEntities );
       if ( view )
-       view->Repaint();
+        view->Repaint();
     }
   }
 };
@@ -1577,7 +1577,7 @@ void SMESH_Swig::UnSetHypothesis(const char* /*uid*/)
 const char* SMESH_Swig::AddSubMesh(const char* /*meshUid*/,
                                    const char* ior,
                                    int /*shapeType*/,
-                                  const char* name)
+                                   const char* name)
 {
   deprecated("SMESH_Swig::AddSubMesh", "SMESH_Swig::publish");
   return publish( ior, name );
@@ -1597,7 +1597,7 @@ const char* SMESH_Swig::AddSubMeshOnShape(const char* /*meshUid*/,
                                           const char* /*shapeUid*/,
                                           const char* ior,
                                           int /*shapeType*/,
-                                         const char* name)
+                                          const char* name)
 {
   deprecated("SMESH_Swig::AddSubMeshOnShape", "SMESH_Swig::publish");
   return publish( ior, name );
@@ -1887,7 +1887,7 @@ public:
     {
       SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( model->getViewManager()->getActiveView() );
       if ( vw )
-       myResult = (SelectionMode)vw->SelectionMode();
+        myResult = (SelectionMode)vw->SelectionMode();
     }
   }
 };
@@ -1925,25 +1925,25 @@ public:
       SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( model->getViewManager()->getActiveView() );
       if ( vw )
       {
-       SelectionMode previousMode = (SelectionMode)vw->SelectionMode();
-       bool switchPointMode = ( previousMode == Node && mySelectionMode != Node ) ||
-         ( previousMode != Node && mySelectionMode == Node );
-       if ( switchPointMode )
-       {
-         vtkRenderer* renderer = vw->getRenderer();
-         VTK::ActorCollectionCopy actors( renderer->GetActors() );
-         vtkActorCollection* collection = actors.GetActors();
-         collection->InitTraversal();
-         while ( vtkActor* vtkActor = collection->GetNextActor() )
-         {
-           if ( SMESH_Actor* actor = dynamic_cast<SMESH_Actor*>( vtkActor ) )
-           {
-             if ( actor->GetVisibility() )
-               actor->SetPointRepresentation( mySelectionMode == Node );
-           }
-         }
-       }
-       vw->SetSelectionMode( mySelectionMode );
+        SelectionMode previousMode = (SelectionMode)vw->SelectionMode();
+        bool switchPointMode = ( previousMode == Node && mySelectionMode != Node ) ||
+          ( previousMode != Node && mySelectionMode == Node );
+        if ( switchPointMode )
+        {
+          vtkRenderer* renderer = vw->getRenderer();
+          VTK::ActorCollectionCopy actors( renderer->GetActors() );
+          vtkActorCollection* collection = actors.GetActors();
+          collection->InitTraversal();
+          while ( vtkActor* vtkActor = collection->GetNextActor() )
+          {
+            if ( SMESH_Actor* actor = dynamic_cast<SMESH_Actor*>( vtkActor ) )
+            {
+              if ( actor->GetVisibility() )
+                actor->SetPointRepresentation( mySelectionMode == Node );
+            }
+          }
+        }
+        vw->SetSelectionMode( mySelectionMode );
       }
     }
   }