1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
23 // File : VISU_View_i.cc
24 // Author : Alexey PETROV
27 #include "VISU_View_i.hh"
29 #include "VISU_Gen_i.hh"
30 #include "VISU_Prs3d_i.hh"
31 #include "VISU_Table_i.hh"
32 #include "VISU_ViewManager_i.hh"
34 #include "VisuGUI_TableDlg.h"
36 #include "VISU_Actor.h"
38 #include "SALOME_Event.hxx"
40 #include "SUIT_ViewWindow.h"
41 #include "SUIT_ViewManager.h"
42 #include "SUIT_Tools.h"
44 #include "STD_MDIDesktop.h"
45 #include "STD_TabDesktop.h"
47 #include "SVTK_ViewWindow.h"
48 #include "SVTK_ViewModel.h"
49 #include "SVTK_RenderWindow.h"
51 #include "SPlot2d_ViewModel.h"
52 #include "Plot2d_ViewFrame.h"
53 #include "Plot2d_ViewModel.h"
55 #include "SalomeApp_Application.h"
56 #include "SalomeApp_Study.h"
58 #include <QtxWorkstack.h>
60 #include <qworkspace.h>
62 #include <vtkCamera.h>
63 #include <vtkRenderer.h>
68 static int MYDEBUG = 0;
70 static int MYDEBUG = 0;
75 typedef TVoidMemFunEvent<SUIT_ViewWindow> TFrameActionEvent;
77 struct TNewViewEvent: public SALOME_Event
79 SalomeApp_Application* myApplication;
80 typedef QWidget* TResult;
83 TNewViewEvent (SalomeApp_Application* theApplication):
84 myApplication(theApplication),
92 if (STD_MDIDesktop* aDesktop = dynamic_cast<STD_MDIDesktop*>(myApplication->desktop())) {
93 myResult = aDesktop->workspace();
99 View_i (SalomeApp_Application *theApplication,
100 SUIT_ViewManager* theViewManager):
101 myApplication(theApplication),
103 myViewManager(theViewManager)
105 if(MYDEBUG) MESSAGE("View_i::View_i - "<<this);
106 myWorkspace = ProcessEvent(new TNewViewEvent(theApplication));
112 if(MYDEBUG) MESSAGE("View_i::~View_i - "<<this);
116 struct TApplicationEvent: public SALOME_Event
118 SalomeApp_Application* myApplication;
120 TApplicationEvent(SalomeApp_Application* theApplication):
121 myApplication(theApplication)
127 ShowPart (VISU::View::ViewRepresentation theViewRepresentation,
128 CORBA::Boolean theState)
130 struct TEvent: public TApplicationEvent
132 VISU::View::ViewRepresentation myViewRepresentation;
133 CORBA::Boolean myState;
135 TEvent(SalomeApp_Application* theApplication,
136 VISU::View::ViewRepresentation theViewRepresentation,
137 CORBA::Boolean theState):
138 TApplicationEvent(theApplication),
139 myViewRepresentation(theViewRepresentation),
147 switch(myViewRepresentation){
148 case VISU::View::OBJECTBROWSER:
149 myApplication->setWindowShown(SalomeApp_Application::WT_ObjectBrowser,myState);
151 case VISU::View::PYTHON:
152 myApplication->setWindowShown(SalomeApp_Application::WT_PyConsole,myState);
154 case VISU::View::MESSAGES:
155 myApplication->setWindowShown(SalomeApp_Application::WT_LogWindow,myState);
157 case VISU::View::VIEWER:{
158 ViewManagerList aViewManagerList = myApplication->viewManagers();
166 ProcessVoidEvent(new TEvent(myApplication,theViewRepresentation,theState));
169 struct TPartShownEvent: public TApplicationEvent
171 VISU::View::ViewRepresentation myViewRepresentation;
172 typedef bool TResult;
175 TPartShownEvent(SalomeApp_Application* theApplication,
176 VISU::View::ViewRepresentation theViewRepresentation):
177 TApplicationEvent(theApplication),
178 myViewRepresentation(theViewRepresentation),
186 switch(myViewRepresentation){
187 case VISU::View::OBJECTBROWSER:
188 myResult = myApplication->isWindowVisible(SalomeApp_Application::WT_ObjectBrowser);
190 case VISU::View::PYTHON:
191 myResult = myApplication->isWindowVisible(SalomeApp_Application::WT_PyConsole);
193 case VISU::View::MESSAGES:
194 myResult = myApplication->isWindowVisible(SalomeApp_Application::WT_LogWindow);
196 case VISU::View::VIEWER:{
197 ViewManagerList aViewManagerList = myApplication->viewManagers();
207 IsPartShown (VISU::View::ViewRepresentation theViewRepresentation)
209 return ProcessEvent(new TPartShownEvent(myApplication,theViewRepresentation));
212 enum SplitSide {SPLIT_LEFT, SPLIT_RIGHT, SPLIT_TOP, SPLIT_BOTTOM};
214 struct TSplitEvent: public SALOME_Event
216 SalomeApp_Application * myApplication;
217 SUIT_ViewWindow * myViewWindow;
218 SplitSide mySplitSide;
221 TSplitEvent (SalomeApp_Application * theApplication,
222 SUIT_ViewWindow * theViewWindow,
223 SplitSide theSplitSide):
224 myApplication(theApplication),
225 myViewWindow(theViewWindow),
226 mySplitSide(theSplitSide)
233 MESSAGE("TSplitEvent::Execute()");
234 SUIT_Desktop* desk = myApplication->desktop();
235 STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
237 MESSAGE("TSplitEvent::Execute() - tabDesk");
238 QtxWorkstack* workstack = tabDesk->workstack();
240 MESSAGE("TSplitEvent::Execute() - workstack");
241 QWidgetList vws = workstack->splitWindowList();
242 if (vws.count() > 1) {
243 MESSAGE("TSplitEvent::Execute() - vws.count() > 1");
244 //jfa tmp:workstack->windowActivated(myViewWindow);
245 //??? to do: set workarea of this vw as active area
246 switch (mySplitSide) {
249 workstack->split(Qt::Horizontal);
253 workstack->split(Qt::Vertical);
266 ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow,SPLIT_RIGHT));
273 ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow,SPLIT_BOTTOM));
276 struct TSetViewSize: public SALOME_Event
278 SUIT_ViewWindow* myViewWindow;
279 typedef void (QRect::* TAction)(int);
284 TSetViewSize(SUIT_ViewWindow* theViewWindow,
286 CORBA::Long theSize):
287 myViewWindow(theViewWindow),
296 if (QWidget* aParent = myViewWindow->parentWidget(true)) {
297 QRect aQRect = aParent->frameGeometry();
298 (aQRect.*myAction)(mySize);
299 aParent->setGeometry(aQRect);
306 SetViewWidth(CORBA::Long theWidth)
308 ProcessVoidEvent(new TSetViewSize(myViewWindow,&QRect::setWidth,theWidth));
313 SetViewHeight(CORBA::Long theHeight)
315 ProcessVoidEvent(new TSetViewSize(myViewWindow,&QRect::setHeight,theHeight));
319 struct TGetViewSize: public SALOME_Event
321 SUIT_ViewWindow* myViewWindow;
323 typedef int (QRect::* TAction)() const;
326 typedef CORBA::Long TResult;
330 TGetViewSize(SUIT_ViewWindow* theViewWindow,
332 myViewWindow(theViewWindow),
340 if(QWidget* aParent = myViewWindow->parentWidget(true)){
341 QRect aQRect = aParent->frameGeometry();
342 myResult = (aQRect.*myAction)();
352 return ProcessEvent(new TGetViewSize(myViewWindow,&QRect::width));
359 return ProcessEvent(new TGetViewSize(myViewWindow,&QRect::height));
363 class TWorkspaceEvent: public SALOME_Event
366 QWidget* myViewWindow;
367 QWidget* myWorkspace;
370 TWorkspaceEvent(QWidget* theViewWindow,
371 QWidget* theWorkspace):
372 myViewWindow(theViewWindow),
373 myWorkspace(theWorkspace)
378 class TAlignEvent: public TWorkspaceEvent
381 Qt::AlignmentFlags myAligment;
384 TAlignEvent(QWidget* theViewWindow,
385 QWidget* theWorkspace,
386 Qt::AlignmentFlags theAligment):
387 TWorkspaceEvent(theViewWindow,theWorkspace),
388 myAligment(theAligment)
395 if(QWidget* aParent = myViewWindow->parentWidget(true))
396 SUIT_Tools::alignWidget(aParent,myWorkspace,myAligment);
403 SetViewPositionHorizontal (VISU::View::ViewPosition theViewPosition)
406 switch (theViewPosition) {
407 case VISU::View::LEFT:
408 ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignLeft));
410 case VISU::View::CENTER:
411 ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignHCenter));
413 case VISU::View::RIGHT:
414 ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignRight));
423 SetViewPositionVertical (VISU::View::ViewPosition theViewPosition)
426 switch (theViewPosition) {
427 case VISU::View::TOP:
428 ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignTop));
430 case VISU::View::CENTER:
431 ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignVCenter));
433 case VISU::View::BOTTOM:
434 ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignBottom));
441 class TXYEvent: public TWorkspaceEvent
444 CORBA::Double myX, myY;
447 TXYEvent(QWidget* theViewWindow,
448 QWidget* theWorkspace,
451 TWorkspaceEvent(theViewWindow,theWorkspace),
460 SetRelativePosition (CORBA::Double theX, CORBA::Double theY)
462 struct TEvent: public TXYEvent
465 TEvent(QWidget* theViewWindow,
466 QWidget* theWorkspace,
469 TXYEvent(theViewWindow,theWorkspace,theX,theY)
476 if(QWidget* aParent = myViewWindow->parentWidget(true))
477 aParent->move(int(myX*myWorkspace->width()),int(myY*myWorkspace->height()));
482 ProcessVoidEvent(new TEvent(myViewWindow,myWorkspace,theX,theY));
487 SetRelativeSize (CORBA::Double theX, CORBA::Double theY)
489 struct TEvent: public TXYEvent
492 TEvent(QWidget* theViewWindow,
493 QWidget* theWorkspace,
496 TXYEvent(theViewWindow,theWorkspace,theX,theY)
503 if(QWidget* aParent = myViewWindow->parentWidget(true))
504 aParent->setGeometry(aParent->x(),
506 int(myX*myWorkspace->width()),
507 int(myY*myWorkspace->height()));
512 ProcessVoidEvent(new TEvent(myViewWindow,myWorkspace,theX,theY));
517 SetBackground (const SALOMEDS::Color& theColor)
519 struct TEvent: public SALOME_Event
522 SALOMEDS::Color myColor;
524 TEvent(QWidget* theWidget,
525 const SALOMEDS::Color& theColor):
529 virtual void Execute(){
531 aColor[0] = int(255.0*myColor.R);
532 aColor[1] = int(255.0*myColor.G);
533 aColor[2] = int(255.0*myColor.B);
534 myWidget->setBackgroundColor(QColor(aColor[0],aColor[1],aColor[2]));
538 ProcessVoidEvent(new TEvent(myViewWindow,theColor));
542 struct TBackgroundEvent: public SALOME_Event
545 typedef SALOMEDS::Color TResult;
548 TBackgroundEvent(QWidget* theWidget):
556 const QColor& aColor = myWidget->backgroundColor();
557 myResult.R = aColor.red()/255.0;
558 myResult.G = aColor.green()/255.0;
559 myResult.B = aColor.blue()/255.0;
567 return ProcessEvent(new TBackgroundEvent(myViewWindow));
574 ProcessVoidEvent(new TFrameActionEvent(myViewWindow,&SUIT_ViewWindow::showMinimized));
581 ProcessVoidEvent(new TFrameActionEvent(myViewWindow,&SUIT_ViewWindow::showNormal));
588 ProcessVoidEvent(new TFrameActionEvent(myViewWindow,&SUIT_ViewWindow::showMaximized));
603 Erase (PrsObject_ptr thePrsObj)
608 Display (PrsObject_ptr thePrsObj)
613 DisplayOnly (PrsObject_ptr thePrsObj)
621 class TSavePictureEvent: public SALOME_Event
623 SUIT_ViewWindow * myViewWindow;
624 const char * myFileName;
626 typedef CORBA::Boolean TResult;
628 TSavePictureEvent (SUIT_ViewWindow * theViewWindow, const char * theFileName)
629 : myViewWindow(theViewWindow),
630 myFileName(theFileName),
635 virtual void Execute()
638 QImage img = myViewWindow->dumpView();
640 QString fileName (myFileName);
641 if (!fileName.isEmpty()) {
642 QString fmt = SUIT_Tools::extension(fileName).upper();
643 if (fmt.isEmpty()) fmt = QString("BMP"); // default format
644 if (fmt == "JPG" ) fmt = "JPEG";
645 //QApplication::setOverrideCursor(Qt::waitCursor);
646 img.save(fileName, fmt.latin1());
647 //QApplication::restoreOverrideCursor();
655 View_i::SavePicture(const char* theFileName)
657 return ProcessEvent(new TSavePictureEvent (myViewWindow,theFileName));
669 ToStream (std::ostringstream& theStr)
674 //================= OLD CODE ===================
676 //QAD_Study* CheckStudy (SALOMEDS::Study_ptr theStudy)
678 // //QAD_Desktop* aDesktop = QAD_Application::getDesktop();
679 // //QAD_Study* aStudy = aDesktop->findStudy(theStudy);
681 // CORBA::String_var aName = theStudy->Name();
682 // aFileInfo.setFile(aName.in());
683 // if (aFileInfo.exists())
684 // aStudy = aDesktop->loadStudy(aFileInfo.baseName());
686 // aStudy = aDesktop->loadStudy(aName.in());
688 // MESSAGE("CheckStudy()::ERROR: Can't load study");
694 template<class TViewer>
695 struct TNewSpecViewEvent: public SALOME_Event
697 SalomeApp_Application* myApplication;
699 typedef SUIT_ViewManager* TResult;
702 TNewSpecViewEvent (SalomeApp_Application* theApplication):
703 myApplication(theApplication),
711 myResult = myApplication->getViewManager(TViewer::Type(), true);
715 //===========================================================================
716 XYPlot_i::XYPlot_i (SalomeApp_Application* theApplication)
717 : View_i(theApplication, NULL)
719 if (MYDEBUG) MESSAGE("XYPlot_i::XYPlot_i");
720 if (theApplication) {
721 myViewManager = ProcessEvent(new TNewSpecViewEvent<Plot2d_Viewer>(theApplication));
726 struct TCreatePlot2dViewEvent: public SALOME_Event
728 SUIT_ViewManager* myViewManager;
729 XYPlot_i * myPlot2dView;
732 typedef Plot2d_ViewFrame* TResult;
735 TCreatePlot2dViewEvent (SUIT_ViewManager* theViewManager,
736 XYPlot_i * thePlot2dView,
738 myViewManager(theViewManager),
739 myPlot2dView(thePlot2dView),
749 myPlot2dView->myViewWindow = myViewManager->createViewWindow();
751 myPlot2dView->myViewWindow = myViewManager->getActiveView();
753 if (myPlot2dView->myViewWindow) {
754 Plot2d_ViewWindow* aPlot2dVW = dynamic_cast<Plot2d_ViewWindow*>(myPlot2dView->myViewWindow);
756 myResult = aPlot2dVW->getViewFrame();
765 Storable* XYPlot_i::Create (int theNew)
767 myView = ProcessEvent(new TCreatePlot2dViewEvent(myViewManager, this, theNew));
771 void XYPlot_i::Update()
773 ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame>(myView,&Plot2d_ViewFrame::Repaint));
776 void XYPlot_i::Close()
778 //jfa: may be need to be enclosed in SALOME_Event?
779 myViewWindow->close();
782 XYPlot_i::~XYPlot_i() {
783 if(MYDEBUG) MESSAGE("XYPlot_i::~XYPlot_i");
786 void XYPlot_i::SetTitle (const char* theTitle)
788 ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
789 (myViewWindow, &SUIT_ViewWindow::setCaption, QString(theTitle)));
791 char* XYPlot_i::GetTitle()
793 //jfa: may be need to be enclosed in SALOME_Event?
794 return CORBA::string_dup(myViewWindow->caption().latin1());
797 void XYPlot_i::SetSubTitle (const char* theTitle)
799 ProcessVoidEvent(new TVoidMemFun1ArgEvent<Plot2d_ViewFrame,const QString&,QString>
800 (myView, &Plot2d_ViewFrame::setTitle, QString(theTitle)));
803 char* XYPlot_i::GetSubTitle()
805 //jfa: may be need to be enclosed in SALOME_Event?
806 return CORBA::string_dup(myView->getTitle());
809 void XYPlot_i::SetCurveType (VISU::XYPlot::CurveType theType)
811 ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
812 (myView,&Plot2d_ViewFrame::setCurveType,theType,true));
815 VISU::XYPlot::CurveType XYPlot_i::GetCurveType()
817 //jfa: may be need to be enclosed in SALOME_Event?
818 return (VISU::XYPlot::CurveType)myView->getCurveType();
821 void XYPlot_i::SetMarkerSize (CORBA::Long theSize)
823 ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
824 (myView,&Plot2d_ViewFrame::setMarkerSize,theSize,true));
827 CORBA::Long XYPlot_i::GetMarkerSize()
829 //jfa: may be need to be enclosed in SALOME_Event?
830 return myView->getMarkerSize();
833 class TEnableGridEvent: public SALOME_Event
836 typedef void (Plot2d_ViewFrame::* TFun)(bool, const int, bool, const int, bool);
837 TEnableGridEvent (Plot2d_ViewFrame* theView, TFun theFun,
838 CORBA::Boolean theMajor, CORBA::Long theNumMajor,
839 CORBA::Boolean theMinor, CORBA::Long theNumMinor):
840 myView(theView), myFun(theFun),
841 myMajor(theMajor), myNumMajor(theNumMajor),
842 myMinor(theMinor), myNumMinor(theNumMinor)
845 virtual void Execute()
847 (myView->*myFun)(myMajor,myNumMajor,myMinor,myNumMinor,true);
850 Plot2d_ViewFrame* myView;
852 CORBA::Boolean myMajor, myNumMajor;
853 CORBA::Boolean myMinor, myNumMinor;
856 void XYPlot_i::EnableXGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
857 CORBA::Boolean theMinor, CORBA::Long theNumMinor)
859 ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setXGrid,
860 theMajor,theNumMajor,theMinor,theNumMinor));
862 void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor,
863 CORBA::Boolean theMinor, CORBA::Long theNumMinor)
865 //jfa tmp:ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setYGrid,
866 //jfa tmp: theMajor,theNumMajor,theMinor,theNumMinor));
869 class TSetScaleModeEvent: public SALOME_Event
872 typedef void (Plot2d_ViewFrame::* TFun)(const int, bool);
873 TSetScaleModeEvent (Plot2d_ViewFrame* theView, TFun theFun, int theScaling):
874 myView(theView), myFun(theFun), myScaling(theScaling)
877 virtual void Execute()
879 (myView->*myFun)(myScaling,true);
882 Plot2d_ViewFrame* myView;
887 void XYPlot_i::SetHorScaling (VISU::Scaling theScaling)
889 ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setHorScaleMode,
890 theScaling == VISU::LOGARITHMIC));
893 VISU::Scaling XYPlot_i::GetHorScaling()
895 //jfa: may be need to be enclosed in SALOME_Event?
896 return (VISU::Scaling)myView->getHorScaleMode();
899 void XYPlot_i::SetVerScaling(VISU::Scaling theScaling)
901 ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setVerScaleMode,
902 theScaling == VISU::LOGARITHMIC));
905 VISU::Scaling XYPlot_i::GetVerScaling()
907 //jfa: may be need to be enclosed in SALOME_Event?
908 return (VISU::Scaling)myView->getVerScaleMode();
911 class TSetTitleEvent: public SALOME_Event
914 TSetTitleEvent (Plot2d_ViewFrame* theView, Plot2d_ViewFrame::ObjectType theType, const char* theTitle):
915 myView(theView), myType(theType), myTitle(theTitle)
917 virtual void Execute()
919 myView->setTitle(true,myTitle,myType);
922 Plot2d_ViewFrame* myView;
923 Plot2d_ViewFrame::ObjectType myType;
927 void XYPlot_i::SetXTitle (const char* theTitle)
929 ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::XTitle, theTitle));
931 char* XYPlot_i::GetXTitle()
933 //jfa: may be need to be enclosed in SALOME_Event?
934 return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::XTitle));
937 void XYPlot_i::SetYTitle (const char* theTitle)
939 ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::YTitle, theTitle));
941 char* XYPlot_i::GetYTitle()
943 //jfa: may be need to be enclosed in SALOME_Event?
944 return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::YTitle));
947 void XYPlot_i::ShowLegend (CORBA::Boolean theShowing)
949 ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,bool,bool>
950 (myView,&Plot2d_ViewFrame::showLegend,theShowing,true));
953 class TXYPlotViewEvent: public SALOME_Event
955 SalomeApp_Application* myApplication;
956 Plot2d_ViewFrame* myView;
957 PrsObject_ptr myPrsObj;
961 TXYPlotViewEvent(SalomeApp_Application* theApplication,
962 Plot2d_ViewFrame* theView,
963 PrsObject_ptr thePrsObj,
965 : myApplication(theApplication),
968 myDisplaing(theDisplaing)
972 virtual void Execute()
975 if (Curve_i* aCurve = dynamic_cast<Curve_i*>(VISU::GetServant(myPrsObj).in())) {
976 UpdatePlot2d(myView,myDisplaing,aCurve);
979 if (Container_i* aContainer = dynamic_cast<Container_i*>(VISU::GetServant(myPrsObj).in())) {
980 int nbCurves = aContainer->GetNbCurves();
981 for ( int i = 1; i <= nbCurves; i++ ) {
982 VISU::Curve_i* aCurve = aContainer->GetCurve( i );
983 if ( aCurve && aCurve->IsValid() ) {
984 UpdatePlot2d(myView,myDisplaing,aCurve);
990 if (Table_i* aTable = dynamic_cast<Table_i*>(VISU::GetServant(myPrsObj).in())) {
992 if (SUIT_Study* aSStudy = myApplication->activeStudy()) {
993 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
994 aCStudy = aStudy->studyDS();
997 if (!aCStudy) return;
998 _PTR(SObject) TableSO = aCStudy->FindObjectID(aTable->GetEntry().latin1());
1000 _PTR(ChildIterator) Iter = aCStudy->NewChildIterator(TableSO);
1001 for (; Iter->More(); Iter->Next()) {
1002 CORBA::Object_var childObject = VISU::ClientSObjectToObject(Iter->Value());
1003 if (!CORBA::is_nil(childObject)) {
1004 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(childObject);
1005 if (!CORBA::is_nil(aCurve))
1006 UpdatePlot2d(myView, myDisplaing,
1007 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in()));
1016 void XYPlot_i::Display (PrsObject_ptr thePrsObj)
1018 ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eDisplay));
1021 void XYPlot_i::Erase (PrsObject_ptr thePrsObj)
1023 ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eErase));
1026 void XYPlot_i::DisplayOnly (PrsObject_ptr thePrsObj)
1028 ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eDisplayOnly));
1031 void XYPlot_i::EraseAll()
1033 ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::EraseAll));
1036 void XYPlot_i::FitAll()
1038 ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::fitAll));
1042 //===========================================================================
1043 TableView_i::TableView_i (SalomeApp_Application* theApplication)
1044 : View_i(theApplication, NULL)
1048 struct TCreateTableViewEvent: public SALOME_Event
1050 SalomeApp_Application* myApplication;
1051 VISU::Table_i* myTable;
1053 typedef VisuGUI_TableDlg* TResult;
1056 TCreateTableViewEvent (SalomeApp_Application* theApplication,
1057 VISU::Table_i* theTable):
1058 myApplication(theApplication),
1067 if (myTable != NULL) {
1068 if (SUIT_Study* aSStudy = myApplication->activeStudy()) {
1069 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
1070 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
1071 _PTR(SObject) aSObject = aCStudy->FindObjectID(myTable->GetObjectEntry());
1073 myResult = new VisuGUI_TableDlg (myApplication->desktop(),
1076 VisuGUI_TableDlg::ttAuto,
1087 Storable* TableView_i::Create (VISU::Table_ptr theTable)
1089 if (MYDEBUG) MESSAGE("TableView_i::Create - " << (!theTable->_is_nil()));
1090 if (!theTable->_is_nil()) {
1091 VISU::Table_i* table =
1092 dynamic_cast<VISU::Table_i*>(VISU::GetServant(theTable).in());
1093 if (MYDEBUG) MESSAGE("TableView_i::Create - dynamic_cast = " << table);
1095 myView = ProcessEvent(new TCreateTableViewEvent(myApplication, table));
1102 TableView_i::~TableView_i()
1104 if(MYDEBUG) MESSAGE("TableView_i::~TableView_i");
1108 void TableView_i::SetTitle (const char* theTitle)
1110 ProcessVoidEvent(new TVoidMemFun1ArgEvent<VisuGUI_TableDlg,const QString&,QString>
1111 (myView, &VisuGUI_TableDlg::setCaption, QString(theTitle)));
1114 char* TableView_i::GetTitle()
1116 //jfa: may be need to be enclosed in SALOME_Event?
1117 return CORBA::string_dup(myView->caption().latin1());
1120 void TableView_i::Close()
1122 //jfa: may be need to be enclosed in SALOME_Event?
1127 //===========================================================================
1128 int View3D_i::myNbViewParams = 0;
1129 const string View3D_i::myComment = "VIEW3D";
1130 const char* View3D_i::GetComment() const { return myComment.c_str();}
1132 QString View3D_i::GenerateViewParamsName()
1134 return VISU::GenerateName("ViewParams", ++myNbViewParams);
1137 View3D_i::View3D_i (SalomeApp_Application* theApplication)
1138 : View_i(theApplication, NULL)
1140 if (MYDEBUG) MESSAGE("View3D_i::View3D_i");
1141 if (theApplication) {
1142 myViewManager = ProcessEvent(new TNewSpecViewEvent<SVTK_Viewer>(theApplication));
1146 struct TCreateView3dEvent: public SALOME_Event
1148 SUIT_ViewManager* myViewManager;
1151 typedef SUIT_ViewWindow* TResult;
1154 TCreateView3dEvent (SUIT_ViewManager* theViewManager,
1156 myViewManager(theViewManager),
1166 myResult = myViewManager->createViewWindow();
1168 myResult = myViewManager->getActiveView();
1173 Storable* View3D_i::Create (int theNew)
1175 if (MYDEBUG) MESSAGE("View3D_i::Create");
1176 myViewWindow = ProcessEvent(new TCreateView3dEvent(myViewManager, theNew));
1180 void View3D_i::Update()
1182 class TEvent: public SALOME_Event
1184 SUIT_ViewWindow* myViewWindow;
1186 TEvent(SUIT_ViewWindow* theStudyFrame):
1187 myViewWindow(theStudyFrame)
1189 virtual void Execute()
1191 SVTK_ViewWindow* vf = GetViewWindow(myViewWindow);
1192 vtkRenderer* Renderer = vf->getRenderer();
1193 vtkActorCollection* theActors = Renderer->GetActors();
1194 theActors->InitTraversal();
1195 while (vtkActor *anAct = theActors->GetNextActor()) {
1196 if (VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)) {
1197 VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d();
1198 if (anActor->GetVisibility() && aPrs3d) {
1200 aPrs3d->UpdateActor(anActor);
1204 RepaintView(myViewWindow);
1207 ProcessVoidEvent(new TEvent(myViewWindow));
1210 bool View3D_i::SaveViewParams (SUIT_ViewManager* theViewManager, const char* theName)
1212 MESSAGE("View3D_i::SaveViewParams()");
1213 _PTR(Study) aCStudy;
1214 if (SUIT_Study* aSStudy = theViewManager->study()) {
1215 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
1216 aCStudy = aStudy->studyDS();
1223 std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName, "VISU");
1224 _PTR(GenericAttribute) anAttr;
1225 int iEnd = aList.size();
1226 for (int i = 0; i < iEnd; i++) {
1227 _PTR(SObject) anObj = aList[i];
1228 string anEntry = anObj->GetID();
1229 if(MYDEBUG) MESSAGE("View3D_i::SaveViewParams - anEntry = " << anEntry);
1230 if (anObj->FindAttribute(anAttr, "AttributeComment")) {
1231 _PTR(AttributeComment) aCmnt (anAttr);
1232 string aComm (aCmnt->Value());
1233 if (MYDEBUG) MESSAGE("View3D_i::SaveViewPoint - aComm = " << aComm);
1234 if (aComm.compare(View3D_i::myComment) >= 0) {
1235 aCmnt->SetValue(ToString(theViewManager->getActiveView()).c_str());
1241 _PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy);
1242 string aSComponentEntry = aSComponent->GetID();
1243 string anEntry = CreateAttributes(aCStudy, aSComponentEntry.c_str(), "", "", theName, "",
1244 ToString(theViewManager->getActiveView()).c_str());
1248 class TSaveViewParamsEvent: public SALOME_Event
1250 SUIT_ViewManager* myViewManager;
1253 TSaveViewParamsEvent (SUIT_ViewManager* theViewManager,
1254 const char* theName):
1255 myViewManager(theViewManager),
1259 virtual void Execute()
1261 myResult = View3D_i::SaveViewParams(myViewManager, myName);
1263 typedef CORBA::Boolean TResult;
1267 CORBA::Boolean View3D_i::SaveViewParams (const char* theName)
1269 return ProcessEvent(new TSaveViewParamsEvent (myViewManager, theName));
1272 bool View3D_i::RestoreViewParams (SUIT_ViewManager* theViewManager, const char* theName)
1274 _PTR(Study) aCStudy;
1275 if (SUIT_Study* aSStudy = theViewManager->study()) {
1276 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
1277 aCStudy = aStudy->studyDS();
1283 std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName, "VISU");
1284 _PTR(GenericAttribute) anAttr;
1285 int iEnd = aList.size();
1286 if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - iEnd = " << iEnd);
1287 for (int i = 0; i < iEnd; i++) {
1288 _PTR(SObject) anObj = aList[i];
1289 string anEntry = anObj->GetID();
1290 if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - anEntry = " << anEntry);
1291 if (anObj->FindAttribute(anAttr, "AttributeComment")) {
1292 _PTR(AttributeComment) aCmnt (anAttr);
1293 QString strIn(aCmnt->Value().c_str());
1294 Storable::TRestoringMap aMap;
1295 Storable::StrToMap(strIn, aMap);
1296 if (Storable::FindValue(aMap, "myComment").compare
1297 (View3D_i::myComment.c_str()) >= 0) {
1298 if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - aComm = " << strIn);
1299 Restore(theViewManager->getActiveView(), aMap);
1307 class TRestoreViewParamsEvent: public SALOME_Event
1309 SUIT_ViewManager* myViewManager;
1312 TRestoreViewParamsEvent (SUIT_ViewManager* theViewManager,
1313 const char* theName):
1314 myViewManager(theViewManager),
1318 virtual void Execute()
1320 myResult = View3D_i::RestoreViewParams(myViewManager, myName);
1322 typedef CORBA::Boolean TResult;
1326 CORBA::Boolean View3D_i::RestoreViewParams (const char* theName)
1328 return ProcessEvent(new TRestoreViewParamsEvent (myViewManager, theName));
1331 void View3D_i::Restore (SUIT_ViewWindow* theStudyFrame,
1332 const Storable::TRestoringMap& theMap)
1334 SALOMEDS::Color aColor;
1335 aColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
1336 aColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
1337 aColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
1339 double aPosition[3];
1340 aPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
1341 aPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
1342 aPosition[2] = VISU::Storable::FindValue(theMap,"myPosition[2]").toDouble();
1344 double aFocalPnt[3];
1345 aFocalPnt[0] = VISU::Storable::FindValue(theMap,"myFocalPnt[0]").toDouble();
1346 aFocalPnt[1] = VISU::Storable::FindValue(theMap,"myFocalPnt[1]").toDouble();
1347 aFocalPnt[2] = VISU::Storable::FindValue(theMap,"myFocalPnt[2]").toDouble();
1350 aViewUp[0] = VISU::Storable::FindValue(theMap,"myViewUp[0]").toDouble();
1351 aViewUp[1] = VISU::Storable::FindValue(theMap,"myViewUp[1]").toDouble();
1352 aViewUp[2] = VISU::Storable::FindValue(theMap,"myViewUp[2]").toDouble();
1354 double aParallelScale = VISU::Storable::FindValue(theMap,"myParallelScale").toDouble();
1356 double aScaleFactor[3];
1357 aScaleFactor[0] = VISU::Storable::FindValue(theMap,"myScaleFactor[0]").toDouble();
1358 aScaleFactor[1] = VISU::Storable::FindValue(theMap,"myScaleFactor[1]").toDouble();
1359 aScaleFactor[2] = VISU::Storable::FindValue(theMap,"myScaleFactor[2]").toDouble();
1361 SetBackground(theStudyFrame,aColor);
1362 SetPointOfView(theStudyFrame,aPosition);
1363 SetViewUp(theStudyFrame,aViewUp);
1364 SetFocalPoint(theStudyFrame,aFocalPnt);
1365 SetParallelScale(theStudyFrame,aParallelScale);
1366 ScaleView(theStudyFrame,VISU::View3D::XAxis,aScaleFactor[0]);
1367 ScaleView(theStudyFrame,VISU::View3D::YAxis,aScaleFactor[1]);
1368 ScaleView(theStudyFrame,VISU::View3D::ZAxis,aScaleFactor[2]);
1372 string View3D_i::ToString (SUIT_ViewWindow* theStudyFrame)
1374 ostringstream strOut;
1375 Storable::DataToStream( strOut, "myComment", myComment.c_str() );
1376 ToStream(theStudyFrame,strOut);
1378 if(MYDEBUG) MESSAGE("View3D_i::ToString - "<<strOut.str());
1379 return strOut.str();
1382 void View3D_i::ToStream (SUIT_ViewWindow* theStudyFrame, std::ostringstream& theStr)
1384 Storable::DataToStream(theStr,"myType",VISU::TVIEW3D);
1387 GetRenderer(theStudyFrame)->GetBackground(backint);
1388 Storable::DataToStream(theStr,"myColor.R",backint[0]);
1389 Storable::DataToStream(theStr,"myColor.G",backint[1]);
1390 Storable::DataToStream(theStr,"myColor.B",backint[2]);
1392 double aPosition[3];
1393 GetPointOfView(theStudyFrame,aPosition);
1394 Storable::DataToStream(theStr,"myPosition[0]",aPosition[0]);
1395 Storable::DataToStream(theStr,"myPosition[1]",aPosition[1]);
1396 Storable::DataToStream(theStr,"myPosition[2]",aPosition[2]);
1398 double aFocalPnt[3];
1399 GetFocalPoint(theStudyFrame,aFocalPnt);
1400 Storable::DataToStream(theStr,"myFocalPnt[0]",aFocalPnt[0]);
1401 Storable::DataToStream(theStr,"myFocalPnt[1]",aFocalPnt[1]);
1402 Storable::DataToStream(theStr,"myFocalPnt[2]",aFocalPnt[2]);
1405 GetCamera(theStudyFrame)->GetViewUp(aViewUp);
1406 Storable::DataToStream(theStr,"myViewUp[0]",aViewUp[0]);
1407 Storable::DataToStream(theStr,"myViewUp[1]",aViewUp[1]);
1408 Storable::DataToStream(theStr,"myViewUp[2]",aViewUp[2]);
1410 Storable::DataToStream(theStr,"myParallelScale",GetParallelScale(theStudyFrame));
1412 double aScaleFactor[3];
1413 GetViewWindow(theStudyFrame)->GetScale(aScaleFactor);
1414 Storable::DataToStream(theStr,"myScaleFactor[0]",aScaleFactor[0]);
1415 Storable::DataToStream(theStr,"myScaleFactor[1]",aScaleFactor[1]);
1416 Storable::DataToStream(theStr,"myScaleFactor[2]",aScaleFactor[2]);
1419 void View3D_i::ToStream(std::ostringstream& theStr)
1421 ToStream(myViewWindow,theStr);
1424 void View3D_i::Close()
1426 //jfa: may be need to be enclosed in SALOME_Event?
1427 myViewWindow->close();
1430 View3D_i::~View3D_i()
1432 if(MYDEBUG) MESSAGE("View3D_i::~View3D_i");
1435 void View3D_i::SetTitle (const char* theTitle)
1437 ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
1438 (myViewWindow,&SUIT_ViewWindow::setCaption,QString(theTitle)));
1441 char* View3D_i::GetTitle()
1443 //jfa: may be need to be enclosed in SALOME_Event?
1444 return CORBA::string_dup(myViewWindow->caption().latin1());
1447 void View3D_i::SetBackground (SUIT_ViewWindow* theStudyFrame,
1448 const SALOMEDS::Color& theColor)
1450 //jfa: may be need to be enclosed in SALOME_Event?
1452 aColor[0] = int(255.0*theColor.R);
1453 aColor[1] = int(255.0*theColor.G);
1454 aColor[2] = int(255.0*theColor.B);
1455 QColor aNewColor(aColor[0],aColor[1],aColor[2]);
1456 GetViewWindow(theStudyFrame)->setBackgroundColor(aNewColor);
1459 SALOMEDS::Color View3D_i::GetBackground (SUIT_ViewWindow* theStudyFrame)
1461 //jfa: may be need to be enclosed in SALOME_Event?
1462 SALOMEDS::Color aColor;
1464 GetRenderer(theStudyFrame)->GetBackground(backint);
1465 aColor.R = backint[0]; aColor.G = backint[1]; aColor.B = backint[2];
1469 class TUpdateViewerEvent: public SALOME_Event
1471 SUIT_ViewWindow* myViewWindow;
1475 TUpdateViewerEvent(SUIT_ViewWindow* theStudyFrame,
1478 myViewWindow(theStudyFrame),
1480 myDisplaing(theDisplaing)
1482 virtual void Execute(){
1483 UpdateViewer(myViewWindow,myDisplaing,myPrs3d);
1487 void View3D_i::EraseAll()
1489 if(MYDEBUG) MESSAGE("View3D_i::EraseAll");
1490 ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,NULL,eEraseAll));
1493 void View3D_i::DisplayAll()
1495 if(MYDEBUG) MESSAGE("View3D_i::DisplayAll");
1496 ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,NULL,eDisplayAll));
1499 void View3D_i::Erase (PrsObject_ptr thePrsObj)
1501 if(MYDEBUG) MESSAGE("View3D_i::Erase");
1502 CORBA::Object_ptr anObj = thePrsObj;
1503 if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
1504 ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eErase));
1508 void View3D_i::Display (PrsObject_ptr thePrsObj)
1510 if(MYDEBUG) MESSAGE("View3D_i::Display");
1511 CORBA::Object_ptr anObj = thePrsObj;
1512 if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
1513 ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eDisplay));
1517 void View3D_i::DisplayOnly (PrsObject_ptr thePrsObj)
1519 if(MYDEBUG) MESSAGE("View3D_i::DisplayOnly");
1520 CORBA::Object_ptr anObj = thePrsObj;
1521 if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
1522 ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eDisplayOnly));
1526 void View3D_i::FitAll()
1528 ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1529 (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onFitAll));
1533 void View3D_i::SetView (VISU::View3D::ViewType theType)
1536 case VISU::View3D::FRONT :
1537 ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1538 (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onFrontView));
1540 case VISU::View3D::BACK :
1541 ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1542 (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onBackView));
1544 case VISU::View3D::LEFT :
1545 ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1546 (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onLeftView));
1548 case VISU::View3D::RIGHT :
1549 ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1550 (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onRightView));
1552 case VISU::View3D::TOP :
1553 ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1554 (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onTopView));
1556 case VISU::View3D::BOTTOM :
1557 ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1558 (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onBottomView));
1564 class TSet3DViewParamEvent: public SALOME_Event
1567 typedef void (*TFun)(SUIT_ViewWindow* theStudyFrame, const CORBA::Double theParam[3]);
1568 TSet3DViewParamEvent (TFun theFun,
1569 SUIT_ViewWindow* theStudyFrame,
1570 const CORBA::Double theParam[3]):
1572 myViewWindow(theStudyFrame),
1575 virtual void Execute(){
1576 myFun(myViewWindow,myParam);
1580 SUIT_ViewWindow* myViewWindow;
1581 const CORBA::Double* myParam;
1584 void View3D_i::SetPointOfView (SUIT_ViewWindow* theStudyFrame,
1585 const CORBA::Double thePosition[3])
1587 //jfa: may be need to be enclosed in SALOME_Event?
1588 GetCamera(theStudyFrame)->SetPosition(thePosition);
1591 void View3D_i::SetPointOfView (const VISU::View3D::XYZ thePosition)
1593 if(MYDEBUG) MESSAGE("View3D_i::SetPointOfView");
1594 ProcessVoidEvent(new TSet3DViewParamEvent(&SetPointOfView,myViewWindow,thePosition));
1597 void View3D_i::GetPointOfView (SUIT_ViewWindow* theStudyFrame,
1598 CORBA::Double thePosition[3])
1600 //jfa: may be need to be enclosed in SALOME_Event?
1601 GetCamera(theStudyFrame)->GetPosition(thePosition);
1604 VISU::View3D::XYZ_slice* View3D_i::GetPointOfView()
1606 //jfa: may be need to be enclosed in SALOME_Event?
1607 if(MYDEBUG) MESSAGE("View3D_i::GetPointOfView");
1608 CORBA::Double aPosition[3];
1609 GetPointOfView(myViewWindow,aPosition);
1610 return VISU::View3D::XYZ_dup(aPosition);
1613 void View3D_i::SetViewUp (SUIT_ViewWindow* theStudyFrame,
1614 const CORBA::Double theViewUp[3])
1616 GetCamera(theStudyFrame)->SetViewUp(theViewUp);
1619 void View3D_i::SetViewUp (const VISU::View3D::XYZ theViewUp)
1621 if(MYDEBUG) MESSAGE("View3D_i::SetViewUp");
1622 ProcessVoidEvent(new TSet3DViewParamEvent(&SetViewUp,myViewWindow,theViewUp));
1625 void View3D_i::GetViewUp (SUIT_ViewWindow* theStudyFrame,
1626 CORBA::Double theViewUp[3])
1628 GetCamera(theStudyFrame)->GetViewUp(theViewUp);
1631 VISU::View3D::XYZ_slice* View3D_i::GetViewUp()
1633 //jfa: may be need to be enclosed in SALOME_Event?
1634 if(MYDEBUG) MESSAGE("View3D_i::GetViewUp");
1635 CORBA::Double aViewUp[3];
1636 GetCamera(myViewWindow)->GetViewUp(aViewUp);
1637 return VISU::View3D::XYZ_dup(aViewUp);
1640 void View3D_i::SetFocalPoint (SUIT_ViewWindow* theStudyFrame,
1641 const CORBA::Double theFocalPnt[3])
1643 GetCamera(theStudyFrame)->SetFocalPoint(theFocalPnt);
1646 void View3D_i::SetFocalPoint (const VISU::View3D::XYZ theCoord)
1648 if(MYDEBUG) MESSAGE("View3D_i::SetFocalPoint");
1649 ProcessVoidEvent(new TSet3DViewParamEvent(&SetFocalPoint,myViewWindow,theCoord));
1653 void View3D_i::GetFocalPoint (SUIT_ViewWindow* theStudyFrame,
1654 CORBA::Double theFocalPnt[3])
1656 GetCamera(theStudyFrame)->GetFocalPoint(theFocalPnt);
1659 VISU::View3D::XYZ_slice* View3D_i::GetFocalPoint()
1661 //jfa: may be need to be enclosed in SALOME_Event?
1662 if(MYDEBUG) MESSAGE("View3D_i::GetFocalPoint");
1663 CORBA::Double aFocalPnt[3];
1664 GetFocalPoint(myViewWindow,aFocalPnt);
1665 return VISU::View3D::XYZ_dup(aFocalPnt);
1668 class TSetViewParamEvent: public SALOME_Event
1671 typedef void (*TFun)(SUIT_ViewWindow* theStudyFrame, CORBA::Double theParam);
1672 TSetViewParamEvent (TFun theFun,
1673 SUIT_ViewWindow* theStudyFrame,
1674 CORBA::Double theParam):
1676 myViewWindow(theStudyFrame),
1679 virtual void Execute()
1681 myFun(myViewWindow,myParam);
1685 SUIT_ViewWindow* myViewWindow;
1686 CORBA::Double myParam;
1689 void View3D_i::SetParallelScale (SUIT_ViewWindow* theStudyFrame,
1690 CORBA::Double theScale)
1692 GetCamera(theStudyFrame)->SetParallelScale(theScale);
1695 void View3D_i::SetParallelScale (CORBA::Double theScale)
1697 if(MYDEBUG) MESSAGE("View3D_i::SetParallelScale");
1698 ProcessVoidEvent(new TSetViewParamEvent(&SetParallelScale,myViewWindow,theScale));
1701 CORBA::Double View3D_i::GetParallelScale (SUIT_ViewWindow* theStudyFrame)
1703 return GetCamera(theStudyFrame)->GetParallelScale();
1706 CORBA::Double View3D_i::GetParallelScale()
1708 //jfa: may be need to be enclosed in SALOME_Event?
1709 if(MYDEBUG) MESSAGE("View3D_i::GetParallelScale");
1710 return GetParallelScale(myViewWindow);
1713 void View3D_i::ScaleView (SUIT_ViewWindow* theStudyFrame,
1714 VISU::View3D::Axis theAxis, CORBA::Double theParam)
1716 SVTK_ViewWindow* aViewFrame = GetViewWindow(theStudyFrame);
1717 double aScaleFactor[3];
1718 aViewFrame->GetScale(aScaleFactor);
1719 aScaleFactor[theAxis] = theParam;
1720 aViewFrame->SetScale(aScaleFactor);
1723 void SetScaleView (SUIT_ViewWindow* theStudyFrame, const CORBA::Double theScale[3])
1725 double aScale[3] = {theScale[0], theScale[1], theScale[2]};
1726 GetViewWindow(theStudyFrame)->SetScale(aScale);
1729 void View3D_i::ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam)
1731 if(MYDEBUG) MESSAGE("View3D_i::ScaleView");
1733 GetViewWindow(myViewWindow)->GetScale(aScale);
1734 aScale[theAxis] = theParam;
1735 ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,myViewWindow,aScale));
1738 void View3D_i::RemoveScale()
1740 if(MYDEBUG) MESSAGE("View3D_i::RemoveScale");
1741 double aScale[3] = {1.0, 1.0, 1.0};
1742 ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,myViewWindow,aScale));