// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
// File : VISU_View_i.cc
#include "VISU_Gen_i.hh"
#include "VISU_Prs3d_i.hh"
#include "VISU_Table_i.hh"
+#include "VISU_ScalarMap_i.hh"
#include "VISU_ViewManager_i.hh"
#include "VisuGUI_TableDlg.h"
#include "VISU_Actor.h"
+#include "VISU_ScalarMapAct.h"
#include "SALOME_Event.hxx"
myApplication->setWindowShown(SalomeApp_Application::WT_LogWindow,myState);
break;
case VISU::View::VIEWER:{
- ViewManagerList aViewManagerList = myApplication->viewManagers();
- // to do something
- // ...
+ ViewManagerList mgrs = myApplication->viewManagers();
+ ViewManagerList::const_iterator anIt = mgrs.begin(), aLast = mgrs.end();
+ for( ; anIt!=aLast; anIt++ )
+ {
+ const QPtrVector<SUIT_ViewWindow>& views = (*anIt)->getViews();
+ for( int i=0; i<views.count(); i++ )
+ views[i]->setShown( myState );
+ }
break;
}}
}
break;
case VISU::View::VIEWER:{
ViewManagerList aViewManagerList = myApplication->viewManagers();
- // to do something
- // ...
+ ViewManagerList::const_iterator anIt = aViewManagerList.begin();
+ for( ; anIt != aViewManagerList.end(); anIt++ )
+ {
+ const QPtrVector<SUIT_ViewWindow>& views = (*anIt)->getViews();
+ for( int i=0; i<views.count(); i++ ) {
+ myResult = views[i]->isShown();
+ return;
+ }
+ }
+ myResult = false;
break;
}}
}
return -1;
}
- class TEnableGridEvent: public SALOME_Event
- {
- public:
- typedef void (Plot2d_ViewFrame::* TFun)(bool, const int, bool, const int, bool);
- TEnableGridEvent (Plot2d_ViewFrame* theView, TFun theFun,
- CORBA::Boolean theMajor, CORBA::Long theNumMajor,
- CORBA::Boolean theMinor, CORBA::Long theNumMinor):
- myView(theView), myFun(theFun),
- myMajor(theMajor), myNumMajor(theNumMajor),
- myMinor(theMinor), myNumMinor(theNumMinor)
- {}
-
- virtual void Execute()
- {
- (myView->*myFun)(myMajor,myNumMajor,myMinor,myNumMinor,true);
- }
- protected:
- Plot2d_ViewFrame* myView;
- TFun myFun;
- CORBA::Boolean myMajor, myMinor;
- CORBA::Long myNumMajor, myNumMinor;
- };
-
void XYPlot_i::EnableXGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
CORBA::Boolean theMinor, CORBA::Long theNumMinor)
{
- if (GetViewWindow())
- ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setXGrid,
- theMajor,theNumMajor,theMinor,theNumMinor));
+ class TEvent: public SALOME_Event
+ {
+ public:
+ TEvent (Plot2d_ViewFrame* theView,
+ CORBA::Boolean theMajor,
+ CORBA::Long theNumMajor,
+ CORBA::Boolean theMinor,
+ CORBA::Long theNumMinor):
+ myView(theView),
+ myMajor(theMajor),
+ myNumMajor(theNumMajor),
+ myMinor(theMinor),
+ myNumMinor(theNumMinor)
+ {}
+
+ virtual void Execute()
+ {
+ myView->setXGrid( myMajor, myNumMajor, myMinor, myNumMinor );
+ }
+ protected:
+ Plot2d_ViewFrame* myView;
+ CORBA::Boolean myMajor, myMinor;
+ CORBA::Long myNumMajor, myNumMinor;
+ };
+
+ if ( GetViewWindow() )
+ ProcessVoidEvent( new TEvent( myView, theMajor, theNumMajor, theMinor, theNumMinor ) );
}
- void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor,
- CORBA::Boolean theMinor, CORBA::Long theNumMinor)
+ void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor,
+ CORBA::Long theNumMajor,
+ CORBA::Boolean theMinor,
+ CORBA::Long theNumMinor)
{
- //asl: Plot2d_ViewFrame::setYGrid has more parameters
- //if (GetViewWindow())
- // ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setYGrid,
- // theMajor,theNumMajor,theMinor,theNumMinor));
+ this->EnableYGrid( theMajor, theNumMajor, theMinor, theNumMinor, false, 0, false, 0 );
}
+ void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor,
+ CORBA::Long theNumMajor,
+ CORBA::Boolean theMinor,
+ CORBA::Long theNumMinor,
+ CORBA::Boolean the2Major,
+ CORBA::Long the2NumMajor,
+ CORBA::Boolean the2Minor,
+ CORBA::Long the2NumMinor)
+ {
+ class TEvent: public SALOME_Event
+ {
+ public:
+ TEvent (Plot2d_ViewFrame* theView,
+ CORBA::Boolean theMajor,
+ CORBA::Long theNumMajor,
+ CORBA::Boolean theMinor,
+ CORBA::Long theNumMinor,
+ CORBA::Boolean the2Major,
+ CORBA::Long the2NumMajor,
+ CORBA::Boolean the2Minor,
+ CORBA::Long the2NumMinor):
+ myView(theView),
+ myMajor(theMajor),
+ myNumMajor(theNumMajor),
+ myMinor(theMinor),
+ myNumMinor(theNumMinor),
+ my2Major(the2Major),
+ my2NumMajor(the2NumMajor),
+ my2Minor(the2Minor),
+ my2NumMinor(the2NumMinor)
+ {}
+
+ virtual void Execute()
+ {
+ myView->setYGrid( myMajor, myNumMajor, myMinor, myNumMinor,
+ my2Major, my2NumMajor, my2Minor, my2NumMinor);
+ }
+ protected:
+ Plot2d_ViewFrame* myView;
+ CORBA::Boolean myMajor, myMinor, my2Major, my2Minor;
+ CORBA::Long myNumMajor, myNumMinor, my2NumMajor, my2NumMinor;
+ };
+
+ if (GetViewWindow())
+ ProcessVoidEvent( new TEvent( myView, theMajor, theNumMajor, theMinor, theNumMinor,
+ the2Major, the2NumMajor, the2Minor, the2NumMinor ) );
+ }
+
class TSetScaleModeEvent: public SALOME_Event
{
public:
}
}
if (!aCStudy) return;
- _PTR(SObject) TableSO = aCStudy->FindObjectID(aTable->GetEntry().latin1());
+ _PTR(SObject) TableSO = aCStudy->FindObjectID(aTable->GetEntry());
if (TableSO) {
_PTR(ChildIterator) Iter = aCStudy->NewChildIterator(TableSO);
for (; Iter->More(); Iter->Next()) {
}else{
if(SUIT_ViewManager* aViewManager = myApplication->activeViewManager()){
if(SUIT_ViewWindow* aView = aViewManager->getActiveView()){
- if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aView)){
+ if(dynamic_cast<SVTK_ViewWindow*>(aView)){
myView3D->myViewManager = aViewManager;
myResult = aViewManager->getActiveView();
}
{
class TEvent: public SALOME_Event
{
- SUIT_ViewWindow* myVW;
+ SUIT_ViewWindow* myViewWindow;
public:
TEvent(SUIT_ViewWindow* theViewWindow):
- myVW(theViewWindow)
+ myViewWindow(theViewWindow)
{}
virtual void Execute()
{
- SVTK_ViewWindow* vf = dynamic_cast<SVTK_ViewWindow*>(myVW);
- vtkRenderer* Renderer = vf->getRenderer();
- vtkActorCollection* theActors = Renderer->GetActors();
- theActors->InitTraversal();
- while (vtkActor *anAct = theActors->GetNextActor()) {
+ SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(myViewWindow);
+ vtkRenderer* aRenderer = aViewWindow->getRenderer();
+ vtkActorCollection* anActors = aRenderer->GetActors();
+ anActors->InitTraversal();
+ while (vtkActor *anAct = anActors->GetNextActor()) {
if (VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)) {
- VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d();
- if (anActor->GetVisibility() && aPrs3d) {
- aPrs3d->Update();
- aPrs3d->UpdateActor(anActor);
- }
+ if (anActor->GetVisibility())
+ anActor->UpdateFromFactory();
}
}
- RepaintView(myVW);
+ RepaintView(myViewWindow);
}
};
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TEvent(aVW));
+ if (SUIT_ViewWindow* aViewWindow = GetViewWindow())
+ ProcessVoidEvent(new TEvent(aViewWindow));
}
- bool View3D_i::SaveViewParams (SUIT_ViewManager* theViewManager, const char* theName)
+ bool View3D_i::SaveViewParams (SUIT_ViewManager* theViewManager, const std::string& theName)
{
MESSAGE("View3D_i::SaveViewParams()");
- if (!theViewManager || !theName)
+ if (!theViewManager || theName == "")
return false;
_PTR(Study) aCStudy;
if (!aCStudy)
return false;
- if (strcmp(theName, "") != 0) {
- std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName, "VISU");
+ if (theName != "") {
+ std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName.c_str(), "VISU");
_PTR(GenericAttribute) anAttr;
int iEnd = aList.size();
for (int i = 0; i < iEnd; i++) {
_PTR(SObject) anObj = aList[i];
string anEntry = anObj->GetID();
if(MYDEBUG) MESSAGE("View3D_i::SaveViewParams - anEntry = " << anEntry);
- if (anObj->FindAttribute(anAttr, "AttributeComment")) {
- _PTR(AttributeComment) aCmnt (anAttr);
+ if (anObj->FindAttribute(anAttr, "AttributeString")) {
+ _PTR(AttributeString) aCmnt (anAttr);
string aComm (aCmnt->Value());
if (MYDEBUG) MESSAGE("View3D_i::SaveViewPoint - aComm = " << aComm);
if (aComm.compare(View3D_i::myComment) >= 0) {
}
_PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy);
string aSComponentEntry = aSComponent->GetID();
- string anEntry = CreateAttributes(aCStudy, aSComponentEntry.c_str(), "", "", theName, "",
+ string anEntry = CreateAttributes(aCStudy,
+ aSComponentEntry.c_str(),
+ "",
+ "",
+ theName,
+ "",
ToString(theViewManager->getActiveView()).c_str());
return true;
}
class TSaveViewParamsEvent: public SALOME_Event
{
SUIT_ViewManager* myViewMgr;
- const char* myName;
+ std::string myName;
public:
TSaveViewParamsEvent (SUIT_ViewManager* theViewManager,
- const char* theName):
+ const std::string& theName):
myViewMgr(theViewManager),
myName(theName)
{}
TResult myResult;
};
- CORBA::Boolean View3D_i::SaveViewParams (const char* theName)
+ CORBA::Boolean View3D_i::SaveViewParams (const char* theViewParamsName)
{
- return ProcessEvent(new TSaveViewParamsEvent (myViewManager, theName));
+ return ProcessEvent(new TSaveViewParamsEvent (myViewManager, theViewParamsName));
}
- bool View3D_i::RestoreViewParams (SUIT_ViewManager* theViewManager, const char* theName)
+ bool View3D_i::RestoreViewParams (SUIT_ViewManager* theViewManager, const std::string& theName)
{
_PTR(Study) aCStudy;
if (SUIT_Study* aSStudy = theViewManager->study()) {
_PTR(SObject) anObj = aList[i];
string anEntry = anObj->GetID();
if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - anEntry = " << anEntry);
- if (anObj->FindAttribute(anAttr, "AttributeComment")) {
- _PTR(AttributeComment) aCmnt (anAttr);
- QString strIn(aCmnt->Value().c_str());
- Storable::TRestoringMap aMap;
- Storable::StrToMap(strIn, aMap);
- if (Storable::FindValue(aMap, "myComment").compare
- (View3D_i::myComment.c_str()) >= 0) {
- if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - aComm = " << strIn);
- Restore(theViewManager->getActiveView(), aMap);
- return true;
- }
+ Storable::TRestoringMap aMap = Storable::GetStorableMap(anObj);
+ if (Storable::FindValue(aMap, "myComment") == View3D_i::myComment) {
+ Restore(theViewManager->getActiveView(), aMap);
+ return true;
}
}
return false;
class TRestoreViewParamsEvent: public SALOME_Event
{
SUIT_ViewManager* myViewMgr;
- const char* myName;
+ std::string myName;
public:
TRestoreViewParamsEvent (SUIT_ViewManager* theViewManager,
- const char* theName):
+ const std::string& theName):
myViewMgr(theViewManager),
myName(theName)
{}
TResult myResult;
};
- CORBA::Boolean View3D_i::RestoreViewParams (const char* theName)
+ CORBA::Boolean View3D_i::RestoreViewParams (const char* theViewParamsName)
{
- return ProcessEvent(new TRestoreViewParamsEvent (myViewManager, theName));
+ return ProcessEvent(new TRestoreViewParamsEvent (myViewManager, theViewParamsName));
}
void View3D_i::Restore (SUIT_ViewWindow* theViewWindow,
void View3D_i::ToStream (SUIT_ViewWindow* theViewWindow, std::ostringstream& theStr)
{
- Storable::DataToStream(theStr,"myType",VISU::TVIEW3D);
-
- float backint[3];
+ vtkFloatingPointType backint[3];
GetRenderer(theViewWindow)->GetBackground(backint);
Storable::DataToStream(theStr,"myColor.R",backint[0]);
Storable::DataToStream(theStr,"myColor.G",backint[1]);
SALOMEDS::Color View3D_i::GetBackground (SUIT_ViewWindow* theViewWindow)
{
SALOMEDS::Color aColor;
- float backint[3];
+ vtkFloatingPointType backint[3];
GetRenderer(theViewWindow)->GetBackground(backint);
aColor.R = backint[0]; aColor.G = backint[1]; aColor.B = backint[2];
return aColor;
if(MYDEBUG) MESSAGE("View3D_i::SetPointOfView");
SUIT_ViewWindow* aVW = GetViewWindow();
if (aVW)
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetPointOfView,aVW,thePosition));
+ ProcessVoidEvent(new TSet3DViewParamEvent(&View3D_i::SetPointOfView,aVW,thePosition));
}
void View3D_i::GetPointOfView (SUIT_ViewWindow* theViewWindow,
if(MYDEBUG) MESSAGE("View3D_i::SetViewUp");
SUIT_ViewWindow* aVW = GetViewWindow();
if (aVW)
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetViewUp,aVW,theViewUp));
+ ProcessVoidEvent(new TSet3DViewParamEvent(&View3D_i::SetViewUp,aVW,theViewUp));
}
void View3D_i::GetViewUp (SUIT_ViewWindow* theViewWindow,
if(MYDEBUG) MESSAGE("View3D_i::SetFocalPoint");
SUIT_ViewWindow* aVW = GetViewWindow();
if (aVW)
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetFocalPoint,aVW,theCoord));
+ ProcessVoidEvent(new TSet3DViewParamEvent(&View3D_i::SetFocalPoint,aVW,theCoord));
}
if(MYDEBUG) MESSAGE("View3D_i::SetParallelScale");
SUIT_ViewWindow* aVW = GetViewWindow();
if (aVW)
- ProcessVoidEvent(new TSetViewParamEvent(&SetParallelScale,aVW,theScale));
+ ProcessVoidEvent(new TSetViewParamEvent(&View3D_i::SetParallelScale,aVW,theScale));
}
CORBA::Double View3D_i::GetParallelScale (SUIT_ViewWindow* theViewWindow)
ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,aVW,aScale));
}
}
+
+ //================================================
+ // Certain presentation view parameters management
+ //================================================
+ class TPrsManageEvent: public SALOME_Event
+ {
+ protected:
+ View3D_i* myView3D;
+ ScalarMap_ptr myPrs;
+ string myError;
+
+ TPrsManageEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
+ myView3D(theView3D),
+ myPrs(ScalarMap::_duplicate(thePrs)),
+ myError("Unknown error occured")
+ {}
+ VISU_Actor* GetMyActor()
+ {
+ SUIT_ViewWindow* aVW = myView3D->GetViewWindow();
+ SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aVW);
+ if (!aVW) {
+ myError = "Corrupted view window";
+ } else {
+ ScalarMap_i* aPrs = dynamic_cast<ScalarMap_i*>(VISU::GetServant(myPrs).in());
+ if (!aPrs) {
+ myError = "Corrupted presentation";
+ } else {
+ VISU_Actor* anActor = VISU::FindActor(vw, aPrs);
+ if (!anActor) {
+ myError = "No actor found. Display the presentation at first.";
+ } else {
+ myError = "";
+ return anActor;
+ }
+ }
+ }
+ return NULL;
+ }
+ };
+
+ // Get
+ class TGetPrsTypeEvent: public TPrsManageEvent {
+ public:
+ typedef VISU::PresentationType TResult;
+ TResult myResult;
+ TGetPrsTypeEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
+ TPrsManageEvent(theView3D, thePrs), myResult(VISU::SHRINK) {}
+ virtual void Execute() {
+ if (VISU_Actor* anActor = GetMyActor())
+ myResult = (VISU::PresentationType)anActor->GetRepresentation();
+ }
+ };
+
+ class TGetShrinkedEvent: public TPrsManageEvent {
+ public:
+ typedef bool TResult;
+ TResult myResult;
+ TGetShrinkedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
+ TPrsManageEvent(theView3D, thePrs), myResult(false) {}
+ virtual void Execute() {
+ if (VISU_Actor* anActor = GetMyActor()) {
+ if (anActor->IsShrunkable())
+ myResult = anActor->IsShrunk();
+ else
+ myResult = false;
+ }
+ }
+ };
+
+ class TGetShadedEvent: public TPrsManageEvent {
+ public:
+ typedef bool TResult;
+ TResult myResult;
+ TGetShadedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
+ TPrsManageEvent(theView3D, thePrs), myResult(false) {}
+ virtual void Execute() {
+ if (VISU_Actor* anActor = GetMyActor())
+ if (VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor))
+ myResult = aScalarMapActor->IsShading();
+ }
+ };
+
+ class TGetOpacityEvent: public TPrsManageEvent {
+ public:
+ typedef double TResult;
+ TResult myResult;
+ TGetOpacityEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
+ TPrsManageEvent(theView3D, thePrs), myResult(-1.0) {}
+ virtual void Execute() {
+ if (VISU_Actor* anActor = GetMyActor()) {
+ vtkFloatingPointType oldvalue = anActor->GetOpacity();
+ myResult = (double)oldvalue;
+ }
+ }
+ };
+
+ class TGetLineWidthEvent: public TPrsManageEvent {
+ public:
+ typedef double TResult;
+ TResult myResult;
+ TGetLineWidthEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
+ TPrsManageEvent(theView3D, thePrs), myResult(-1.0) {}
+ virtual void Execute() {
+ if (VISU_Actor* anActor = GetMyActor()) {
+ vtkFloatingPointType oldvalue = anActor->GetLineWidth();
+ myResult = (double)oldvalue;
+ }
+ }
+ };
+
+ // Set
+ class TSetPrsTypeEvent: public TPrsManageEvent {
+ private:
+ PresentationType myPrsType;
+ public:
+ typedef string TResult;
+ TResult myResult;
+ TSetPrsTypeEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, PresentationType thePrsType):
+ TPrsManageEvent(theView3D, thePrs), myPrsType(thePrsType),
+ myResult("Unknown error occured")
+ {}
+ virtual void Execute() {
+ switch (myPrsType) {
+ case VISU::INSIDEFRAME:
+ {
+ VISU::VISUType aType = myPrs->GetType();
+ if (aType != VISU::TSCALARMAP &&
+ aType != VISU::TDEFORMEDSHAPE &&
+ aType != VISU::TSCALARMAPONDEFORMEDSHAPE) {
+ myResult = "Insideframe representation is not available for this type of presentations.";
+ return;
+ }
+ }
+ break;
+ case VISU::SURFACEFRAME:
+ myResult = "Surfaceframe representation is available only for mesh presentation.";
+ return;
+ case VISU::SHRINK:
+ myResult = "Use SetShrinked() method to shrink/unshrink presentation.";
+ return;
+ default:
+ break;
+ }
+ if (VISU_Actor* anActor = GetMyActor()) {
+ anActor->SetRepresentation((int)myPrsType);
+ SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
+ vw->Repaint();
+ myResult = "";
+ } else {
+ myResult = myError;
+ }
+ }
+ };
+
+ class TSetShrinkedEvent: public TPrsManageEvent {
+ private:
+ bool myIsOn;
+ public:
+ typedef string TResult;
+ TResult myResult;
+ TSetShrinkedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, bool isOn):
+ TPrsManageEvent(theView3D, thePrs), myIsOn(isOn),
+ myResult("Unknown error occured")
+ {}
+ virtual void Execute() {
+ VISU::VISUType aType = myPrs->GetType();
+ if (aType == VISU::TVECTORS || aType == VISU::TSTREAMLINES) {
+ myResult = "Shrinked representation is not available for this type of presentations.";
+ } else {
+ if (VISU_Actor* anActor = GetMyActor()) {
+ if (anActor->IsShrunkable()) {
+ if (myIsOn) anActor->SetShrink();
+ else anActor->UnShrink();
+ SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
+ vw->Repaint();
+ myResult = "";
+ } else {
+ myResult = "This presentation is not shrunkable.";
+ }
+ } else {
+ myResult = myError;
+ }
+ }
+ }
+ };
+
+ class TSetShadedEvent: public TPrsManageEvent {
+ private:
+ bool myIsOn;
+ public:
+ typedef string TResult;
+ TResult myResult;
+ TSetShadedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, bool isOn):
+ TPrsManageEvent(theView3D, thePrs), myIsOn(isOn),
+ myResult("Unknown error occured")
+ {}
+ virtual void Execute() {
+ if (VISU_Actor* anActor = GetMyActor()) {
+ if (VISU_ScalarMapAct* aScalarMapActor =
+ dynamic_cast<VISU_ScalarMapAct*>(anActor)) {
+ aScalarMapActor->SetShading(myIsOn);
+ SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
+ vw->Repaint();
+ myResult = "";
+ } else {
+ myResult = "Corrupted actor";
+ }
+ } else {
+ myResult = myError;
+ }
+ }
+ };
+
+ class TSetOpacityEvent: public TPrsManageEvent {
+ private:
+ double myOpacity;
+ public:
+ typedef string TResult;
+ TResult myResult;
+ TSetOpacityEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, double theOpacity):
+ TPrsManageEvent(theView3D, thePrs), myOpacity(theOpacity),
+ myResult("Unknown error occured")
+ {}
+ virtual void Execute() {
+ VISU::VISUType aType = myPrs->GetType();
+ if (aType == VISU::TVECTORS || aType == VISU::TSTREAMLINES) {
+ myResult = "Opacity is meaningless for this type of presentations.";
+ return;
+ }
+ if (VISU_Actor* anActor = GetMyActor()) {
+ anActor->SetOpacity((vtkFloatingPointType)myOpacity);
+ SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
+ vw->Repaint();
+ myResult = "";
+ } else {
+ myResult = myError;
+ }
+ }
+ };
+
+ class TSetLineWidthEvent: public TPrsManageEvent {
+ private:
+ double myLineWidth;
+ public:
+ typedef string TResult;
+ TResult myResult;
+ TSetLineWidthEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, double theLineWidth):
+ TPrsManageEvent(theView3D, thePrs), myLineWidth(theLineWidth),
+ myResult("Unknown error occured")
+ {}
+ virtual void Execute() {
+ if (myPrs->GetType() == VISU::TVECTORS) {
+ myResult = "Line Width is meaningless for Vectors presentation.";
+ return;
+ }
+ if (VISU_Actor* anActor = GetMyActor()) {
+ anActor->SetLineWidth((vtkFloatingPointType)myLineWidth);
+ SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
+ vw->Repaint();
+ myResult = "";
+ } else {
+ myResult = myError;
+ }
+ }
+ };
+
+ PresentationType View3D_i::GetPresentationType(ScalarMap_ptr thePrs)
+ {
+ return ProcessEvent(new TGetPrsTypeEvent(this,thePrs));
+ }
+ CORBA::Boolean View3D_i::IsShrinked(ScalarMap_ptr thePrs)
+ {
+ return ProcessEvent(new TGetShrinkedEvent(this,thePrs));
+ }
+ CORBA::Boolean View3D_i::IsShaded(ScalarMap_ptr thePrs)
+ {
+ return ProcessEvent(new TGetShadedEvent(this,thePrs));
+ }
+ CORBA::Double View3D_i::GetOpacity(ScalarMap_ptr thePrs)
+ {
+ return ProcessEvent(new TGetOpacityEvent(this,thePrs));
+ }
+ CORBA::Double View3D_i::GetLineWidth(ScalarMap_ptr thePrs)
+ {
+ return ProcessEvent(new TGetLineWidthEvent(this,thePrs));
+ }
+
+ char* View3D_i::SetPresentationType(ScalarMap_ptr thePrs, PresentationType thePrsType)
+ {
+ string aRet = ProcessEvent(new TSetPrsTypeEvent(this,thePrs,thePrsType));
+ return CORBA::string_dup(aRet.c_str());
+ }
+ char* View3D_i::SetShrinked(ScalarMap_ptr thePrs, CORBA::Boolean isShrinked)
+ {
+ string aRet = ProcessEvent(new TSetShrinkedEvent(this,thePrs,isShrinked));
+ return CORBA::string_dup(aRet.c_str());
+ }
+ char* View3D_i::SetShaded(ScalarMap_ptr thePrs, CORBA::Boolean isShaded)
+ {
+ string aRet = ProcessEvent(new TSetShadedEvent(this,thePrs,isShaded));
+ return CORBA::string_dup(aRet.c_str());
+ }
+ char* View3D_i::SetOpacity(ScalarMap_ptr thePrs, CORBA::Double theOpacity)
+ {
+ string aRet = ProcessEvent(new TSetOpacityEvent(this,thePrs,theOpacity));
+ return CORBA::string_dup(aRet.c_str());
+ }
+ char* View3D_i::SetLineWidth(ScalarMap_ptr thePrs, CORBA::Double theLineWidth)
+ {
+ string aRet = ProcessEvent(new TSetLineWidthEvent(this,thePrs,theLineWidth));
+ return CORBA::string_dup(aRet.c_str());
+ }
}