#include "VISU_Table_i.hh"
#include "VISU_ViewManager_i.hh"
+#include "VisuGUI_TableDlg.h"
+
#include "VISU_Actor.h"
#include "SALOME_Event.hxx"
#include "SUIT_Tools.h"
#include "STD_MDIDesktop.h"
+#include "STD_TabDesktop.h"
#include "SVTK_ViewWindow.h"
#include "SVTK_ViewModel.h"
+#include "SVTK_RenderWindow.h"
+
+#include "SPlot2d_ViewModel.h"
#include "Plot2d_ViewFrame.h"
-#include "Plot2d_ViewModel.h"
#include "SalomeApp_Application.h"
#include "SalomeApp_Study.h"
+#include <QtxWorkstack.h>
+
#include <qworkspace.h>
#include <vtkCamera.h>
static int MYDEBUG = 0;
#endif
-namespace VISU{
+namespace VISU {
typedef TVoidMemFunEvent<SUIT_ViewWindow> TFrameActionEvent;
+ struct TNewViewEvent: public SALOME_Event
+ {
+ SalomeApp_Application* myApplication;
+ typedef QWidget* TResult;
+ TResult myResult;
+
+ TNewViewEvent (SalomeApp_Application* theApplication):
+ myApplication(theApplication),
+ myResult(NULL)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ if (STD_MDIDesktop* aDesktop = dynamic_cast<STD_MDIDesktop*>(myApplication->desktop())) {
+ myResult = aDesktop->workspace();
+ }
+ }
+ };
+
View_i::
- View_i(SalomeApp_Application *theApplication,
- SUIT_ViewManager* theViewManager):
+ View_i (SalomeApp_Application *theApplication,
+ SUIT_ViewManager* theViewManager):
myApplication(theApplication),
myWorkspace(NULL),
myViewManager(theViewManager)
{
if(MYDEBUG) MESSAGE("View_i::View_i - "<<this);
- if(STD_MDIDesktop* aDesktop = dynamic_cast<STD_MDIDesktop*>(myApplication->desktop())){
- myWorkspace = aDesktop->workspace();
- }
+ myWorkspace = ProcessEvent(new TNewViewEvent(theApplication));
}
View_i::
{}
};
-
void
View_i::
- ShowPart(VISU::View::ViewRepresentation theViewRepresentation,
- CORBA::Boolean theState)
+ ShowPart (VISU::View::ViewRepresentation theViewRepresentation,
+ CORBA::Boolean theState)
{
struct TEvent: public TApplicationEvent
{
ProcessVoidEvent(new TEvent(myApplication,theViewRepresentation,theState));
}
-
struct TPartShownEvent: public TApplicationEvent
{
VISU::View::ViewRepresentation myViewRepresentation;
}
};
-
CORBA::Boolean
View_i::
- IsPartShown(VISU::View::ViewRepresentation theViewRepresentation)
+ IsPartShown (VISU::View::ViewRepresentation theViewRepresentation)
{
return ProcessEvent(new TPartShownEvent(myApplication,theViewRepresentation));
}
+ // Begin: New methods for view parameters management
+ struct TSplitEvent: public SALOME_Event
+ {
+ SalomeApp_Application * myApplication;
+ SUIT_ViewWindow * myVW;
+ Qt::Orientation myOrientation;
+ QtxWorkstack::SplitType mySplitType;
+
+ public:
+ TSplitEvent (SalomeApp_Application * theApplication,
+ SUIT_ViewWindow * theViewWindow,
+ Qt::Orientation theOrientation,
+ QtxWorkstack::SplitType theSplitType):
+ myApplication(theApplication),
+ myVW(theViewWindow),
+ myOrientation(theOrientation),
+ mySplitType(theSplitType)
+ {}
+
+ virtual void Execute()
+ {
+ SUIT_Desktop* desk = myApplication->desktop();
+ STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
+ if (tabDesk) {
+ QtxWorkstack* workstack = tabDesk->workstack();
+ if (workstack) {
+ workstack->Split(myVW, myOrientation, mySplitType);
+ }
+ }
+ }
+ };
+
+ void
+ View_i::
+ SplitRight()
+ {
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
+ Qt::Horizontal, QtxWorkstack::SPLIT_MOVE));
+ }
+
+ void
+ View_i::
+ SplitLeft()
+ {
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
+ Qt::Horizontal, QtxWorkstack::SPLIT_STAY));
+ }
+
+ void
+ View_i::
+ SplitBottom()
+ {
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
+ Qt::Vertical, QtxWorkstack::SPLIT_MOVE));
+ }
+
+ void
+ View_i::
+ SplitTop()
+ {
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
+ Qt::Vertical, QtxWorkstack::SPLIT_STAY));
+ }
+
+ void
+ View_i::
+ OnTop()
+ {
+ struct TOnTopEvent: public SALOME_Event
+ {
+ SUIT_ViewWindow * myVW;
+
+ public:
+ TOnTopEvent (SUIT_ViewWindow * theViewWindow):
+ myVW(theViewWindow)
+ {}
+
+ virtual void Execute()
+ {
+ if (myVW) {
+ myVW->setFocus();
+ }
+ }
+ };
+
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TOnTopEvent(aVW));
+ }
+
+ struct TAttractEvent: public SALOME_Event
+ {
+ SalomeApp_Application * myApplication;
+ SUIT_ViewWindow * myVW1;
+ SUIT_ViewWindow * myVW2;
+ bool myAttractAll;
+
+ public:
+ TAttractEvent (SalomeApp_Application * theApplication,
+ SUIT_ViewWindow * theViewWindow1,
+ SUIT_ViewWindow * theViewWindow2,
+ bool theAttractAll):
+ myApplication(theApplication),
+ myVW1(theViewWindow1),
+ myVW2(theViewWindow2),
+ myAttractAll(theAttractAll)
+ {}
+
+ virtual void Execute()
+ {
+ SUIT_Desktop* desk = myApplication->desktop();
+ STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
+ if (tabDesk) {
+ QtxWorkstack* workstack = tabDesk->workstack();
+ if (workstack) {
+ workstack->Attract(myVW1, myVW2, myAttractAll);
+ }
+ }
+ }
+ };
+ void
+ View_i::
+ Attract (VISU::View_ptr theView)
+ {
+ if (!CORBA::is_nil(theView)) {
+ if (VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(theView).in())) {
+ if (pView) {
+ SUIT_ViewWindow* aVW1 = GetViewWindow();
+ SUIT_ViewWindow* aVW2 = pView->GetViewWindow();
+ if (aVW1 && aVW2)
+ ProcessVoidEvent(new TAttractEvent(myApplication, aVW1, aVW2, false));
+ }
+ }
+ }
+ }
+
+ void
+ View_i::
+ AttractAll (VISU::View_ptr theView)
+ {
+ if (!CORBA::is_nil(theView)) {
+ if (VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(theView).in())) {
+ if (pView) {
+ SUIT_ViewWindow* aVW1 = GetViewWindow();
+ SUIT_ViewWindow* aVW2 = pView->GetViewWindow();
+ if (aVW1 && aVW2)
+ ProcessVoidEvent(new TAttractEvent(myApplication, aVW1, aVW2, true));
+ }
+ }
+ }
+ }
+
+ struct TSizePositionEvent: public SALOME_Event
+ {
+ SalomeApp_Application * myApplication;
+ SUIT_ViewWindow * myVW;
+ double myValue;
+ bool myIsSize;
+
+ public:
+ TSizePositionEvent (SalomeApp_Application * theApplication,
+ SUIT_ViewWindow * theViewWindow,
+ double theValue,
+ bool theIsSize):
+ myApplication(theApplication),
+ myVW(theViewWindow),
+ myValue(theValue),
+ myIsSize(theIsSize)
+ {}
+
+ virtual void Execute()
+ {
+ MESSAGE("TSizePositionEvent::Execute()");
+ SUIT_Desktop* desk = myApplication->desktop();
+ STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
+ if (tabDesk) {
+ QtxWorkstack* workstack = tabDesk->workstack();
+ if (workstack) {
+ if (myIsSize) {
+ //jfa to do:workstack->SetRelativeSizeInSplitter(myVW, myValue);
+ } else {
+ workstack->SetRelativePositionInSplitter(myVW, myValue);
+ }
+ }
+ }
+ }
+ };
+
+ void
+ View_i::
+ SetRelativePositionInSplitter (CORBA::Double thePosition)
+ {
+ if (thePosition < 0.0 || 1.0 < thePosition) {
+ return;
+ }
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TSizePositionEvent(myApplication, aVW, thePosition, false));
+ }
+
+ void
+ View_i::
+ SetRelativeSizeInSplitter (CORBA::Double theSize)
+ {
+ if (theSize < 0.0 || 1.0 < theSize) {
+ return;
+ }
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TSizePositionEvent(myApplication, aVW, theSize, true));
+ }
+
+ struct TWSSizePositionEvent: public SALOME_Event
+ {
+ SalomeApp_Application * myApplication;
+ SUIT_ViewWindow * myVW;
+ Qt::Orientation myOrientation;
+ double myValue;
+ bool myIsSize;
+
+ public:
+ TWSSizePositionEvent (SalomeApp_Application * theApplication,
+ SUIT_ViewWindow * theViewWindow,
+ Qt::Orientation theOrientation,
+ double theValue,
+ bool theIsSize):
+ myApplication(theApplication),
+ myVW(theViewWindow),
+ myOrientation(theOrientation),
+ myValue(theValue),
+ myIsSize(theIsSize)
+ {}
+
+ virtual void Execute()
+ {
+ MESSAGE("TWSSizePositionEvent::Execute()");
+ SUIT_Desktop* desk = myApplication->desktop();
+ STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
+ if (tabDesk) {
+ QtxWorkstack* workstack = tabDesk->workstack();
+ if (workstack) {
+ if (myIsSize) {
+ //jfa to do:workstack->SetRelativeSize(myVW, myOrientation, myValue);
+ } else {
+ workstack->SetRelativePosition(myVW, myOrientation, myValue);
+ }
+ }
+ }
+ }
+ };
+
+ void
+ View_i::
+ SetRelativePositionX (CORBA::Double thePosition)
+ {
+ if (thePosition < 0.0 || 1.0 < thePosition) {
+ return;
+ }
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
+ Qt::Horizontal, thePosition, false));
+ }
+
+ void
+ View_i::
+ SetRelativePositionY (CORBA::Double thePosition)
+ {
+ if (thePosition < 0.0 || 1.0 < thePosition) {
+ return;
+ }
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
+ Qt::Vertical, thePosition, false));
+ }
+
+ void
+ View_i::
+ SetRelativeSizeX (CORBA::Double theSize)
+ {
+ if (theSize < 0.0 || 1.0 < theSize) {
+ return;
+ }
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
+ Qt::Horizontal, theSize, true));
+ }
+
+ void
+ View_i::
+ SetRelativeSizeY (CORBA::Double theSize)
+ {
+ if (theSize < 0.0 || 1.0 < theSize) {
+ return;
+ }
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
+ Qt::Vertical, theSize, true));
+ }
+ // End: New methods for view parameters management
+
+ // Begin: Old methods for view parameters management, they don't work now
struct TSetViewSize: public SALOME_Event
{
- SUIT_ViewWindow* myViewWindow;
+ SUIT_ViewWindow* myVW;
typedef void (QRect::* TAction)(int);
TAction myAction;
CORBA::Long mySize;
TSetViewSize(SUIT_ViewWindow* theViewWindow,
TAction theAction,
CORBA::Long theSize):
- myViewWindow(theViewWindow),
+ myVW(theViewWindow),
myAction(theAction),
mySize(theSize)
{}
void
Execute()
{
- if (QWidget* aParent = myViewWindow->parentWidget(true)) {
+ if (QWidget* aParent = myVW->parentWidget(true)) {
QRect aQRect = aParent->frameGeometry();
(aQRect.*myAction)(mySize);
aParent->setGeometry(aQRect);
}
};
-
void
View_i::
SetViewWidth(CORBA::Long theWidth)
ProcessVoidEvent(new TSetViewSize(myViewWindow,&QRect::setWidth,theWidth));
}
-
void
View_i::
SetViewHeight(CORBA::Long theHeight)
struct TGetViewSize: public SALOME_Event
{
- SUIT_ViewWindow* myViewWindow;
+ SUIT_ViewWindow* myVW;
typedef int (QRect::* TAction)() const;
TAction myAction;
public:
TGetViewSize(SUIT_ViewWindow* theViewWindow,
TAction theAction):
- myViewWindow(theViewWindow),
+ myVW(theViewWindow),
myAction(theAction)
{}
void
Execute()
{
- if(QWidget* aParent = myViewWindow->parentWidget(true)){
+ if(QWidget* aParent = myVW->parentWidget(true)){
QRect aQRect = aParent->frameGeometry();
myResult = (aQRect.*myAction)();
}
class TWorkspaceEvent: public SALOME_Event
{
protected:
- QWidget* myViewWindow;
+ QWidget* myVW;
QWidget* myWorkspace;
public:
TWorkspaceEvent(QWidget* theViewWindow,
QWidget* theWorkspace):
- myViewWindow(theViewWindow),
+ myVW(theViewWindow),
myWorkspace(theWorkspace)
{}
};
void
Execute()
{
- if(QWidget* aParent = myViewWindow->parentWidget(true))
+ if(QWidget* aParent = myVW->parentWidget(true))
SUIT_Tools::alignWidget(aParent,myWorkspace,myAligment);
}
};
void
View_i::
- SetViewPositionHorizontal(VISU::View::ViewPosition theViewPosition)
+ SetViewPositionHorizontal (VISU::View::ViewPosition theViewPosition)
{
- if(myWorkspace){
- switch(theViewPosition){
+ if (myWorkspace) {
+ switch (theViewPosition) {
case VISU::View::LEFT:
ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignLeft));
break;
void
View_i::
- SetViewPositionVertical(VISU::View::ViewPosition theViewPosition)
+ SetViewPositionVertical (VISU::View::ViewPosition theViewPosition)
{
- if(myWorkspace){
- switch(theViewPosition){
+ if (myWorkspace) {
+ switch (theViewPosition) {
case VISU::View::TOP:
ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignTop));
break;
void
View_i::
- SetRelativePosition(CORBA::Double theX, CORBA::Double theY)
+ SetRelativePosition (CORBA::Double theX, CORBA::Double theY)
{
struct TEvent: public TXYEvent
{
void
Execute()
{
- if(QWidget* aParent = myViewWindow->parentWidget(true))
+ if(QWidget* aParent = myVW->parentWidget(true))
aParent->move(int(myX*myWorkspace->width()),int(myY*myWorkspace->height()));
}
};
- if(myWorkspace)
+ if (myWorkspace)
ProcessVoidEvent(new TEvent(myViewWindow,myWorkspace,theX,theY));
}
void
View_i::
- SetRelativeSize(CORBA::Double theX, CORBA::Double theY)
+ SetRelativeSize (CORBA::Double theX, CORBA::Double theY)
{
struct TEvent: public TXYEvent
{
void
Execute()
{
- if(QWidget* aParent = myViewWindow->parentWidget(true))
+ if(QWidget* aParent = myVW->parentWidget(true))
aParent->setGeometry(aParent->x(),
aParent->y(),
int(myX*myWorkspace->width()),
}
};
- if(myWorkspace)
+ if (myWorkspace)
ProcessVoidEvent(new TEvent(myViewWindow,myWorkspace,theX,theY));
}
+ // End: Old methods for view parameters management, they don't work now
void
View_i::
- SetBackground(const SALOMEDS::Color& theColor)
+ SetBackground (const SALOMEDS::Color& theColor)
{
struct TEvent: public SALOME_Event
{
}
};
- ProcessVoidEvent(new TEvent(myViewWindow,theColor));
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TEvent(aVW, theColor));
}
View_i::
GetBackground()
{
- return ProcessEvent(new TBackgroundEvent(myViewWindow));
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ return ProcessEvent(new TBackgroundEvent(aVW));
+
+ SALOMEDS::Color aBlack;
+ aBlack.R = 0.0;
+ aBlack.G = 0.0;
+ aBlack.B = 0.0;
+ return aBlack;
}
void
View_i::
Minimize()
{
- ProcessVoidEvent(new TFrameActionEvent(myViewWindow,&SUIT_ViewWindow::showMinimized));
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TFrameActionEvent(aVW, &SUIT_ViewWindow::showMinimized));
}
void
View_i::
Restore()
{
- ProcessVoidEvent(new TFrameActionEvent(myViewWindow,&SUIT_ViewWindow::showNormal));
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TFrameActionEvent(aVW, &SUIT_ViewWindow::showNormal));
}
void
View_i::
Maximize()
{
- ProcessVoidEvent(new TFrameActionEvent(myViewWindow,&SUIT_ViewWindow::showMaximized));
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TFrameActionEvent(aVW, &SUIT_ViewWindow::showMaximized));
}
void
void
View_i::
- Erase(PrsObject_ptr thePrsObj)
+ Erase (PrsObject_ptr thePrsObj)
{}
void
View_i::
- Display(PrsObject_ptr thePrsObj)
+ Display (PrsObject_ptr thePrsObj)
{}
void
View_i::
- DisplayOnly(PrsObject_ptr thePrsObj)
+ DisplayOnly (PrsObject_ptr thePrsObj)
{}
void
Update()
{}
- CORBA::Boolean
- View_i::SavePicture(const char* theFileName)
- {
- return false;
- }
-
- const char*
- View_i::
- GetComment() const
- {
- return "";
- }
- void
- View_i::
- ToStream(std::ostringstream& theStr)
- {}
-
-
- //================= OLD CODE ===================
-
- //QAD_Study* CheckStudy (SALOMEDS::Study_ptr theStudy)
- //{
- // //QAD_Desktop* aDesktop = QAD_Application::getDesktop();
- // //QAD_Study* aStudy = aDesktop->findStudy(theStudy);
- // if (!aStudy) {
- // CORBA::String_var aName = theStudy->Name();
- // aFileInfo.setFile(aName.in());
- // if (aFileInfo.exists())
- // aStudy = aDesktop->loadStudy(aFileInfo.baseName());
- // else
- // aStudy = aDesktop->loadStudy(aName.in());
- // if (!aStudy) {
- // MESSAGE("CheckStudy()::ERROR: Can't load study");
- // }
- // }
- // return aStudy;
- //}
-
class TSavePictureEvent: public SALOME_Event
{
- QWidget* myWidget;
- const char* myFileName;
+ SUIT_ViewWindow * myVW;
+ const char * myFileName;
public:
typedef CORBA::Boolean TResult;
TResult myResult;
- TSavePictureEvent (QWidget* theWidget, const char* theFileName)
- : myWidget(theWidget),
+ TSavePictureEvent (SUIT_ViewWindow * theViewWindow, const char * theFileName)
+ : myVW(theViewWindow),
myFileName(theFileName),
myResult(false)
{
virtual void Execute()
{
- if (myWidget) {
- QPixmap px = QPixmap::grabWindow(myWidget->winId());
- if (!QString(myFileName).isNull()) {
- QString fmt = SUIT_Tools::extension(myFileName).upper();
- if (fmt.isEmpty())
- fmt = QString("BMP"); // default format
- if (fmt == "JPG")
- fmt = "JPEG";
- myResult = px.save(myFileName, fmt.latin1());
- }
+ if (myVW) {
+ QImage img = myVW->dumpView();
+ if (!img.isNull()) {
+ QString fileName (myFileName);
+ if (!fileName.isEmpty()) {
+ QString fmt = SUIT_Tools::extension(fileName).upper();
+ if (fmt.isEmpty()) fmt = QString("BMP"); // default format
+ if (fmt == "JPG" ) fmt = "JPEG";
+ //QApplication::setOverrideCursor(Qt::waitCursor);
+ img.save(fileName, fmt.latin1());
+ myResult = true;
+ //QApplication::restoreOverrideCursor();
+ }
+ }
}
}
};
+ CORBA::Boolean
+ View_i::SavePicture(const char* theFileName)
+ {
+ return ProcessEvent(new TSavePictureEvent (GetViewWindow(), theFileName));
+ }
+
+ const char*
+ View_i::GetComment() const
+ {
+ return "";
+ }
+
+ void
+ View_i::
+ ToStream (std::ostringstream& theStr)
+ {
+ }
+
+ SUIT_ViewWindow* View_i::GetViewWindow()
+ {
+ if (myViewWindow) {
+ QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+ int aPos = aViews.find(myViewWindow);
+ if (aPos < 0)
+ myViewWindow = NULL;
+ }
+ return myViewWindow;
+ }
+
+ void View_i::SetViewWindow(SUIT_ViewWindow* theViewWindow)
+ {
+ myViewWindow = theViewWindow;
+ }
+
//===========================================================================
XYPlot_i::XYPlot_i (SalomeApp_Application* theApplication)
- : View_i(theApplication, theApplication->getViewManager(Plot2d_Viewer::Type(), true))
+ : View_i(theApplication, NULL)
{
if (MYDEBUG) MESSAGE("XYPlot_i::XYPlot_i");
}
- Storable* XYPlot_i::Create (int theNew)
+ struct TCreatePlot2dViewEvent: public SALOME_Event
{
- if (theNew) {
- myViewWindow = myViewManager->createViewWindow();
- } else {
- myViewWindow = myViewManager->getActiveView();
+ XYPlot_i * myPlot2dView;
+ int myNew;
+
+ typedef Plot2d_ViewFrame* TResult;
+ TResult myResult;
+
+ TCreatePlot2dViewEvent (XYPlot_i * thePlot2dView,
+ const int theNew):
+ myPlot2dView(thePlot2dView),
+ myNew(theNew),
+ myResult(NULL)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ if (!myPlot2dView->myApplication)
+ return;
+
+ SUIT_ViewManager* aViewMgr =
+ myPlot2dView->myApplication->getViewManager(SPlot2d_Viewer::Type(), false);
+ SUIT_ViewWindow* aVW = NULL;
+
+ if (aViewMgr) {
+ if (myNew)
+ aVW = aViewMgr->createViewWindow();
+ else
+ aVW = aViewMgr->getActiveView();
+ } else {
+ if (myNew) {
+ aViewMgr = myPlot2dView->myApplication->getViewManager(SPlot2d_Viewer::Type(), true);
+ aVW = aViewMgr->getActiveView();
+ } else {
+ return; // there are no current Plot2d view
+ }
+ }
+
+ if (aVW) {
+ Plot2d_ViewWindow* aPlot2dVW = dynamic_cast<Plot2d_ViewWindow*>(aVW);
+ if (aPlot2dVW) {
+ myResult = aPlot2dVW->getViewFrame();
+ if (myResult) {
+ myResult->Repaint();
+ }
+
+ myPlot2dView->myViewManager = aViewMgr;
+ myPlot2dView->SetViewWindow(aVW);
+ }
+ }
}
- //jfa tmp:myView = dynamic_cast<Plot2d_ViewFrame*>(myViewWindow->getRightFrame()->getViewFrame());
- //jfa tmp:myView->Repaint();
- return this;
+ };
+
+ Storable* XYPlot_i::Create (int theNew)
+ {
+ myView = ProcessEvent(new TCreatePlot2dViewEvent(this, theNew));
+ if (myView)
+ return this;
+ return NULL;
}
void XYPlot_i::Update()
void XYPlot_i::Close()
{
- myViewWindow->close();
+ //jfa: may be need to be enclosed in SALOME_Event?
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ aVW->close();
+ //QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+ //int aPos = aViews.find(myViewWindow);
+ //if (aPos >= 0)
+ // myViewWindow->close();
}
XYPlot_i::~XYPlot_i() {
void XYPlot_i::SetTitle (const char* theTitle)
{
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
- (myViewWindow, &SUIT_ViewWindow::setCaption, QString(theTitle)));
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
+ (aVW, &SUIT_ViewWindow::setCaption, QString(theTitle)));
}
char* XYPlot_i::GetTitle()
{
- return CORBA::string_dup(myViewWindow->caption().latin1());
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ return CORBA::string_dup(aVW->caption().latin1());
+ return CORBA::string_dup("");
}
void XYPlot_i::SetSubTitle (const char* theTitle)
{
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<Plot2d_ViewFrame,const QString&,QString>
- (myView, &Plot2d_ViewFrame::setTitle, QString(theTitle)));
+ if (GetViewWindow())
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<Plot2d_ViewFrame,const QString&,QString>
+ (myView, &Plot2d_ViewFrame::setTitle, QString(theTitle)));
}
char* XYPlot_i::GetSubTitle()
{
- return CORBA::string_dup(myView->getTitle());
+ if (GetViewWindow())
+ return CORBA::string_dup(myView->getTitle());
+ return CORBA::string_dup("");
}
void XYPlot_i::SetCurveType (VISU::XYPlot::CurveType theType)
{
- ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
- (myView,&Plot2d_ViewFrame::setCurveType,theType,true));
+ if (GetViewWindow())
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
+ (myView,&Plot2d_ViewFrame::setCurveType,theType,true));
}
VISU::XYPlot::CurveType XYPlot_i::GetCurveType()
{
- return (VISU::XYPlot::CurveType)myView->getCurveType();
+ if (GetViewWindow())
+ return (VISU::XYPlot::CurveType)myView->getCurveType();
+ return VISU::XYPlot::POINTS;
}
void XYPlot_i::SetMarkerSize (CORBA::Long theSize)
{
- ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
- (myView,&Plot2d_ViewFrame::setMarkerSize,theSize,true));
+ if (GetViewWindow())
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
+ (myView,&Plot2d_ViewFrame::setMarkerSize,theSize,true));
}
CORBA::Long XYPlot_i::GetMarkerSize()
{
- return myView->getMarkerSize();
+ if (GetViewWindow())
+ return myView->getMarkerSize();
+ return -1;
}
class TEnableGridEvent: public SALOME_Event
protected:
Plot2d_ViewFrame* myView;
TFun myFun;
- CORBA::Boolean myMajor, myNumMajor;
- CORBA::Boolean myMinor, myNumMinor;
+ CORBA::Boolean myMajor, myMinor;
+ CORBA::Long myNumMajor, myNumMinor;
};
void XYPlot_i::EnableXGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
CORBA::Boolean theMinor, CORBA::Long theNumMinor)
{
- ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setXGrid,
- theMajor,theNumMajor,theMinor,theNumMinor));
+ if (GetViewWindow())
+ ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setXGrid,
+ theMajor,theNumMajor,theMinor,theNumMinor));
}
void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor,
CORBA::Boolean theMinor, CORBA::Long theNumMinor)
{
- //jfa tmp:ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setYGrid,
- //jfa tmp: theMajor,theNumMajor,theMinor,theNumMinor));
+ //asl: Plot2d_ViewFrame::setYGrid has more parameters
+ //if (GetViewWindow())
+ // ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setYGrid,
+ // theMajor,theNumMajor,theMinor,theNumMinor));
}
class TSetScaleModeEvent: public SALOME_Event
void XYPlot_i::SetHorScaling (VISU::Scaling theScaling)
{
- ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setHorScaleMode,
- theScaling == VISU::LOGARITHMIC));
+ if (GetViewWindow())
+ ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setHorScaleMode,
+ theScaling == VISU::LOGARITHMIC));
}
VISU::Scaling XYPlot_i::GetHorScaling()
{
- return (VISU::Scaling)myView->getHorScaleMode();
+ //jfa: may be need to be enclosed in SALOME_Event?
+ if (GetViewWindow())
+ return (VISU::Scaling)myView->getHorScaleMode();
+ return VISU::LINEAR;
}
void XYPlot_i::SetVerScaling(VISU::Scaling theScaling)
{
- ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setVerScaleMode,
- theScaling == VISU::LOGARITHMIC));
+ if (GetViewWindow())
+ ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setVerScaleMode,
+ theScaling == VISU::LOGARITHMIC));
}
VISU::Scaling XYPlot_i::GetVerScaling()
{
- return (VISU::Scaling)myView->getVerScaleMode();
+ if (GetViewWindow())
+ return (VISU::Scaling)myView->getVerScaleMode();
+ return VISU::LINEAR;
}
class TSetTitleEvent: public SALOME_Event
{
public:
- //typedef void (Plot2d_ViewFrame::* TFun)(bool, const QString&, bool = true);
- typedef void (Plot2d_ViewFrame::* TFun)(bool, const QString&, Plot2d_ViewFrame::ObjectType, bool = true);
- //TSetTitleEvent (Plot2d_ViewFrame* theView, TFun theFun, const char* theTitle):
TSetTitleEvent (Plot2d_ViewFrame* theView, Plot2d_ViewFrame::ObjectType theType, const char* theTitle):
- //myView(theView), myFun(theFun), myTitle(theTitle)
myView(theView), myType(theType), myTitle(theTitle)
{}
virtual void Execute()
{
- //(myView->*myFun)(true,myTitle,myType);
myView->setTitle(true,myTitle,myType);
}
protected:
Plot2d_ViewFrame* myView;
- //TFun myFun;
Plot2d_ViewFrame::ObjectType myType;
const char* myTitle;
};
void XYPlot_i::SetXTitle (const char* theTitle)
{
- //ProcessVoidEvent(new TSetTitleEvent(myView, &Plot2d_ViewFrame::setXTitle, theTitle));
- ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::XTitle, theTitle));
+ if (GetViewWindow())
+ ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::XTitle, theTitle));
}
char* XYPlot_i::GetXTitle()
{
- //return CORBA::string_dup(myView->getXTitle());
- return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::XTitle));
+ if (GetViewWindow())
+ return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::XTitle));
+ return CORBA::string_dup("");
}
void XYPlot_i::SetYTitle (const char* theTitle)
{
- //ProcessVoidEvent(new TSetTitleEvent(myView, &Plot2d_ViewFrame::setYTitle, theTitle));
- ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::YTitle, theTitle));
+ if (GetViewWindow())
+ ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::YTitle, theTitle));
}
char* XYPlot_i::GetYTitle()
{
- //return CORBA::string_dup(myView->getYTitle());
- return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::YTitle));
+ if (GetViewWindow())
+ return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::YTitle));
+ return CORBA::string_dup("");
}
void XYPlot_i::ShowLegend (CORBA::Boolean theShowing)
{
- ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,bool,bool>
- (myView,&Plot2d_ViewFrame::showLegend,theShowing,true));
+ if (GetViewWindow())
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,bool,bool>
+ (myView,&Plot2d_ViewFrame::showLegend,theShowing,true));
}
class TXYPlotViewEvent: public SALOME_Event
{
- _PTR(Study) myStudy;
- Plot2d_ViewFrame* myView;
- PrsObject_ptr myPrsObj;
- int myDisplaing;
+ SalomeApp_Application* myApplication;
+ Plot2d_ViewFrame* myView;
+ PrsObject_ptr myPrsObj;
+ int myDisplaing;
public:
- TXYPlotViewEvent(_PTR(Study) theStudy,
- Plot2d_ViewFrame* theView,
- PrsObject_ptr thePrsObj,
- int theDisplaing)
- : myStudy(theStudy),
+ TXYPlotViewEvent(SalomeApp_Application* theApplication,
+ Plot2d_ViewFrame* theView,
+ PrsObject_ptr thePrsObj,
+ int theDisplaing)
+ : myApplication(theApplication),
myView(theView),
myPrsObj(thePrsObj),
myDisplaing(theDisplaing)
}
// is it Table ?
if (Table_i* aTable = dynamic_cast<Table_i*>(VISU::GetServant(myPrsObj).in())) {
- _PTR(SObject) TableSO = myStudy->FindObjectID(aTable->GetEntry().latin1());
+ _PTR(Study) aCStudy;
+ if (SUIT_Study* aSStudy = myApplication->activeStudy()) {
+ if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
+ aCStudy = aStudy->studyDS();
+ }
+ }
+ if (!aCStudy) return;
+ _PTR(SObject) TableSO = aCStudy->FindObjectID(aTable->GetEntry().latin1());
if (TableSO) {
- _PTR(ChildIterator) Iter = myStudy->NewChildIterator(TableSO);
+ _PTR(ChildIterator) Iter = aCStudy->NewChildIterator(TableSO);
for (; Iter->More(); Iter->Next()) {
CORBA::Object_var childObject = VISU::ClientSObjectToObject(Iter->Value());
if (!CORBA::is_nil(childObject)) {
void XYPlot_i::Display (PrsObject_ptr thePrsObj)
{
- //jfa tmp:ProcessVoidEvent(new TXYPlotViewEvent (myStudy,myView,thePrsObj,eDisplay));
+ if (GetViewWindow())
+ ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eDisplay));
}
void XYPlot_i::Erase (PrsObject_ptr thePrsObj)
{
- //jfa tmp:ProcessVoidEvent(new TXYPlotViewEvent (myStudy,myView,thePrsObj,eErase));
+ if (GetViewWindow())
+ ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eErase));
}
void XYPlot_i::DisplayOnly (PrsObject_ptr thePrsObj)
{
- //jfa tmp:ProcessVoidEvent(new TXYPlotViewEvent (myStudy,myView,thePrsObj,eDisplayOnly));
+ if (GetViewWindow())
+ ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eDisplayOnly));
}
void XYPlot_i::EraseAll()
{
- ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::EraseAll));
+ if (GetViewWindow())
+ ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::EraseAll));
}
void XYPlot_i::FitAll()
{
- ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::fitAll));
+ if (GetViewWindow())
+ ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::fitAll));
+ }
+
+ class TFitRangeEvent: public SALOME_Event
+ {
+ public:
+ TFitRangeEvent (Plot2d_ViewFrame* theView,
+ const int mode,
+ const double xMin, const double xMax,
+ const double yMin, const double yMax):
+ myView(theView),
+ myMode(mode),
+ myXMin(xMin),myXMax(xMax),
+ myYMin(yMin),myYMax(yMax)
+ {}
+ virtual void Execute()
+ {
+ myView->fitData(myMode,myXMin,myXMax,myYMin,myYMax);
+ }
+ protected:
+ const int myMode;
+ const double myXMin;
+ const double myXMax;
+ const double myYMin;
+ const double myYMax;
+ Plot2d_ViewFrame* myView;
+ };
+
+ void XYPlot_i::FitXRange(const CORBA::Double xMin,const CORBA::Double xMax)
+ {
+ const CORBA::Long mode = 1;
+ const CORBA::Double yMin = 0.0;
+ const CORBA::Double yMax = 0.0;
+ ProcessVoidEvent(new TFitRangeEvent(myView,mode,xMin,xMax,yMin,yMax));
}
- CORBA::Boolean XYPlot_i::SavePicture (const char* theFileName)
+ void XYPlot_i::FitYRange(const CORBA::Double yMin,const CORBA::Double yMax)
{
- return ProcessEvent(new TSavePictureEvent (myView->getViewWidget(),theFileName));
+ const CORBA::Long mode = 2;
+ const CORBA::Double xMin = 0.0;
+ const CORBA::Double xMax = 0.0;
+ ProcessVoidEvent(new TFitRangeEvent(myView,mode,xMin,xMax,yMin,yMax));
}
+ void XYPlot_i::FitRange(const CORBA::Double xMin,const CORBA::Double xMax,
+ const CORBA::Double yMin,const CORBA::Double yMax)
+ {
+ const CORBA::Long mode = 0;
+ ProcessVoidEvent(new TFitRangeEvent(myView,mode,xMin,xMax,yMin,yMax));
+ }
+
+ void XYPlot_i::GetFitRanges(double& xMin, double& xMax, double& yMin, double& yMax)
+ {
+ double y2Min,y2Max;
+ myView->getFitRanges(xMin,xMax,yMin,yMax,y2Min,y2Max);
+ }
//===========================================================================
TableView_i::TableView_i (SalomeApp_Application* theApplication)
- : View_i(theApplication, theApplication->getViewManager("???"/*jfa tmp*/, true))
+ : View_i(theApplication, NULL)
{
}
- Storable* TableView_i::Create (VISU::Table_ptr theTable)
+ struct TCreateTableViewEvent: public SALOME_Event
{
- if (MYDEBUG) MESSAGE("TableView_i::Create - " << (!theTable->_is_nil()));
- if (!theTable->_is_nil()) {
- VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(theTable).in());
- if (MYDEBUG) MESSAGE("TableView_i::Create - dynamic_cast = " << table);
- if (table != NULL) {
+ SalomeApp_Application* myApplication;
+ VISU::Table_i* myTable;
- if (SUIT_Study* aSStudy = myViewManager->study()) {
+ typedef VisuGUI_TableDlg* TResult;
+ TResult myResult;
+
+ TCreateTableViewEvent (SalomeApp_Application* theApplication,
+ VISU::Table_i* theTable):
+ myApplication(theApplication),
+ myTable(theTable),
+ myResult(NULL)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ if (myTable != NULL) {
+ if (SUIT_Study* aSStudy = myApplication->activeStudy()) {
if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
if (_PTR(Study) aCStudy = aStudy->studyDS()) {
- _PTR(SObject) aSObject = aCStudy->FindObjectID(table->GetObjectEntry());
+ _PTR(SObject) aSObject = aCStudy->FindObjectID(myTable->GetObjectEntry());
if (aSObject) {
- //jfa tmp:myView = new SALOMEGUI_TableDlg (QAD_Application::getDesktop(),
- //jfa tmp: aSObject,
- //jfa tmp: false,
- //jfa tmp: SALOMEGUI_TableDlg::ttAuto,
- //jfa tmp: Qt::Vertical);
- //jfa tmp:myView->show();
- return this;
+ myResult = new VisuGUI_TableDlg (myApplication->desktop(),
+ aSObject,
+ false,
+ VisuGUI_TableDlg::ttAuto,
+ Qt::Vertical);
+ myResult->show();
}
}
}
}
}
}
+ };
+
+ Storable* TableView_i::Create (VISU::Table_ptr theTable)
+ {
+ if (MYDEBUG) MESSAGE("TableView_i::Create - " << (!theTable->_is_nil()));
+ if (!theTable->_is_nil()) {
+ VISU::Table_i* table =
+ dynamic_cast<VISU::Table_i*>(VISU::GetServant(theTable).in());
+ if (MYDEBUG) MESSAGE("TableView_i::Create - dynamic_cast = " << table);
+
+ myView = ProcessEvent(new TCreateTableViewEvent(myApplication, table));
+ if (myView)
+ return this;
+ }
return NULL;
}
TableView_i::~TableView_i()
{
if(MYDEBUG) MESSAGE("TableView_i::~TableView_i");
- //jfa tmp:delete myView;
+ delete myView;
}
void TableView_i::SetTitle (const char* theTitle)
{
- //jfa tmp:ProcessVoidEvent(new TVoidMemFun1ArgEvent<SALOMEGUI_TableDlg,const QString&,QString>
- //jfa tmp: (myView, &SALOMEGUI_TableDlg::setCaption, QString(theTitle)));
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VisuGUI_TableDlg,const QString&,QString>
+ (myView, &VisuGUI_TableDlg::setCaption, QString(theTitle)));
}
char* TableView_i::GetTitle()
{
- //jfa tmp:return CORBA::string_dup(myView->caption().latin1());
- return "";
+ //jfa: may be need to be enclosed in SALOME_Event?
+ return CORBA::string_dup(myView->caption().latin1());
}
void TableView_i::Close()
{
- //jfa tmp:myView->close();
+ //jfa: may be need to be enclosed in SALOME_Event?
+ myView->close();
}
}
View3D_i::View3D_i (SalomeApp_Application* theApplication)
- : View_i(theApplication, theApplication->getViewManager(SVTK_Viewer::Type(), true))
+ : View_i(theApplication, NULL)
{
if (MYDEBUG) MESSAGE("View3D_i::View3D_i");
}
+ struct TCreateView3dEvent: public SALOME_Event
+ {
+ View3D_i * myView3D;
+ int myNew;
+
+ typedef SUIT_ViewWindow* TResult;
+ TResult myResult;
+
+ TCreateView3dEvent (View3D_i * theView3D,
+ const int theNew):
+ myView3D(theView3D),
+ myNew(theNew),
+ myResult(NULL)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ if (!myView3D->myApplication)
+ return;
+
+ SUIT_ViewManager * aViewMgr =
+ myView3D->myApplication->getViewManager(SVTK_Viewer::Type(), false);
+
+ if (aViewMgr) {
+ if (myNew) {
+ myResult = aViewMgr->createViewWindow();
+ } else {
+ myResult = aViewMgr->getActiveView();
+ }
+ } else {
+ if (myNew) {
+ aViewMgr = myView3D->myApplication->getViewManager(SVTK_Viewer::Type(), true);
+ myResult = aViewMgr->getActiveView();
+ } else {
+ return; // there are no current 3D view
+ }
+ }
+
+ myView3D->myViewManager = aViewMgr;
+ }
+ };
+
Storable* View3D_i::Create (int theNew)
{
if (MYDEBUG) MESSAGE("View3D_i::Create");
- if (theNew) {
- myViewWindow = myViewManager->createViewWindow();
- } else {
- myViewWindow = myViewManager->getActiveView();
+ SUIT_ViewWindow* aVW = ProcessEvent(new TCreateView3dEvent(this, theNew));
+ if (aVW) {
+ SetViewWindow(aVW);
+ return this;
}
- return this;
+ return NULL;
}
void View3D_i::Update()
{
class TEvent: public SALOME_Event
{
- SUIT_ViewWindow* myViewWindow;
+ SUIT_ViewWindow* myVW;
public:
- TEvent(SUIT_ViewWindow* theStudyFrame):
- myViewWindow(theStudyFrame)
+ TEvent(SUIT_ViewWindow* theViewWindow):
+ myVW(theViewWindow)
{}
virtual void Execute()
{
- SVTK_ViewWindow* vf = GetViewWindow(myViewWindow);
+ SVTK_ViewWindow* vf = VISU::GetViewWindow(myVW);
vtkRenderer* Renderer = vf->getRenderer();
vtkActorCollection* theActors = Renderer->GetActors();
theActors->InitTraversal();
}
}
}
- RepaintView(myViewWindow);
+ RepaintView(myVW);
}
};
- ProcessVoidEvent(new TEvent(myViewWindow));
- }
- CORBA::Boolean View3D_i::SavePicture (const char* theFileName)
- {
- //jfa tmp:return ProcessEvent(new TSavePictureEvent
- //jfa tmp: (myView->getViewWidget(), theFileName));
- return false;
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TEvent(aVW));
}
bool View3D_i::SaveViewParams (SUIT_ViewManager* theViewManager, const char* theName)
{
+ MESSAGE("View3D_i::SaveViewParams()");
+
+ if (!theViewManager || !theName)
+ return false;
+
_PTR(Study) aCStudy;
if (SUIT_Study* aSStudy = theViewManager->study()) {
if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
if (!aCStudy)
return false;
- if (theName) {
+ if (strcmp(theName, "") != 0) {
std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName, "VISU");
_PTR(GenericAttribute) anAttr;
int iEnd = aList.size();
return true;
}
+ class TSaveViewParamsEvent: public SALOME_Event
+ {
+ SUIT_ViewManager* myViewMgr;
+ const char* myName;
+ public:
+ TSaveViewParamsEvent (SUIT_ViewManager* theViewManager,
+ const char* theName):
+ myViewMgr(theViewManager),
+ myName(theName)
+ {}
+
+ virtual void Execute()
+ {
+ myResult = View3D_i::SaveViewParams(myViewMgr, myName);
+ }
+ typedef CORBA::Boolean TResult;
+ TResult myResult;
+ };
+
CORBA::Boolean View3D_i::SaveViewParams (const char* theName)
{
- return SaveViewParams(myViewManager, theName);
+ return ProcessEvent(new TSaveViewParamsEvent (myViewManager, theName));
}
bool View3D_i::RestoreViewParams (SUIT_ViewManager* theViewManager, const char* theName)
class TRestoreViewParamsEvent: public SALOME_Event
{
- SUIT_ViewManager* myViewManager;
+ SUIT_ViewManager* myViewMgr;
const char* myName;
public:
TRestoreViewParamsEvent (SUIT_ViewManager* theViewManager,
const char* theName):
- myViewManager(theViewManager),
+ myViewMgr(theViewManager),
myName(theName)
{}
virtual void Execute()
{
- myResult = View3D_i::RestoreViewParams(myViewManager, myName);
+ myResult = View3D_i::RestoreViewParams(myViewMgr, myName);
}
typedef CORBA::Boolean TResult;
TResult myResult;
return ProcessEvent(new TRestoreViewParamsEvent (myViewManager, theName));
}
- void View3D_i::Restore (SUIT_ViewWindow* theStudyFrame,
+ void View3D_i::Restore (SUIT_ViewWindow* theViewWindow,
const Storable::TRestoringMap& theMap)
{
SALOMEDS::Color aColor;
aScaleFactor[1] = VISU::Storable::FindValue(theMap,"myScaleFactor[1]").toDouble();
aScaleFactor[2] = VISU::Storable::FindValue(theMap,"myScaleFactor[2]").toDouble();
- SetBackground(theStudyFrame,aColor);
- SetPointOfView(theStudyFrame,aPosition);
- SetViewUp(theStudyFrame,aViewUp);
- SetFocalPoint(theStudyFrame,aFocalPnt);
- SetParallelScale(theStudyFrame,aParallelScale);
- ScaleView(theStudyFrame,VISU::View3D::XAxis,aScaleFactor[0]);
- ScaleView(theStudyFrame,VISU::View3D::YAxis,aScaleFactor[1]);
- ScaleView(theStudyFrame,VISU::View3D::ZAxis,aScaleFactor[2]);
+ SetBackground(theViewWindow,aColor);
+ SetPointOfView(theViewWindow,aPosition);
+ SetViewUp(theViewWindow,aViewUp);
+ SetFocalPoint(theViewWindow,aFocalPnt);
+ SetParallelScale(theViewWindow,aParallelScale);
+ ScaleView(theViewWindow,VISU::View3D::XAxis,aScaleFactor[0]);
+ ScaleView(theViewWindow,VISU::View3D::YAxis,aScaleFactor[1]);
+ ScaleView(theViewWindow,VISU::View3D::ZAxis,aScaleFactor[2]);
}
- string View3D_i::ToString (SUIT_ViewWindow* theStudyFrame)
+ string View3D_i::ToString (SUIT_ViewWindow* theViewWindow)
{
ostringstream strOut;
- Storable::DataToStream( strOut, "myComment", myComment.c_str() );
- ToStream(theStudyFrame,strOut);
- strOut<<ends;
- if(MYDEBUG) MESSAGE("View3D_i::ToString - "<<strOut.str());
+ Storable::DataToStream(strOut, "myComment", myComment.c_str());
+ ToStream(theViewWindow, strOut);
+ strOut << ends;
+ if(MYDEBUG) MESSAGE("View3D_i::ToString - " << strOut.str());
return strOut.str();
}
- void View3D_i::ToStream (SUIT_ViewWindow* theStudyFrame, std::ostringstream& theStr)
+ void View3D_i::ToStream (SUIT_ViewWindow* theViewWindow, std::ostringstream& theStr)
{
Storable::DataToStream(theStr,"myType",VISU::TVIEW3D);
float backint[3];
- GetRenderer(theStudyFrame)->GetBackground(backint);
+ GetRenderer(theViewWindow)->GetBackground(backint);
Storable::DataToStream(theStr,"myColor.R",backint[0]);
Storable::DataToStream(theStr,"myColor.G",backint[1]);
Storable::DataToStream(theStr,"myColor.B",backint[2]);
double aPosition[3];
- GetPointOfView(theStudyFrame,aPosition);
+ GetPointOfView(theViewWindow,aPosition);
Storable::DataToStream(theStr,"myPosition[0]",aPosition[0]);
Storable::DataToStream(theStr,"myPosition[1]",aPosition[1]);
Storable::DataToStream(theStr,"myPosition[2]",aPosition[2]);
double aFocalPnt[3];
- GetFocalPoint(theStudyFrame,aFocalPnt);
+ GetFocalPoint(theViewWindow,aFocalPnt);
Storable::DataToStream(theStr,"myFocalPnt[0]",aFocalPnt[0]);
Storable::DataToStream(theStr,"myFocalPnt[1]",aFocalPnt[1]);
Storable::DataToStream(theStr,"myFocalPnt[2]",aFocalPnt[2]);
double aViewUp[3];
- GetCamera(theStudyFrame)->GetViewUp(aViewUp);
+ GetCamera(theViewWindow)->GetViewUp(aViewUp);
Storable::DataToStream(theStr,"myViewUp[0]",aViewUp[0]);
Storable::DataToStream(theStr,"myViewUp[1]",aViewUp[1]);
Storable::DataToStream(theStr,"myViewUp[2]",aViewUp[2]);
- Storable::DataToStream(theStr,"myParallelScale",GetParallelScale(theStudyFrame));
+ Storable::DataToStream(theStr,"myParallelScale",GetParallelScale(theViewWindow));
double aScaleFactor[3];
- GetViewWindow(theStudyFrame)->GetScale(aScaleFactor);
+ VISU::GetViewWindow(theViewWindow)->GetScale(aScaleFactor);
Storable::DataToStream(theStr,"myScaleFactor[0]",aScaleFactor[0]);
Storable::DataToStream(theStr,"myScaleFactor[1]",aScaleFactor[1]);
Storable::DataToStream(theStr,"myScaleFactor[2]",aScaleFactor[2]);
void View3D_i::ToStream(std::ostringstream& theStr)
{
- ToStream(myViewWindow,theStr);
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ToStream(aVW, theStr);
}
void View3D_i::Close()
{
- myViewWindow->close();
+ //jfa: may be need to be enclosed in SALOME_Event?
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ aVW->close();
+ //QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+ //int aPos = aViews.find(myViewWindow);
+ //if (aPos >= 0)
+ // myViewWindow->close();
}
View3D_i::~View3D_i()
void View3D_i::SetTitle (const char* theTitle)
{
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
- (myViewWindow,&SUIT_ViewWindow::setCaption,QString(theTitle)));
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
+ (aVW,&SUIT_ViewWindow::setCaption,QString(theTitle)));
}
char* View3D_i::GetTitle()
{
- return CORBA::string_dup(myViewWindow->caption().latin1());
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ return CORBA::string_dup(aVW->caption().latin1());
+ return CORBA::string_dup("");
}
- void View3D_i::SetBackground (SUIT_ViewWindow* theStudyFrame,
+ void View3D_i::SetBackground (SUIT_ViewWindow* theViewWindow,
const SALOMEDS::Color& theColor)
{
+ //jfa: may be need to be enclosed in SALOME_Event?
int aColor[3];
aColor[0] = int(255.0*theColor.R);
aColor[1] = int(255.0*theColor.G);
aColor[2] = int(255.0*theColor.B);
- QColor aNewColor(aColor[0],aColor[1],aColor[2]);
- GetViewWindow(theStudyFrame)->setBackgroundColor(aNewColor);
+ QColor aNewColor (aColor[0],aColor[1],aColor[2]);
+ VISU::GetViewWindow(theViewWindow)->setBackgroundColor(aNewColor);
}
- SALOMEDS::Color View3D_i::GetBackground (SUIT_ViewWindow* theStudyFrame)
+ SALOMEDS::Color View3D_i::GetBackground (SUIT_ViewWindow* theViewWindow)
{
SALOMEDS::Color aColor;
float backint[3];
- GetRenderer(theStudyFrame)->GetBackground(backint);
+ GetRenderer(theViewWindow)->GetBackground(backint);
aColor.R = backint[0]; aColor.G = backint[1]; aColor.B = backint[2];
return aColor;
}
class TUpdateViewerEvent: public SALOME_Event
{
- SUIT_ViewWindow* myViewWindow;
+ SUIT_ViewWindow* myVW;
Prs3d_i* myPrs3d;
int myDisplaing;
public:
- TUpdateViewerEvent(SUIT_ViewWindow* theStudyFrame,
+ TUpdateViewerEvent(SUIT_ViewWindow* theViewWindow,
Prs3d_i* thePrs3d,
int theDisplaing):
- myViewWindow(theStudyFrame),
+ myVW(theViewWindow),
myPrs3d(thePrs3d),
myDisplaing(theDisplaing)
{}
virtual void Execute(){
- UpdateViewer(myViewWindow,myDisplaing,myPrs3d);
+ UpdateViewer(myVW, myDisplaing, myPrs3d);
}
};
void View3D_i::EraseAll()
{
if(MYDEBUG) MESSAGE("View3D_i::EraseAll");
- ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,NULL,eEraseAll));
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TUpdateViewerEvent(aVW,NULL,eEraseAll));
}
void View3D_i::DisplayAll()
{
if(MYDEBUG) MESSAGE("View3D_i::DisplayAll");
- ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,NULL,eDisplayAll));
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TUpdateViewerEvent(aVW,NULL,eDisplayAll));
}
void View3D_i::Erase (PrsObject_ptr thePrsObj)
{
if(MYDEBUG) MESSAGE("View3D_i::Erase");
+ SUIT_ViewWindow* aVW = GetViewWindow();
CORBA::Object_ptr anObj = thePrsObj;
- if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
- ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eErase));
- }
+ Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in());
+ if (aVW && aPrs)
+ ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eErase));
}
void View3D_i::Display (PrsObject_ptr thePrsObj)
{
if(MYDEBUG) MESSAGE("View3D_i::Display");
+ SUIT_ViewWindow* aVW = GetViewWindow();
CORBA::Object_ptr anObj = thePrsObj;
- if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
- ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eDisplay));
- }
+ Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in());
+ if (aVW && aPrs)
+ ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eDisplay));
}
void View3D_i::DisplayOnly (PrsObject_ptr thePrsObj)
{
if(MYDEBUG) MESSAGE("View3D_i::DisplayOnly");
+ SUIT_ViewWindow* aVW = GetViewWindow();
CORBA::Object_ptr anObj = thePrsObj;
- if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
- ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eDisplayOnly));
- }
+ Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in());
+ if (aVW && aPrs)
+ ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eDisplayOnly));
}
void View3D_i::FitAll()
{
- ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onFitAll));
- Update();
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW) {
+ ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
+ (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onFitAll));
+ Update();
+ }
}
void View3D_i::SetView (VISU::View3D::ViewType theType)
{
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (!aVW)
+ return;
+
switch (theType) {
case VISU::View3D::FRONT :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onFrontView));
+ (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onFrontView));
break;
case VISU::View3D::BACK :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onBackView));
+ (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onBackView));
break;
case VISU::View3D::LEFT :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onLeftView));
+ (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onLeftView));
break;
case VISU::View3D::RIGHT :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onRightView));
+ (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onRightView));
break;
case VISU::View3D::TOP :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onTopView));
+ (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onTopView));
break;
case VISU::View3D::BOTTOM :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onBottomView));
+ (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onBottomView));
break;
}
Update();
class TSet3DViewParamEvent: public SALOME_Event
{
public:
- typedef void (*TFun)(SUIT_ViewWindow* theStudyFrame, const CORBA::Double theParam[3]);
+ typedef void (*TFun)(SUIT_ViewWindow* theViewWindow, const CORBA::Double theParam[3]);
TSet3DViewParamEvent (TFun theFun,
- SUIT_ViewWindow* theStudyFrame,
+ SUIT_ViewWindow* theViewWindow,
const CORBA::Double theParam[3]):
myFun(theFun),
- myViewWindow(theStudyFrame),
+ myVW(theViewWindow),
myParam(theParam)
{}
- virtual void Execute(){
- myFun(myViewWindow,myParam);
+ virtual void Execute() {
+ myFun(myVW,myParam);
}
private:
TFun myFun;
- SUIT_ViewWindow* myViewWindow;
+ SUIT_ViewWindow* myVW;
const CORBA::Double* myParam;
};
- void View3D_i::SetPointOfView (SUIT_ViewWindow* theStudyFrame,
+ void View3D_i::SetPointOfView (SUIT_ViewWindow* theViewWindow,
const CORBA::Double thePosition[3])
{
- GetCamera(theStudyFrame)->SetPosition(thePosition);
+ //jfa: may be need to be enclosed in SALOME_Event?
+ GetCamera(theViewWindow)->SetPosition(thePosition);
}
void View3D_i::SetPointOfView (const VISU::View3D::XYZ thePosition)
{
if(MYDEBUG) MESSAGE("View3D_i::SetPointOfView");
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetPointOfView,myViewWindow,thePosition));
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TSet3DViewParamEvent(&SetPointOfView,aVW,thePosition));
}
- void View3D_i::GetPointOfView (SUIT_ViewWindow* theStudyFrame,
+ void View3D_i::GetPointOfView (SUIT_ViewWindow* theViewWindow,
CORBA::Double thePosition[3])
{
- GetCamera(theStudyFrame)->GetPosition(thePosition);
+ GetCamera(theViewWindow)->GetPosition(thePosition);
}
VISU::View3D::XYZ_slice* View3D_i::GetPointOfView()
{
if(MYDEBUG) MESSAGE("View3D_i::GetPointOfView");
CORBA::Double aPosition[3];
- GetPointOfView(myViewWindow,aPosition);
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ GetPointOfView(aVW,aPosition);
return VISU::View3D::XYZ_dup(aPosition);
}
- void View3D_i::SetViewUp (SUIT_ViewWindow* theStudyFrame,
+ void View3D_i::SetViewUp (SUIT_ViewWindow* theViewWindow,
const CORBA::Double theViewUp[3])
{
- GetCamera(theStudyFrame)->SetViewUp(theViewUp);
+ GetCamera(theViewWindow)->SetViewUp(theViewUp);
}
void View3D_i::SetViewUp (const VISU::View3D::XYZ theViewUp)
{
if(MYDEBUG) MESSAGE("View3D_i::SetViewUp");
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetViewUp,myViewWindow,theViewUp));
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TSet3DViewParamEvent(&SetViewUp,aVW,theViewUp));
}
- void View3D_i::GetViewUp (SUIT_ViewWindow* theStudyFrame,
+ void View3D_i::GetViewUp (SUIT_ViewWindow* theViewWindow,
CORBA::Double theViewUp[3])
{
- GetCamera(theStudyFrame)->GetViewUp(theViewUp);
+ GetCamera(theViewWindow)->GetViewUp(theViewUp);
}
VISU::View3D::XYZ_slice* View3D_i::GetViewUp()
{
if(MYDEBUG) MESSAGE("View3D_i::GetViewUp");
CORBA::Double aViewUp[3];
- GetCamera(myViewWindow)->GetViewUp(aViewUp);
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ GetCamera(aVW)->GetViewUp(aViewUp);
return VISU::View3D::XYZ_dup(aViewUp);
}
- void View3D_i::SetFocalPoint (SUIT_ViewWindow* theStudyFrame,
+ void View3D_i::SetFocalPoint (SUIT_ViewWindow* theViewWindow,
const CORBA::Double theFocalPnt[3])
{
- GetCamera(theStudyFrame)->SetFocalPoint(theFocalPnt);
+ GetCamera(theViewWindow)->SetFocalPoint(theFocalPnt);
}
void View3D_i::SetFocalPoint (const VISU::View3D::XYZ theCoord)
{
if(MYDEBUG) MESSAGE("View3D_i::SetFocalPoint");
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetFocalPoint,myViewWindow,theCoord));
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TSet3DViewParamEvent(&SetFocalPoint,aVW,theCoord));
}
- void View3D_i::GetFocalPoint (SUIT_ViewWindow* theStudyFrame,
+ void View3D_i::GetFocalPoint (SUIT_ViewWindow* theViewWindow,
CORBA::Double theFocalPnt[3])
{
- GetCamera(theStudyFrame)->GetFocalPoint(theFocalPnt);
+ GetCamera(theViewWindow)->GetFocalPoint(theFocalPnt);
}
VISU::View3D::XYZ_slice* View3D_i::GetFocalPoint()
{
if(MYDEBUG) MESSAGE("View3D_i::GetFocalPoint");
CORBA::Double aFocalPnt[3];
- GetFocalPoint(myViewWindow,aFocalPnt);
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ GetFocalPoint(aVW,aFocalPnt);
return VISU::View3D::XYZ_dup(aFocalPnt);
}
class TSetViewParamEvent: public SALOME_Event
{
public:
- typedef void (*TFun)(SUIT_ViewWindow* theStudyFrame, CORBA::Double theParam);
+ typedef void (*TFun)(SUIT_ViewWindow* theViewWindow, CORBA::Double theParam);
TSetViewParamEvent (TFun theFun,
- SUIT_ViewWindow* theStudyFrame,
+ SUIT_ViewWindow* theViewWindow,
CORBA::Double theParam):
myFun(theFun),
- myViewWindow(theStudyFrame),
+ myVW(theViewWindow),
myParam(theParam)
{}
virtual void Execute()
{
- myFun(myViewWindow,myParam);
+ myFun(myVW,myParam);
}
private:
TFun myFun;
- SUIT_ViewWindow* myViewWindow;
+ SUIT_ViewWindow* myVW;
CORBA::Double myParam;
};
- void View3D_i::SetParallelScale (SUIT_ViewWindow* theStudyFrame,
+ void View3D_i::SetParallelScale (SUIT_ViewWindow* theViewWindow,
CORBA::Double theScale)
{
- GetCamera(theStudyFrame)->SetParallelScale(theScale);
+ GetCamera(theViewWindow)->SetParallelScale(theScale);
}
void View3D_i::SetParallelScale (CORBA::Double theScale)
{
if(MYDEBUG) MESSAGE("View3D_i::SetParallelScale");
- ProcessVoidEvent(new TSetViewParamEvent(&SetParallelScale,myViewWindow,theScale));
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ ProcessVoidEvent(new TSetViewParamEvent(&SetParallelScale,aVW,theScale));
}
- CORBA::Double View3D_i::GetParallelScale (SUIT_ViewWindow* theStudyFrame)
+ CORBA::Double View3D_i::GetParallelScale (SUIT_ViewWindow* theViewWindow)
{
- return GetCamera(theStudyFrame)->GetParallelScale();
+ return GetCamera(theViewWindow)->GetParallelScale();
}
CORBA::Double View3D_i::GetParallelScale()
{
if(MYDEBUG) MESSAGE("View3D_i::GetParallelScale");
- return GetParallelScale(myViewWindow);
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW)
+ return GetParallelScale(aVW);
+ return 1.0;
}
- void View3D_i::ScaleView (SUIT_ViewWindow* theStudyFrame,
+ void View3D_i::ScaleView (SUIT_ViewWindow* theViewWindow,
VISU::View3D::Axis theAxis, CORBA::Double theParam)
{
- SVTK_ViewWindow* aViewFrame = GetViewWindow(theStudyFrame);
+ SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(theViewWindow);
double aScaleFactor[3];
- aViewFrame->GetScale(aScaleFactor);
+ aViewWindow->GetScale(aScaleFactor);
aScaleFactor[theAxis] = theParam;
- aViewFrame->SetScale(aScaleFactor);
+ aViewWindow->SetScale(aScaleFactor);
}
- void SetScaleView (SUIT_ViewWindow* theStudyFrame, const CORBA::Double theScale[3])
+ void SetScaleView (SUIT_ViewWindow* theViewWindow, const CORBA::Double theScale[3])
{
double aScale[3] = {theScale[0], theScale[1], theScale[2]};
- GetViewWindow(theStudyFrame)->SetScale(aScale);
+ VISU::GetViewWindow(theViewWindow)->SetScale(aScale);
}
void View3D_i::ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam)
{
if(MYDEBUG) MESSAGE("View3D_i::ScaleView");
- double aScale[3];
- GetViewWindow(myViewWindow)->GetScale(aScale);
- aScale[theAxis] = theParam;
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,myViewWindow,aScale));
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW) {
+ double aScale[3];
+ VISU::GetViewWindow(aVW)->GetScale(aScale);
+ aScale[theAxis] = theParam;
+ ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,aVW,aScale));
+ }
}
void View3D_i::RemoveScale()
{
if(MYDEBUG) MESSAGE("View3D_i::RemoveScale");
- double aScale[3] = {1.0, 1.0, 1.0};
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,myViewWindow,aScale));
+ SUIT_ViewWindow* aVW = GetViewWindow();
+ if (aVW) {
+ double aScale[3] = {1.0, 1.0, 1.0};
+ ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,aVW,aScale));
+ }
}
}