Salome HOME
Some methods for view parameters management have been added. Old methods are not...
[modules/visu.git] / src / VISU_I / VISU_View_i.cc
1 //  VISU OBJECT : interactive object for VISU entities implementation
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //  File   : VISU_View_i.cc
24 //  Author : Alexey PETROV
25 //  Module : VISU
26
27 #include "VISU_View_i.hh"
28
29 #include "VISU_Gen_i.hh"
30 #include "VISU_Prs3d_i.hh"
31 #include "VISU_Table_i.hh"
32 #include "VISU_ViewManager_i.hh"
33
34 #include "VisuGUI_TableDlg.h"
35
36 #include "VISU_Actor.h"
37
38 #include "SALOME_Event.hxx"
39
40 #include "SUIT_ViewWindow.h"
41 #include "SUIT_ViewManager.h"
42 #include "SUIT_Tools.h"
43
44 #include "STD_MDIDesktop.h"
45 #include "STD_TabDesktop.h"
46
47 #include "SVTK_ViewWindow.h"
48 #include "SVTK_ViewModel.h"
49 #include "SVTK_RenderWindow.h"
50
51 #include "SPlot2d_ViewModel.h"
52 #include "Plot2d_ViewFrame.h"
53 #include "Plot2d_ViewModel.h"
54
55 #include "SalomeApp_Application.h"
56 #include "SalomeApp_Study.h"
57
58 #include <QtxWorkstack.h>
59
60 #include <qworkspace.h>
61
62 #include <vtkCamera.h>
63 #include <vtkRenderer.h>
64
65 using namespace std;
66
67 #ifdef _DEBUG_
68 static int MYDEBUG = 0;
69 #else
70 static int MYDEBUG = 0;
71 #endif
72
73 namespace VISU {
74
75   typedef TVoidMemFunEvent<SUIT_ViewWindow> TFrameActionEvent;
76
77   struct TNewViewEvent: public SALOME_Event
78   {
79     SalomeApp_Application* myApplication;
80     typedef QWidget* TResult;
81     TResult myResult;
82
83     TNewViewEvent (SalomeApp_Application* theApplication):
84       myApplication(theApplication),
85       myResult(NULL)
86     {}
87
88     virtual
89     void
90     Execute()
91     {
92       if (STD_MDIDesktop* aDesktop = dynamic_cast<STD_MDIDesktop*>(myApplication->desktop())) {
93         myResult = aDesktop->workspace();
94       }
95     }
96   };
97
98   View_i::
99   View_i (SalomeApp_Application *theApplication,
100           SUIT_ViewManager* theViewManager):
101     myApplication(theApplication),
102     myWorkspace(NULL),
103     myViewManager(theViewManager)
104   {
105     if(MYDEBUG) MESSAGE("View_i::View_i - "<<this);
106     myWorkspace = ProcessEvent(new TNewViewEvent(theApplication));
107   }
108
109   View_i::
110   ~View_i()
111   {
112     if(MYDEBUG) MESSAGE("View_i::~View_i - "<<this);
113   }
114
115
116   struct TApplicationEvent: public SALOME_Event
117   {
118     SalomeApp_Application* myApplication;
119
120     TApplicationEvent(SalomeApp_Application* theApplication):
121       myApplication(theApplication)
122     {}
123   };
124
125   void
126   View_i::
127   ShowPart (VISU::View::ViewRepresentation theViewRepresentation,
128             CORBA::Boolean theState)
129   {
130     struct TEvent: public TApplicationEvent
131     {
132       VISU::View::ViewRepresentation myViewRepresentation;
133       CORBA::Boolean myState;
134
135       TEvent(SalomeApp_Application* theApplication,
136              VISU::View::ViewRepresentation theViewRepresentation,
137              CORBA::Boolean theState):
138         TApplicationEvent(theApplication),
139         myViewRepresentation(theViewRepresentation),
140         myState(theState)
141       {}
142
143       virtual
144       void
145       Execute()
146       {
147         switch(myViewRepresentation){
148         case VISU::View::OBJECTBROWSER:
149           myApplication->setWindowShown(SalomeApp_Application::WT_ObjectBrowser,myState);
150           break;
151         case VISU::View::PYTHON:
152           myApplication->setWindowShown(SalomeApp_Application::WT_PyConsole,myState);
153           break;
154         case VISU::View::MESSAGES:
155           myApplication->setWindowShown(SalomeApp_Application::WT_LogWindow,myState);
156           break;
157         case VISU::View::VIEWER:{
158           ViewManagerList aViewManagerList = myApplication->viewManagers();
159           // to do something
160           // ...
161           break;
162         }}
163       }
164     };
165
166     ProcessVoidEvent(new TEvent(myApplication,theViewRepresentation,theState));
167   }
168
169   struct TPartShownEvent: public TApplicationEvent
170   {
171     VISU::View::ViewRepresentation myViewRepresentation;
172     typedef bool TResult;
173     TResult myResult;
174
175     TPartShownEvent(SalomeApp_Application* theApplication,
176                     VISU::View::ViewRepresentation theViewRepresentation):
177       TApplicationEvent(theApplication),
178       myViewRepresentation(theViewRepresentation),
179       myResult(false)
180     {}
181
182     virtual
183     void
184     Execute()
185     {
186       switch(myViewRepresentation){
187       case VISU::View::OBJECTBROWSER:
188         myResult = myApplication->isWindowVisible(SalomeApp_Application::WT_ObjectBrowser);
189         break;
190       case VISU::View::PYTHON:
191         myResult = myApplication->isWindowVisible(SalomeApp_Application::WT_PyConsole);
192         break;
193       case VISU::View::MESSAGES:
194         myResult = myApplication->isWindowVisible(SalomeApp_Application::WT_LogWindow);
195         break;
196       case VISU::View::VIEWER:{
197         ViewManagerList aViewManagerList = myApplication->viewManagers();
198         // to do something
199         // ...
200         break;
201       }}
202     }
203   };
204
205   CORBA::Boolean
206   View_i::
207   IsPartShown (VISU::View::ViewRepresentation theViewRepresentation)
208   {
209     return ProcessEvent(new TPartShownEvent(myApplication,theViewRepresentation));
210   }
211
212   // Begin: New methods for view parameters management
213   struct TSplitEvent: public SALOME_Event
214   {
215     SalomeApp_Application * myApplication;
216     SUIT_ViewWindow       * myViewWindow;
217     Qt::Orientation         myOrientation;
218     QtxWorkstack::SplitType mySplitType;
219
220   public:
221     TSplitEvent (SalomeApp_Application * theApplication,
222                  SUIT_ViewWindow       * theViewWindow,
223                  Qt::Orientation         theOrientation,
224                  QtxWorkstack::SplitType theSplitType):
225       myApplication(theApplication),
226       myViewWindow(theViewWindow),
227       myOrientation(theOrientation),
228       mySplitType(theSplitType)
229     {}
230
231     virtual void Execute()
232     {
233       SUIT_Desktop* desk = myApplication->desktop();
234       STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
235       if (tabDesk) {
236         QtxWorkstack* workstack = tabDesk->workstack();
237         if (workstack) {
238           workstack->Split(myViewWindow, myOrientation, mySplitType);
239         }
240       }
241     }
242   };
243
244   void
245   View_i::
246   SplitRight()
247   {
248     ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow,
249                                      Qt::Horizontal,QtxWorkstack::SPLIT_MOVE));
250   }
251
252   void
253   View_i::
254   SplitLeft()
255   {
256     ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow,
257                                      Qt::Horizontal,QtxWorkstack::SPLIT_STAY));
258   }
259
260   void
261   View_i::
262   SplitBottom()
263   {
264     ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow,
265                                      Qt::Vertical,QtxWorkstack::SPLIT_MOVE));
266   }
267
268   void
269   View_i::
270   SplitTop()
271   {
272     ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow,
273                                      Qt::Vertical,QtxWorkstack::SPLIT_STAY));
274   }
275
276   void
277   View_i::
278   OnTop()
279   {
280     struct TOnTopEvent: public SALOME_Event
281     {
282       SalomeApp_Application * myApplication;
283       SUIT_ViewWindow       * myViewWindow;
284
285     public:
286       TOnTopEvent (SalomeApp_Application * theApplication,
287                    SUIT_ViewWindow       * theViewWindow):
288         myApplication(theApplication),
289         myViewWindow(theViewWindow)
290       {}
291
292       virtual void Execute()
293       {
294         SUIT_Desktop* desk = myApplication->desktop();
295         STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
296         if (tabDesk) {
297           QtxWorkstack* workstack = tabDesk->workstack();
298           if (workstack) {
299             workstack->OnTop(myViewWindow);
300           }
301         }
302       }
303     };
304
305     ProcessVoidEvent(new TOnTopEvent(myApplication,myViewWindow));
306   }
307
308   struct TAttractEvent: public SALOME_Event
309   {
310     SalomeApp_Application * myApplication;
311     SUIT_ViewWindow       * myViewWindow1;
312     SUIT_ViewWindow       * myViewWindow2;
313     bool                    myAttractAll;
314
315   public:
316     TAttractEvent (SalomeApp_Application * theApplication,
317                    SUIT_ViewWindow       * theViewWindow1,
318                    SUIT_ViewWindow       * theViewWindow2,
319                    bool                    theAttractAll):
320       myApplication(theApplication),
321       myViewWindow1(theViewWindow1),
322       myViewWindow2(theViewWindow2),
323       myAttractAll(theAttractAll)
324     {}
325
326     virtual void Execute()
327     {
328       SUIT_Desktop* desk = myApplication->desktop();
329       STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
330       if (tabDesk) {
331         QtxWorkstack* workstack = tabDesk->workstack();
332         if (workstack) {
333           workstack->Attract(myViewWindow1, myViewWindow2, myAttractAll);
334         }
335       }
336     }
337   };
338
339   void
340   View_i::
341   Attract (VISU::View_ptr theView)
342   {
343     if (!CORBA::is_nil(theView)) {
344       if (VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(theView).in())) {
345         ProcessVoidEvent(new TAttractEvent(myApplication,myViewWindow,pView->myViewWindow,false));
346       }
347     }
348   }
349
350   void
351   View_i::
352   AttractAll (VISU::View_ptr theView)
353   {
354     if (!CORBA::is_nil(theView)) {
355       if (VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(theView).in())) {
356         ProcessVoidEvent(new TAttractEvent(myApplication,myViewWindow,pView->myViewWindow,true));
357       }
358     }
359   }
360
361   struct TSizePositionEvent: public SALOME_Event
362   {
363     SalomeApp_Application * myApplication;
364     SUIT_ViewWindow       * myViewWindow;
365     double                  myValue;
366     bool                    myIsSize;
367
368   public:
369     TSizePositionEvent (SalomeApp_Application * theApplication,
370                         SUIT_ViewWindow       * theViewWindow,
371                         double                  theValue,
372                         bool                    theIsSize):
373       myApplication(theApplication),
374       myViewWindow(theViewWindow),
375       myValue(theValue),
376       myIsSize(theIsSize)
377     {}
378
379     virtual void Execute()
380     {
381       MESSAGE("TSizePositionEvent::Execute()");
382       SUIT_Desktop* desk = myApplication->desktop();
383       STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
384       if (tabDesk) {
385         QtxWorkstack* workstack = tabDesk->workstack();
386         if (workstack) {
387           if (myIsSize) {
388             //jfa to do:workstack->SetRelativeSizeInSplitter(myViewWindow, myValue);
389           } else {
390             workstack->SetRelativePositionInSplitter(myViewWindow, myValue);
391           }
392         }
393       }
394     }
395   };
396
397   void
398   View_i::
399   SetRelativePositionInSplitter (CORBA::Double thePosition)
400   {
401     if (thePosition < 0.0 || 1.0 < thePosition) {
402       return;
403     }
404     ProcessVoidEvent(new TSizePositionEvent(myApplication,myViewWindow,thePosition,false));
405   }
406
407   void
408   View_i::
409   SetRelativeSizeInSplitter (CORBA::Double theSize)
410   {
411     if (theSize < 0.0 || 1.0 < theSize) {
412       return;
413     }
414     ProcessVoidEvent(new TSizePositionEvent(myApplication,myViewWindow,theSize,true));
415   }
416
417   struct TWSSizePositionEvent: public SALOME_Event
418   {
419     SalomeApp_Application * myApplication;
420     SUIT_ViewWindow       * myViewWindow;
421     Qt::Orientation         myOrientation;
422     double                  myValue;
423     bool                    myIsSize;
424
425   public:
426     TWSSizePositionEvent (SalomeApp_Application * theApplication,
427                           SUIT_ViewWindow       * theViewWindow,
428                           Qt::Orientation         theOrientation,
429                           double                  theValue,
430                           bool                    theIsSize):
431       myApplication(theApplication),
432       myViewWindow(theViewWindow),
433       myOrientation(theOrientation),
434       myValue(theValue),
435       myIsSize(theIsSize)
436     {}
437
438     virtual void Execute()
439     {
440       MESSAGE("TWSSizePositionEvent::Execute()");
441       SUIT_Desktop* desk = myApplication->desktop();
442       STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
443       if (tabDesk) {
444         QtxWorkstack* workstack = tabDesk->workstack();
445         if (workstack) {
446           if (myIsSize) {
447             //jfa to do:workstack->SetRelativeSize(myViewWindow, myOrientation, myValue);
448           } else {
449             workstack->SetRelativePosition(myViewWindow, myOrientation, myValue);
450           }
451         }
452       }
453     }
454   };
455
456   void
457   View_i::
458   SetRelativePositionX (CORBA::Double thePosition)
459   {
460     if (thePosition < 0.0 || 1.0 < thePosition) {
461       return;
462     }
463     ProcessVoidEvent(new TWSSizePositionEvent(myApplication,myViewWindow,
464                                               Qt::Horizontal,thePosition,false));
465   }
466
467   void
468   View_i::
469   SetRelativePositionY (CORBA::Double thePosition)
470   {
471     if (thePosition < 0.0 || 1.0 < thePosition) {
472       return;
473     }
474     ProcessVoidEvent(new TWSSizePositionEvent(myApplication,myViewWindow,
475                                               Qt::Vertical,thePosition,false));
476   }
477
478   void
479   View_i::
480   SetRelativeSizeX (CORBA::Double theSize)
481   {
482     if (theSize < 0.0 || 1.0 < theSize) {
483       return;
484     }
485     ProcessVoidEvent(new TWSSizePositionEvent(myApplication,myViewWindow,
486                                               Qt::Horizontal,theSize,true));
487   }
488
489   void
490   View_i::
491   SetRelativeSizeY (CORBA::Double theSize)
492   {
493     if (theSize < 0.0 || 1.0 < theSize) {
494       return;
495     }
496     ProcessVoidEvent(new TWSSizePositionEvent(myApplication,myViewWindow,
497                                               Qt::Vertical,theSize,true));
498   }
499   // End: New methods for view parameters management
500
501   // Begin: Old methods for view parameters management, they don't work now
502   struct TSetViewSize: public SALOME_Event
503   {
504     SUIT_ViewWindow* myViewWindow;
505     typedef void (QRect::* TAction)(int);
506     TAction myAction;
507     CORBA::Long mySize;
508
509   public:
510     TSetViewSize(SUIT_ViewWindow* theViewWindow,
511                  TAction theAction,
512                  CORBA::Long theSize):
513       myViewWindow(theViewWindow),
514       myAction(theAction),
515       mySize(theSize)
516     {}
517
518     virtual
519     void
520     Execute()
521     {
522       if (QWidget* aParent = myViewWindow->parentWidget(true)) {
523         QRect aQRect = aParent->frameGeometry();
524         (aQRect.*myAction)(mySize);
525         aParent->setGeometry(aQRect);
526       }
527     }
528   };
529
530   void
531   View_i::
532   SetViewWidth(CORBA::Long theWidth)
533   {
534     ProcessVoidEvent(new TSetViewSize(myViewWindow,&QRect::setWidth,theWidth));
535   }
536
537   void
538   View_i::
539   SetViewHeight(CORBA::Long theHeight)
540   {
541     ProcessVoidEvent(new TSetViewSize(myViewWindow,&QRect::setHeight,theHeight));
542   }
543
544
545   struct TGetViewSize: public SALOME_Event
546   {
547     SUIT_ViewWindow* myViewWindow;
548
549     typedef int (QRect::* TAction)() const;
550     TAction myAction;
551
552     typedef CORBA::Long TResult;
553     TResult myResult;
554
555   public:
556     TGetViewSize(SUIT_ViewWindow* theViewWindow,
557                  TAction theAction):
558       myViewWindow(theViewWindow),
559       myAction(theAction)
560     {}
561
562     virtual
563     void
564     Execute()
565     {
566       if(QWidget* aParent = myViewWindow->parentWidget(true)){
567         QRect aQRect = aParent->frameGeometry();
568         myResult = (aQRect.*myAction)();
569       }
570     }
571   };
572
573
574   CORBA::Long
575   View_i::
576   GetViewWidth()
577   {
578     return ProcessEvent(new TGetViewSize(myViewWindow,&QRect::width));
579   }
580
581   CORBA::Long
582   View_i::
583   GetViewHeight()
584   {
585     return ProcessEvent(new TGetViewSize(myViewWindow,&QRect::height));
586   }
587
588
589   class TWorkspaceEvent: public SALOME_Event
590   {
591   protected:
592     QWidget* myViewWindow;
593     QWidget* myWorkspace;
594
595   public:
596     TWorkspaceEvent(QWidget* theViewWindow,
597                     QWidget* theWorkspace):
598       myViewWindow(theViewWindow),
599       myWorkspace(theWorkspace)
600     {}
601   };
602
603
604   class TAlignEvent: public TWorkspaceEvent
605   {
606   protected:
607     Qt::AlignmentFlags myAligment;
608
609   public:
610     TAlignEvent(QWidget* theViewWindow,
611                 QWidget* theWorkspace,
612                 Qt::AlignmentFlags theAligment):
613       TWorkspaceEvent(theViewWindow,theWorkspace),
614       myAligment(theAligment)
615     {}
616
617     virtual
618     void
619     Execute()
620     {
621       if(QWidget* aParent = myViewWindow->parentWidget(true))
622         SUIT_Tools::alignWidget(aParent,myWorkspace,myAligment);
623     }
624   };
625
626
627   void
628   View_i::
629   SetViewPositionHorizontal (VISU::View::ViewPosition theViewPosition)
630   {
631     if (myWorkspace) {
632       switch (theViewPosition) {
633       case VISU::View::LEFT:
634         ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignLeft));
635         break;
636       case VISU::View::CENTER:
637         ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignHCenter));
638         break;
639       case VISU::View::RIGHT:
640         ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignRight));
641         break;
642       }
643     }
644   }
645
646
647   void
648   View_i::
649   SetViewPositionVertical (VISU::View::ViewPosition theViewPosition)
650   {
651     if (myWorkspace) {
652       switch (theViewPosition) {
653       case VISU::View::TOP:
654         ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignTop));
655         break;
656       case VISU::View::CENTER:
657         ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignVCenter));
658         break;
659       case VISU::View::BOTTOM:
660         ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignBottom));
661         break;
662       }
663     }
664   }
665
666
667   class TXYEvent: public TWorkspaceEvent
668   {
669   protected:
670     CORBA::Double myX, myY;
671
672   public:
673     TXYEvent(QWidget* theViewWindow,
674              QWidget* theWorkspace,
675              CORBA::Double theX,
676              CORBA::Double theY):
677       TWorkspaceEvent(theViewWindow,theWorkspace),
678       myX(theX),
679       myY(theY)
680     {}
681   };
682
683
684   void
685   View_i::
686   SetRelativePosition (CORBA::Double theX, CORBA::Double theY)
687   {
688     struct TEvent: public TXYEvent
689     {
690     public:
691       TEvent(QWidget* theViewWindow,
692              QWidget* theWorkspace,
693              CORBA::Double theX,
694              CORBA::Double theY):
695         TXYEvent(theViewWindow,theWorkspace,theX,theY)
696       {}
697
698       virtual
699       void
700       Execute()
701       {
702         if(QWidget* aParent = myViewWindow->parentWidget(true))
703           aParent->move(int(myX*myWorkspace->width()),int(myY*myWorkspace->height()));
704       }
705     };
706
707     if (myWorkspace)
708       ProcessVoidEvent(new TEvent(myViewWindow,myWorkspace,theX,theY));
709   }
710
711   void
712   View_i::
713   SetRelativeSize (CORBA::Double theX, CORBA::Double theY)
714   {
715     struct TEvent: public TXYEvent
716     {
717     public:
718       TEvent(QWidget* theViewWindow,
719              QWidget* theWorkspace,
720              CORBA::Double theX,
721              CORBA::Double theY):
722         TXYEvent(theViewWindow,theWorkspace,theX,theY)
723       {}
724
725       virtual
726       void
727       Execute()
728       {
729         if(QWidget* aParent = myViewWindow->parentWidget(true))
730           aParent->setGeometry(aParent->x(),
731                                aParent->y(),
732                                int(myX*myWorkspace->width()),
733                                int(myY*myWorkspace->height()));
734       }
735     };
736
737     if (myWorkspace)
738       ProcessVoidEvent(new TEvent(myViewWindow,myWorkspace,theX,theY));
739   }
740   // End: Old methods for view parameters management, they don't work now
741
742   void
743   View_i::
744   SetBackground (const SALOMEDS::Color& theColor)
745   {
746     struct TEvent: public SALOME_Event
747     {
748       QWidget* myWidget;
749       SALOMEDS::Color myColor;
750     public:
751       TEvent(QWidget* theWidget,
752              const SALOMEDS::Color& theColor):
753         myWidget(theWidget),
754         myColor(theColor)
755       {}
756       virtual void Execute(){
757         int aColor[3];
758         aColor[0] = int(255.0*myColor.R);
759         aColor[1] = int(255.0*myColor.G);
760         aColor[2] = int(255.0*myColor.B);
761         myWidget->setBackgroundColor(QColor(aColor[0],aColor[1],aColor[2]));
762       }
763     };
764
765     ProcessVoidEvent(new TEvent(myViewWindow,theColor));
766   }
767
768
769   struct TBackgroundEvent: public SALOME_Event
770   {
771     QWidget* myWidget;
772     typedef SALOMEDS::Color TResult;
773     TResult myResult;
774
775     TBackgroundEvent(QWidget* theWidget):
776       myWidget(theWidget)
777     {}
778
779     virtual
780     void
781     Execute()
782     {
783       const QColor& aColor = myWidget->backgroundColor();
784       myResult.R = aColor.red()/255.0;
785       myResult.G = aColor.green()/255.0;
786       myResult.B = aColor.blue()/255.0;
787     }
788   };
789
790   SALOMEDS::Color
791   View_i::
792   GetBackground()
793   {
794     return ProcessEvent(new TBackgroundEvent(myViewWindow));
795   }
796
797   void
798   View_i::
799   Minimize()
800   {
801     ProcessVoidEvent(new TFrameActionEvent(myViewWindow,&SUIT_ViewWindow::showMinimized));
802   }
803
804   void
805   View_i::
806   Restore()
807   {
808     ProcessVoidEvent(new TFrameActionEvent(myViewWindow,&SUIT_ViewWindow::showNormal));
809   }
810
811   void
812   View_i::
813   Maximize()
814   {
815     ProcessVoidEvent(new TFrameActionEvent(myViewWindow,&SUIT_ViewWindow::showMaximized));
816   }
817
818   void
819   View_i::
820   EraseAll()
821   {}
822
823   void
824   View_i::
825   DisplayAll()
826   {}
827
828   void
829   View_i::
830   Erase (PrsObject_ptr thePrsObj)
831   {}
832
833   void
834   View_i::
835   Display (PrsObject_ptr thePrsObj)
836   {}
837
838   void
839   View_i::
840   DisplayOnly (PrsObject_ptr thePrsObj)
841   {}
842
843   void
844   View_i::
845   Update()
846   {}
847
848   class TSavePictureEvent: public SALOME_Event
849   {
850     SUIT_ViewWindow * myViewWindow;
851     const char      * myFileName;
852   public:
853     typedef CORBA::Boolean TResult;
854     TResult myResult;
855     TSavePictureEvent (SUIT_ViewWindow * theViewWindow, const char * theFileName)
856       : myViewWindow(theViewWindow),
857         myFileName(theFileName),
858         myResult(false)
859     {
860     }
861
862     virtual void Execute()
863     {
864       if (myViewWindow) {
865         QImage img = myViewWindow->dumpView();
866         if (!img.isNull()) {
867           QString fileName (myFileName);
868           if (!fileName.isEmpty()) {
869             QString fmt = SUIT_Tools::extension(fileName).upper();
870             if (fmt.isEmpty()) fmt = QString("BMP"); // default format
871             if (fmt == "JPG" ) fmt = "JPEG";
872             //QApplication::setOverrideCursor(Qt::waitCursor);
873             img.save(fileName, fmt.latin1());
874             //QApplication::restoreOverrideCursor();
875           }
876         }
877       }
878     }
879   };
880
881   CORBA::Boolean
882   View_i::SavePicture(const char* theFileName)
883   {
884     return ProcessEvent(new TSavePictureEvent (myViewWindow,theFileName));
885   }
886
887   const char*
888   View_i::
889   GetComment() const
890   {
891     return "";
892   }
893
894   void
895   View_i::
896   ToStream (std::ostringstream& theStr)
897   {
898   }
899
900
901   //================= OLD CODE ===================
902
903   //QAD_Study* CheckStudy (SALOMEDS::Study_ptr theStudy)
904   //{
905   //  //QAD_Desktop* aDesktop = QAD_Application::getDesktop();
906   //  //QAD_Study* aStudy = aDesktop->findStudy(theStudy);
907   //  if (!aStudy) {
908   //    CORBA::String_var aName = theStudy->Name();
909   //    aFileInfo.setFile(aName.in());
910   //    if (aFileInfo.exists())
911   //      aStudy = aDesktop->loadStudy(aFileInfo.baseName());
912   //    else
913   //      aStudy = aDesktop->loadStudy(aName.in());
914   //    if (!aStudy) {
915   //      MESSAGE("CheckStudy()::ERROR: Can't load study");
916   //    }
917   //  }
918   //  return aStudy;
919   //}
920
921   template<class TViewer>
922   struct TNewSpecViewEvent: public SALOME_Event
923   {
924     SalomeApp_Application* myApplication;
925
926     typedef SUIT_ViewManager* TResult;
927     TResult myResult;
928
929     TNewSpecViewEvent (SalomeApp_Application* theApplication):
930       myApplication(theApplication),
931       myResult(NULL)
932     {}
933
934     virtual
935     void
936     Execute()
937     {
938       myResult = myApplication->getViewManager(TViewer::Type(), true);
939     }
940   };
941
942   //===========================================================================
943   XYPlot_i::XYPlot_i (SalomeApp_Application* theApplication)
944     : View_i(theApplication, NULL)
945   {
946     if (MYDEBUG) MESSAGE("XYPlot_i::XYPlot_i");
947     if (theApplication) {
948       myViewManager = ProcessEvent(new TNewSpecViewEvent<Plot2d_Viewer>(theApplication));
949     }
950   }
951
952
953   struct TCreatePlot2dViewEvent: public SALOME_Event
954   {
955     SUIT_ViewManager* myViewManager;
956     XYPlot_i        * myPlot2dView;
957     int               myNew;
958
959     typedef Plot2d_ViewFrame* TResult;
960     TResult myResult;
961
962     TCreatePlot2dViewEvent (SUIT_ViewManager* theViewManager,
963                             XYPlot_i        * thePlot2dView,
964                             const int         theNew):
965       myViewManager(theViewManager),
966       myPlot2dView(thePlot2dView),
967       myNew(theNew),
968       myResult(NULL)
969     {}
970
971     virtual
972     void
973     Execute()
974     {
975       if (myNew) {
976         myPlot2dView->myViewWindow = myViewManager->createViewWindow();
977       } else {
978         myPlot2dView->myViewWindow = myViewManager->getActiveView();
979       }
980       if (myPlot2dView->myViewWindow) {
981         Plot2d_ViewWindow* aPlot2dVW = dynamic_cast<Plot2d_ViewWindow*>(myPlot2dView->myViewWindow);
982         if (aPlot2dVW) {
983           myResult = aPlot2dVW->getViewFrame();
984           if (myResult) {
985             myResult->Repaint();
986           }
987         }
988       }
989     }
990   };
991
992   Storable* XYPlot_i::Create (int theNew)
993   {
994     myView = ProcessEvent(new TCreatePlot2dViewEvent(myViewManager, this, theNew));
995     return this;
996   }
997
998   void XYPlot_i::Update()
999   {
1000     ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame>(myView,&Plot2d_ViewFrame::Repaint));
1001   }
1002
1003   void XYPlot_i::Close()
1004   {
1005     //jfa: may be need to be enclosed in SALOME_Event?
1006     myViewWindow->close();
1007   }
1008
1009   XYPlot_i::~XYPlot_i() {
1010     if(MYDEBUG) MESSAGE("XYPlot_i::~XYPlot_i");
1011   }
1012
1013   void XYPlot_i::SetTitle (const char* theTitle)
1014   {
1015     ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
1016                      (myViewWindow, &SUIT_ViewWindow::setCaption, QString(theTitle)));
1017   }
1018   char* XYPlot_i::GetTitle()
1019   {
1020     //jfa: may be need to be enclosed in SALOME_Event?
1021     return CORBA::string_dup(myViewWindow->caption().latin1());
1022   }
1023
1024   void XYPlot_i::SetSubTitle (const char* theTitle)
1025   {
1026     ProcessVoidEvent(new TVoidMemFun1ArgEvent<Plot2d_ViewFrame,const QString&,QString>
1027                      (myView, &Plot2d_ViewFrame::setTitle, QString(theTitle)));
1028   }
1029
1030   char* XYPlot_i::GetSubTitle()
1031   {
1032     //jfa: may be need to be enclosed in SALOME_Event?
1033     return CORBA::string_dup(myView->getTitle());
1034   }
1035
1036   void XYPlot_i::SetCurveType (VISU::XYPlot::CurveType theType)
1037   {
1038     ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
1039                      (myView,&Plot2d_ViewFrame::setCurveType,theType,true));
1040   }
1041
1042   VISU::XYPlot::CurveType XYPlot_i::GetCurveType()
1043   {
1044     //jfa: may be need to be enclosed in SALOME_Event?
1045     return (VISU::XYPlot::CurveType)myView->getCurveType();
1046   }
1047
1048   void XYPlot_i::SetMarkerSize (CORBA::Long theSize)
1049   {
1050     ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
1051                      (myView,&Plot2d_ViewFrame::setMarkerSize,theSize,true));
1052   }
1053
1054   CORBA::Long XYPlot_i::GetMarkerSize()
1055   {
1056     //jfa: may be need to be enclosed in SALOME_Event?
1057     return myView->getMarkerSize();
1058   }
1059
1060   class TEnableGridEvent: public SALOME_Event
1061   {
1062   public:
1063     typedef void (Plot2d_ViewFrame::* TFun)(bool, const int, bool, const int, bool);
1064     TEnableGridEvent (Plot2d_ViewFrame* theView, TFun theFun,
1065                       CORBA::Boolean theMajor, CORBA::Long theNumMajor,
1066                       CORBA::Boolean theMinor, CORBA::Long theNumMinor):
1067       myView(theView), myFun(theFun),
1068       myMajor(theMajor), myNumMajor(theNumMajor),
1069       myMinor(theMinor), myNumMinor(theNumMinor)
1070     {}
1071
1072     virtual void Execute()
1073     {
1074       (myView->*myFun)(myMajor,myNumMajor,myMinor,myNumMinor,true);
1075     }
1076   protected:
1077     Plot2d_ViewFrame* myView;
1078     TFun myFun;
1079     CORBA::Boolean myMajor, myNumMajor;
1080     CORBA::Boolean myMinor, myNumMinor;
1081   };
1082
1083   void XYPlot_i::EnableXGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
1084                               CORBA::Boolean theMinor, CORBA::Long theNumMinor)
1085   {
1086     ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setXGrid,
1087                                           theMajor,theNumMajor,theMinor,theNumMinor));
1088   }
1089   void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor,
1090                              CORBA::Boolean theMinor, CORBA::Long theNumMinor)
1091   {
1092     //jfa tmp:ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setYGrid,
1093     //jfa tmp:                                      theMajor,theNumMajor,theMinor,theNumMinor));
1094   }
1095
1096   class TSetScaleModeEvent: public SALOME_Event
1097   {
1098   public:
1099     typedef void (Plot2d_ViewFrame::* TFun)(const int, bool);
1100     TSetScaleModeEvent (Plot2d_ViewFrame* theView, TFun theFun, int theScaling):
1101       myView(theView), myFun(theFun), myScaling(theScaling)
1102     {}
1103
1104     virtual void Execute()
1105     {
1106       (myView->*myFun)(myScaling,true);
1107     }
1108   protected:
1109     Plot2d_ViewFrame* myView;
1110     TFun myFun;
1111     int myScaling;
1112   };
1113
1114   void XYPlot_i::SetHorScaling (VISU::Scaling theScaling)
1115   {
1116     ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setHorScaleMode,
1117                                             theScaling == VISU::LOGARITHMIC));
1118   }
1119
1120   VISU::Scaling XYPlot_i::GetHorScaling()
1121   {
1122     //jfa: may be need to be enclosed in SALOME_Event?
1123     return (VISU::Scaling)myView->getHorScaleMode();
1124   }
1125
1126   void XYPlot_i::SetVerScaling(VISU::Scaling theScaling)
1127   {
1128     ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setVerScaleMode,
1129                                             theScaling == VISU::LOGARITHMIC));
1130   }
1131
1132   VISU::Scaling XYPlot_i::GetVerScaling()
1133   {
1134     //jfa: may be need to be enclosed in SALOME_Event?
1135     return (VISU::Scaling)myView->getVerScaleMode();
1136   }
1137
1138   class TSetTitleEvent: public SALOME_Event
1139   {
1140   public:
1141     TSetTitleEvent (Plot2d_ViewFrame* theView, Plot2d_ViewFrame::ObjectType theType, const char* theTitle):
1142       myView(theView), myType(theType), myTitle(theTitle)
1143     {}
1144     virtual void Execute()
1145     {
1146       myView->setTitle(true,myTitle,myType);
1147     }
1148   protected:
1149     Plot2d_ViewFrame* myView;
1150     Plot2d_ViewFrame::ObjectType myType;
1151     const char* myTitle;
1152   };
1153
1154   void XYPlot_i::SetXTitle (const char* theTitle)
1155   {
1156     ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::XTitle, theTitle));
1157   }
1158   char* XYPlot_i::GetXTitle()
1159   {
1160     //jfa: may be need to be enclosed in SALOME_Event?
1161     return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::XTitle));
1162   }
1163
1164   void XYPlot_i::SetYTitle (const char* theTitle)
1165   {
1166     ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::YTitle, theTitle));
1167   }
1168   char* XYPlot_i::GetYTitle()
1169   {
1170     //jfa: may be need to be enclosed in SALOME_Event?
1171     return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::YTitle));
1172   }
1173
1174   void XYPlot_i::ShowLegend (CORBA::Boolean theShowing)
1175   {
1176     ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,bool,bool>
1177                      (myView,&Plot2d_ViewFrame::showLegend,theShowing,true));
1178   }
1179
1180   class TXYPlotViewEvent: public SALOME_Event
1181   {
1182     SalomeApp_Application* myApplication;
1183     Plot2d_ViewFrame*      myView;
1184     PrsObject_ptr          myPrsObj;
1185     int                    myDisplaing;
1186
1187   public:
1188     TXYPlotViewEvent(SalomeApp_Application* theApplication,
1189                      Plot2d_ViewFrame*      theView,
1190                      PrsObject_ptr          thePrsObj,
1191                      int                    theDisplaing)
1192       : myApplication(theApplication),
1193       myView(theView),
1194       myPrsObj(thePrsObj),
1195       myDisplaing(theDisplaing)
1196     {
1197     }
1198
1199     virtual void Execute()
1200     {
1201       // is it Curve ?
1202       if (Curve_i* aCurve = dynamic_cast<Curve_i*>(VISU::GetServant(myPrsObj).in())) {
1203         UpdatePlot2d(myView,myDisplaing,aCurve);
1204       }
1205       // is it Container ?
1206       if (Container_i* aContainer = dynamic_cast<Container_i*>(VISU::GetServant(myPrsObj).in())) {
1207         int nbCurves = aContainer->GetNbCurves();
1208         for ( int i = 1; i <= nbCurves; i++ ) {
1209           VISU::Curve_i* aCurve = aContainer->GetCurve( i );
1210           if ( aCurve && aCurve->IsValid() ) {
1211             UpdatePlot2d(myView,myDisplaing,aCurve);
1212           }
1213         }
1214         myView->Repaint();
1215       }
1216       // is it Table ?
1217       if (Table_i* aTable = dynamic_cast<Table_i*>(VISU::GetServant(myPrsObj).in())) {
1218         _PTR(Study) aCStudy;
1219         if (SUIT_Study* aSStudy = myApplication->activeStudy()) {
1220           if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
1221             aCStudy = aStudy->studyDS();
1222           }
1223         }
1224         if (!aCStudy) return;
1225         _PTR(SObject) TableSO = aCStudy->FindObjectID(aTable->GetEntry().latin1());
1226         if (TableSO) {
1227           _PTR(ChildIterator) Iter = aCStudy->NewChildIterator(TableSO);
1228           for (; Iter->More(); Iter->Next()) {
1229             CORBA::Object_var childObject = VISU::ClientSObjectToObject(Iter->Value());
1230             if (!CORBA::is_nil(childObject)) {
1231               CORBA::Object_ptr aCurve = VISU::Curve::_narrow(childObject);
1232               if (!CORBA::is_nil(aCurve))
1233                 UpdatePlot2d(myView, myDisplaing,
1234                              dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in()));
1235             }
1236           }
1237           myView->Repaint();
1238         }
1239       }
1240     }
1241   };
1242
1243   void XYPlot_i::Display (PrsObject_ptr thePrsObj)
1244   {
1245     ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eDisplay));
1246   }
1247
1248   void XYPlot_i::Erase (PrsObject_ptr thePrsObj)
1249   {
1250     ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eErase));
1251   }
1252
1253   void XYPlot_i::DisplayOnly (PrsObject_ptr thePrsObj)
1254   {
1255     ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eDisplayOnly));
1256   }
1257
1258   void XYPlot_i::EraseAll()
1259   {
1260     ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::EraseAll));
1261   }
1262
1263   void XYPlot_i::FitAll()
1264   {
1265     ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::fitAll));
1266   }
1267
1268
1269   //===========================================================================
1270   TableView_i::TableView_i (SalomeApp_Application* theApplication)
1271     : View_i(theApplication, NULL)
1272   {
1273   }
1274
1275   struct TCreateTableViewEvent: public SALOME_Event
1276   {
1277     SalomeApp_Application* myApplication;
1278     VISU::Table_i*         myTable;
1279
1280     typedef VisuGUI_TableDlg* TResult;
1281     TResult myResult;
1282
1283     TCreateTableViewEvent (SalomeApp_Application* theApplication,
1284                            VISU::Table_i*         theTable):
1285       myApplication(theApplication),
1286       myTable(theTable),
1287       myResult(NULL)
1288     {}
1289
1290     virtual
1291     void
1292     Execute()
1293     {
1294       if (myTable != NULL) {
1295         if (SUIT_Study* aSStudy = myApplication->activeStudy()) {
1296           if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
1297             if (_PTR(Study) aCStudy = aStudy->studyDS()) {
1298               _PTR(SObject) aSObject = aCStudy->FindObjectID(myTable->GetObjectEntry());
1299               if (aSObject) {
1300                 myResult = new VisuGUI_TableDlg (myApplication->desktop(),
1301                                                  aSObject,
1302                                                  false,
1303                                                  VisuGUI_TableDlg::ttAuto,
1304                                                  Qt::Vertical);
1305                 myResult->show();
1306               }
1307             }
1308           }
1309         }
1310       }
1311     }
1312   };
1313
1314   Storable* TableView_i::Create (VISU::Table_ptr theTable)
1315   {
1316     if (MYDEBUG) MESSAGE("TableView_i::Create - " << (!theTable->_is_nil()));
1317     if (!theTable->_is_nil()) {
1318       VISU::Table_i* table =
1319         dynamic_cast<VISU::Table_i*>(VISU::GetServant(theTable).in());
1320       if (MYDEBUG) MESSAGE("TableView_i::Create - dynamic_cast = " << table);
1321
1322       myView = ProcessEvent(new TCreateTableViewEvent(myApplication, table));
1323       if (myView)
1324         return this;
1325     }
1326     return NULL;
1327   }
1328
1329   TableView_i::~TableView_i()
1330   {
1331     if(MYDEBUG) MESSAGE("TableView_i::~TableView_i");
1332     delete myView;
1333   }
1334
1335   void TableView_i::SetTitle (const char* theTitle)
1336   {
1337     ProcessVoidEvent(new TVoidMemFun1ArgEvent<VisuGUI_TableDlg,const QString&,QString>
1338                      (myView, &VisuGUI_TableDlg::setCaption, QString(theTitle)));
1339   }
1340
1341   char* TableView_i::GetTitle()
1342   {
1343     //jfa: may be need to be enclosed in SALOME_Event?
1344     return CORBA::string_dup(myView->caption().latin1());
1345   }
1346
1347   void TableView_i::Close()
1348   {
1349     //jfa: may be need to be enclosed in SALOME_Event?
1350     myView->close();
1351   }
1352
1353
1354   //===========================================================================
1355   int View3D_i::myNbViewParams = 0;
1356   const string View3D_i::myComment = "VIEW3D";
1357   const char* View3D_i::GetComment() const { return myComment.c_str();}
1358
1359   QString View3D_i::GenerateViewParamsName()
1360   {
1361     return VISU::GenerateName("ViewParams", ++myNbViewParams);
1362   }
1363
1364   View3D_i::View3D_i (SalomeApp_Application* theApplication)
1365     : View_i(theApplication, NULL)
1366   {
1367     if (MYDEBUG) MESSAGE("View3D_i::View3D_i");
1368     if (theApplication) {
1369       myViewManager = ProcessEvent(new TNewSpecViewEvent<SVTK_Viewer>(theApplication));
1370     }
1371   }
1372
1373   struct TCreateView3dEvent: public SALOME_Event
1374   {
1375     SUIT_ViewManager* myViewManager;
1376     int               myNew;
1377
1378     typedef SUIT_ViewWindow* TResult;
1379     TResult myResult;
1380
1381     TCreateView3dEvent (SUIT_ViewManager* theViewManager,
1382                         const int         theNew):
1383       myViewManager(theViewManager),
1384       myNew(theNew),
1385       myResult(NULL)
1386     {}
1387
1388     virtual
1389     void
1390     Execute()
1391     {
1392       if (myNew) {
1393         myResult = myViewManager->createViewWindow();
1394       } else {
1395         myResult = myViewManager->getActiveView();
1396       }
1397     }
1398   };
1399
1400   Storable* View3D_i::Create (int theNew)
1401   {
1402     if (MYDEBUG) MESSAGE("View3D_i::Create");
1403     myViewWindow = ProcessEvent(new TCreateView3dEvent(myViewManager, theNew));
1404     return this;
1405   }
1406
1407   void View3D_i::Update()
1408   {
1409     class TEvent: public SALOME_Event
1410     {
1411       SUIT_ViewWindow* myViewWindow;
1412     public:
1413       TEvent(SUIT_ViewWindow* theStudyFrame):
1414         myViewWindow(theStudyFrame)
1415       {}
1416       virtual void Execute()
1417       {
1418         SVTK_ViewWindow* vf = GetViewWindow(myViewWindow);
1419         vtkRenderer* Renderer = vf->getRenderer();
1420         vtkActorCollection* theActors = Renderer->GetActors();
1421         theActors->InitTraversal();
1422         while (vtkActor *anAct = theActors->GetNextActor()) {
1423           if (VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)) {
1424             VISU::Prs3d_i* aPrs3d  = anActor->GetPrs3d();
1425             if (anActor->GetVisibility() && aPrs3d) {
1426               aPrs3d->Update();
1427               aPrs3d->UpdateActor(anActor);
1428             }
1429           }
1430         }
1431         RepaintView(myViewWindow);
1432       }
1433     };
1434     ProcessVoidEvent(new TEvent(myViewWindow));
1435   }
1436
1437   bool View3D_i::SaveViewParams (SUIT_ViewManager* theViewManager, const char* theName)
1438   {
1439     MESSAGE("View3D_i::SaveViewParams()");
1440     _PTR(Study) aCStudy;
1441     if (SUIT_Study* aSStudy = theViewManager->study()) {
1442       if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
1443         aCStudy = aStudy->studyDS();
1444       }
1445     }
1446     if (!aCStudy)
1447       return false;
1448
1449     if (theName) {
1450       std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName, "VISU");
1451       _PTR(GenericAttribute) anAttr;
1452       int iEnd = aList.size();
1453       for (int i = 0; i < iEnd; i++) {
1454         _PTR(SObject) anObj = aList[i];
1455         string anEntry = anObj->GetID();
1456         if(MYDEBUG) MESSAGE("View3D_i::SaveViewParams - anEntry = " << anEntry);
1457         if (anObj->FindAttribute(anAttr, "AttributeComment")) {
1458           _PTR(AttributeComment) aCmnt (anAttr);
1459           string aComm (aCmnt->Value());
1460           if (MYDEBUG) MESSAGE("View3D_i::SaveViewPoint - aComm = " << aComm);
1461           if (aComm.compare(View3D_i::myComment) >= 0) {
1462             aCmnt->SetValue(ToString(theViewManager->getActiveView()).c_str());
1463             return true;
1464           }
1465         }
1466       }
1467     }
1468     _PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy);
1469     string aSComponentEntry = aSComponent->GetID();
1470     string anEntry = CreateAttributes(aCStudy, aSComponentEntry.c_str(), "", "", theName, "",
1471                                       ToString(theViewManager->getActiveView()).c_str());
1472     return true;
1473   }
1474
1475   class TSaveViewParamsEvent: public SALOME_Event
1476   {
1477     SUIT_ViewManager* myViewManager;
1478     const char*       myName;
1479   public:
1480     TSaveViewParamsEvent (SUIT_ViewManager* theViewManager,
1481                           const char*       theName):
1482       myViewManager(theViewManager),
1483       myName(theName)
1484     {}
1485
1486     virtual void Execute()
1487     {
1488       myResult = View3D_i::SaveViewParams(myViewManager, myName);
1489     }
1490     typedef CORBA::Boolean TResult;
1491     TResult myResult;
1492   };
1493
1494   CORBA::Boolean View3D_i::SaveViewParams (const char* theName)
1495   {
1496     return ProcessEvent(new TSaveViewParamsEvent (myViewManager, theName));
1497   }
1498
1499   bool View3D_i::RestoreViewParams (SUIT_ViewManager* theViewManager, const char* theName)
1500   {
1501     _PTR(Study) aCStudy;
1502     if (SUIT_Study* aSStudy = theViewManager->study()) {
1503       if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
1504         aCStudy = aStudy->studyDS();
1505       }
1506     }
1507     if (!aCStudy)
1508       return false;
1509
1510     std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName, "VISU");
1511     _PTR(GenericAttribute) anAttr;
1512     int iEnd = aList.size();
1513     if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - iEnd = " << iEnd);
1514     for (int i = 0; i < iEnd; i++) {
1515       _PTR(SObject) anObj = aList[i];
1516       string anEntry = anObj->GetID();
1517       if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - anEntry = " << anEntry);
1518       if (anObj->FindAttribute(anAttr, "AttributeComment")) {
1519         _PTR(AttributeComment) aCmnt (anAttr);
1520         QString strIn(aCmnt->Value().c_str());
1521         Storable::TRestoringMap aMap;
1522         Storable::StrToMap(strIn, aMap);
1523         if (Storable::FindValue(aMap, "myComment").compare
1524             (View3D_i::myComment.c_str()) >= 0) {
1525           if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - aComm = " << strIn);
1526           Restore(theViewManager->getActiveView(), aMap);
1527           return true;
1528         }
1529       }
1530     }
1531     return false;
1532   }
1533
1534   class TRestoreViewParamsEvent: public SALOME_Event
1535   {
1536     SUIT_ViewManager* myViewManager;
1537     const char*       myName;
1538   public:
1539     TRestoreViewParamsEvent (SUIT_ViewManager* theViewManager,
1540                              const char*       theName):
1541       myViewManager(theViewManager),
1542       myName(theName)
1543     {}
1544
1545     virtual void Execute()
1546     {
1547       myResult = View3D_i::RestoreViewParams(myViewManager, myName);
1548     }
1549     typedef CORBA::Boolean TResult;
1550     TResult myResult;
1551   };
1552
1553   CORBA::Boolean View3D_i::RestoreViewParams (const char* theName)
1554   {
1555     return ProcessEvent(new TRestoreViewParamsEvent (myViewManager, theName));
1556   }
1557
1558   void View3D_i::Restore (SUIT_ViewWindow* theStudyFrame,
1559                           const Storable::TRestoringMap& theMap)
1560   {
1561     SALOMEDS::Color aColor;
1562     aColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
1563     aColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
1564     aColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
1565
1566     double aPosition[3];
1567     aPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
1568     aPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
1569     aPosition[2] = VISU::Storable::FindValue(theMap,"myPosition[2]").toDouble();
1570
1571     double aFocalPnt[3];
1572     aFocalPnt[0] = VISU::Storable::FindValue(theMap,"myFocalPnt[0]").toDouble();
1573     aFocalPnt[1] = VISU::Storable::FindValue(theMap,"myFocalPnt[1]").toDouble();
1574     aFocalPnt[2] = VISU::Storable::FindValue(theMap,"myFocalPnt[2]").toDouble();
1575
1576     double aViewUp[3];
1577     aViewUp[0] = VISU::Storable::FindValue(theMap,"myViewUp[0]").toDouble();
1578     aViewUp[1] = VISU::Storable::FindValue(theMap,"myViewUp[1]").toDouble();
1579     aViewUp[2] = VISU::Storable::FindValue(theMap,"myViewUp[2]").toDouble();
1580
1581     double aParallelScale = VISU::Storable::FindValue(theMap,"myParallelScale").toDouble();
1582
1583     double aScaleFactor[3];
1584     aScaleFactor[0] = VISU::Storable::FindValue(theMap,"myScaleFactor[0]").toDouble();
1585     aScaleFactor[1] = VISU::Storable::FindValue(theMap,"myScaleFactor[1]").toDouble();
1586     aScaleFactor[2] = VISU::Storable::FindValue(theMap,"myScaleFactor[2]").toDouble();
1587
1588     SetBackground(theStudyFrame,aColor);
1589     SetPointOfView(theStudyFrame,aPosition);
1590     SetViewUp(theStudyFrame,aViewUp);
1591     SetFocalPoint(theStudyFrame,aFocalPnt);
1592     SetParallelScale(theStudyFrame,aParallelScale);
1593     ScaleView(theStudyFrame,VISU::View3D::XAxis,aScaleFactor[0]);
1594     ScaleView(theStudyFrame,VISU::View3D::YAxis,aScaleFactor[1]);
1595     ScaleView(theStudyFrame,VISU::View3D::ZAxis,aScaleFactor[2]);
1596   }
1597
1598
1599   string View3D_i::ToString (SUIT_ViewWindow* theStudyFrame)
1600   {
1601     ostringstream strOut;
1602     Storable::DataToStream( strOut, "myComment", myComment.c_str() );
1603     ToStream(theStudyFrame,strOut);
1604     strOut<<ends;
1605     if(MYDEBUG) MESSAGE("View3D_i::ToString - "<<strOut.str());
1606     return strOut.str();
1607   }
1608
1609   void View3D_i::ToStream (SUIT_ViewWindow* theStudyFrame, std::ostringstream& theStr)
1610   {
1611     Storable::DataToStream(theStr,"myType",VISU::TVIEW3D);
1612
1613     float backint[3];
1614     GetRenderer(theStudyFrame)->GetBackground(backint);
1615     Storable::DataToStream(theStr,"myColor.R",backint[0]);
1616     Storable::DataToStream(theStr,"myColor.G",backint[1]);
1617     Storable::DataToStream(theStr,"myColor.B",backint[2]);
1618
1619     double aPosition[3];
1620     GetPointOfView(theStudyFrame,aPosition);
1621     Storable::DataToStream(theStr,"myPosition[0]",aPosition[0]);
1622     Storable::DataToStream(theStr,"myPosition[1]",aPosition[1]);
1623     Storable::DataToStream(theStr,"myPosition[2]",aPosition[2]);
1624
1625     double aFocalPnt[3];
1626     GetFocalPoint(theStudyFrame,aFocalPnt);
1627     Storable::DataToStream(theStr,"myFocalPnt[0]",aFocalPnt[0]);
1628     Storable::DataToStream(theStr,"myFocalPnt[1]",aFocalPnt[1]);
1629     Storable::DataToStream(theStr,"myFocalPnt[2]",aFocalPnt[2]);
1630
1631     double aViewUp[3];
1632     GetCamera(theStudyFrame)->GetViewUp(aViewUp);
1633     Storable::DataToStream(theStr,"myViewUp[0]",aViewUp[0]);
1634     Storable::DataToStream(theStr,"myViewUp[1]",aViewUp[1]);
1635     Storable::DataToStream(theStr,"myViewUp[2]",aViewUp[2]);
1636
1637     Storable::DataToStream(theStr,"myParallelScale",GetParallelScale(theStudyFrame));
1638
1639     double aScaleFactor[3];
1640     GetViewWindow(theStudyFrame)->GetScale(aScaleFactor);
1641     Storable::DataToStream(theStr,"myScaleFactor[0]",aScaleFactor[0]);
1642     Storable::DataToStream(theStr,"myScaleFactor[1]",aScaleFactor[1]);
1643     Storable::DataToStream(theStr,"myScaleFactor[2]",aScaleFactor[2]);
1644   }
1645
1646   void View3D_i::ToStream(std::ostringstream& theStr)
1647   {
1648     ToStream(myViewWindow,theStr);
1649   }
1650
1651   void View3D_i::Close()
1652   {
1653     //jfa: may be need to be enclosed in SALOME_Event?
1654     myViewWindow->close();
1655   }
1656
1657   View3D_i::~View3D_i()
1658   {
1659     if(MYDEBUG) MESSAGE("View3D_i::~View3D_i");
1660   }
1661
1662   void View3D_i::SetTitle (const char* theTitle)
1663   {
1664     ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
1665                      (myViewWindow,&SUIT_ViewWindow::setCaption,QString(theTitle)));
1666   }
1667
1668   char* View3D_i::GetTitle()
1669   {
1670     //jfa: may be need to be enclosed in SALOME_Event?
1671     return CORBA::string_dup(myViewWindow->caption().latin1());
1672   }
1673
1674   void View3D_i::SetBackground (SUIT_ViewWindow* theStudyFrame,
1675                                 const SALOMEDS::Color& theColor)
1676   {
1677     //jfa: may be need to be enclosed in SALOME_Event?
1678     int aColor[3];
1679     aColor[0] = int(255.0*theColor.R);
1680     aColor[1] = int(255.0*theColor.G);
1681     aColor[2] = int(255.0*theColor.B);
1682     QColor aNewColor(aColor[0],aColor[1],aColor[2]);
1683     GetViewWindow(theStudyFrame)->setBackgroundColor(aNewColor);
1684   }
1685
1686   SALOMEDS::Color View3D_i::GetBackground (SUIT_ViewWindow* theStudyFrame)
1687   {
1688     //jfa: may be need to be enclosed in SALOME_Event?
1689     SALOMEDS::Color aColor;
1690     float backint[3];
1691     GetRenderer(theStudyFrame)->GetBackground(backint);
1692     aColor.R = backint[0];  aColor.G = backint[1];  aColor.B = backint[2];
1693     return aColor;
1694   }
1695
1696   class TUpdateViewerEvent: public SALOME_Event
1697   {
1698     SUIT_ViewWindow* myViewWindow;
1699     Prs3d_i* myPrs3d;
1700     int myDisplaing;
1701   public:
1702     TUpdateViewerEvent(SUIT_ViewWindow* theStudyFrame,
1703                        Prs3d_i* thePrs3d,
1704                        int theDisplaing):
1705       myViewWindow(theStudyFrame),
1706       myPrs3d(thePrs3d),
1707       myDisplaing(theDisplaing)
1708     {}
1709     virtual void Execute(){
1710       UpdateViewer(myViewWindow,myDisplaing,myPrs3d);
1711     }
1712   };
1713
1714   void View3D_i::EraseAll()
1715   {
1716     if(MYDEBUG) MESSAGE("View3D_i::EraseAll");
1717     ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,NULL,eEraseAll));
1718   }
1719
1720   void View3D_i::DisplayAll()
1721   {
1722     if(MYDEBUG) MESSAGE("View3D_i::DisplayAll");
1723     ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,NULL,eDisplayAll));
1724   }
1725
1726   void View3D_i::Erase (PrsObject_ptr thePrsObj)
1727   {
1728     if(MYDEBUG) MESSAGE("View3D_i::Erase");
1729     CORBA::Object_ptr anObj = thePrsObj;
1730     if(Prs3d_i* aPrs =  dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
1731       ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eErase));
1732     }
1733   }
1734
1735   void View3D_i::Display (PrsObject_ptr thePrsObj)
1736   {
1737     if(MYDEBUG) MESSAGE("View3D_i::Display");
1738     CORBA::Object_ptr anObj = thePrsObj;
1739     if(Prs3d_i* aPrs =  dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
1740       ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eDisplay));
1741     }
1742   }
1743
1744   void View3D_i::DisplayOnly (PrsObject_ptr thePrsObj)
1745   {
1746     if(MYDEBUG) MESSAGE("View3D_i::DisplayOnly");
1747     CORBA::Object_ptr anObj = thePrsObj;
1748     if(Prs3d_i* aPrs =  dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
1749       ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eDisplayOnly));
1750     }
1751   }
1752
1753   void View3D_i::FitAll()
1754   {
1755     ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1756                      (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onFitAll));
1757     Update();
1758   }
1759
1760   void View3D_i::SetView (VISU::View3D::ViewType theType)
1761   {
1762     switch (theType) {
1763     case VISU::View3D::FRONT :
1764       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1765                        (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onFrontView));
1766       break;
1767     case VISU::View3D::BACK :
1768       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1769                        (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onBackView));
1770       break;
1771     case VISU::View3D::LEFT :
1772       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1773                        (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onLeftView));
1774       break;
1775     case VISU::View3D::RIGHT :
1776       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1777                        (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onRightView));
1778       break;
1779     case VISU::View3D::TOP :
1780       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1781                        (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onTopView));
1782       break;
1783     case VISU::View3D::BOTTOM :
1784       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
1785                        (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onBottomView));
1786       break;
1787     }
1788     Update();
1789   }
1790
1791   class TSet3DViewParamEvent: public SALOME_Event
1792   {
1793   public:
1794     typedef void (*TFun)(SUIT_ViewWindow* theStudyFrame, const CORBA::Double theParam[3]);
1795     TSet3DViewParamEvent (TFun theFun,
1796                           SUIT_ViewWindow* theStudyFrame,
1797                           const CORBA::Double theParam[3]):
1798       myFun(theFun),
1799       myViewWindow(theStudyFrame),
1800       myParam(theParam)
1801     {}
1802     virtual void Execute(){
1803       myFun(myViewWindow,myParam);
1804     }
1805   private:
1806     TFun myFun;
1807     SUIT_ViewWindow* myViewWindow;
1808     const CORBA::Double* myParam;
1809   };
1810
1811   void View3D_i::SetPointOfView (SUIT_ViewWindow* theStudyFrame,
1812                                  const CORBA::Double thePosition[3])
1813   {
1814     //jfa: may be need to be enclosed in SALOME_Event?
1815     GetCamera(theStudyFrame)->SetPosition(thePosition);
1816   }
1817
1818   void View3D_i::SetPointOfView (const VISU::View3D::XYZ thePosition)
1819   {
1820     if(MYDEBUG) MESSAGE("View3D_i::SetPointOfView");
1821     ProcessVoidEvent(new TSet3DViewParamEvent(&SetPointOfView,myViewWindow,thePosition));
1822   }
1823
1824   void View3D_i::GetPointOfView (SUIT_ViewWindow* theStudyFrame,
1825                                  CORBA::Double thePosition[3])
1826   {
1827     //jfa: may be need to be enclosed in SALOME_Event?
1828     GetCamera(theStudyFrame)->GetPosition(thePosition);
1829   }
1830
1831   VISU::View3D::XYZ_slice* View3D_i::GetPointOfView()
1832   {
1833     //jfa: may be need to be enclosed in SALOME_Event?
1834     if(MYDEBUG) MESSAGE("View3D_i::GetPointOfView");
1835     CORBA::Double aPosition[3];
1836     GetPointOfView(myViewWindow,aPosition);
1837     return VISU::View3D::XYZ_dup(aPosition);
1838   }
1839
1840   void View3D_i::SetViewUp (SUIT_ViewWindow* theStudyFrame,
1841                             const CORBA::Double theViewUp[3])
1842   {
1843     GetCamera(theStudyFrame)->SetViewUp(theViewUp);
1844   }
1845
1846   void View3D_i::SetViewUp (const VISU::View3D::XYZ theViewUp)
1847   {
1848     if(MYDEBUG) MESSAGE("View3D_i::SetViewUp");
1849     ProcessVoidEvent(new TSet3DViewParamEvent(&SetViewUp,myViewWindow,theViewUp));
1850   }
1851
1852   void View3D_i::GetViewUp (SUIT_ViewWindow* theStudyFrame,
1853                             CORBA::Double theViewUp[3])
1854   {
1855     GetCamera(theStudyFrame)->GetViewUp(theViewUp);
1856   }
1857
1858   VISU::View3D::XYZ_slice* View3D_i::GetViewUp()
1859   {
1860     //jfa: may be need to be enclosed in SALOME_Event?
1861     if(MYDEBUG) MESSAGE("View3D_i::GetViewUp");
1862     CORBA::Double aViewUp[3];
1863     GetCamera(myViewWindow)->GetViewUp(aViewUp);
1864     return VISU::View3D::XYZ_dup(aViewUp);
1865   }
1866
1867   void View3D_i::SetFocalPoint (SUIT_ViewWindow* theStudyFrame,
1868                                 const CORBA::Double theFocalPnt[3])
1869   {
1870     GetCamera(theStudyFrame)->SetFocalPoint(theFocalPnt);
1871   }
1872
1873   void View3D_i::SetFocalPoint (const VISU::View3D::XYZ theCoord)
1874   {
1875     if(MYDEBUG) MESSAGE("View3D_i::SetFocalPoint");
1876     ProcessVoidEvent(new TSet3DViewParamEvent(&SetFocalPoint,myViewWindow,theCoord));
1877   }
1878
1879
1880   void View3D_i::GetFocalPoint (SUIT_ViewWindow* theStudyFrame,
1881                                 CORBA::Double theFocalPnt[3])
1882   {
1883     GetCamera(theStudyFrame)->GetFocalPoint(theFocalPnt);
1884   }
1885
1886   VISU::View3D::XYZ_slice* View3D_i::GetFocalPoint()
1887   {
1888     //jfa: may be need to be enclosed in SALOME_Event?
1889     if(MYDEBUG) MESSAGE("View3D_i::GetFocalPoint");
1890     CORBA::Double aFocalPnt[3];
1891     GetFocalPoint(myViewWindow,aFocalPnt);
1892     return VISU::View3D::XYZ_dup(aFocalPnt);
1893   }
1894
1895   class TSetViewParamEvent: public SALOME_Event
1896   {
1897   public:
1898     typedef void (*TFun)(SUIT_ViewWindow* theStudyFrame, CORBA::Double theParam);
1899     TSetViewParamEvent (TFun theFun,
1900                         SUIT_ViewWindow* theStudyFrame,
1901                         CORBA::Double theParam):
1902       myFun(theFun),
1903       myViewWindow(theStudyFrame),
1904       myParam(theParam)
1905     {}
1906     virtual void Execute()
1907     {
1908       myFun(myViewWindow,myParam);
1909     }
1910   private:
1911     TFun myFun;
1912     SUIT_ViewWindow* myViewWindow;
1913     CORBA::Double myParam;
1914   };
1915
1916   void View3D_i::SetParallelScale (SUIT_ViewWindow* theStudyFrame,
1917                                    CORBA::Double theScale)
1918   {
1919     GetCamera(theStudyFrame)->SetParallelScale(theScale);
1920   }
1921
1922   void View3D_i::SetParallelScale (CORBA::Double theScale)
1923   {
1924     if(MYDEBUG) MESSAGE("View3D_i::SetParallelScale");
1925     ProcessVoidEvent(new TSetViewParamEvent(&SetParallelScale,myViewWindow,theScale));
1926   }
1927
1928   CORBA::Double View3D_i::GetParallelScale (SUIT_ViewWindow* theStudyFrame)
1929   {
1930     return GetCamera(theStudyFrame)->GetParallelScale();
1931   }
1932
1933   CORBA::Double View3D_i::GetParallelScale()
1934   {
1935     //jfa: may be need to be enclosed in SALOME_Event?
1936     if(MYDEBUG) MESSAGE("View3D_i::GetParallelScale");
1937     return GetParallelScale(myViewWindow);
1938   }
1939
1940   void View3D_i::ScaleView (SUIT_ViewWindow* theStudyFrame,
1941                             VISU::View3D::Axis theAxis, CORBA::Double theParam)
1942   {
1943     SVTK_ViewWindow* aViewFrame = GetViewWindow(theStudyFrame);
1944     double aScaleFactor[3];
1945     aViewFrame->GetScale(aScaleFactor);
1946     aScaleFactor[theAxis] = theParam;
1947     aViewFrame->SetScale(aScaleFactor);
1948   }
1949
1950   void SetScaleView (SUIT_ViewWindow* theStudyFrame, const CORBA::Double theScale[3])
1951   {
1952     double aScale[3] = {theScale[0], theScale[1], theScale[2]};
1953     GetViewWindow(theStudyFrame)->SetScale(aScale);
1954   }
1955
1956   void View3D_i::ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam)
1957   {
1958     if(MYDEBUG) MESSAGE("View3D_i::ScaleView");
1959     double aScale[3];
1960     GetViewWindow(myViewWindow)->GetScale(aScale);
1961     aScale[theAxis] = theParam;
1962     ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,myViewWindow,aScale));
1963   }
1964
1965   void View3D_i::RemoveScale()
1966   {
1967     if(MYDEBUG) MESSAGE("View3D_i::RemoveScale");
1968     double aScale[3] = {1.0, 1.0, 1.0};
1969     ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,myViewWindow,aScale));
1970   }
1971 }