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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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_ScalarMap_i.hh"
33 #include "VISU_ViewManager_i.hh"
35 #include "VisuGUI_TableDlg.h"
37 #include "VISU_Actor.h"
38 #include "VISU_ScalarMapAct.h"
40 #include "SALOME_Event.hxx"
42 #include "SUIT_ViewWindow.h"
43 #include "SUIT_ViewManager.h"
44 #include "SUIT_Tools.h"
46 #include "STD_MDIDesktop.h"
47 #include "STD_TabDesktop.h"
49 #include "SVTK_ViewWindow.h"
50 #include "SVTK_ViewModel.h"
52 #include "SPlot2d_ViewModel.h"
53 #include "Plot2d_ViewFrame.h"
55 #include "SalomeApp_Application.h"
56 #include "SalomeApp_Study.h"
58 #include <QtxWorkstack.h>
60 #include <qworkspace.h>
63 #include <vtkCamera.h>
64 #include <vtkRenderer.h>
69 static int MYDEBUG = 0;
71 static int MYDEBUG = 0;
76 typedef TVoidMemFunEvent<SUIT_ViewWindow> TFrameActionEvent;
78 struct TNewViewEvent: public SALOME_Event
80 SalomeApp_Application* myApplication;
81 typedef QWidget* TResult;
84 TNewViewEvent (SalomeApp_Application* theApplication):
85 myApplication(theApplication),
93 if (STD_MDIDesktop* aDesktop = dynamic_cast<STD_MDIDesktop*>(myApplication->desktop())) {
94 myResult = aDesktop->workspace();
100 View_i (SalomeApp_Application *theApplication,
101 SUIT_ViewManager* theViewManager):
102 myApplication(theApplication),
104 myViewManager(theViewManager)
106 if(MYDEBUG) MESSAGE("View_i::View_i - "<<this);
107 myWorkspace = ProcessEvent(new TNewViewEvent(theApplication));
113 if(MYDEBUG) MESSAGE("View_i::~View_i - "<<this);
117 struct TApplicationEvent: public SALOME_Event
119 SalomeApp_Application* myApplication;
121 TApplicationEvent(SalomeApp_Application* theApplication):
122 myApplication(theApplication)
128 ShowPart (VISU::View::ViewRepresentation theViewRepresentation,
129 CORBA::Boolean theState)
131 struct TEvent: public TApplicationEvent
133 VISU::View::ViewRepresentation myViewRepresentation;
134 CORBA::Boolean myState;
136 TEvent(SalomeApp_Application* theApplication,
137 VISU::View::ViewRepresentation theViewRepresentation,
138 CORBA::Boolean theState):
139 TApplicationEvent(theApplication),
140 myViewRepresentation(theViewRepresentation),
148 switch(myViewRepresentation){
149 case VISU::View::OBJECTBROWSER:
150 myApplication->setWindowShown(SalomeApp_Application::WT_ObjectBrowser,myState);
152 case VISU::View::PYTHON:
153 myApplication->setWindowShown(SalomeApp_Application::WT_PyConsole,myState);
155 case VISU::View::MESSAGES:
156 myApplication->setWindowShown(SalomeApp_Application::WT_LogWindow,myState);
158 case VISU::View::VIEWER:{
159 ViewManagerList mgrs = myApplication->viewManagers();
160 ViewManagerList::const_iterator anIt = mgrs.begin(), aLast = mgrs.end();
161 for( ; anIt!=aLast; anIt++ )
163 const QPtrVector<SUIT_ViewWindow>& views = (*anIt)->getViews();
164 for( int i=0; i<views.count(); i++ )
165 views[i]->setShown( myState );
172 ProcessVoidEvent(new TEvent(myApplication,theViewRepresentation,theState));
175 struct TPartShownEvent: public TApplicationEvent
177 VISU::View::ViewRepresentation myViewRepresentation;
178 typedef bool TResult;
181 TPartShownEvent(SalomeApp_Application* theApplication,
182 VISU::View::ViewRepresentation theViewRepresentation):
183 TApplicationEvent(theApplication),
184 myViewRepresentation(theViewRepresentation),
192 switch(myViewRepresentation){
193 case VISU::View::OBJECTBROWSER:
194 myResult = myApplication->isWindowVisible(SalomeApp_Application::WT_ObjectBrowser);
196 case VISU::View::PYTHON:
197 myResult = myApplication->isWindowVisible(SalomeApp_Application::WT_PyConsole);
199 case VISU::View::MESSAGES:
200 myResult = myApplication->isWindowVisible(SalomeApp_Application::WT_LogWindow);
202 case VISU::View::VIEWER:{
203 ViewManagerList aViewManagerList = myApplication->viewManagers();
204 ViewManagerList::const_iterator anIt = aViewManagerList.begin();
205 for( ; anIt != aViewManagerList.end(); anIt++ )
207 const QPtrVector<SUIT_ViewWindow>& views = (*anIt)->getViews();
208 for( int i=0; i<views.count(); i++ ) {
209 myResult = views[i]->isShown();
221 IsPartShown (VISU::View::ViewRepresentation theViewRepresentation)
223 return ProcessEvent(new TPartShownEvent(myApplication,theViewRepresentation));
226 // Begin: New methods for view parameters management
227 struct TSplitEvent: public SALOME_Event
229 SalomeApp_Application * myApplication;
230 SUIT_ViewWindow * myVW;
231 Qt::Orientation myOrientation;
232 QtxWorkstack::SplitType mySplitType;
235 TSplitEvent (SalomeApp_Application * theApplication,
236 SUIT_ViewWindow * theViewWindow,
237 Qt::Orientation theOrientation,
238 QtxWorkstack::SplitType theSplitType):
239 myApplication(theApplication),
241 myOrientation(theOrientation),
242 mySplitType(theSplitType)
245 virtual void Execute()
247 SUIT_Desktop* desk = myApplication->desktop();
248 STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
250 QtxWorkstack* workstack = tabDesk->workstack();
252 workstack->Split(myVW, myOrientation, mySplitType);
262 SUIT_ViewWindow* aVW = GetViewWindow();
264 ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
265 Qt::Horizontal, QtxWorkstack::SPLIT_MOVE));
272 SUIT_ViewWindow* aVW = GetViewWindow();
274 ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
275 Qt::Horizontal, QtxWorkstack::SPLIT_STAY));
282 SUIT_ViewWindow* aVW = GetViewWindow();
284 ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
285 Qt::Vertical, QtxWorkstack::SPLIT_MOVE));
292 SUIT_ViewWindow* aVW = GetViewWindow();
294 ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
295 Qt::Vertical, QtxWorkstack::SPLIT_STAY));
302 struct TOnTopEvent: public SALOME_Event
304 SUIT_ViewWindow * myVW;
307 TOnTopEvent (SUIT_ViewWindow * theViewWindow):
311 virtual void Execute()
319 SUIT_ViewWindow* aVW = GetViewWindow();
321 ProcessVoidEvent(new TOnTopEvent(aVW));
324 struct TAttractEvent: public SALOME_Event
326 SalomeApp_Application * myApplication;
327 SUIT_ViewWindow * myVW1;
328 SUIT_ViewWindow * myVW2;
332 TAttractEvent (SalomeApp_Application * theApplication,
333 SUIT_ViewWindow * theViewWindow1,
334 SUIT_ViewWindow * theViewWindow2,
336 myApplication(theApplication),
337 myVW1(theViewWindow1),
338 myVW2(theViewWindow2),
339 myAttractAll(theAttractAll)
342 virtual void Execute()
344 SUIT_Desktop* desk = myApplication->desktop();
345 STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
347 QtxWorkstack* workstack = tabDesk->workstack();
349 workstack->Attract(myVW1, myVW2, myAttractAll);
357 Attract (VISU::View_ptr theView)
359 if (!CORBA::is_nil(theView)) {
360 if (VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(theView).in())) {
362 SUIT_ViewWindow* aVW1 = GetViewWindow();
363 SUIT_ViewWindow* aVW2 = pView->GetViewWindow();
365 ProcessVoidEvent(new TAttractEvent(myApplication, aVW1, aVW2, false));
373 AttractAll (VISU::View_ptr theView)
375 if (!CORBA::is_nil(theView)) {
376 if (VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(theView).in())) {
378 SUIT_ViewWindow* aVW1 = GetViewWindow();
379 SUIT_ViewWindow* aVW2 = pView->GetViewWindow();
381 ProcessVoidEvent(new TAttractEvent(myApplication, aVW1, aVW2, true));
387 struct TSizePositionEvent: public SALOME_Event
389 SalomeApp_Application * myApplication;
390 SUIT_ViewWindow * myVW;
395 TSizePositionEvent (SalomeApp_Application * theApplication,
396 SUIT_ViewWindow * theViewWindow,
399 myApplication(theApplication),
405 virtual void Execute()
407 MESSAGE("TSizePositionEvent::Execute()");
408 SUIT_Desktop* desk = myApplication->desktop();
409 STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
411 QtxWorkstack* workstack = tabDesk->workstack();
414 //jfa to do:workstack->SetRelativeSizeInSplitter(myVW, myValue);
416 workstack->SetRelativePositionInSplitter(myVW, myValue);
425 SetRelativePositionInSplitter (CORBA::Double thePosition)
427 if (thePosition < 0.0 || 1.0 < thePosition) {
430 SUIT_ViewWindow* aVW = GetViewWindow();
432 ProcessVoidEvent(new TSizePositionEvent(myApplication, aVW, thePosition, false));
437 SetRelativeSizeInSplitter (CORBA::Double theSize)
439 if (theSize < 0.0 || 1.0 < theSize) {
442 SUIT_ViewWindow* aVW = GetViewWindow();
444 ProcessVoidEvent(new TSizePositionEvent(myApplication, aVW, theSize, true));
447 struct TWSSizePositionEvent: public SALOME_Event
449 SalomeApp_Application * myApplication;
450 SUIT_ViewWindow * myVW;
451 Qt::Orientation myOrientation;
456 TWSSizePositionEvent (SalomeApp_Application * theApplication,
457 SUIT_ViewWindow * theViewWindow,
458 Qt::Orientation theOrientation,
461 myApplication(theApplication),
463 myOrientation(theOrientation),
468 virtual void Execute()
470 MESSAGE("TWSSizePositionEvent::Execute()");
471 SUIT_Desktop* desk = myApplication->desktop();
472 STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
474 QtxWorkstack* workstack = tabDesk->workstack();
477 //jfa to do:workstack->SetRelativeSize(myVW, myOrientation, myValue);
479 workstack->SetRelativePosition(myVW, myOrientation, myValue);
488 SetRelativePositionX (CORBA::Double thePosition)
490 if (thePosition < 0.0 || 1.0 < thePosition) {
493 SUIT_ViewWindow* aVW = GetViewWindow();
495 ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
496 Qt::Horizontal, thePosition, false));
501 SetRelativePositionY (CORBA::Double thePosition)
503 if (thePosition < 0.0 || 1.0 < thePosition) {
506 SUIT_ViewWindow* aVW = GetViewWindow();
508 ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
509 Qt::Vertical, thePosition, false));
514 SetRelativeSizeX (CORBA::Double theSize)
516 if (theSize < 0.0 || 1.0 < theSize) {
519 SUIT_ViewWindow* aVW = GetViewWindow();
521 ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
522 Qt::Horizontal, theSize, true));
527 SetRelativeSizeY (CORBA::Double theSize)
529 if (theSize < 0.0 || 1.0 < theSize) {
532 SUIT_ViewWindow* aVW = GetViewWindow();
534 ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
535 Qt::Vertical, theSize, true));
537 // End: New methods for view parameters management
539 // Begin: Old methods for view parameters management, they don't work now
540 struct TSetViewSize: public SALOME_Event
542 SUIT_ViewWindow* myVW;
543 typedef void (QRect::* TAction)(int);
548 TSetViewSize(SUIT_ViewWindow* theViewWindow,
550 CORBA::Long theSize):
560 if (QWidget* aParent = myVW->parentWidget(true)) {
561 QRect aQRect = aParent->frameGeometry();
562 (aQRect.*myAction)(mySize);
563 aParent->setGeometry(aQRect);
570 SetViewWidth(CORBA::Long theWidth)
572 ProcessVoidEvent(new TSetViewSize(myViewWindow,&QRect::setWidth,theWidth));
577 SetViewHeight(CORBA::Long theHeight)
579 ProcessVoidEvent(new TSetViewSize(myViewWindow,&QRect::setHeight,theHeight));
583 struct TGetViewSize: public SALOME_Event
585 SUIT_ViewWindow* myVW;
587 typedef int (QRect::* TAction)() const;
590 typedef CORBA::Long TResult;
594 TGetViewSize(SUIT_ViewWindow* theViewWindow,
604 if(QWidget* aParent = myVW->parentWidget(true)){
605 QRect aQRect = aParent->frameGeometry();
606 myResult = (aQRect.*myAction)();
616 return ProcessEvent(new TGetViewSize(myViewWindow,&QRect::width));
623 return ProcessEvent(new TGetViewSize(myViewWindow,&QRect::height));
627 class TWorkspaceEvent: public SALOME_Event
631 QWidget* myWorkspace;
634 TWorkspaceEvent(QWidget* theViewWindow,
635 QWidget* theWorkspace):
637 myWorkspace(theWorkspace)
642 class TAlignEvent: public TWorkspaceEvent
645 Qt::AlignmentFlags myAligment;
648 TAlignEvent(QWidget* theViewWindow,
649 QWidget* theWorkspace,
650 Qt::AlignmentFlags theAligment):
651 TWorkspaceEvent(theViewWindow,theWorkspace),
652 myAligment(theAligment)
659 if(QWidget* aParent = myVW->parentWidget(true))
660 SUIT_Tools::alignWidget(aParent,myWorkspace,myAligment);
667 SetViewPositionHorizontal (VISU::View::ViewPosition theViewPosition)
670 switch (theViewPosition) {
671 case VISU::View::LEFT:
672 ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignLeft));
674 case VISU::View::CENTER:
675 ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignHCenter));
677 case VISU::View::RIGHT:
678 ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignRight));
687 SetViewPositionVertical (VISU::View::ViewPosition theViewPosition)
690 switch (theViewPosition) {
691 case VISU::View::TOP:
692 ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignTop));
694 case VISU::View::CENTER:
695 ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignVCenter));
697 case VISU::View::BOTTOM:
698 ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignBottom));
705 class TXYEvent: public TWorkspaceEvent
708 CORBA::Double myX, myY;
711 TXYEvent(QWidget* theViewWindow,
712 QWidget* theWorkspace,
715 TWorkspaceEvent(theViewWindow,theWorkspace),
724 SetRelativePosition (CORBA::Double theX, CORBA::Double theY)
726 struct TEvent: public TXYEvent
729 TEvent(QWidget* theViewWindow,
730 QWidget* theWorkspace,
733 TXYEvent(theViewWindow,theWorkspace,theX,theY)
740 if(QWidget* aParent = myVW->parentWidget(true))
741 aParent->move(int(myX*myWorkspace->width()),int(myY*myWorkspace->height()));
746 ProcessVoidEvent(new TEvent(myViewWindow,myWorkspace,theX,theY));
751 SetRelativeSize (CORBA::Double theX, CORBA::Double theY)
753 struct TEvent: public TXYEvent
756 TEvent(QWidget* theViewWindow,
757 QWidget* theWorkspace,
760 TXYEvent(theViewWindow,theWorkspace,theX,theY)
767 if(QWidget* aParent = myVW->parentWidget(true))
768 aParent->setGeometry(aParent->x(),
770 int(myX*myWorkspace->width()),
771 int(myY*myWorkspace->height()));
776 ProcessVoidEvent(new TEvent(myViewWindow,myWorkspace,theX,theY));
778 // End: Old methods for view parameters management, they don't work now
782 SetBackground (const SALOMEDS::Color& theColor)
784 struct TEvent: public SALOME_Event
787 SALOMEDS::Color myColor;
789 TEvent(QWidget* theWidget,
790 const SALOMEDS::Color& theColor):
794 virtual void Execute(){
796 aColor[0] = int(255.0*myColor.R);
797 aColor[1] = int(255.0*myColor.G);
798 aColor[2] = int(255.0*myColor.B);
799 myWidget->setBackgroundColor(QColor(aColor[0],aColor[1],aColor[2]));
803 SUIT_ViewWindow* aVW = GetViewWindow();
805 ProcessVoidEvent(new TEvent(aVW, theColor));
809 struct TBackgroundEvent: public SALOME_Event
812 typedef SALOMEDS::Color TResult;
815 TBackgroundEvent(QWidget* theWidget):
823 const QColor& aColor = myWidget->backgroundColor();
824 myResult.R = aColor.red()/255.0;
825 myResult.G = aColor.green()/255.0;
826 myResult.B = aColor.blue()/255.0;
834 SUIT_ViewWindow* aVW = GetViewWindow();
836 return ProcessEvent(new TBackgroundEvent(aVW));
838 SALOMEDS::Color aBlack;
849 SUIT_ViewWindow* aVW = GetViewWindow();
851 ProcessVoidEvent(new TFrameActionEvent(aVW, &SUIT_ViewWindow::showMinimized));
858 SUIT_ViewWindow* aVW = GetViewWindow();
860 ProcessVoidEvent(new TFrameActionEvent(aVW, &SUIT_ViewWindow::showNormal));
867 SUIT_ViewWindow* aVW = GetViewWindow();
869 ProcessVoidEvent(new TFrameActionEvent(aVW, &SUIT_ViewWindow::showMaximized));
884 Erase (PrsObject_ptr thePrsObj)
889 Display (PrsObject_ptr thePrsObj)
894 DisplayOnly (PrsObject_ptr thePrsObj)
902 class TSavePictureEvent: public SALOME_Event
904 SUIT_ViewWindow * myVW;
905 const char * myFileName;
907 typedef CORBA::Boolean TResult;
909 TSavePictureEvent (SUIT_ViewWindow * theViewWindow, const char * theFileName)
910 : myVW(theViewWindow),
911 myFileName(theFileName),
916 virtual void Execute()
919 QImage img = myVW->dumpView();
921 QString fileName (myFileName);
922 if (!fileName.isEmpty()) {
923 QString fmt = SUIT_Tools::extension(fileName).upper();
924 if (fmt.isEmpty()) fmt = QString("BMP"); // default format
925 if (fmt == "JPG" ) fmt = "JPEG";
926 //QApplication::setOverrideCursor(Qt::waitCursor);
927 img.save(fileName, fmt.latin1());
929 //QApplication::restoreOverrideCursor();
937 View_i::SavePicture(const char* theFileName)
939 return ProcessEvent(new TSavePictureEvent (GetViewWindow(), theFileName));
943 View_i::GetComment() const
950 ToStream (std::ostringstream& theStr)
954 SUIT_ViewWindow* View_i::GetViewWindow()
957 QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
958 int aPos = aViews.find(myViewWindow);
965 void View_i::SetViewWindow(SUIT_ViewWindow* theViewWindow)
967 myViewWindow = theViewWindow;
971 //===========================================================================
972 XYPlot_i::XYPlot_i (SalomeApp_Application* theApplication)
973 : View_i(theApplication, NULL)
975 if (MYDEBUG) MESSAGE("XYPlot_i::XYPlot_i");
978 struct TCreatePlot2dViewEvent: public SALOME_Event
980 XYPlot_i * myPlot2dView;
983 typedef Plot2d_ViewFrame* TResult;
986 TCreatePlot2dViewEvent (XYPlot_i * thePlot2dView,
988 myPlot2dView(thePlot2dView),
997 if (!myPlot2dView->myApplication)
1000 SUIT_ViewManager* aViewMgr =
1001 myPlot2dView->myApplication->getViewManager(SPlot2d_Viewer::Type(), false);
1002 SUIT_ViewWindow* aVW = NULL;
1006 aVW = aViewMgr->createViewWindow();
1008 aVW = aViewMgr->getActiveView();
1011 aViewMgr = myPlot2dView->myApplication->getViewManager(SPlot2d_Viewer::Type(), true);
1012 aVW = aViewMgr->getActiveView();
1014 return; // there are no current Plot2d view
1019 Plot2d_ViewWindow* aPlot2dVW = dynamic_cast<Plot2d_ViewWindow*>(aVW);
1021 myResult = aPlot2dVW->getViewFrame();
1023 myResult->Repaint();
1026 myPlot2dView->myViewManager = aViewMgr;
1027 myPlot2dView->SetViewWindow(aVW);
1033 Storable* XYPlot_i::Create (int theNew)
1035 myView = ProcessEvent(new TCreatePlot2dViewEvent(this, theNew));
1041 void XYPlot_i::Update()
1043 ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame>(myView,&Plot2d_ViewFrame::Repaint));
1046 void XYPlot_i::Close()
1048 //jfa: may be need to be enclosed in SALOME_Event?
1049 SUIT_ViewWindow* aVW = GetViewWindow();
1052 //QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
1053 //int aPos = aViews.find(myViewWindow);
1055 // myViewWindow->close();
1058 XYPlot_i::~XYPlot_i() {
1059 if(MYDEBUG) MESSAGE("XYPlot_i::~XYPlot_i");
1062 void XYPlot_i::SetTitle (const char* theTitle)
1064 SUIT_ViewWindow* aVW = GetViewWindow();
1066 ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
1067 (aVW, &SUIT_ViewWindow::setCaption, QString(theTitle)));
1069 char* XYPlot_i::GetTitle()
1071 SUIT_ViewWindow* aVW = GetViewWindow();
1073 return CORBA::string_dup(aVW->caption().latin1());
1074 return CORBA::string_dup("");
1077 void XYPlot_i::SetSubTitle (const char* theTitle)
1079 if (GetViewWindow())
1080 ProcessVoidEvent(new TVoidMemFun1ArgEvent<Plot2d_ViewFrame,const QString&,QString>
1081 (myView, &Plot2d_ViewFrame::setTitle, QString(theTitle)));
1084 char* XYPlot_i::GetSubTitle()
1086 if (GetViewWindow())
1087 return CORBA::string_dup(myView->getTitle());
1088 return CORBA::string_dup("");
1091 void XYPlot_i::SetCurveType (VISU::XYPlot::CurveType theType)
1093 if (GetViewWindow())
1094 ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
1095 (myView,&Plot2d_ViewFrame::setCurveType,theType,true));
1098 VISU::XYPlot::CurveType XYPlot_i::GetCurveType()
1100 if (GetViewWindow())
1101 return (VISU::XYPlot::CurveType)myView->getCurveType();
1102 return VISU::XYPlot::POINTS;
1105 void XYPlot_i::SetMarkerSize (CORBA::Long theSize)
1107 if (GetViewWindow())
1108 ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
1109 (myView,&Plot2d_ViewFrame::setMarkerSize,theSize,true));
1112 CORBA::Long XYPlot_i::GetMarkerSize()
1114 if (GetViewWindow())
1115 return myView->getMarkerSize();
1119 void XYPlot_i::EnableXGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
1120 CORBA::Boolean theMinor, CORBA::Long theNumMinor)
1122 class TEvent: public SALOME_Event
1125 TEvent (Plot2d_ViewFrame* theView,
1126 CORBA::Boolean theMajor,
1127 CORBA::Long theNumMajor,
1128 CORBA::Boolean theMinor,
1129 CORBA::Long theNumMinor):
1132 myNumMajor(theNumMajor),
1134 myNumMinor(theNumMinor)
1137 virtual void Execute()
1139 myView->setXGrid( myMajor, myNumMajor, myMinor, myNumMinor );
1142 Plot2d_ViewFrame* myView;
1143 CORBA::Boolean myMajor, myMinor;
1144 CORBA::Long myNumMajor, myNumMinor;
1147 if ( GetViewWindow() )
1148 ProcessVoidEvent( new TEvent( myView, theMajor, theNumMajor, theMinor, theNumMinor ) );
1150 void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor,
1151 CORBA::Long theNumMajor,
1152 CORBA::Boolean theMinor,
1153 CORBA::Long theNumMinor)
1155 this->EnableYGrid( theMajor, theNumMajor, theMinor, theNumMinor, false, 0, false, 0 );
1158 void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor,
1159 CORBA::Long theNumMajor,
1160 CORBA::Boolean theMinor,
1161 CORBA::Long theNumMinor,
1162 CORBA::Boolean the2Major,
1163 CORBA::Long the2NumMajor,
1164 CORBA::Boolean the2Minor,
1165 CORBA::Long the2NumMinor)
1167 class TEvent: public SALOME_Event
1170 TEvent (Plot2d_ViewFrame* theView,
1171 CORBA::Boolean theMajor,
1172 CORBA::Long theNumMajor,
1173 CORBA::Boolean theMinor,
1174 CORBA::Long theNumMinor,
1175 CORBA::Boolean the2Major,
1176 CORBA::Long the2NumMajor,
1177 CORBA::Boolean the2Minor,
1178 CORBA::Long the2NumMinor):
1181 myNumMajor(theNumMajor),
1183 myNumMinor(theNumMinor),
1184 my2Major(the2Major),
1185 my2NumMajor(the2NumMajor),
1186 my2Minor(the2Minor),
1187 my2NumMinor(the2NumMinor)
1190 virtual void Execute()
1192 myView->setYGrid( myMajor, myNumMajor, myMinor, myNumMinor,
1193 my2Major, my2NumMajor, my2Minor, my2NumMinor);
1196 Plot2d_ViewFrame* myView;
1197 CORBA::Boolean myMajor, myMinor, my2Major, my2Minor;
1198 CORBA::Long myNumMajor, myNumMinor, my2NumMajor, my2NumMinor;
1201 if (GetViewWindow())
1202 ProcessVoidEvent( new TEvent( myView, theMajor, theNumMajor, theMinor, theNumMinor,
1203 the2Major, the2NumMajor, the2Minor, the2NumMinor ) );
1206 class TSetScaleModeEvent: public SALOME_Event
1209 typedef void (Plot2d_ViewFrame::* TFun)(const int, bool);
1210 TSetScaleModeEvent (Plot2d_ViewFrame* theView, TFun theFun, int theScaling):
1211 myView(theView), myFun(theFun), myScaling(theScaling)
1214 virtual void Execute()
1216 (myView->*myFun)(myScaling,true);
1219 Plot2d_ViewFrame* myView;
1224 void XYPlot_i::SetHorScaling (VISU::Scaling theScaling)
1226 if (GetViewWindow())
1227 ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setHorScaleMode,
1228 theScaling == VISU::LOGARITHMIC));
1231 VISU::Scaling XYPlot_i::GetHorScaling()
1233 //jfa: may be need to be enclosed in SALOME_Event?
1234 if (GetViewWindow())
1235 return (VISU::Scaling)myView->getHorScaleMode();
1236 return VISU::LINEAR;
1239 void XYPlot_i::SetVerScaling(VISU::Scaling theScaling)
1241 if (GetViewWindow())
1242 ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setVerScaleMode,
1243 theScaling == VISU::LOGARITHMIC));
1246 VISU::Scaling XYPlot_i::GetVerScaling()
1248 if (GetViewWindow())
1249 return (VISU::Scaling)myView->getVerScaleMode();
1250 return VISU::LINEAR;
1253 class TSetTitleEvent: public SALOME_Event
1256 TSetTitleEvent (Plot2d_ViewFrame* theView, Plot2d_ViewFrame::ObjectType theType, const char* theTitle):
1257 myView(theView), myType(theType), myTitle(theTitle)
1259 virtual void Execute()
1261 myView->setTitle(true,myTitle,myType);
1264 Plot2d_ViewFrame* myView;
1265 Plot2d_ViewFrame::ObjectType myType;
1266 const char* myTitle;
1269 void XYPlot_i::SetXTitle (const char* theTitle)
1271 if (GetViewWindow())
1272 ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::XTitle, theTitle));
1274 char* XYPlot_i::GetXTitle()
1276 if (GetViewWindow())
1277 return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::XTitle));
1278 return CORBA::string_dup("");
1281 void XYPlot_i::SetYTitle (const char* theTitle)
1283 if (GetViewWindow())
1284 ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::YTitle, theTitle));
1286 char* XYPlot_i::GetYTitle()
1288 if (GetViewWindow())
1289 return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::YTitle));
1290 return CORBA::string_dup("");
1293 void XYPlot_i::ShowLegend (CORBA::Boolean theShowing)
1295 if (GetViewWindow())
1296 ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,bool,bool>
1297 (myView,&Plot2d_ViewFrame::showLegend,theShowing,true));
1300 class TXYPlotViewEvent: public SALOME_Event
1302 SalomeApp_Application* myApplication;
1303 Plot2d_ViewFrame* myView;
1304 PrsObject_ptr myPrsObj;
1308 TXYPlotViewEvent(SalomeApp_Application* theApplication,
1309 Plot2d_ViewFrame* theView,
1310 PrsObject_ptr thePrsObj,
1312 : myApplication(theApplication),
1314 myPrsObj(thePrsObj),
1315 myDisplaing(theDisplaing)
1319 virtual void Execute()
1322 if (Curve_i* aCurve = dynamic_cast<Curve_i*>(VISU::GetServant(myPrsObj).in())) {
1323 UpdatePlot2d(myView,myDisplaing,aCurve);
1325 // is it Container ?
1326 if (Container_i* aContainer = dynamic_cast<Container_i*>(VISU::GetServant(myPrsObj).in())) {
1327 int nbCurves = aContainer->GetNbCurves();
1328 for ( int i = 1; i <= nbCurves; i++ ) {
1329 VISU::Curve_i* aCurve = aContainer->GetCurve( i );
1330 if ( aCurve && aCurve->IsValid() ) {
1331 UpdatePlot2d(myView,myDisplaing,aCurve);
1337 if (Table_i* aTable = dynamic_cast<Table_i*>(VISU::GetServant(myPrsObj).in())) {
1338 _PTR(Study) aCStudy;
1339 if (SUIT_Study* aSStudy = myApplication->activeStudy()) {
1340 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
1341 aCStudy = aStudy->studyDS();
1344 if (!aCStudy) return;
1345 _PTR(SObject) TableSO = aCStudy->FindObjectID(aTable->GetEntry());
1347 _PTR(ChildIterator) Iter = aCStudy->NewChildIterator(TableSO);
1348 for (; Iter->More(); Iter->Next()) {
1349 CORBA::Object_var childObject = VISU::ClientSObjectToObject(Iter->Value());
1350 if (!CORBA::is_nil(childObject)) {
1351 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(childObject);
1352 if (!CORBA::is_nil(aCurve))
1353 UpdatePlot2d(myView, myDisplaing,
1354 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in()));
1363 void XYPlot_i::Display (PrsObject_ptr thePrsObj)
1365 if (GetViewWindow())
1366 ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eDisplay));
1369 void XYPlot_i::Erase (PrsObject_ptr thePrsObj)
1371 if (GetViewWindow())
1372 ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eErase));
1375 void XYPlot_i::DisplayOnly (PrsObject_ptr thePrsObj)
1377 if (GetViewWindow())
1378 ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eDisplayOnly));
1381 void XYPlot_i::EraseAll()
1383 if (GetViewWindow())
1384 ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::EraseAll));
1387 void XYPlot_i::FitAll()
1389 if (GetViewWindow())
1390 ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::fitAll));
1393 class TFitRangeEvent: public SALOME_Event
1396 TFitRangeEvent (Plot2d_ViewFrame* theView,
1398 const double xMin, const double xMax,
1399 const double yMin, const double yMax):
1402 myXMin(xMin),myXMax(xMax),
1403 myYMin(yMin),myYMax(yMax)
1405 virtual void Execute()
1407 myView->fitData(myMode,myXMin,myXMax,myYMin,myYMax);
1411 const double myXMin;
1412 const double myXMax;
1413 const double myYMin;
1414 const double myYMax;
1415 Plot2d_ViewFrame* myView;
1418 void XYPlot_i::FitXRange(const CORBA::Double xMin,const CORBA::Double xMax)
1420 const CORBA::Long mode = 1;
1421 const CORBA::Double yMin = 0.0;
1422 const CORBA::Double yMax = 0.0;
1423 ProcessVoidEvent(new TFitRangeEvent(myView,mode,xMin,xMax,yMin,yMax));
1426 void XYPlot_i::FitYRange(const CORBA::Double yMin,const CORBA::Double yMax)
1428 const CORBA::Long mode = 2;
1429 const CORBA::Double xMin = 0.0;
1430 const CORBA::Double xMax = 0.0;
1431 ProcessVoidEvent(new TFitRangeEvent(myView,mode,xMin,xMax,yMin,yMax));
1434 void XYPlot_i::FitRange(const CORBA::Double xMin,const CORBA::Double xMax,
1435 const CORBA::Double yMin,const CORBA::Double yMax)
1437 const CORBA::Long mode = 0;
1438 ProcessVoidEvent(new TFitRangeEvent(myView,mode,xMin,xMax,yMin,yMax));
1441 void XYPlot_i::GetFitRanges(double& xMin, double& xMax, double& yMin, double& yMax)
1444 myView->getFitRanges(xMin,xMax,yMin,yMax,y2Min,y2Max);
1447 //===========================================================================
1448 TableView_i::TableView_i (SalomeApp_Application* theApplication)
1449 : View_i(theApplication, NULL)
1453 struct TCreateTableViewEvent: public SALOME_Event
1455 SalomeApp_Application* myApplication;
1456 VISU::Table_i* myTable;
1458 typedef VisuGUI_TableDlg* TResult;
1461 TCreateTableViewEvent (SalomeApp_Application* theApplication,
1462 VISU::Table_i* theTable):
1463 myApplication(theApplication),
1472 if (myTable != NULL) {
1473 if (SUIT_Study* aSStudy = myApplication->activeStudy()) {
1474 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
1475 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
1476 _PTR(SObject) aSObject = aCStudy->FindObjectID(myTable->GetObjectEntry());
1478 myResult = new VisuGUI_TableDlg (myApplication->desktop(),
1481 VisuGUI_TableDlg::ttAuto,
1492 Storable* TableView_i::Create (VISU::Table_ptr theTable)
1494 if (MYDEBUG) MESSAGE("TableView_i::Create - " << (!theTable->_is_nil()));
1495 if (!theTable->_is_nil()) {
1496 VISU::Table_i* table =
1497 dynamic_cast<VISU::Table_i*>(VISU::GetServant(theTable).in());
1498 if (MYDEBUG) MESSAGE("TableView_i::Create - dynamic_cast = " << table);
1500 myView = ProcessEvent(new TCreateTableViewEvent(myApplication, table));
1507 TableView_i::~TableView_i()
1509 if(MYDEBUG) MESSAGE("TableView_i::~TableView_i");
1513 void TableView_i::SetTitle (const char* theTitle)
1515 ProcessVoidEvent(new TVoidMemFun1ArgEvent<VisuGUI_TableDlg,const QString&,QString>
1516 (myView, &VisuGUI_TableDlg::setCaption, QString(theTitle)));
1519 char* TableView_i::GetTitle()
1521 //jfa: may be need to be enclosed in SALOME_Event?
1522 return CORBA::string_dup(myView->caption().latin1());
1525 void TableView_i::Close()
1527 //jfa: may be need to be enclosed in SALOME_Event?
1532 //===========================================================================
1533 int View3D_i::myNbViewParams = 0;
1534 const string View3D_i::myComment = "VIEW3D";
1535 const char* View3D_i::GetComment() const { return myComment.c_str();}
1537 QString View3D_i::GenerateViewParamsName()
1539 return VISU::GenerateName("ViewParams", ++myNbViewParams);
1542 View3D_i::View3D_i (SalomeApp_Application* theApplication)
1543 : View_i(theApplication, NULL)
1545 if (MYDEBUG) MESSAGE("View3D_i::View3D_i");
1548 struct TCreateView3dEvent: public SALOME_Event
1550 SalomeApp_Application *myApplication;
1551 View3D_i * myView3D;
1554 typedef SUIT_ViewWindow* TResult;
1557 TCreateView3dEvent (SalomeApp_Application *theApplication,
1558 View3D_i * theView3D,
1560 myApplication(theApplication),
1561 myView3D(theView3D),
1574 if(SUIT_ViewManager* aViewManager = myApplication->getViewManager(SVTK_Viewer::Type(),false)){
1575 myResult = aViewManager->createViewWindow();
1576 myView3D->myViewManager = aViewManager;
1578 if(SUIT_ViewManager* aViewManager = myApplication->getViewManager(SVTK_Viewer::Type(),true)){
1579 myResult = aViewManager->getActiveView();
1580 myView3D->myViewManager = aViewManager;
1584 if(SUIT_ViewManager* aViewManager = myApplication->activeViewManager()){
1585 if(SUIT_ViewWindow* aView = aViewManager->getActiveView()){
1586 if(dynamic_cast<SVTK_ViewWindow*>(aView)){
1587 myView3D->myViewManager = aViewManager;
1588 myResult = aViewManager->getActiveView();
1592 if(SUIT_ViewManager* aViewManager = myApplication->getViewManager(SVTK_Viewer::Type(),false)){
1593 myView3D->myViewManager = aViewManager;
1594 myResult = aViewManager->getActiveView();
1601 Storable* View3D_i::Create (int theNew)
1603 if (MYDEBUG) MESSAGE("View3D_i::Create");
1604 SUIT_ViewWindow* aVW = ProcessEvent(new TCreateView3dEvent(myApplication, this, theNew));
1612 void View3D_i::Update()
1614 class TEvent: public SALOME_Event
1616 SUIT_ViewWindow* myViewWindow;
1618 TEvent(SUIT_ViewWindow* theViewWindow):
1619 myViewWindow(theViewWindow)
1621 virtual void Execute()
1623 SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(myViewWindow);
1624 vtkRenderer* aRenderer = aViewWindow->getRenderer();
1625 vtkActorCollection* anActors = aRenderer->GetActors();
1626 anActors->InitTraversal();
1627 while (vtkActor *anAct = anActors->GetNextActor()) {
1628 if (VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)) {
1629 if (anActor->GetVisibility())
1630 anActor->UpdateFromFactory();
1633 RepaintView(myViewWindow);
1637 if (SUIT_ViewWindow* aViewWindow = GetViewWindow())
1638 ProcessVoidEvent(new TEvent(aViewWindow));
1641 bool View3D_i::SaveViewParams (SUIT_ViewManager* theViewManager, const std::string& theName)
1643 MESSAGE("View3D_i::SaveViewParams()");
1645 if (!theViewManager || theName == "")
1648 _PTR(Study) aCStudy;
1649 if (SUIT_Study* aSStudy = theViewManager->study()) {
1650 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
1651 aCStudy = aStudy->studyDS();
1657 if (theName != "") {
1658 std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName.c_str(), "VISU");
1659 _PTR(GenericAttribute) anAttr;
1660 int iEnd = aList.size();
1661 for (int i = 0; i < iEnd; i++) {
1662 _PTR(SObject) anObj = aList[i];
1663 string anEntry = anObj->GetID();
1664 if(MYDEBUG) MESSAGE("View3D_i::SaveViewParams - anEntry = " << anEntry);
1665 if (anObj->FindAttribute(anAttr, "AttributeString")) {
1666 _PTR(AttributeString) aCmnt (anAttr);
1667 string aComm (aCmnt->Value());
1668 if (MYDEBUG) MESSAGE("View3D_i::SaveViewPoint - aComm = " << aComm);
1669 if (aComm.compare(View3D_i::myComment) >= 0) {
1670 aCmnt->SetValue(ToString(theViewManager->getActiveView()).c_str());
1676 _PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy);
1677 string aSComponentEntry = aSComponent->GetID();
1678 string anEntry = CreateAttributes(aCStudy,
1679 aSComponentEntry.c_str(),
1684 ToString(theViewManager->getActiveView()).c_str());
1688 class TSaveViewParamsEvent: public SALOME_Event
1690 SUIT_ViewManager* myViewMgr;
1693 TSaveViewParamsEvent (SUIT_ViewManager* theViewManager,
1694 const std::string& theName):
1695 myViewMgr(theViewManager),
1699 virtual void Execute()
1701 myResult = View3D_i::SaveViewParams(myViewMgr, myName);
1703 typedef CORBA::Boolean TResult;
1707 CORBA::Boolean View3D_i::SaveViewParams (const char* theViewParamsName)
1709 return ProcessEvent(new TSaveViewParamsEvent (myViewManager, theViewParamsName));
1712 bool View3D_i::RestoreViewParams (SUIT_ViewManager* theViewManager, const std::string& theName)
1714 _PTR(Study) aCStudy;
1715 if (SUIT_Study* aSStudy = theViewManager->study()) {
1716 if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
1717 aCStudy = aStudy->studyDS();
1723 std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName, "VISU");
1724 _PTR(GenericAttribute) anAttr;
1725 int iEnd = aList.size();
1726 if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - iEnd = " << iEnd);
1727 for (int i = 0; i < iEnd; i++) {
1728 _PTR(SObject) anObj = aList[i];
1729 string anEntry = anObj->GetID();
1730 if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - anEntry = " << anEntry);
1731 Storable::TRestoringMap aMap = Storable::GetStorableMap(anObj);
1732 if (Storable::FindValue(aMap, "myComment") == View3D_i::myComment) {
1733 Restore(theViewManager->getActiveView(), aMap);
1740 class TRestoreViewParamsEvent: public SALOME_Event
1742 SUIT_ViewManager* myViewMgr;
1745 TRestoreViewParamsEvent (SUIT_ViewManager* theViewManager,
1746 const std::string& theName):
1747 myViewMgr(theViewManager),
1751 virtual void Execute()
1753 myResult = View3D_i::RestoreViewParams(myViewMgr, myName);
1755 typedef CORBA::Boolean TResult;
1759 CORBA::Boolean View3D_i::RestoreViewParams (const char* theViewParamsName)
1761 return ProcessEvent(new TRestoreViewParamsEvent (myViewManager, theViewParamsName));
1764 void View3D_i::Restore (SUIT_ViewWindow* theViewWindow,
1765 const Storable::TRestoringMap& theMap)
1767 SALOMEDS::Color aColor;
1768 aColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
1769 aColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
1770 aColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
1772 double aPosition[3];
1773 aPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
1774 aPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
1775 aPosition[2] = VISU::Storable::FindValue(theMap,"myPosition[2]").toDouble();
1777 double aFocalPnt[3];
1778 aFocalPnt[0] = VISU::Storable::FindValue(theMap,"myFocalPnt[0]").toDouble();
1779 aFocalPnt[1] = VISU::Storable::FindValue(theMap,"myFocalPnt[1]").toDouble();
1780 aFocalPnt[2] = VISU::Storable::FindValue(theMap,"myFocalPnt[2]").toDouble();
1783 aViewUp[0] = VISU::Storable::FindValue(theMap,"myViewUp[0]").toDouble();
1784 aViewUp[1] = VISU::Storable::FindValue(theMap,"myViewUp[1]").toDouble();
1785 aViewUp[2] = VISU::Storable::FindValue(theMap,"myViewUp[2]").toDouble();
1787 double aParallelScale = VISU::Storable::FindValue(theMap,"myParallelScale").toDouble();
1789 double aScaleFactor[3];
1790 aScaleFactor[0] = VISU::Storable::FindValue(theMap,"myScaleFactor[0]").toDouble();
1791 aScaleFactor[1] = VISU::Storable::FindValue(theMap,"myScaleFactor[1]").toDouble();
1792 aScaleFactor[2] = VISU::Storable::FindValue(theMap,"myScaleFactor[2]").toDouble();
1794 SetBackground(theViewWindow,aColor);
1795 SetPointOfView(theViewWindow,aPosition);
1796 SetViewUp(theViewWindow,aViewUp);
1797 SetFocalPoint(theViewWindow,aFocalPnt);
1798 SetParallelScale(theViewWindow,aParallelScale);
1799 ScaleView(theViewWindow,VISU::View3D::XAxis,aScaleFactor[0]);
1800 ScaleView(theViewWindow,VISU::View3D::YAxis,aScaleFactor[1]);
1801 ScaleView(theViewWindow,VISU::View3D::ZAxis,aScaleFactor[2]);
1805 string View3D_i::ToString (SUIT_ViewWindow* theViewWindow)
1807 ostringstream strOut;
1808 Storable::DataToStream(strOut, "myComment", myComment.c_str());
1809 ToStream(theViewWindow, strOut);
1811 if(MYDEBUG) MESSAGE("View3D_i::ToString - " << strOut.str());
1812 return strOut.str();
1815 void View3D_i::ToStream (SUIT_ViewWindow* theViewWindow, std::ostringstream& theStr)
1817 vtkFloatingPointType backint[3];
1818 GetRenderer(theViewWindow)->GetBackground(backint);
1819 Storable::DataToStream(theStr,"myColor.R",backint[0]);
1820 Storable::DataToStream(theStr,"myColor.G",backint[1]);
1821 Storable::DataToStream(theStr,"myColor.B",backint[2]);
1823 double aPosition[3];
1824 GetPointOfView(theViewWindow,aPosition);
1825 Storable::DataToStream(theStr,"myPosition[0]",aPosition[0]);
1826 Storable::DataToStream(theStr,"myPosition[1]",aPosition[1]);
1827 Storable::DataToStream(theStr,"myPosition[2]",aPosition[2]);
1829 double aFocalPnt[3];
1830 GetFocalPoint(theViewWindow,aFocalPnt);
1831 Storable::DataToStream(theStr,"myFocalPnt[0]",aFocalPnt[0]);
1832 Storable::DataToStream(theStr,"myFocalPnt[1]",aFocalPnt[1]);
1833 Storable::DataToStream(theStr,"myFocalPnt[2]",aFocalPnt[2]);
1836 GetCamera(theViewWindow)->GetViewUp(aViewUp);
1837 Storable::DataToStream(theStr,"myViewUp[0]",aViewUp[0]);
1838 Storable::DataToStream(theStr,"myViewUp[1]",aViewUp[1]);
1839 Storable::DataToStream(theStr,"myViewUp[2]",aViewUp[2]);
1841 Storable::DataToStream(theStr,"myParallelScale",GetParallelScale(theViewWindow));
1843 double aScaleFactor[3];
1844 (dynamic_cast<SVTK_ViewWindow*>(theViewWindow))->GetScale(aScaleFactor);
1845 Storable::DataToStream(theStr,"myScaleFactor[0]",aScaleFactor[0]);
1846 Storable::DataToStream(theStr,"myScaleFactor[1]",aScaleFactor[1]);
1847 Storable::DataToStream(theStr,"myScaleFactor[2]",aScaleFactor[2]);
1850 void View3D_i::ToStream(std::ostringstream& theStr)
1852 SUIT_ViewWindow* aVW = GetViewWindow();
1854 ToStream(aVW, theStr);
1857 void View3D_i::Close()
1859 //jfa: may be need to be enclosed in SALOME_Event?
1860 SUIT_ViewWindow* aVW = GetViewWindow();
1863 //QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
1864 //int aPos = aViews.find(myViewWindow);
1866 // myViewWindow->close();
1869 View3D_i::~View3D_i()
1871 if(MYDEBUG) MESSAGE("View3D_i::~View3D_i");
1874 void View3D_i::SetTitle (const char* theTitle)
1876 SUIT_ViewWindow* aVW = GetViewWindow();
1878 ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
1879 (aVW,&SUIT_ViewWindow::setCaption,QString(theTitle)));
1882 char* View3D_i::GetTitle()
1884 SUIT_ViewWindow* aVW = GetViewWindow();
1886 return CORBA::string_dup(aVW->caption().latin1());
1887 return CORBA::string_dup("");
1890 void View3D_i::SetBackground (SUIT_ViewWindow* theViewWindow,
1891 const SALOMEDS::Color& theColor)
1893 //jfa: may be need to be enclosed in SALOME_Event?
1895 aColor[0] = int(255.0*theColor.R);
1896 aColor[1] = int(255.0*theColor.G);
1897 aColor[2] = int(255.0*theColor.B);
1898 QColor aNewColor (aColor[0],aColor[1],aColor[2]);
1899 (dynamic_cast<SVTK_ViewWindow*>(theViewWindow))->setBackgroundColor(aNewColor);
1902 SALOMEDS::Color View3D_i::GetBackground (SUIT_ViewWindow* theViewWindow)
1904 SALOMEDS::Color aColor;
1905 vtkFloatingPointType backint[3];
1906 GetRenderer(theViewWindow)->GetBackground(backint);
1907 aColor.R = backint[0]; aColor.G = backint[1]; aColor.B = backint[2];
1911 class TUpdateViewerEvent: public SALOME_Event
1913 SUIT_ViewWindow* myVW;
1917 TUpdateViewerEvent(SUIT_ViewWindow* theViewWindow,
1920 myVW(theViewWindow),
1922 myDisplaing(theDisplaing)
1924 virtual void Execute(){
1925 UpdateViewer(myVW, myDisplaing, myPrs3d);
1929 void View3D_i::EraseAll()
1931 if(MYDEBUG) MESSAGE("View3D_i::EraseAll");
1932 SUIT_ViewWindow* aVW = GetViewWindow();
1934 ProcessVoidEvent(new TUpdateViewerEvent(aVW,NULL,eEraseAll));
1937 void View3D_i::DisplayAll()
1939 if(MYDEBUG) MESSAGE("View3D_i::DisplayAll");
1940 SUIT_ViewWindow* aVW = GetViewWindow();
1942 ProcessVoidEvent(new TUpdateViewerEvent(aVW,NULL,eDisplayAll));
1945 void View3D_i::Erase (PrsObject_ptr thePrsObj)
1947 if(MYDEBUG) MESSAGE("View3D_i::Erase");
1948 SUIT_ViewWindow* aVW = GetViewWindow();
1949 CORBA::Object_ptr anObj = thePrsObj;
1950 Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in());
1952 ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eErase));
1955 void View3D_i::Display (PrsObject_ptr thePrsObj)
1957 if(MYDEBUG) MESSAGE("View3D_i::Display");
1958 SUIT_ViewWindow* aVW = GetViewWindow();
1959 CORBA::Object_ptr anObj = thePrsObj;
1960 Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in());
1962 ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eDisplay));
1965 void View3D_i::DisplayOnly (PrsObject_ptr thePrsObj)
1967 if(MYDEBUG) MESSAGE("View3D_i::DisplayOnly");
1968 SUIT_ViewWindow* aVW = GetViewWindow();
1969 CORBA::Object_ptr anObj = thePrsObj;
1970 Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in());
1972 ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eDisplayOnly));
1975 void View3D_i::FitAll()
1977 SUIT_ViewWindow* aVW = GetViewWindow();
1979 ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1980 (dynamic_cast<SVTK_ViewWindow*>(aVW), &SVTK_ViewWindow::onFitAll));
1985 void View3D_i::SetView (VISU::View3D::ViewType theType)
1987 SUIT_ViewWindow* aVW = GetViewWindow();
1992 case VISU::View3D::FRONT :
1993 ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1994 (dynamic_cast<SVTK_ViewWindow*>(aVW), &SVTK_ViewWindow::onFrontView));
1996 case VISU::View3D::BACK :
1997 ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1998 (dynamic_cast<SVTK_ViewWindow*>(aVW), &SVTK_ViewWindow::onBackView));
2000 case VISU::View3D::LEFT :
2001 ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
2002 (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onLeftView));
2004 case VISU::View3D::RIGHT :
2005 ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
2006 (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onRightView));
2008 case VISU::View3D::TOP :
2009 ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
2010 (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onTopView));
2012 case VISU::View3D::BOTTOM :
2013 ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
2014 (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onBottomView));
2020 class TSet3DViewParamEvent: public SALOME_Event
2023 typedef void (*TFun)(SUIT_ViewWindow* theViewWindow, const CORBA::Double theParam[3]);
2024 TSet3DViewParamEvent (TFun theFun,
2025 SUIT_ViewWindow* theViewWindow,
2026 const CORBA::Double theParam[3]):
2028 myVW(theViewWindow),
2031 virtual void Execute() {
2032 myFun(myVW,myParam);
2036 SUIT_ViewWindow* myVW;
2037 const CORBA::Double* myParam;
2040 void View3D_i::SetPointOfView (SUIT_ViewWindow* theViewWindow,
2041 const CORBA::Double thePosition[3])
2043 //jfa: may be need to be enclosed in SALOME_Event?
2044 GetCamera(theViewWindow)->SetPosition(thePosition);
2047 void View3D_i::SetPointOfView (const VISU::View3D::XYZ thePosition)
2049 if(MYDEBUG) MESSAGE("View3D_i::SetPointOfView");
2050 SUIT_ViewWindow* aVW = GetViewWindow();
2052 ProcessVoidEvent(new TSet3DViewParamEvent(&View3D_i::SetPointOfView,aVW,thePosition));
2055 void View3D_i::GetPointOfView (SUIT_ViewWindow* theViewWindow,
2056 CORBA::Double thePosition[3])
2058 GetCamera(theViewWindow)->GetPosition(thePosition);
2061 VISU::View3D::XYZ_slice* View3D_i::GetPointOfView()
2063 if(MYDEBUG) MESSAGE("View3D_i::GetPointOfView");
2064 CORBA::Double aPosition[3];
2065 SUIT_ViewWindow* aVW = GetViewWindow();
2067 GetPointOfView(aVW,aPosition);
2068 return VISU::View3D::XYZ_dup(aPosition);
2071 void View3D_i::SetViewUp (SUIT_ViewWindow* theViewWindow,
2072 const CORBA::Double theViewUp[3])
2074 GetCamera(theViewWindow)->SetViewUp(theViewUp);
2077 void View3D_i::SetViewUp (const VISU::View3D::XYZ theViewUp)
2079 if(MYDEBUG) MESSAGE("View3D_i::SetViewUp");
2080 SUIT_ViewWindow* aVW = GetViewWindow();
2082 ProcessVoidEvent(new TSet3DViewParamEvent(&View3D_i::SetViewUp,aVW,theViewUp));
2085 void View3D_i::GetViewUp (SUIT_ViewWindow* theViewWindow,
2086 CORBA::Double theViewUp[3])
2088 GetCamera(theViewWindow)->GetViewUp(theViewUp);
2091 VISU::View3D::XYZ_slice* View3D_i::GetViewUp()
2093 if(MYDEBUG) MESSAGE("View3D_i::GetViewUp");
2094 CORBA::Double aViewUp[3];
2095 SUIT_ViewWindow* aVW = GetViewWindow();
2097 GetCamera(aVW)->GetViewUp(aViewUp);
2098 return VISU::View3D::XYZ_dup(aViewUp);
2101 void View3D_i::SetFocalPoint (SUIT_ViewWindow* theViewWindow,
2102 const CORBA::Double theFocalPnt[3])
2104 GetCamera(theViewWindow)->SetFocalPoint(theFocalPnt);
2107 void View3D_i::SetFocalPoint (const VISU::View3D::XYZ theCoord)
2109 if(MYDEBUG) MESSAGE("View3D_i::SetFocalPoint");
2110 SUIT_ViewWindow* aVW = GetViewWindow();
2112 ProcessVoidEvent(new TSet3DViewParamEvent(&View3D_i::SetFocalPoint,aVW,theCoord));
2116 void View3D_i::GetFocalPoint (SUIT_ViewWindow* theViewWindow,
2117 CORBA::Double theFocalPnt[3])
2119 GetCamera(theViewWindow)->GetFocalPoint(theFocalPnt);
2122 VISU::View3D::XYZ_slice* View3D_i::GetFocalPoint()
2124 if(MYDEBUG) MESSAGE("View3D_i::GetFocalPoint");
2125 CORBA::Double aFocalPnt[3];
2126 SUIT_ViewWindow* aVW = GetViewWindow();
2128 GetFocalPoint(aVW,aFocalPnt);
2129 return VISU::View3D::XYZ_dup(aFocalPnt);
2132 class TSetViewParamEvent: public SALOME_Event
2135 typedef void (*TFun)(SUIT_ViewWindow* theViewWindow, CORBA::Double theParam);
2136 TSetViewParamEvent (TFun theFun,
2137 SUIT_ViewWindow* theViewWindow,
2138 CORBA::Double theParam):
2140 myVW(theViewWindow),
2143 virtual void Execute()
2145 myFun(myVW,myParam);
2149 SUIT_ViewWindow* myVW;
2150 CORBA::Double myParam;
2153 void View3D_i::SetParallelScale (SUIT_ViewWindow* theViewWindow,
2154 CORBA::Double theScale)
2156 GetCamera(theViewWindow)->SetParallelScale(theScale);
2159 void View3D_i::SetParallelScale (CORBA::Double theScale)
2161 if(MYDEBUG) MESSAGE("View3D_i::SetParallelScale");
2162 SUIT_ViewWindow* aVW = GetViewWindow();
2164 ProcessVoidEvent(new TSetViewParamEvent(&View3D_i::SetParallelScale,aVW,theScale));
2167 CORBA::Double View3D_i::GetParallelScale (SUIT_ViewWindow* theViewWindow)
2169 return GetCamera(theViewWindow)->GetParallelScale();
2172 CORBA::Double View3D_i::GetParallelScale()
2174 if(MYDEBUG) MESSAGE("View3D_i::GetParallelScale");
2175 SUIT_ViewWindow* aVW = GetViewWindow();
2177 return GetParallelScale(aVW);
2181 void View3D_i::ScaleView (SUIT_ViewWindow* theViewWindow,
2182 VISU::View3D::Axis theAxis, CORBA::Double theParam)
2184 SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(theViewWindow);
2185 double aScaleFactor[3];
2186 aViewWindow->GetScale(aScaleFactor);
2187 aScaleFactor[theAxis] = theParam;
2188 aViewWindow->SetScale(aScaleFactor);
2191 void SetScaleView (SUIT_ViewWindow* theViewWindow, const CORBA::Double theScale[3])
2193 double aScale[3] = {theScale[0], theScale[1], theScale[2]};
2194 (dynamic_cast<SVTK_ViewWindow*>(theViewWindow))->SetScale(aScale);
2197 void View3D_i::ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam)
2199 if(MYDEBUG) MESSAGE("View3D_i::ScaleView");
2200 SUIT_ViewWindow* aVW = GetViewWindow();
2203 (dynamic_cast<SVTK_ViewWindow*>(aVW))->GetScale(aScale);
2204 aScale[theAxis] = theParam;
2205 ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,aVW,aScale));
2209 void View3D_i::RemoveScale()
2211 if(MYDEBUG) MESSAGE("View3D_i::RemoveScale");
2212 SUIT_ViewWindow* aVW = GetViewWindow();
2214 double aScale[3] = {1.0, 1.0, 1.0};
2215 ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,aVW,aScale));
2219 //================================================
2220 // Certain presentation view parameters management
2221 //================================================
2222 class TPrsManageEvent: public SALOME_Event
2226 ScalarMap_ptr myPrs;
2229 TPrsManageEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
2230 myView3D(theView3D),
2231 myPrs(ScalarMap::_duplicate(thePrs)),
2232 myError("Unknown error occured")
2234 VISU_Actor* GetMyActor()
2236 SUIT_ViewWindow* aVW = myView3D->GetViewWindow();
2237 SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aVW);
2239 myError = "Corrupted view window";
2241 ScalarMap_i* aPrs = dynamic_cast<ScalarMap_i*>(VISU::GetServant(myPrs).in());
2243 myError = "Corrupted presentation";
2245 VISU_Actor* anActor = VISU::FindActor(vw, aPrs);
2247 myError = "No actor found. Display the presentation at first.";
2259 class TGetPrsTypeEvent: public TPrsManageEvent {
2261 typedef VISU::PresentationType TResult;
2263 TGetPrsTypeEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
2264 TPrsManageEvent(theView3D, thePrs), myResult(VISU::SHRINK) {}
2265 virtual void Execute() {
2266 if (VISU_Actor* anActor = GetMyActor())
2267 myResult = (VISU::PresentationType)anActor->GetRepresentation();
2271 class TGetShrinkedEvent: public TPrsManageEvent {
2273 typedef bool TResult;
2275 TGetShrinkedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
2276 TPrsManageEvent(theView3D, thePrs), myResult(false) {}
2277 virtual void Execute() {
2278 if (VISU_Actor* anActor = GetMyActor()) {
2279 if (anActor->IsShrunkable())
2280 myResult = anActor->IsShrunk();
2287 class TGetShadedEvent: public TPrsManageEvent {
2289 typedef bool TResult;
2291 TGetShadedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
2292 TPrsManageEvent(theView3D, thePrs), myResult(false) {}
2293 virtual void Execute() {
2294 if (VISU_Actor* anActor = GetMyActor())
2295 if (VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor))
2296 myResult = aScalarMapActor->IsShading();
2300 class TGetOpacityEvent: public TPrsManageEvent {
2302 typedef double TResult;
2304 TGetOpacityEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
2305 TPrsManageEvent(theView3D, thePrs), myResult(-1.0) {}
2306 virtual void Execute() {
2307 if (VISU_Actor* anActor = GetMyActor()) {
2308 vtkFloatingPointType oldvalue = anActor->GetOpacity();
2309 myResult = (double)oldvalue;
2314 class TGetLineWidthEvent: public TPrsManageEvent {
2316 typedef double TResult;
2318 TGetLineWidthEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
2319 TPrsManageEvent(theView3D, thePrs), myResult(-1.0) {}
2320 virtual void Execute() {
2321 if (VISU_Actor* anActor = GetMyActor()) {
2322 vtkFloatingPointType oldvalue = anActor->GetLineWidth();
2323 myResult = (double)oldvalue;
2329 class TSetPrsTypeEvent: public TPrsManageEvent {
2331 PresentationType myPrsType;
2333 typedef string TResult;
2335 TSetPrsTypeEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, PresentationType thePrsType):
2336 TPrsManageEvent(theView3D, thePrs), myPrsType(thePrsType),
2337 myResult("Unknown error occured")
2339 virtual void Execute() {
2340 switch (myPrsType) {
2341 case VISU::INSIDEFRAME:
2343 VISU::VISUType aType = myPrs->GetType();
2344 if (aType != VISU::TSCALARMAP &&
2345 aType != VISU::TDEFORMEDSHAPE &&
2346 aType != VISU::TSCALARMAPONDEFORMEDSHAPE) {
2347 myResult = "Insideframe representation is not available for this type of presentations.";
2352 case VISU::SURFACEFRAME:
2353 myResult = "Surfaceframe representation is available only for mesh presentation.";
2356 myResult = "Use SetShrinked() method to shrink/unshrink presentation.";
2361 if (VISU_Actor* anActor = GetMyActor()) {
2362 anActor->SetRepresentation((int)myPrsType);
2363 SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
2372 class TSetShrinkedEvent: public TPrsManageEvent {
2376 typedef string TResult;
2378 TSetShrinkedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, bool isOn):
2379 TPrsManageEvent(theView3D, thePrs), myIsOn(isOn),
2380 myResult("Unknown error occured")
2382 virtual void Execute() {
2383 VISU::VISUType aType = myPrs->GetType();
2384 if (aType == VISU::TVECTORS || aType == VISU::TSTREAMLINES) {
2385 myResult = "Shrinked representation is not available for this type of presentations.";
2387 if (VISU_Actor* anActor = GetMyActor()) {
2388 if (anActor->IsShrunkable()) {
2389 if (myIsOn) anActor->SetShrink();
2390 else anActor->UnShrink();
2391 SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
2395 myResult = "This presentation is not shrunkable.";
2404 class TSetShadedEvent: public TPrsManageEvent {
2408 typedef string TResult;
2410 TSetShadedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, bool isOn):
2411 TPrsManageEvent(theView3D, thePrs), myIsOn(isOn),
2412 myResult("Unknown error occured")
2414 virtual void Execute() {
2415 if (VISU_Actor* anActor = GetMyActor()) {
2416 if (VISU_ScalarMapAct* aScalarMapActor =
2417 dynamic_cast<VISU_ScalarMapAct*>(anActor)) {
2418 aScalarMapActor->SetShading(myIsOn);
2419 SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
2423 myResult = "Corrupted actor";
2431 class TSetOpacityEvent: public TPrsManageEvent {
2435 typedef string TResult;
2437 TSetOpacityEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, double theOpacity):
2438 TPrsManageEvent(theView3D, thePrs), myOpacity(theOpacity),
2439 myResult("Unknown error occured")
2441 virtual void Execute() {
2442 VISU::VISUType aType = myPrs->GetType();
2443 if (aType == VISU::TVECTORS || aType == VISU::TSTREAMLINES) {
2444 myResult = "Opacity is meaningless for this type of presentations.";
2447 if (VISU_Actor* anActor = GetMyActor()) {
2448 anActor->SetOpacity((vtkFloatingPointType)myOpacity);
2449 SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
2458 class TSetLineWidthEvent: public TPrsManageEvent {
2462 typedef string TResult;
2464 TSetLineWidthEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, double theLineWidth):
2465 TPrsManageEvent(theView3D, thePrs), myLineWidth(theLineWidth),
2466 myResult("Unknown error occured")
2468 virtual void Execute() {
2469 if (myPrs->GetType() == VISU::TVECTORS) {
2470 myResult = "Line Width is meaningless for Vectors presentation.";
2473 if (VISU_Actor* anActor = GetMyActor()) {
2474 anActor->SetLineWidth((vtkFloatingPointType)myLineWidth);
2475 SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
2484 PresentationType View3D_i::GetPresentationType(ScalarMap_ptr thePrs)
2486 return ProcessEvent(new TGetPrsTypeEvent(this,thePrs));
2488 CORBA::Boolean View3D_i::IsShrinked(ScalarMap_ptr thePrs)
2490 return ProcessEvent(new TGetShrinkedEvent(this,thePrs));
2492 CORBA::Boolean View3D_i::IsShaded(ScalarMap_ptr thePrs)
2494 return ProcessEvent(new TGetShadedEvent(this,thePrs));
2496 CORBA::Double View3D_i::GetOpacity(ScalarMap_ptr thePrs)
2498 return ProcessEvent(new TGetOpacityEvent(this,thePrs));
2500 CORBA::Double View3D_i::GetLineWidth(ScalarMap_ptr thePrs)
2502 return ProcessEvent(new TGetLineWidthEvent(this,thePrs));
2505 char* View3D_i::SetPresentationType(ScalarMap_ptr thePrs, PresentationType thePrsType)
2507 string aRet = ProcessEvent(new TSetPrsTypeEvent(this,thePrs,thePrsType));
2508 return CORBA::string_dup(aRet.c_str());
2510 char* View3D_i::SetShrinked(ScalarMap_ptr thePrs, CORBA::Boolean isShrinked)
2512 string aRet = ProcessEvent(new TSetShrinkedEvent(this,thePrs,isShrinked));
2513 return CORBA::string_dup(aRet.c_str());
2515 char* View3D_i::SetShaded(ScalarMap_ptr thePrs, CORBA::Boolean isShaded)
2517 string aRet = ProcessEvent(new TSetShadedEvent(this,thePrs,isShaded));
2518 return CORBA::string_dup(aRet.c_str());
2520 char* View3D_i::SetOpacity(ScalarMap_ptr thePrs, CORBA::Double theOpacity)
2522 string aRet = ProcessEvent(new TSetOpacityEvent(this,thePrs,theOpacity));
2523 return CORBA::string_dup(aRet.c_str());
2525 char* View3D_i::SetLineWidth(ScalarMap_ptr thePrs, CORBA::Double theLineWidth)
2527 string aRet = ProcessEvent(new TSetLineWidthEvent(this,thePrs,theLineWidth));
2528 return CORBA::string_dup(aRet.c_str());