]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
PAL13474: VISU-STUDY: Error or HangUp or Crash. Wrap calls to GUI from VISU engine...
authorjfa <jfa@opencascade.com>
Tue, 26 Sep 2006 09:43:12 +0000 (09:43 +0000)
committerjfa <jfa@opencascade.com>
Tue, 26 Sep 2006 09:43:12 +0000 (09:43 +0000)
src/VISU_I/VISU_Prs3d_i.cc

index 70d0e429985a68baf146ddc17c79fc7a5a38ab0e..461b04f47800ea55dbaa95942c81b3d0584199aa 100644 (file)
@@ -91,18 +91,36 @@ VISU::Prs3d_i
   }
 }
 
+struct TRemoveActorsFromRendererEvent: public SALOME_Event
+{
+  typedef boost::signal0<void> TRemoveActorsFromRendererSignalType;
+  const TRemoveActorsFromRendererSignalType& myRemoveActorsFromRendererSignalVar;
+
+  TRemoveActorsFromRendererEvent
+  (const TRemoveActorsFromRendererSignalType& theRemoveActorsFromRendererSignalVar):
+    myRemoveActorsFromRendererSignalVar(theRemoveActorsFromRendererSignalVar)
+  {}
+
+  virtual
+  void
+  Execute()
+  {
+    myRemoveActorsFromRendererSignalVar();
+  }
+};
+
 VISU::Prs3d_i
-::~Prs3d_i() 
+::~Prs3d_i()
 {
   if(MYDEBUG) MESSAGE("Prs3d_i::~Prs3d_i - this = "<<this);
-  myRemoveActorsFromRendererSignal();
+  ProcessVoidEvent(new TRemoveActorsFromRendererEvent(myRemoveActorsFromRendererSignal));
   myPipeLine->Delete();
   myResult->Destroy();
 }
 
 
 //----------------------------------------------------------------------------
