if (CORBA::is_nil(aRemovableObject)) continue;
aRemovableObject->RemoveFromStudy();
-
- // Destroy
- if (theDestroySubObjects) {
- VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aRemovableObject);
- if (CORBA::is_nil(aPrs3d)) continue;
- aPrs3d->Destroy();
- }
}
// asl, fix for PAL10455: Remove references to SObject
for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
_PTR(SObject) aChildSObject = aChildIter->Value();
CORBA::Object_var aChildObj = VISU::ClientSObjectToObject(aChildSObject);
- if (CORBA::is_nil(aChildObj)) continue;
+ if (CORBA::is_nil(aChildObj))
+ continue;
VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(aChildObj);
- if (CORBA::is_nil(aRemovableObject)) continue;
+ if (CORBA::is_nil(aRemovableObject))
+ continue;
aRemovableObject->RemoveFromStudy();
-
- // Destroy
- if (theDestroySubObjects) {
- VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aRemovableObject);
- if (CORBA::is_nil(aPrs3d)) continue;
- aPrs3d->Destroy();
- }
}
// Remove the SObject itself
#include "VISU_Convertor.hxx"
#include "SUIT_ResourceMgr.h"
+#include "SALOME_Event.hxx"
#include <vtkMapper.h>
::~ColoredPrs3d_i()
{}
+//---------------------------------------------------------------
void
VISU::ColoredPrs3d_i
::RemoveFromStudy()
{
- TSuperClass::RemoveFromStudy();
- VISU::RemoveFromStudy(mySObject,false);
+ struct TRemoveFromStudy: public SALOME_Event
+ {
+ VISU::ColoredPrs3d_i* myRemovable;
+ TRemoveFromStudy(VISU::ColoredPrs3d_i* theRemovable):
+ myRemovable(theRemovable)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ myRemovable->TSuperClass::RemoveFromStudy();
+ VISU::RemoveFromStudy(myRemovable->GetSObject(),false);
+ }
+ };
+
+ ProcessVoidEvent(new TRemoveFromStudy(this));
}
+//---------------------------------------------------------------
void
VISU::ColoredPrs3d_i
::SameAs(const Prs3d_i* theOrigin)
void VISU_Gen_i::DeleteResult (Result_ptr theResult)
{
- class TEvent: public SALOME_Event {
- Result_ptr myResult;
- public:
- TEvent(Result_ptr theResult): myResult(theResult) {}
- virtual void Execute()
- {
- if (Result_i* aResult = dynamic_cast<Result_i*>(GetServant(myResult).in())) {
- SALOMEDS::SObject_var aSObject = aResult->GetSObject();
- VISU::RemoveFromStudy(aSObject,
- false, // not only attribute
- true); // destroy sub-objects
-
- //jfa tmp:if (QAD_Desktop* aDesktop = QAD_Application::getDesktop())
- //jfa tmp: if (QAD_Study* aStudy = aDesktop->findStudy(aStudyDocument))
- //jfa tmp: aStudy->updateObjBrowser(); //update Object browser
- }
-
- myResult->Destroy();
- }
- };
-
- if (myStudyDocument->GetProperties()->IsLocked())
- return;
- Mutex mt(myMutex); // jfa ???
-
- ProcessVoidEvent(new TEvent(theResult));
+ theResult->RemoveFromStudy();
}
void VISU_Gen_i::DeletePrs3d (Prs3d_ptr thePrs3d)
{
- class TEvent: public SALOME_Event {
- Prs3d_ptr myPrs3d;
- public:
- TEvent(Prs3d_ptr thePrs3d): myPrs3d(thePrs3d) {}
- virtual void Execute() {
- myPrs3d->RemoveFromStudy();
-
- //update Object browser
- /*jfa tmp:if (QAD_Desktop* aDesktop = QAD_Application::getDesktop()) {
- if (Prs3d_i* aPrs3d = dynamic_cast<Prs3d_i*>(GetServant(myPrs3d).in())) {
- SALOMEDS::SObject_var aSObject = aPrs3d->GetSObject();
- SALOMEDS::Study_var aStudyDocument = aSObject->GetStudy();
- if (QAD_Study* aStudy = aDesktop->findStudy(aStudyDocument))
- aStudy->updateObjBrowser();
- }
- }*/
-
- myPrs3d->Destroy();
- }
- };
-
- if (myStudyDocument->GetProperties()->IsLocked())
- return;
- Mutex mt(myMutex); // jfa ???
-
- ProcessVoidEvent(new TEvent(thePrs3d));
+ thePrs3d->RemoveFromStudy();
}
void VISU_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent){
#include "VISU_MeshPL.hxx"
#include "VISU_Convertor.hxx"
+#include "SALOME_Event.hxx"
+
using namespace VISU;
using namespace std;
}
+//---------------------------------------------------------------
void VISU::Mesh_i::RemoveFromStudy()
{
- VISU::Prs3d_i::RemoveFromStudy();
- VISU::RemoveFromStudy(mySObject);
+ struct TRemoveFromStudy: public SALOME_Event
+ {
+ VISU::Mesh_i* myRemovable;
+ TRemoveFromStudy(VISU::Mesh_i* theRemovable):
+ myRemovable(theRemovable)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ myRemovable->TSuperClass::RemoveFromStudy();
+ VISU::RemoveFromStudy(myRemovable->GetSObject());
+ }
+ };
+
+ ProcessVoidEvent(new TRemoveFromStudy(this));
}
class VISU_MeshPL;
-namespace VISU{
+namespace VISU
+{
class Mesh_i : public virtual POA_VISU::Mesh,
public virtual Prs3d_i
{
static int myNbPresent;
Mesh_i();
Mesh_i(const Mesh_i&);
+
public:
+ typedef Prs3d_i TSuperClass;
+
explicit
Mesh_i(Result_i* theResult);
+
explicit
Mesh_i(Result_i* theResult,
SALOMEDS::SObject_ptr theSObject);
+
virtual void SameAs(const Prs3d_i* theOrigin);
virtual ~Mesh_i();
virtual void RemoveFromStudy();
#include "VISU_Result_i.hh"
#include "VISU_Actor.h"
+#include "SALOME_Event.hxx"
+
#include <vtkActorCollection.h>
#include <vtkMapper.h>
}
}
+
+//----------------------------------------------------------------------------
void
VISU::Prs3d_i
::RemoveFromStudy()
{
- myRemoveActorsFromRendererSignal();
+ struct TRemoveFromStudy: public SALOME_Event
+ {
+ VISU::Prs3d_i* myRemovable;
+ typedef boost::signal0<void> TRemoveFromStudySignal;
+ const TRemoveFromStudySignal& myRemoveFromStudySignal;
+
+ TRemoveFromStudy(VISU::Prs3d_i* theRemovable,
+ const TRemoveFromStudySignal& theRemoveFromStudySignal):
+ myRemovable(theRemovable),
+ myRemoveFromStudySignal(theRemoveFromStudySignal)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ myRemoveFromStudySignal();
+ myRemovable->Destroy();
+ }
+ };
+
+ ProcessVoidEvent(new TRemoveFromStudy(this,myRemoveActorsFromRendererSignal));
}
VISU::Result_i
::RemoveFromStudy()
{
+ struct TRemoveFromStudy: public SALOME_Event
+ {
+ VISU::Result_i* myRemovable;
+ TRemoveFromStudy(VISU::Result_i* theRemovable):
+ myRemovable(theRemovable)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ VISU::RemoveFromStudy(myRemovable->GetSObject(),false);
+ myRemovable->Destroy();
+ }
+ };
+
// Remove the result with all presentations and other possible sub-objects
- VISU::RemoveFromStudy(mySObject,false);
- Destroy();
+ ProcessVoidEvent(new TRemoveFromStudy(this));
}
#include "VISU_Result_i.hh"
#include "VISU_ViewManager_i.hh"
+#include "SALOME_Event.hxx"
#include "SPlot2d_Curve.h"
#include <memory>
return "";
}
+//---------------------------------------------------------------
void VISU::Table_i::RemoveFromStudy()
{
+ struct TRemoveFromStudy: public SALOME_Event
+ {
+ VISU::Table_i* myRemovable;
+ TRemoveFromStudy(VISU::Table_i* theRemovable):
+ myRemovable(theRemovable)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ VISU::RemoveFromStudy(myRemovable->GetSObject(),false);
+ }
+ };
+
// Remove the table with all curves
- VISU::RemoveFromStudy(mySObj,false);
+ ProcessVoidEvent(new TRemoveFromStudy(this));
}
//----------------------------------------------------------------
void VISU::Curve_i::RemoveFromStudy()
{
- VISU::DeleteActors(this);
- VISU::RemoveFromStudy(mySObj,false);
+ struct TRemoveFromStudy: public SALOME_Event
+ {
+ VISU::Curve_i* myRemovable;
+ TRemoveFromStudy(VISU::Curve_i* theRemovable):
+ myRemovable(theRemovable)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ VISU::DeleteActors(myRemovable);
+ VISU::RemoveFromStudy(myRemovable->GetSObject(),false);
+ }
+ };
+
+ ProcessVoidEvent(new TRemoveFromStudy(this));
}
SALOMEDS::SObject_var VISU::Curve_i::GetSObject()
void VISU::Container_i::RemoveFromStudy()
{
- VISU::RemoveFromStudy(mySObj,false);
+ struct TRemoveFromStudy: public SALOME_Event
+ {
+ VISU::Container_i* myRemovable;
+ TRemoveFromStudy(VISU::Container_i* theRemovable):
+ myRemovable(theRemovable)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ VISU::RemoveFromStudy(myRemovable->GetSObject(),false);
+ }
+ };
+
+ ProcessVoidEvent(new TRemoveFromStudy(this));
+}
+
+SALOMEDS::SObject_var VISU::Container_i::GetSObject()
+{
+ return mySObj;
}
//-------------------------------------------------------------
virtual void RemoveFromStudy();
+ virtual SALOMEDS::SObject_var GetSObject();
+
protected:
Storable* Build(int theRestoring);