#include "SVTK_ViewWindow.h"
#include "SVTK_ViewModel.h"
-#include "SVTK_RenderWindow.h"
#include "SPlot2d_ViewModel.h"
#include "Plot2d_ViewFrame.h"
#include <QtxWorkstack.h>
#include <qworkspace.h>
+#include <qimage.h>
#include <vtkCamera.h>
#include <vtkRenderer.h>
const int mode,
const double xMin, const double xMax,
const double yMin, const double yMax):
- myView(theView),
+ myView(theView),
myMode(mode),
myXMin(xMin),myXMax(xMax),
myYMin(yMin),myYMax(yMax)
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::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;
struct TCreateView3dEvent: public SALOME_Event
{
+ SalomeApp_Application *myApplication;
View3D_i * myView3D;
int myNew;
typedef SUIT_ViewWindow* TResult;
TResult myResult;
- TCreateView3dEvent (View3D_i * theView3D,
+ TCreateView3dEvent (SalomeApp_Application *theApplication,
+ View3D_i * theView3D,
const int theNew):
+ myApplication(theApplication),
myView3D(theView3D),
myNew(theNew),
myResult(NULL)
void
Execute()
{
- if (!myView3D->myApplication)
+ if (!myApplication)
return;
- SUIT_ViewManager * aViewMgr =
- myView3D->myApplication->getViewManager(SVTK_Viewer::Type(), false);
-
- if (aViewMgr) {
- if (myNew) {
- myResult = aViewMgr->createViewWindow();
- } else {
- myResult = aViewMgr->getActiveView();
+ if(myNew){
+ if(SUIT_ViewManager* aViewManager = myApplication->getViewManager(SVTK_Viewer::Type(),false)){
+ myResult = aViewManager->createViewWindow();
+ myView3D->myViewManager = aViewManager;
+ }else{
+ if(SUIT_ViewManager* aViewManager = myApplication->getViewManager(SVTK_Viewer::Type(),true)){
+ myResult = aViewManager->getActiveView();
+ myView3D->myViewManager = aViewManager;
+ }
}
- } else {
- if (myNew) {
- aViewMgr = myView3D->myApplication->getViewManager(SVTK_Viewer::Type(), true);
- myResult = aViewMgr->getActiveView();
- } else {
- return; // there are no current 3D view
+ }else{
+ if(SUIT_ViewManager* aViewManager = myApplication->activeViewManager()){
+ if(SUIT_ViewWindow* aView = aViewManager->getActiveView()){
+ if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aView)){
+ myView3D->myViewManager = aViewManager;
+ myResult = aViewManager->getActiveView();
+ }
+ }
+ }else{
+ if(SUIT_ViewManager* aViewManager = myApplication->getViewManager(SVTK_Viewer::Type(),false)){
+ myView3D->myViewManager = aViewManager;
+ myResult = aViewManager->getActiveView();
+ }
}
}
-
- myView3D->myViewManager = aViewMgr;
}
};
Storable* View3D_i::Create (int theNew)
{
if (MYDEBUG) MESSAGE("View3D_i::Create");
- SUIT_ViewWindow* aVW = ProcessEvent(new TCreateView3dEvent(this, theNew));
+ SUIT_ViewWindow* aVW = ProcessEvent(new TCreateView3dEvent(myApplication, this, theNew));
if (aVW) {
SetViewWindow(aVW);
return this;
{}
virtual void Execute()
{
- SVTK_ViewWindow* vf = VISU::GetViewWindow(myVW);
+ SVTK_ViewWindow* vf = dynamic_cast<SVTK_ViewWindow*>(myVW);
vtkRenderer* Renderer = vf->getRenderer();
vtkActorCollection* theActors = Renderer->GetActors();
theActors->InitTraversal();
SetViewUp(theViewWindow,aViewUp);
SetFocalPoint(theViewWindow,aFocalPnt);
SetParallelScale(theViewWindow,aParallelScale);
- SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(theViewWindow);
- aViewWindow->SetScale(aScaleFactor);
+ ScaleView(theViewWindow,VISU::View3D::XAxis,aScaleFactor[0]);
+ ScaleView(theViewWindow,VISU::View3D::YAxis,aScaleFactor[1]);
+ ScaleView(theViewWindow,VISU::View3D::ZAxis,aScaleFactor[2]);
}
Storable::DataToStream(theStr,"myParallelScale",GetParallelScale(theViewWindow));
double aScaleFactor[3];
- VISU::GetViewWindow(theViewWindow)->GetScale(aScaleFactor);
+ (dynamic_cast<SVTK_ViewWindow*>(theViewWindow))->GetScale(aScaleFactor);
Storable::DataToStream(theStr,"myScaleFactor[0]",aScaleFactor[0]);
Storable::DataToStream(theStr,"myScaleFactor[1]",aScaleFactor[1]);
Storable::DataToStream(theStr,"myScaleFactor[2]",aScaleFactor[2]);
aColor[1] = int(255.0*theColor.G);
aColor[2] = int(255.0*theColor.B);
QColor aNewColor (aColor[0],aColor[1],aColor[2]);
- VISU::GetViewWindow(theViewWindow)->setBackgroundColor(aNewColor);
+ (dynamic_cast<SVTK_ViewWindow*>(theViewWindow))->setBackgroundColor(aNewColor);
}
SALOMEDS::Color View3D_i::GetBackground (SUIT_ViewWindow* theViewWindow)
SUIT_ViewWindow* aVW = GetViewWindow();
if (aVW) {
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onFitAll));
+ (dynamic_cast<SVTK_ViewWindow*>(aVW), &SVTK_ViewWindow::onFitAll));
Update();
}
}
switch (theType) {
case VISU::View3D::FRONT :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onFrontView));
+ (dynamic_cast<SVTK_ViewWindow*>(aVW), &SVTK_ViewWindow::onFrontView));
break;
case VISU::View3D::BACK :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onBackView));
+ (dynamic_cast<SVTK_ViewWindow*>(aVW), &SVTK_ViewWindow::onBackView));
break;
case VISU::View3D::LEFT :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onLeftView));
+ (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onLeftView));
break;
case VISU::View3D::RIGHT :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onRightView));
+ (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onRightView));
break;
case VISU::View3D::TOP :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onTopView));
+ (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onTopView));
break;
case VISU::View3D::BOTTOM :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onBottomView));
+ (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onBottomView));
break;
}
Update();
void View3D_i::ScaleView (SUIT_ViewWindow* theViewWindow,
VISU::View3D::Axis theAxis, CORBA::Double theParam)
{
- SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(theViewWindow);
+ SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(theViewWindow);
double aScaleFactor[3];
aViewWindow->GetScale(aScaleFactor);
aScaleFactor[theAxis] = theParam;
void SetScaleView (SUIT_ViewWindow* theViewWindow, const CORBA::Double theScale[3])
{
double aScale[3] = {theScale[0], theScale[1], theScale[2]};
- VISU::GetViewWindow(theViewWindow)->SetScale(aScale);
+ (dynamic_cast<SVTK_ViewWindow*>(theViewWindow))->SetScale(aScale);
}
void View3D_i::ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam)
SUIT_ViewWindow* aVW = GetViewWindow();
if (aVW) {
double aScale[3];
- VISU::GetViewWindow(aVW)->GetScale(aScale);
+ (dynamic_cast<SVTK_ViewWindow*>(aVW))->GetScale(aScale);
aScale[theAxis] = theParam;
ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,aVW,aScale));
}