-VISU::Storable* 
+VISU::Storable*
 VISU::Prs3d_i
 ::Restore(const Storable::TRestoringMap& theMap)
 {
@@ -125,7 +143,7 @@ VISU::Prs3d_i
 
 
 //----------------------------------------------------------------------------
-SALOMEDS::SObject_var 
+SALOMEDS::SObject_var
 VISU::Prs3d_i
 ::GetSObject()
 {
@@ -137,25 +155,25 @@ VISU::Prs3d_i
   return mySObject;
 }
 
-Result_i* 
+Result_i*
 VISU::Prs3d_i
-::GetResult() const 
-{ 
+::GetResult() const
+{
   return myResult;
 }
 
-const std::string& 
+const std::string&
 VISU::Prs3d_i
-::GetMeshName() const 
-{ 
-  return myMeshName; 
+::GetMeshName() const
+{
+  return myMeshName;
 }
 
 
 //----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
-::Update() 
+::Update()
 {
   if(MYDEBUG) MESSAGE("Prs3d_i::Update - this = "<<this);
   try{
@@ -169,7 +187,7 @@ VISU::Prs3d_i
 //----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
-::CheckDataSet() 
+::CheckDataSet()
 {
   vtkMapper *aMapper = myPipeLine->GetMapper();
   vtkDataSet *aDataSet = aMapper->GetInput();
@@ -185,7 +203,7 @@ VISU::Prs3d_i
 
 void
 VISU::Prs3d_i
-::RemoveFromStudy() 
+::RemoveFromStudy()
 {
   struct TRemoveFromStudy: public SALOME_Event
   {
@@ -198,7 +216,7 @@ VISU::Prs3d_i
       myRemovable(theRemovable),
       myRemoveFromStudySignal(theRemoveFromStudySignal)
     {}
-    
+
     virtual
     void
     Execute()
@@ -213,21 +231,21 @@ VISU::Prs3d_i
 
 
 //----------------------------------------------------------------------------
-VISU_PipeLine* 
+VISU_PipeLine*
 VISU::Prs3d_i
 ::GetPipeLine()
 {
   return GetPL();
 }
 
-VISU_PipeLine* 
+VISU_PipeLine*
 VISU::Prs3d_i
 ::GetPL()
 {
   return myPipeLine;
 }
 
-vtkUnstructuredGrid* 
+vtkUnstructuredGrid*
 VISU::Prs3d_i::
 GetInput()
 {
@@ -274,7 +292,7 @@ VISU::Prs3d_i
 
 void
 VISU::Prs3d_i
-::RemoveActor(VISU_Actor* theActor) 
+::RemoveActor(VISU_Actor* theActor)
 {
   if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActor - this = "<<this<<"; theActor = "<<theActor);
   myActorCollection->RemoveItem(theActor);
@@ -285,13 +303,13 @@ VISU::Prs3d_i
 ::RemoveActors()
 {
   if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActors - this = "<<this);
-  myRemoveActorsFromRendererSignal();
+  ProcessVoidEvent(new TRemoveActorsFromRendererEvent(myRemoveActorsFromRendererSignal));
   myActorCollection->RemoveAllItems();
 }
 
 void
 VISU::Prs3d_i
-::UpdateActor(VISU_Actor* theActor) 
+::UpdateActor(VISU_Actor* theActor)
 {
   if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<<this<<"; theActor = "<<theActor);
   theActor->ShallowCopyPL(myPipeLine);
@@ -303,10 +321,27 @@ void
 VISU::Prs3d_i
 ::UpdateActors()
 {
+  struct TUpdateActorsEvent: public SALOME_Event
+  {
+    typedef boost::signal0<void> TUpdateActorsSignalType;
+    const TUpdateActorsSignalType& myUpdateActorsSignalVar;
+
+    TUpdateActorsEvent(const TUpdateActorsSignalType& theUpdateActorsSignalVar):
+      myUpdateActorsSignalVar(theUpdateActorsSignalVar)
+    {}
+
+    virtual
+    void
+    Execute()
+    {
+      myUpdateActorsSignalVar();
+    }
+  };
+
   if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActors - this = "<<this);
   Update();
   CheckDataSet();
-  myUpdateActorsSignal();
+  ProcessVoidEvent(new TUpdateActorsEvent(myUpdateActorsSignal));
 }
 
 
@@ -333,7 +368,7 @@ VISU::Prs3d_i
   return myPipeLine->GetNumberOfClippingPlanes();
 }
 
-vtkPlane* 
+vtkPlane*
 VISU::Prs3d_i::
 GetClippingPlane(vtkIdType theID) const
 {
@@ -342,9 +377,9 @@ GetClippingPlane(vtkIdType theID) const
 
 void
 VISU::Prs3d_i
-::SetPlaneParam (vtkFloatingPointType theDir[3], 
-                vtkFloatingPointType theDist, 
-                vtkPlane* thePlane) 
+::SetPlaneParam (vtkFloatingPointType theDir[3],
+                vtkFloatingPointType theDist,
+                vtkPlane* thePlane)
 {
   myPipeLine->SetPlaneParam(theDir, theDist, thePlane);
 }
@@ -358,7 +393,7 @@ VISU::Prs3d_i
   myPipeLine->GetMapper()->GetBounds(aBounds);
 }
 
-void 
+void
 VISU::Prs3d_i
 ::SetOffset(const CORBA::Float* theOffsets)
 {
@@ -369,8 +404,8 @@ VISU::Prs3d_i
 
 void
 VISU::Prs3d_i
-::SetOffset(CORBA::Float theDx, 
-           CORBA::Float theDy, 
+::SetOffset(CORBA::Float theDx,
+           CORBA::Float theDy,
            CORBA::Float theDz)
 {
   myOffset[0] = theDx;
@@ -387,10 +422,10 @@ VISU::Prs3d_i
   theOffsets[2] = myOffset[2];
 }
 
-void 
+void
 VISU::Prs3d_i
-::GetOffset(CORBA::Float& theDx, 
-           CORBA::Float& theDy, 
+::GetOffset(CORBA::Float& theDx,
+           CORBA::Float& theDy,
            CORBA::Float& theDz)
 {
   theDx = myOffset[0];
@@ -400,7 +435,7 @@ VISU::Prs3d_i
 
 
 //----------------------------------------------------------------------------
-VISU::Result_i* 
+VISU::Result_i*
 VISU::GetResult(SALOMEDS::SObject_ptr theSObject)
 {
   VISU::Result_var aResult = FindResult(theSObject);