Salome HOME
PAL16617 (Modification/Transformation operations with copy don't create a new mesh)
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Swig.cxx
index 219b409a747d92af9ce272cd3b03b72149733981..fec084979966469eae52d41301a8133ccc11c300 100644 (file)
 #include "SMESHGUI.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_GEOMGenUtils.h"
+#include "SMESHGUI_Displayer.h"
 
 // SALOME Includes
 #include "SUIT_ResourceMgr.h"
 #include "SUIT_Session.h"
+#include "SUIT_ViewModel.h"
+#include "VTKViewer_ViewModel.h"
 
 #include "SALOME_Event.hxx"
 #include "SALOME_NamingService.hxx"
@@ -49,6 +52,9 @@
 // Open CASCADE Includes
 #include <TopoDS.hxx>
 
+// QT Includes
+#include <qapplication.h>
+
 // IDL Headers
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SMESH_Gen)
@@ -376,6 +382,8 @@ SMESH_Swig::Init(int theStudyID)
       }
 
       mySComponentMesh = SALOMEDS::SComponent::_narrow(aSComponent);
+
+      qApp->processEvents(); // Workaround for bug 12662
     }
   };
 
@@ -579,6 +587,27 @@ SMESH_Swig::AddSubMeshOnShape(const char* theMeshEntry,
 void SMESH_Swig::CreateAndDisplayActor( const char* Mesh_Entry )
 {
   //  SMESH_Actor* Mesh = smeshGUI->ReadScript(aM);
+  class TEvent: public SALOME_Event
+  {
+  private:
+    const char* _entry;
+  public:
+    TEvent(const char* Mesh_Entry) {
+      _entry = Mesh_Entry;
+    }
+    virtual void Execute() {
+      //SMESH::UpdateView(SMESH::eDisplay, _entry);
+      SUIT_Session* aSession = SUIT_Session::session();
+      SUIT_Application* anApplication = aSession->activeApplication();
+      SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
+      SUIT_ViewManager* vman = anApp->getViewManager(VTKViewer_Viewer::Type(),true);
+      SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp);
+      aDisp->Display(_entry,1);
+    }
+  };
+  
+  ProcessVoidEvent(new TEvent(Mesh_Entry));
+  
 }
 
 void
@@ -604,20 +633,23 @@ SMESH_Swig::SetName(const char* theEntry,
 //================================================================================
 
 void SMESH_Swig::SetMeshIcon(const char* theMeshEntry, 
-                            const bool theIsComputed)
+                            const bool theIsComputed,
+                             const bool isEmpty)
 {
   class TEvent: public SALOME_Event
   {
     SALOMEDS::Study_var myStudy;
     std::string myMeshEntry;
-    bool myIsComputed;
+    bool myIsComputed, myIsEmpty;
   public:
     TEvent(const SALOMEDS::Study_var& theStudy,
           const std::string& theMeshEntry,
-          const bool theIsComputed):
+          const bool theIsComputed,
+           const bool isEmpty):
       myStudy(theStudy),
       myMeshEntry(theMeshEntry),
-      myIsComputed(theIsComputed)
+      myIsComputed(theIsComputed),
+      myIsEmpty(isEmpty)
     {}
 
     virtual
@@ -627,11 +659,12 @@ void SMESH_Swig::SetMeshIcon(const char* theMeshEntry,
       SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID(myMeshEntry.c_str());
       if(!aMeshSO->_is_nil())
        if(_PTR(SObject) aMesh = ClientFactory::SObject(aMeshSO))
-         SMESH::ModifiedMesh(aMesh,myIsComputed);
+         SMESH::ModifiedMesh(aMesh,myIsComputed,myIsEmpty);
     }
   };
 
   ProcessVoidEvent(new TEvent(myStudy,
                              theMeshEntry,
-                             theIsComputed));
+                             theIsComputed,
+                              isEmpty));
 }