From ba1c14af05f2e6f7cb9ca2fde1225a7f246e0a1e Mon Sep 17 00:00:00 2001 From: srn Date: Fri, 19 Jan 2007 13:24:59 +0000 Subject: [PATCH] 13246. Wrapped the following methods by SALOME_Event's: VISU_ScalarMap_i SetRange VISU_ColoredPrs3d_i SetNbColors VISU_CutLines_i SetOrientaton, SetOrienation2 VISU_IsoSurfaces_i SetNbSurfaces VISU_CutPlanes_i SetNbPlanes, SetOrienation VISU_Gen_i CreateTable --- src/VISU_I/VISU_ColoredPrs3d_i.cc | 17 ++++++++++- src/VISU_I/VISU_CutLines_i.cc | 47 ++++++++++++++++++++++++++++--- src/VISU_I/VISU_CutPlanes_i.cc | 41 +++++++++++++++++++++++++-- src/VISU_I/VISU_Gen_i.cc | 40 ++++++++++++++++++++------ src/VISU_I/VISU_IsoSurfaces_i.cc | 20 ++++++++++++- src/VISU_I/VISU_ScalarMap_i.cc | 24 ++++++++++++++-- src/VISU_I/VISU_StreamLines_i.cc | 3 +- 7 files changed, 172 insertions(+), 20 deletions(-) diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 08657c70..309473f1 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -199,7 +199,22 @@ void VISU::ColoredPrs3d_i ::SetNbColors(CORBA::Long theNbColors) { - myScalarMapPL->SetNbColors(theNbColors); + struct TEvent: public SALOME_Event { + VISU_ScalarMapPL* myMap; + int myNbColors; + TEvent( VISU_ScalarMapPL* theMap, int theNbColors) + :myMap(theMap), myNbColors(theNbColors) + {} + + virtual + void + Execute() + { + myMap->SetNbColors(myNbColors); + } + }; + + ProcessVoidEvent(new TEvent(myScalarMapPL, theNbColors)); } CORBA::Long diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index d078935e..46132a1d 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -33,6 +33,7 @@ #include "VISU_PipeLineUtils.hxx" #include "SUIT_ResourceMgr.h" +#include "SALOME_Event.hxx" #include @@ -192,14 +193,52 @@ VISU::CutLines_i::~CutLines_i(){ void VISU::CutLines_i::SetOrientation(VISU::CutPlanes::Orientation theOrient, CORBA::Double theXAngle, CORBA::Double theYAngle) { - myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient), - theXAngle,theYAngle); + + struct TEvent: public SALOME_Event { + VISU_CutLinesPL* myCutLinesPL; + CORBA::Double myXAngle, myYAngle; + VISU::CutPlanes::Orientation myOrient; + TEvent( VISU_CutLinesPL* theCutLines, VISU::CutPlanes::Orientation theOrient, + CORBA::Double theXAngle, CORBA::Double theYAngle) + :myCutLinesPL(theCutLines), myOrient(theOrient), myXAngle(theXAngle), myYAngle(theYAngle) + {} + + virtual + void + Execute() + { + myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(myOrient), + myXAngle, myYAngle); + } + }; + + ProcessVoidEvent(new TEvent(myCutLinesPL, theOrient, theXAngle, theYAngle)); + } + void VISU::CutLines_i::SetOrientation2(VISU::CutPlanes::Orientation theOrient, CORBA::Double theXAngle, CORBA::Double theYAngle) { - myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient), - theXAngle,theYAngle,1); + struct TEvent: public SALOME_Event { + VISU_CutLinesPL* myCutLinesPL; + CORBA::Double myXAngle, myYAngle; + VISU::CutPlanes::Orientation myOrient; + TEvent( VISU_CutLinesPL* theCutLines, VISU::CutPlanes::Orientation theOrient, + CORBA::Double theXAngle, CORBA::Double theYAngle) + :myCutLinesPL(theCutLines), myOrient(theOrient), myXAngle(theXAngle), myYAngle(theYAngle) + {} + + virtual + void + Execute() + { + myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(myOrient), + myXAngle, myYAngle, 1); + } + }; + + ProcessVoidEvent(new TEvent(myCutLinesPL, theOrient, theXAngle, theYAngle)); + } VISU::CutPlanes::Orientation VISU::CutLines_i::GetOrientationType() { diff --git a/src/VISU_I/VISU_CutPlanes_i.cc b/src/VISU_I/VISU_CutPlanes_i.cc index 300957a4..a23d15bf 100644 --- a/src/VISU_I/VISU_CutPlanes_i.cc +++ b/src/VISU_I/VISU_CutPlanes_i.cc @@ -30,6 +30,7 @@ #include "VISU_Actor.h" #include "SUIT_ResourceMgr.h" +#include "SALOME_Event.hxx" using namespace VISU; using namespace std; @@ -133,8 +134,25 @@ VISU::CutPlanes_i::~CutPlanes_i(){ void VISU::CutPlanes_i::SetOrientation(VISU::CutPlanes::Orientation theOrient, CORBA::Double theXAngle, CORBA::Double theYAngle) { - myCutPlanesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient), - theXAngle,theYAngle); + struct TEvent: public SALOME_Event { + VISU_CutPlanesPL* myCutPlanes; + CORBA::Double myXAngle, myYAngle; + VISU::CutPlanes::Orientation myOrient; + TEvent( VISU_CutPlanesPL* theCutPlanes, VISU::CutPlanes::Orientation theOrient, + CORBA::Double theXAngle, CORBA::Double theYAngle) + :myCutPlanes(theCutPlanes), myOrient(theOrient), myXAngle(theXAngle), myYAngle(theYAngle) + {} + + virtual + void + Execute() + { + myCutPlanes->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(myOrient), + myXAngle, myYAngle); + } + }; + + ProcessVoidEvent(new TEvent(myCutPlanesPL, theOrient, theXAngle, theYAngle)); } VISU::CutPlanes::Orientation VISU::CutPlanes_i::GetOrientationType() { @@ -173,8 +191,25 @@ CORBA::Boolean VISU::CutPlanes_i::IsDefault(CORBA::Long thePlaneNumber){ void VISU::CutPlanes_i::SetNbPlanes(CORBA::Long theNb) { - myCutPlanesPL->SetNbParts(theNb); + + struct TEvent: public SALOME_Event { + VISU_CutPlanesPL* myCutPlanes; + CORBA::Long myNbPlanes; + TEvent( VISU_CutPlanesPL* theCutPlanes, int theNbPlanes) + :myCutPlanes(theCutPlanes), myNbPlanes(theNbPlanes) + {} + + virtual + void + Execute() + { + myCutPlanes->SetNbParts(myNbPlanes); + } + }; + + ProcessVoidEvent(new TEvent(myCutPlanesPL, theNb)); } + CORBA::Long VISU::CutPlanes_i::GetNbPlanes() { return myCutPlanesPL->GetNbParts(); } diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index 65011443..60a78ad0 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -960,17 +960,41 @@ namespace VISU return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); } - Table_ptr VISU_Gen_i::CreateTable(const char* theTableEntry){ + struct CreateTableEvent: public SALOME_Event + { + SALOMEDS::Study_var myStudyDocument; + const char* myTableEntry; + typedef Table_ptr TResult; + TResult myResult; + + CreateTableEvent(const SALOMEDS::Study_var& theStudy, const char* theTableEntry) + { + myStudyDocument = theStudy; + myTableEntry = theTableEntry; + myResult = Table::_nil(); + } + + virtual + void + Execute() + { + Table_i* pPresent = new Table_i(myStudyDocument,myTableEntry); + if(pPresent->Create() != NULL) + myResult = pPresent->_this(); + else{ + pPresent->_remove_ref(); + myResult = VISU::Table::_nil(); + } + } + }; + + + Table_ptr VISU_Gen_i::CreateTable(const char* theTableEntry) + { if(myStudyDocument->GetProperties()->IsLocked()) return Table::_nil(); Mutex mt(myMutex); - Table_i* pPresent = new Table_i(myStudyDocument,theTableEntry); - if(pPresent->Create() != NULL) - return pPresent->_this(); - else{ - pPresent->_remove_ref(); - return VISU::Table::_nil(); - } + return ProcessEvent(new CreateTableEvent(myStudyDocument, theTableEntry)); } Curve_ptr VISU_Gen_i::CreateCurve(Table_ptr theTable, diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index 03559ba3..0f8b392b 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -30,6 +30,7 @@ #include "VISU_Actor.h" #include "SUIT_ResourceMgr.h" +#include "SALOME_Event.hxx" using namespace VISU; using namespace std; @@ -112,8 +113,25 @@ VISU::IsoSurfaces_i::~IsoSurfaces_i(){ void VISU::IsoSurfaces_i::SetNbSurfaces(CORBA::Long theNb){ - myIsoSurfacesPL->SetNbParts(theNb); + + struct TEvent: public SALOME_Event { + VISU_IsoSurfacesPL* myIsoSurfacesPL; + CORBA::Long myNb; + TEvent( VISU_IsoSurfacesPL* theIsoSurfacesPL, int theNb) + :myIsoSurfacesPL(theIsoSurfacesPL), myNb(theNb) + {} + + virtual + void + Execute() + { + myIsoSurfacesPL->SetNbParts(myNb); + } + }; + + ProcessVoidEvent(new TEvent(myIsoSurfacesPL, theNb)); } + CORBA::Long VISU::IsoSurfaces_i::GetNbSurfaces(){ return myIsoSurfacesPL->GetNbParts(); } diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 5e1f83c6..27e98bc2 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -38,6 +38,8 @@ #include #include +#include "SALOME_Event.hxx" + using namespace VISU; using namespace std; @@ -240,8 +242,26 @@ VISU::ScalarMap_i { if(theMin > theMax) return; - vtkFloatingPointType aScalarRange[2] = {theMin, theMax}; - myScalarMapPL->SetScalarRange(aScalarRange); + + struct TEvent: public SALOME_Event { + VISU_ScalarMapPL* myMap; + vtkFloatingPointType myRange[2]; + TEvent( VISU_ScalarMapPL* theMap, const vtkFloatingPointType& theMin , const vtkFloatingPointType& theMax) + :myMap(theMap) + { + myRange[0] = theMin; + myRange[1] = theMax; + } + + virtual + void + Execute() + { + myMap->SetScalarRange(myRange); + } + }; + + ProcessVoidEvent(new TEvent(myScalarMapPL, theMin, theMax)); myIsFixedRange = true; } diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index ba959d3a..e3b8565b 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -190,7 +190,8 @@ VISU::StreamLines_i::SetParams(CORBA::Double theIntStep, thePercents, theDirection, 1); - if(isAccepted == 1) SetSource(aPrs3di); + if(isAccepted == 1) + SetSource(aPrs3di); return isAccepted == 1; } -- 2.39.2