Salome HOME
Implementation of the issue 20115: [CEA 308] Quadratic elements visualization.
[modules/visu.git] / src / VISU_I / VISU_View_i.cc
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  VISU OBJECT : interactive object for VISU entities implementation
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_PointMap3d_i.hh"
33 #include "VISU_ScalarMap_i.hh"
34 #include "VISU_ViewManager_i.hh"
35
36 #include "VisuGUI_TableDlg.h"
37
38 #include "VISU_Actor.h"
39 #include "VISU_ScalarMapAct.h"
40 #include "VISU_PointMap3dActor.h"
41 #include "VISU_DeformedGridPL.hxx"
42
43 #include "SALOME_Event.h"
44
45 #include "SUIT_ViewWindow.h"
46 #include "SUIT_ViewManager.h"
47 #include "SUIT_Tools.h"
48
49 #include "STD_MDIDesktop.h"
50 #include "STD_TabDesktop.h"
51
52 #include "SVTK_ViewWindow.h"
53 #include "SVTK_ViewModel.h"
54
55 #include "SPlot2d_ViewModel.h"
56 #include "Plot2d_ViewFrame.h"
57
58 #include "SalomeApp_Application.h"
59 #include "SalomeApp_Study.h"
60
61 #include <QtxWorkstack.h>
62 #include <QtxWorkspace.h>
63
64 #include <QWorkspace>
65 #include <QImage>
66
67 #include <vtkCamera.h>
68 #include <vtkRenderer.h>
69 #include <vtkActor.h>
70
71 using namespace std;
72
73 #ifdef _DEBUG_
74 static int MYDEBUG = 0;
75 #else
76 static int MYDEBUG = 0;
77 #endif
78
79 namespace VISU {
80
81   typedef TVoidMemFunEvent<SUIT_ViewWindow> TFrameActionEvent;
82
83   struct TNewViewEvent: public SALOME_Event
84   {
85     SalomeApp_Application* myApplication;
86     typedef QWidget* TResult;
87     TResult myResult;
88
89     TNewViewEvent (SalomeApp_Application* theApplication):
90       myApplication(theApplication),
91       myResult(NULL)
92     {}
93
94     virtual
95     void
96     Execute()
97     {
98       if (STD_MDIDesktop* aDesktop = dynamic_cast<STD_MDIDesktop*>(myApplication->desktop())) {
99         myResult = aDesktop->workspace();
100       }
101     }
102   };
103
104   View_i::
105   View_i (SalomeApp_Application *theApplication,
106           SUIT_ViewManager* theViewManager):
107     myApplication(theApplication),
108     myWorkspace(NULL),
109     myViewManager(theViewManager)
110   {
111     if(MYDEBUG) MESSAGE("View_i::View_i - "<<this);
112     myWorkspace = ProcessEvent(new TNewViewEvent(theApplication));
113   }
114
115   View_i::
116   ~View_i()
117   {
118     if(MYDEBUG) MESSAGE("View_i::~View_i - "<<this);
119   }
120
121
122   struct TApplicationEvent: public SALOME_Event
123   {
124     SalomeApp_Application* myApplication;
125
126     TApplicationEvent(SalomeApp_Application* theApplication):
127       myApplication(theApplication)
128     {}
129   };
130
131   void
132   View_i::
133   ShowPart (VISU::View::ViewRepresentation theViewRepresentation,
134             CORBA::Boolean theState)
135   {
136     struct TEvent: public TApplicationEvent
137     {
138       VISU::View::ViewRepresentation myViewRepresentation;
139       CORBA::Boolean myState;
140
141       TEvent(SalomeApp_Application* theApplication,
142              VISU::View::ViewRepresentation theViewRepresentation,
143              CORBA::Boolean theState):
144         TApplicationEvent(theApplication),
145         myViewRepresentation(theViewRepresentation),
146         myState(theState)
147       {}
148
149       virtual
150       void
151       Execute()
152       {
153         switch(myViewRepresentation){
154         case VISU::View::OBJECTBROWSER:
155           myApplication->getWindow( SalomeApp_Application::WT_ObjectBrowser )->setVisible( myState );
156           break;
157         case VISU::View::PYTHON:
158           myApplication->getWindow( SalomeApp_Application::WT_PyConsole )->setVisible( myState );
159           break;
160         case VISU::View::MESSAGES:
161           myApplication->getWindow( SalomeApp_Application::WT_LogWindow )->setVisible( myState );
162           break;
163         case VISU::View::VIEWER:
164         {
165           ViewManagerList mgrs = myApplication->viewManagers();
166           ViewManagerList::const_iterator anIt = mgrs.begin(), aLast = mgrs.end();
167           for( ; anIt!=aLast; anIt++ )
168           {
169             const QVector<SUIT_ViewWindow*>& views = (*anIt)->getViews();
170             for( int i=0; i<views.count(); i++ )
171               views[i]->setShown( myState );
172           }
173           break;
174         }}
175       }
176     };
177
178     ProcessVoidEvent(new TEvent(myApplication,theViewRepresentation,theState));
179   }
180
181   struct TPartShownEvent: public TApplicationEvent
182   {
183     VISU::View::ViewRepresentation myViewRepresentation;
184     typedef bool TResult;
185     TResult myResult;
186
187     TPartShownEvent(SalomeApp_Application* theApplication,
188                     VISU::View::ViewRepresentation theViewRepresentation):
189       TApplicationEvent(theApplication),
190       myViewRepresentation(theViewRepresentation),
191       myResult(false)
192     {}
193
194     virtual
195     void
196     Execute()
197     {
198       switch(myViewRepresentation){
199       case VISU::View::OBJECTBROWSER:
200         myResult = myApplication->dockWindow( SalomeApp_Application::WT_ObjectBrowser )->isVisible();
201         break;
202       case VISU::View::PYTHON:
203         myResult = myApplication->dockWindow( SalomeApp_Application::WT_PyConsole )->isVisible();
204         break;
205       case VISU::View::MESSAGES:
206         myResult = myApplication->dockWindow( SalomeApp_Application::WT_LogWindow )->isVisible();
207         break;
208       case VISU::View::VIEWER:{
209         ViewManagerList aViewManagerList = myApplication->viewManagers();
210         ViewManagerList::const_iterator anIt = aViewManagerList.begin();
211         for( ; anIt != aViewManagerList.end(); anIt++ )
212         {
213           const QVector<SUIT_ViewWindow*>& views = (*anIt)->getViews();
214           for( int i=0; i<views.count(); i++ ) {
215             myResult = views[i]->isVisible();
216             return;
217           }
218         }
219         myResult = false;
220         break;
221       }}
222     }
223   };
224
225   CORBA::Boolean
226   View_i::
227   IsPartShown (VISU::View::ViewRepresentation theViewRepresentation)
228   {
229     return ProcessEvent(new TPartShownEvent(myApplication,theViewRepresentation));
230   }
231
232   // Begin: New methods for view parameters management
233   struct TSplitEvent: public SALOME_Event
234   {
235     SalomeApp_Application * myApplication;
236     SUIT_ViewWindow       * myVW;
237     Qt::Orientation         myOrientation;
238     QtxWorkstack::SplitType mySplitType;
239
240   public:
241     TSplitEvent (SalomeApp_Application * theApplication,
242                  SUIT_ViewWindow       * theViewWindow,
243                  Qt::Orientation         theOrientation,
244                  QtxWorkstack::SplitType theSplitType):
245       myApplication(theApplication),
246       myVW(theViewWindow),
247       myOrientation(theOrientation),
248       mySplitType(theSplitType)
249     {}
250
251     virtual void Execute()
252     {
253       SUIT_Desktop* desk = myApplication->desktop();
254       STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
255       if (tabDesk) {
256         QtxWorkstack* workstack = tabDesk->workstack();
257         if (workstack) {
258           workstack->Split(myVW, myOrientation, mySplitType);
259         }
260       }
261     }
262   };
263
264   void
265   View_i::
266   SplitRight()
267   {
268     SUIT_ViewWindow* aVW = GetViewWindow();
269     if (aVW)
270       ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
271                                        Qt::Horizontal, QtxWorkstack::SplitMove));
272   }
273
274   void
275   View_i::
276   SplitLeft()
277   {
278     SUIT_ViewWindow* aVW = GetViewWindow();
279     if (aVW)
280       ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
281                                        Qt::Horizontal, QtxWorkstack::SplitStay));
282   }
283
284   void
285   View_i::
286   SplitBottom()
287   {
288     SUIT_ViewWindow* aVW = GetViewWindow();
289     if (aVW)
290       ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
291                                        Qt::Vertical, QtxWorkstack::SplitMove));
292   }
293
294   void
295   View_i::
296   SplitTop()
297   {
298     SUIT_ViewWindow* aVW = GetViewWindow();
299     if (aVW)
300       ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
301                                        Qt::Vertical, QtxWorkstack::SplitStay));
302   }
303
304   void
305   View_i::
306   OnTop()
307   {
308     struct TOnTopEvent: public SALOME_Event
309     {
310       SUIT_ViewWindow * myVW;
311
312     public:
313       TOnTopEvent (SUIT_ViewWindow * theViewWindow):
314         myVW(theViewWindow)
315       {}
316
317       virtual void Execute()
318       {
319         if (myVW) {
320           myVW->setFocus();
321         }
322       }
323     };
324
325     SUIT_ViewWindow* aVW = GetViewWindow();
326     if (aVW)
327       ProcessVoidEvent(new TOnTopEvent(aVW));
328   }
329
330   struct TAttractEvent: public SALOME_Event
331   {
332     SalomeApp_Application * myApplication;
333     SUIT_ViewWindow       * myVW1;
334     SUIT_ViewWindow       * myVW2;
335     bool                    myAttractAll;
336
337   public:
338     TAttractEvent (SalomeApp_Application * theApplication,
339                    SUIT_ViewWindow       * theViewWindow1,
340                    SUIT_ViewWindow       * theViewWindow2,
341                    bool                    theAttractAll):
342       myApplication(theApplication),
343       myVW1(theViewWindow1),
344       myVW2(theViewWindow2),
345       myAttractAll(theAttractAll)
346     {}
347
348     virtual void Execute()
349     {
350       SUIT_Desktop* desk = myApplication->desktop();
351       STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
352       if (tabDesk) {
353         QtxWorkstack* workstack = tabDesk->workstack();
354         if (workstack) {
355           workstack->Attract(myVW1, myVW2, myAttractAll);
356         }
357       }
358     }
359   };
360
361   void
362   View_i::
363   Attract (VISU::View_ptr theView)
364   {
365     if (!CORBA::is_nil(theView)) {
366       if (VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(theView).in())) {
367         if (pView) {
368           SUIT_ViewWindow* aVW1 = GetViewWindow();
369           SUIT_ViewWindow* aVW2 = pView->GetViewWindow();
370           if (aVW1 && aVW2)
371             ProcessVoidEvent(new TAttractEvent(myApplication, aVW1, aVW2, false));
372         }
373       }
374     }
375   }
376
377   void
378   View_i::
379   AttractAll (VISU::View_ptr theView)
380   {
381     if (!CORBA::is_nil(theView)) {
382       if (VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(theView).in())) {
383         if (pView) {
384           SUIT_ViewWindow* aVW1 = GetViewWindow();
385           SUIT_ViewWindow* aVW2 = pView->GetViewWindow();
386           if (aVW1 && aVW2)
387             ProcessVoidEvent(new TAttractEvent(myApplication, aVW1, aVW2, true));
388         }
389       }
390     }
391   }
392
393   struct TSizePositionEvent: public SALOME_Event
394   {
395     SalomeApp_Application * myApplication;
396     SUIT_ViewWindow       * myVW;
397     double                  myValue;
398     bool                    myIsSize;
399
400   public:
401     TSizePositionEvent (SalomeApp_Application * theApplication,
402                         SUIT_ViewWindow       * theViewWindow,
403                         double                  theValue,
404                         bool                    theIsSize):
405       myApplication(theApplication),
406       myVW(theViewWindow),
407       myValue(theValue),
408       myIsSize(theIsSize)
409     {}
410
411     virtual void Execute()
412     {
413       MESSAGE("TSizePositionEvent::Execute()");
414       SUIT_Desktop* desk = myApplication->desktop();
415       STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
416       if (tabDesk) {
417         QtxWorkstack* workstack = tabDesk->workstack();
418         if (workstack) {
419           if (myIsSize) {
420             //jfa to do:workstack->SetRelativeSizeInSplitter(myVW, myValue);
421           } else {
422             workstack->SetRelativePositionInSplitter(myVW, myValue);
423           }
424         }
425       }
426     }
427   };
428
429   void
430   View_i::
431   SetRelativePositionInSplitter (CORBA::Double thePosition)
432   {
433     if (thePosition < 0.0 || 1.0 < thePosition) {
434       return;
435     }
436     SUIT_ViewWindow* aVW = GetViewWindow();
437     if (aVW)
438       ProcessVoidEvent(new TSizePositionEvent(myApplication, aVW, thePosition, false));
439   }
440
441   void
442   View_i::
443   SetRelativeSizeInSplitter (CORBA::Double theSize)
444   {
445     if (theSize < 0.0 || 1.0 < theSize) {
446       return;
447     }
448     SUIT_ViewWindow* aVW = GetViewWindow();
449     if (aVW)
450       ProcessVoidEvent(new TSizePositionEvent(myApplication, aVW, theSize, true));
451   }
452
453   struct TWSSizePositionEvent: public SALOME_Event
454   {
455     SalomeApp_Application * myApplication;
456     SUIT_ViewWindow       * myVW;
457     Qt::Orientation         myOrientation;
458     double                  myValue;
459     bool                    myIsSize;
460
461   public:
462     TWSSizePositionEvent (SalomeApp_Application * theApplication,
463                           SUIT_ViewWindow       * theViewWindow,
464                           Qt::Orientation         theOrientation,
465                           double                  theValue,
466                           bool                    theIsSize):
467       myApplication(theApplication),
468       myVW(theViewWindow),
469       myOrientation(theOrientation),
470       myValue(theValue),
471       myIsSize(theIsSize)
472     {}
473
474     virtual void Execute()
475     {
476       MESSAGE("TWSSizePositionEvent::Execute()");
477       SUIT_Desktop* desk = myApplication->desktop();
478       STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>(desk);
479       if (tabDesk) {
480         QtxWorkstack* workstack = tabDesk->workstack();
481         if (workstack) {
482           if (myIsSize) {
483             //jfa to do:workstack->SetRelativeSize(myVW, myOrientation, myValue);
484           } else {
485             workstack->SetRelativePosition(myVW, myOrientation, myValue);
486           }
487         }
488       }
489     }
490   };
491
492   void
493   View_i::
494   SetRelativePositionX (CORBA::Double thePosition)
495   {
496     if (thePosition < 0.0 || 1.0 < thePosition) {
497       return;
498     }
499     SUIT_ViewWindow* aVW = GetViewWindow();
500     if (aVW)
501       ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
502                                                 Qt::Horizontal, thePosition, false));
503   }
504
505   void
506   View_i::
507   SetRelativePositionY (CORBA::Double thePosition)
508   {
509     if (thePosition < 0.0 || 1.0 < thePosition) {
510       return;
511     }
512     SUIT_ViewWindow* aVW = GetViewWindow();
513     if (aVW)
514       ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
515                                                 Qt::Vertical, thePosition, false));
516   }
517
518   void
519   View_i::
520   SetRelativeSizeX (CORBA::Double theSize)
521   {
522     if (theSize < 0.0 || 1.0 < theSize) {
523       return;
524     }
525     SUIT_ViewWindow* aVW = GetViewWindow();
526     if (aVW)
527       ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
528                                                 Qt::Horizontal, theSize, true));
529   }
530
531   void
532   View_i::
533   SetRelativeSizeY (CORBA::Double theSize)
534   {
535     if (theSize < 0.0 || 1.0 < theSize) {
536       return;
537     }
538     SUIT_ViewWindow* aVW = GetViewWindow();
539     if (aVW)
540       ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
541                                                 Qt::Vertical, theSize, true));
542   }
543   // End: New methods for view parameters management
544
545   // Begin: Old methods for view parameters management, they don't work now
546   struct TSetViewSize: public SALOME_Event
547   {
548     SUIT_ViewWindow* myVW;
549     typedef void (QRect::* TAction)(int);
550     TAction myAction;
551     CORBA::Long mySize;
552
553   public:
554     TSetViewSize(SUIT_ViewWindow* theViewWindow,
555                  TAction theAction,
556                  CORBA::Long theSize):
557       myVW(theViewWindow),
558       myAction(theAction),
559       mySize(theSize)
560     {}
561
562     virtual
563     void
564     Execute()
565     {
566       if (QWidget* aParent = myVW->parentWidget()) {
567         QRect aQRect = aParent->frameGeometry();
568         (aQRect.*myAction)(mySize);
569         aParent->setGeometry(aQRect);
570       }
571     }
572   };
573
574   void
575   View_i::
576   SetViewWidth(CORBA::Long theWidth)
577   {
578     ProcessVoidEvent(new TSetViewSize(myViewWindow,&QRect::setWidth,theWidth));
579   }
580
581   void
582   View_i::
583   SetViewHeight(CORBA::Long theHeight)
584   {
585     ProcessVoidEvent(new TSetViewSize(myViewWindow,&QRect::setHeight,theHeight));
586   }
587
588
589   struct TGetViewSize: public SALOME_Event
590   {
591     SUIT_ViewWindow* myVW;
592
593     typedef int (QRect::* TAction)() const;
594     TAction myAction;
595
596     typedef CORBA::Long TResult;
597     TResult myResult;
598
599   public:
600     TGetViewSize(SUIT_ViewWindow* theViewWindow,
601                  TAction theAction):
602       myVW(theViewWindow),
603       myAction(theAction)
604     {}
605
606     virtual
607     void
608     Execute()
609     {
610       if(QWidget* aParent = myVW->parentWidget()){
611         QRect aQRect = aParent->frameGeometry();
612         myResult = (aQRect.*myAction)();
613       }
614     }
615   };
616
617
618   CORBA::Long
619   View_i::
620   GetViewWidth()
621   {
622     return ProcessEvent(new TGetViewSize(myViewWindow,&QRect::width));
623   }
624
625   CORBA::Long
626   View_i::
627   GetViewHeight()
628   {
629     return ProcessEvent(new TGetViewSize(myViewWindow,&QRect::height));
630   }
631
632
633   class TWorkspaceEvent: public SALOME_Event
634   {
635   protected:
636     QWidget* myVW;
637     QWidget* myWorkspace;
638
639   public:
640     TWorkspaceEvent(QWidget* theViewWindow,
641                     QWidget* theWorkspace):
642       myVW(theViewWindow),
643       myWorkspace(theWorkspace)
644     {}
645   };
646
647
648   class TAlignEvent: public TWorkspaceEvent
649   {
650   protected:
651     Qt::AlignmentFlag myAligment;
652
653   public:
654     TAlignEvent(QWidget* theViewWindow,
655                 QWidget* theWorkspace,
656                 Qt::AlignmentFlag theAligment):
657       TWorkspaceEvent(theViewWindow,theWorkspace),
658       myAligment(theAligment)
659     {}
660
661     virtual
662     void
663     Execute()
664     {
665       if(QWidget* aParent = myVW->parentWidget())
666         SUIT_Tools::alignWidget(aParent,myWorkspace,myAligment);
667     }
668   };
669
670
671   void
672   View_i::
673   SetViewPositionHorizontal (VISU::View::ViewPosition theViewPosition)
674   {
675     if (myWorkspace) {
676       switch (theViewPosition) {
677       case VISU::View::LEFT:
678         ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignLeft));
679         break;
680       case VISU::View::CENTER:
681         ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignHCenter));
682         break;
683       case VISU::View::RIGHT:
684         ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignRight));
685         break;
686       }
687     }
688   }
689
690
691   void
692   View_i::
693   SetViewPositionVertical (VISU::View::ViewPosition theViewPosition)
694   {
695     if (myWorkspace) {
696       switch (theViewPosition) {
697       case VISU::View::TOP:
698         ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignTop));
699         break;
700       case VISU::View::CENTER:
701         ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignVCenter));
702         break;
703       case VISU::View::BOTTOM:
704         ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignBottom));
705         break;
706       }
707     }
708   }
709
710
711   class TXYEvent: public TWorkspaceEvent
712   {
713   protected:
714     CORBA::Double myX, myY;
715
716   public:
717     TXYEvent(QWidget* theViewWindow,
718              QWidget* theWorkspace,
719              CORBA::Double theX,
720              CORBA::Double theY):
721       TWorkspaceEvent(theViewWindow,theWorkspace),
722       myX(theX),
723       myY(theY)
724     {}
725   };
726
727
728   void
729   View_i::
730   SetRelativePosition (CORBA::Double theX, CORBA::Double theY)
731   {
732     struct TEvent: public TXYEvent
733     {
734     public:
735       TEvent(QWidget* theViewWindow,
736              QWidget* theWorkspace,
737              CORBA::Double theX,
738              CORBA::Double theY):
739         TXYEvent(theViewWindow,theWorkspace,theX,theY)
740       {}
741
742       virtual
743       void
744       Execute()
745       {
746         if(QWidget* aParent = myVW->parentWidget())
747           aParent->move(int(myX*myWorkspace->width()),int(myY*myWorkspace->height()));
748       }
749     };
750
751     if (myWorkspace)
752       ProcessVoidEvent(new TEvent(myViewWindow,myWorkspace,theX,theY));
753   }
754
755   void
756   View_i::
757   SetRelativeSize (CORBA::Double theX, CORBA::Double theY)
758   {
759     struct TEvent: public TXYEvent
760     {
761     public:
762       TEvent(QWidget* theViewWindow,
763              QWidget* theWorkspace,
764              CORBA::Double theX,
765              CORBA::Double theY):
766         TXYEvent(theViewWindow,theWorkspace,theX,theY)
767       {}
768
769       virtual
770       void
771       Execute()
772       {
773         if(QWidget* aParent = myVW->parentWidget())
774           aParent->setGeometry(aParent->x(),
775                                aParent->y(),
776                                int(myX*myWorkspace->width()),
777                                int(myY*myWorkspace->height()));
778       }
779     };
780
781     if (myWorkspace)
782       ProcessVoidEvent(new TEvent(myViewWindow,myWorkspace,theX,theY));
783   }
784   // End: Old methods for view parameters management, they don't work now
785
786   void
787   View_i::
788   SetBackground (const SALOMEDS::Color& theColor)
789   {
790     struct TEvent: public SALOME_Event
791     {
792       SVTK_ViewWindow* myVW;
793       SALOMEDS::Color myColor;
794     public:
795       TEvent(SVTK_ViewWindow* theViewWindow,
796              const SALOMEDS::Color& theColor):
797         myVW(theViewWindow),
798         myColor(theColor)
799       {}
800       virtual void Execute(){
801         int aColor[3];
802         aColor[0] = int(255.0*myColor.R);
803         aColor[1] = int(255.0*myColor.G);
804         aColor[2] = int(255.0*myColor.B);
805         QColor aNewColor (aColor[0],aColor[1],aColor[2]);
806         myVW->setBackgroundColor(aNewColor);
807       }
808     };
809         
810     SVTK_ViewWindow* aVW = dynamic_cast<SVTK_ViewWindow*>(GetViewWindow());
811     if (aVW)
812       ProcessVoidEvent(new TEvent(aVW, theColor));
813   }
814
815
816   struct TBackgroundEvent: public SALOME_Event
817   {
818     SVTK_ViewWindow* myVW;
819     typedef SALOMEDS::Color TResult;
820     TResult myResult;
821
822     TBackgroundEvent(SVTK_ViewWindow* theViewWindow):
823       myVW(theViewWindow)
824     {}
825
826     virtual
827     void
828     Execute()
829     {
830       vtkFloatingPointType backint[3];
831       GetRenderer(myVW)->GetBackground(backint);
832       myResult.R = backint[0];
833       myResult.G = backint[1];
834       myResult.B = backint[2];
835     }
836   };
837
838   SALOMEDS::Color
839   View_i::
840   GetBackground()
841   {
842     SVTK_ViewWindow* aVW = dynamic_cast<SVTK_ViewWindow*>(GetViewWindow());
843     if (aVW)
844       return ProcessEvent(new TBackgroundEvent(aVW));
845
846     SALOMEDS::Color aBlack;
847     aBlack.R = 0.0;
848     aBlack.G = 0.0;
849     aBlack.B = 0.0;
850     return aBlack;
851   }
852
853   void
854   View_i::
855   Minimize()
856   {
857     SUIT_ViewWindow* aVW = GetViewWindow();
858     if (aVW)
859       ProcessVoidEvent(new TFrameActionEvent(aVW, &SUIT_ViewWindow::showMinimized));
860   }
861
862   void
863   View_i::
864   Restore()
865   {
866     SUIT_ViewWindow* aVW = GetViewWindow();
867     if (aVW)
868       ProcessVoidEvent(new TFrameActionEvent(aVW, &SUIT_ViewWindow::showNormal));
869   }
870
871   void
872   View_i::
873   Maximize()
874   {
875     SUIT_ViewWindow* aVW = GetViewWindow();
876     if (aVW)
877       ProcessVoidEvent(new TFrameActionEvent(aVW, &SUIT_ViewWindow::showMaximized));
878   }
879
880   void
881   View_i::
882   EraseAll()
883   {}
884
885   void
886   View_i::
887   DisplayAll()
888   {}
889
890   void
891   View_i::
892   Erase (PrsObject_ptr thePrsObj)
893   {}
894
895   void
896   View_i::
897   Display (PrsObject_ptr thePrsObj)
898   {}
899
900   void
901   View_i::
902   DisplayOnly (PrsObject_ptr thePrsObj)
903   {}
904
905   void
906   View_i::
907   Update()
908   {}
909
910   class TSavePictureEvent: public SALOME_Event
911   {
912     SUIT_ViewWindow * myVW;
913     const char      * myFileName;
914   public:
915     typedef CORBA::Boolean TResult;
916     TResult myResult;
917     TSavePictureEvent (SUIT_ViewWindow * theViewWindow, const char * theFileName)
918       : myVW(theViewWindow),
919         myFileName(theFileName),
920         myResult(false)
921     {
922     }
923
924     virtual void Execute()
925     {
926       if (myVW) {
927         QImage img = myVW->dumpView();
928         if (!img.isNull()) {
929           QString fileName (myFileName);
930           if (!fileName.isEmpty()) {
931             QString fmt = SUIT_Tools::extension(fileName).toUpper();
932             if (fmt.isEmpty()) fmt = QString("BMP"); // default format
933             if (fmt == "JPG" ) fmt = "JPEG";
934             //QApplication::setOverrideCursor(Qt::waitCursor);
935             img.save(fileName, fmt.toLatin1().data());
936             myResult = true;
937             //QApplication::restoreOverrideCursor();
938           }
939         }
940       }
941     }
942   };
943
944   CORBA::Boolean
945   View_i::SavePicture(const char* theFileName)
946   {
947     return ProcessEvent(new TSavePictureEvent (GetViewWindow(), theFileName));
948   }
949
950   const char*
951   View_i::GetComment() const
952   {
953     return "";
954   }
955
956   void
957   View_i::
958   ToStream (std::ostringstream& theStr)
959   {
960   }
961
962   SUIT_ViewWindow* View_i::GetViewWindow()
963   {
964     if (myViewWindow) {
965       QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
966       int aPos = aViews.indexOf(myViewWindow);
967       if (aPos < 0)
968         myViewWindow = NULL;
969     }
970     return myViewWindow;
971   }
972
973   void View_i::SetViewWindow(SUIT_ViewWindow* theViewWindow)
974   {
975     myViewWindow = theViewWindow;
976   }
977
978
979   //===========================================================================
980   XYPlot_i::XYPlot_i (SalomeApp_Application* theApplication)
981     : View_i(theApplication, NULL)
982   {
983     if (MYDEBUG) MESSAGE("XYPlot_i::XYPlot_i");
984   }
985
986   struct TCreatePlot2dViewEvent: public SALOME_Event
987   {
988     XYPlot_i * myPlot2dView;
989     int        myNew;
990
991     typedef Plot2d_ViewFrame* TResult;
992     TResult myResult;
993
994     TCreatePlot2dViewEvent (XYPlot_i * thePlot2dView,
995                             const int  theNew):
996       myPlot2dView(thePlot2dView),
997       myNew(theNew),
998       myResult(NULL)
999     {}
1000
1001     virtual
1002     void
1003     Execute()
1004     {
1005       if (!myPlot2dView->myApplication)
1006         return;
1007
1008       SUIT_ViewManager* aViewMgr =
1009         myPlot2dView->myApplication->getViewManager(SPlot2d_Viewer::Type(), false);
1010       SUIT_ViewWindow* aVW = NULL;
1011
1012       if (aViewMgr) {
1013         if (myNew)
1014           aVW = aViewMgr->createViewWindow();
1015         else
1016           aVW = aViewMgr->getActiveView();
1017       } else {
1018         if (myNew) {
1019           aViewMgr = myPlot2dView->myApplication->getViewManager(SPlot2d_Viewer::Type(), true);
1020           aVW = aViewMgr->getActiveView();
1021         } else {
1022           return; // there are no current Plot2d view
1023         }
1024       }
1025
1026       if (aVW) {
1027         Plot2d_ViewWindow* aPlot2dVW = dynamic_cast<Plot2d_ViewWindow*>(aVW);
1028         if (aPlot2dVW) {
1029           myResult = aPlot2dVW->getViewFrame();
1030           if (myResult) {
1031             myResult->Repaint();
1032           }
1033
1034           myPlot2dView->myViewManager = aViewMgr;
1035           myPlot2dView->SetViewWindow(aVW);
1036         }
1037       }
1038     }
1039   };
1040
1041   Storable* XYPlot_i::Create (int theNew)
1042   {
1043     myView = ProcessEvent(new TCreatePlot2dViewEvent(this, theNew));
1044     if (myView)
1045       return this;
1046     return NULL;
1047   }
1048
1049   void XYPlot_i::Update()
1050   {
1051     ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame>(myView,&Plot2d_ViewFrame::Repaint));
1052   }
1053
1054   void XYPlot_i::Close()
1055   {
1056     //jfa: may be need to be enclosed in SALOME_Event?
1057     SUIT_ViewWindow* aVW = GetViewWindow();
1058     if (aVW)
1059       aVW->close();
1060     //QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
1061     //int aPos = aViews.find(myViewWindow);
1062     //if (aPos >= 0)
1063     //  myViewWindow->close();
1064   }
1065
1066   XYPlot_i::~XYPlot_i() {
1067     if(MYDEBUG) MESSAGE("XYPlot_i::~XYPlot_i");
1068   }
1069
1070   void XYPlot_i::SetTitle (const char* theTitle)
1071   {
1072     SUIT_ViewWindow* aVW = GetViewWindow();
1073     if (aVW)
1074       ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
1075                        (aVW, &SUIT_ViewWindow::setWindowTitle, QString(theTitle)));
1076   }
1077   char* XYPlot_i::GetTitle()
1078   {
1079     SUIT_ViewWindow* aVW = GetViewWindow();
1080     if (aVW)
1081       return CORBA::string_dup( aVW->windowTitle().toLatin1().data());
1082     return CORBA::string_dup("");
1083   }
1084
1085   void XYPlot_i::SetSubTitle (const char* theTitle)
1086   {
1087     if (GetViewWindow())
1088       ProcessVoidEvent(new TVoidMemFun1ArgEvent<Plot2d_ViewFrame,const QString&,QString>
1089                        (myView, &Plot2d_ViewFrame::setTitle, QString(theTitle)));
1090   }
1091
1092   char* XYPlot_i::GetSubTitle()
1093   {
1094     if (GetViewWindow())
1095       return CORBA::string_dup(myView->getTitle().toLatin1().data());
1096     return CORBA::string_dup("");
1097   }
1098
1099   void XYPlot_i::SetCurveType (VISU::XYPlot::CurveType theType)
1100   {
1101     if (GetViewWindow())
1102       ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
1103                        (myView,&Plot2d_ViewFrame::setCurveType,theType,true));
1104   }
1105
1106   VISU::XYPlot::CurveType XYPlot_i::GetCurveType()
1107   {
1108     if (GetViewWindow())
1109       return (VISU::XYPlot::CurveType)myView->getCurveType();
1110     return VISU::XYPlot::POINTS;
1111   }
1112
1113   void XYPlot_i::SetMarkerSize (CORBA::Long theSize)
1114   {
1115     if (GetViewWindow())
1116       ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
1117                        (myView,&Plot2d_ViewFrame::setMarkerSize,theSize,true));
1118   }
1119
1120   CORBA::Long XYPlot_i::GetMarkerSize()
1121   {
1122     if (GetViewWindow())
1123       return myView->getMarkerSize();
1124     return -1;
1125   }
1126
1127   void XYPlot_i::EnableXGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
1128                               CORBA::Boolean theMinor, CORBA::Long theNumMinor)
1129   {
1130     class TEvent: public SALOME_Event
1131     {
1132     public:
1133       TEvent (Plot2d_ViewFrame* theView, 
1134               CORBA::Boolean theMajor, 
1135               CORBA::Long theNumMajor,
1136               CORBA::Boolean theMinor, 
1137               CORBA::Long theNumMinor):
1138         myView(theView),
1139         myMajor(theMajor), 
1140         myNumMajor(theNumMajor),
1141         myMinor(theMinor), 
1142         myNumMinor(theNumMinor)
1143       {}
1144       
1145       virtual void Execute()
1146       {
1147         myView->setXGrid( myMajor, myNumMajor, myMinor, myNumMinor );
1148       }
1149     protected:
1150       Plot2d_ViewFrame* myView;
1151       CORBA::Boolean myMajor, myMinor;
1152       CORBA::Long myNumMajor, myNumMinor;
1153     };
1154
1155     if ( GetViewWindow() )
1156       ProcessVoidEvent( new TEvent( myView, theMajor, theNumMajor, theMinor, theNumMinor ) );
1157   }
1158   void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor, 
1159                              CORBA::Long theNumMajor,
1160                              CORBA::Boolean theMinor, 
1161                              CORBA::Long theNumMinor)
1162   {
1163     this->EnableYGrid( theMajor, theNumMajor, theMinor, theNumMinor, false, 0, false, 0 );
1164   }
1165
1166   void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor,
1167                              CORBA::Long theNumMajor,
1168                              CORBA::Boolean theMinor, 
1169                              CORBA::Long theNumMinor,
1170                              CORBA::Boolean the2Major, 
1171                              CORBA::Long the2NumMajor,
1172                              CORBA::Boolean the2Minor, 
1173                              CORBA::Long the2NumMinor)
1174   {
1175     class TEvent: public SALOME_Event
1176     {
1177     public:
1178       TEvent (Plot2d_ViewFrame* theView, 
1179               CORBA::Boolean theMajor,
1180               CORBA::Long theNumMajor,
1181               CORBA::Boolean theMinor, 
1182               CORBA::Long theNumMinor,
1183               CORBA::Boolean the2Major, 
1184               CORBA::Long the2NumMajor,
1185               CORBA::Boolean the2Minor, 
1186               CORBA::Long the2NumMinor):
1187         myView(theView),
1188         myMajor(theMajor), 
1189         myNumMajor(theNumMajor),
1190         myMinor(theMinor), 
1191         myNumMinor(theNumMinor),
1192         my2Major(the2Major), 
1193         my2NumMajor(the2NumMajor),
1194         my2Minor(the2Minor), 
1195         my2NumMinor(the2NumMinor)
1196       {}
1197       
1198       virtual void Execute()
1199       {
1200         myView->setYGrid( myMajor, myNumMajor, myMinor, myNumMinor,
1201                           my2Major, my2NumMajor, my2Minor, my2NumMinor);
1202       }
1203     protected:
1204       Plot2d_ViewFrame* myView;
1205       CORBA::Boolean myMajor, myMinor, my2Major, my2Minor;
1206       CORBA::Long myNumMajor, myNumMinor, my2NumMajor, my2NumMinor;
1207     };
1208
1209     if (GetViewWindow())
1210       ProcessVoidEvent( new TEvent( myView, theMajor, theNumMajor, theMinor, theNumMinor, 
1211                                     the2Major, the2NumMajor, the2Minor, the2NumMinor ) );
1212   }
1213   
1214   class TSetScaleModeEvent: public SALOME_Event
1215   {
1216   public:
1217     typedef void (Plot2d_ViewFrame::* TFun)(const int, bool);
1218     TSetScaleModeEvent (Plot2d_ViewFrame* theView, TFun theFun, int theScaling):
1219       myView(theView), myFun(theFun), myScaling(theScaling)
1220     {}
1221
1222     virtual void Execute()
1223     {
1224       (myView->*myFun)(myScaling,true);
1225     }
1226   protected:
1227     Plot2d_ViewFrame* myView;
1228     TFun myFun;
1229     int myScaling;
1230   };
1231
1232   void XYPlot_i::SetHorScaling (VISU::Scaling theScaling)
1233   {
1234     if (GetViewWindow())
1235       ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setHorScaleMode,
1236                                               theScaling == VISU::LOGARITHMIC));
1237   }
1238
1239   VISU::Scaling XYPlot_i::GetHorScaling()
1240   {
1241     //jfa: may be need to be enclosed in SALOME_Event?
1242     if (GetViewWindow())
1243       return (VISU::Scaling)myView->getHorScaleMode();
1244     return VISU::LINEAR;
1245   }
1246
1247   void XYPlot_i::SetVerScaling(VISU::Scaling theScaling)
1248   {
1249     if (GetViewWindow())
1250       ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setVerScaleMode,
1251                                               theScaling == VISU::LOGARITHMIC));
1252   }
1253
1254   VISU::Scaling XYPlot_i::GetVerScaling()
1255   {
1256     if (GetViewWindow())
1257       return (VISU::Scaling)myView->getVerScaleMode();
1258     return VISU::LINEAR;
1259   }
1260
1261   class TSetTitleEvent: public SALOME_Event
1262   {
1263   public:
1264     TSetTitleEvent (Plot2d_ViewFrame* theView, Plot2d_ViewFrame::ObjectType theType, const char* theTitle):
1265       myView(theView), myType(theType), myTitle(theTitle)
1266     {}
1267     virtual void Execute()
1268     {
1269       myView->setTitle(true,myTitle,myType);
1270     }
1271   protected:
1272     Plot2d_ViewFrame* myView;
1273     Plot2d_ViewFrame::ObjectType myType;
1274     const char* myTitle;
1275   };
1276
1277   void XYPlot_i::SetXTitle (const char* theTitle)
1278   {
1279     if (GetViewWindow())
1280       ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::XTitle, theTitle));
1281   }
1282   char* XYPlot_i::GetXTitle()
1283   {
1284     if (GetViewWindow())
1285       return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::XTitle).toLatin1().data());
1286     return CORBA::string_dup("");
1287   }
1288
1289   void XYPlot_i::SetYTitle (const char* theTitle)
1290   {
1291     if (GetViewWindow())
1292       ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::YTitle, theTitle));
1293   }
1294   char* XYPlot_i::GetYTitle()
1295   {
1296     if (GetViewWindow())
1297       return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::YTitle).toLatin1().data());
1298     return CORBA::string_dup("");
1299   }
1300
1301   void XYPlot_i::ShowLegend (CORBA::Boolean theShowing)
1302   {
1303     if (GetViewWindow())
1304       ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,bool,bool>
1305                        (myView,&Plot2d_ViewFrame::showLegend,theShowing,true));
1306   }
1307
1308   class TXYPlotViewEvent: public SALOME_Event
1309   {
1310     SalomeApp_Application* myApplication;
1311     Plot2d_ViewFrame*      myView;
1312     PrsObject_ptr          myPrsObj;
1313     int                    myDisplaing;
1314
1315   public:
1316     TXYPlotViewEvent(SalomeApp_Application* theApplication,
1317                      Plot2d_ViewFrame*      theView,
1318                      PrsObject_ptr          thePrsObj,
1319                      int                    theDisplaing)
1320       : myApplication(theApplication),
1321       myView(theView),
1322       myPrsObj(thePrsObj),
1323       myDisplaing(theDisplaing)
1324     {
1325     }
1326
1327     virtual void Execute()
1328     {
1329       // is it Curve ?
1330       if (Curve_i* aCurve = dynamic_cast<Curve_i*>(VISU::GetServant(myPrsObj).in())) {
1331         UpdatePlot2d(myView,myDisplaing,aCurve);
1332       }
1333       // is it Container ?
1334       if (Container_i* aContainer = dynamic_cast<Container_i*>(VISU::GetServant(myPrsObj).in())) {
1335         int nbCurves = aContainer->GetNbCurves();
1336         for ( int i = 1; i <= nbCurves; i++ ) {
1337           VISU::Curve_i* aCurve = aContainer->GetCurve( i );
1338           if ( aCurve && aCurve->IsValid() ) {
1339             UpdatePlot2d(myView,myDisplaing,aCurve);
1340           }
1341         }
1342         myView->Repaint();
1343       }
1344       // is it Table ?
1345       if (Table_i* aTable = dynamic_cast<Table_i*>(VISU::GetServant(myPrsObj).in())) {
1346         _PTR(Study) aCStudy;
1347         if (SUIT_Study* aSStudy = myApplication->activeStudy()) {
1348           if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
1349             aCStudy = aStudy->studyDS();
1350           }
1351         }
1352         if (!aCStudy) return;
1353         _PTR(SObject) TableSO = aCStudy->FindObjectID(aTable->GetEntry());
1354         if (TableSO) {
1355           _PTR(ChildIterator) Iter = aCStudy->NewChildIterator(TableSO);
1356           for (; Iter->More(); Iter->Next()) {
1357             CORBA::Object_var childObject = VISU::ClientSObjectToObject(Iter->Value());
1358             if (!CORBA::is_nil(childObject)) {
1359               CORBA::Object_ptr aCurve = VISU::Curve::_narrow(childObject);
1360               if (!CORBA::is_nil(aCurve))
1361                 UpdatePlot2d(myView, myDisplaing,
1362                              dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in()));
1363             }
1364           }
1365           myView->Repaint();
1366         }
1367       }
1368     }
1369   };
1370
1371   void XYPlot_i::Display (PrsObject_ptr thePrsObj)
1372   {
1373     if (GetViewWindow())
1374       ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eDisplay));
1375   }
1376
1377   void XYPlot_i::Erase (PrsObject_ptr thePrsObj)
1378   {
1379     if (GetViewWindow())
1380       ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eErase));
1381   }
1382
1383   void XYPlot_i::DisplayOnly (PrsObject_ptr thePrsObj)
1384   {
1385     if (GetViewWindow())
1386       ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eDisplayOnly));
1387   }
1388
1389   void XYPlot_i::EraseAll()
1390   {
1391     if (GetViewWindow())
1392       ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::EraseAll));
1393   }
1394
1395   void XYPlot_i::FitAll()
1396   {
1397     if (GetViewWindow())
1398       ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::fitAll));
1399   }
1400
1401   class TFitRangeEvent: public SALOME_Event
1402   {
1403   public:
1404     TFitRangeEvent (Plot2d_ViewFrame* theView,
1405                     const int mode,
1406                     const double xMin, const double xMax,
1407                     const double yMin, const double yMax):
1408       myView(theView), 
1409       myMode(mode),
1410       myXMin(xMin),myXMax(xMax),
1411       myYMin(yMin),myYMax(yMax)
1412     {}
1413     virtual void Execute()
1414     {
1415       myView->fitData(myMode,myXMin,myXMax,myYMin,myYMax);
1416     }
1417   protected:
1418     const int myMode;
1419     const double myXMin;
1420     const double myXMax;
1421     const double myYMin;
1422     const double myYMax;
1423     Plot2d_ViewFrame* myView;
1424   };
1425   
1426   void XYPlot_i::FitXRange(const CORBA::Double xMin,const CORBA::Double xMax)
1427   {
1428     const CORBA::Long mode = 1;
1429     const CORBA::Double yMin = 0.0;
1430     const CORBA::Double yMax = 0.0;
1431     ProcessVoidEvent(new TFitRangeEvent(myView,mode,xMin,xMax,yMin,yMax));
1432   }
1433
1434   void XYPlot_i::FitYRange(const CORBA::Double yMin,const CORBA::Double yMax)
1435   {
1436     const CORBA::Long mode = 2;
1437     const CORBA::Double xMin = 0.0;
1438     const CORBA::Double xMax = 0.0;
1439     ProcessVoidEvent(new TFitRangeEvent(myView,mode,xMin,xMax,yMin,yMax));
1440   }
1441
1442   void XYPlot_i::FitRange(const CORBA::Double xMin,const CORBA::Double xMax,
1443                           const CORBA::Double yMin,const CORBA::Double yMax)
1444   {
1445     const CORBA::Long mode = 0;
1446     ProcessVoidEvent(new TFitRangeEvent(myView,mode,xMin,xMax,yMin,yMax));
1447   }
1448   
1449   void XYPlot_i::GetFitRanges(double& xMin, double& xMax, double& yMin, double& yMax)
1450   {
1451     double y2Min,y2Max;
1452     myView->getFitRanges(xMin,xMax,yMin,yMax,y2Min,y2Max);
1453   }
1454
1455   //===========================================================================
1456   TableView_i::TableView_i (SalomeApp_Application* theApplication)
1457     : View_i(theApplication, NULL)
1458   {
1459   }
1460
1461   struct TCreateTableViewEvent: public SALOME_Event
1462   {
1463     SalomeApp_Application* myApplication;
1464     VISU::Table_i*         myTable;
1465
1466     typedef VisuGUI_TableDlg* TResult;
1467     TResult myResult;
1468
1469     TCreateTableViewEvent (SalomeApp_Application* theApplication,
1470                            VISU::Table_i*         theTable):
1471       myApplication(theApplication),
1472       myTable(theTable),
1473       myResult(NULL)
1474     {}
1475
1476     virtual
1477     void
1478     Execute()
1479     {
1480       if (myTable != NULL) {
1481         if (SUIT_Study* aSStudy = myApplication->activeStudy()) {
1482           if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
1483             if (_PTR(Study) aCStudy = aStudy->studyDS()) {
1484               _PTR(SObject) aSObject = aCStudy->FindObjectID(myTable->GetObjectEntry());
1485               if (aSObject) {
1486                 myResult = new VisuGUI_TableDlg (myApplication->desktop(),
1487                                                  aSObject,
1488                                                  false,
1489                                                  VisuGUI_TableDlg::ttAuto,
1490                                                  Qt::Vertical);
1491                 myResult->show();
1492               }
1493             }
1494           }
1495         }
1496       }
1497     }
1498   };
1499
1500   Storable* TableView_i::Create (VISU::Table_ptr theTable)
1501   {
1502     if (MYDEBUG) MESSAGE("TableView_i::Create - " << (!theTable->_is_nil()));
1503     if (!theTable->_is_nil()) {
1504       VISU::Table_i* table =
1505         dynamic_cast<VISU::Table_i*>(VISU::GetServant(theTable).in());
1506       if (MYDEBUG) MESSAGE("TableView_i::Create - dynamic_cast = " << table);
1507
1508       myView = ProcessEvent(new TCreateTableViewEvent(myApplication, table));
1509       if (myView)
1510         return this;
1511     }
1512     return NULL;
1513   }
1514
1515   TableView_i::~TableView_i()
1516   {
1517     if(MYDEBUG) MESSAGE("TableView_i::~TableView_i");
1518     delete myView;
1519   }
1520
1521   void TableView_i::SetTitle (const char* theTitle)
1522   {
1523     ProcessVoidEvent(new TVoidMemFun1ArgEvent<VisuGUI_TableDlg,const QString&,QString>
1524                      (myView, &VisuGUI_TableDlg::setWindowTitle, QString(theTitle)));
1525   }
1526
1527   char* TableView_i::GetTitle()
1528   {
1529     //jfa: may be need to be enclosed in SALOME_Event?
1530     return CORBA::string_dup(myView->windowTitle().toLatin1().data());
1531   }
1532
1533   void TableView_i::Close()
1534   {
1535     //jfa: may be need to be enclosed in SALOME_Event?
1536     myView->close();
1537   }
1538
1539
1540   //===========================================================================
1541   int View3D_i::myNbViewParams = 0;
1542   const string View3D_i::myComment = "VIEW3D";
1543   const char* View3D_i::GetComment() const { return myComment.c_str();}
1544
1545   QString View3D_i::GenerateViewParamsName()
1546   {
1547     return VISU::GenerateName("ViewParams", ++myNbViewParams);
1548   }
1549
1550   View3D_i::View3D_i (SalomeApp_Application* theApplication)
1551     : View_i(theApplication, NULL)
1552   {
1553     if (MYDEBUG) MESSAGE("View3D_i::View3D_i");
1554   }
1555
1556   struct TCreateView3dEvent: public SALOME_Event
1557   {
1558     SalomeApp_Application *myApplication;
1559     View3D_i * myView3D;
1560     int        myNew;
1561
1562     typedef SUIT_ViewWindow* TResult;
1563     TResult myResult;
1564
1565     TCreateView3dEvent (SalomeApp_Application *theApplication,
1566                         View3D_i * theView3D,
1567                         const int  theNew):
1568       myApplication(theApplication),
1569       myView3D(theView3D),
1570       myNew(theNew),
1571       myResult(NULL)
1572     {}
1573
1574     virtual
1575     void
1576     Execute()
1577     {
1578       if (!myApplication)
1579         return;
1580
1581       if(myNew){
1582         if(SUIT_ViewManager* aViewManager = myApplication->getViewManager(SVTK_Viewer::Type(),false)){
1583           myResult = aViewManager->createViewWindow();
1584           myView3D->myViewManager = aViewManager;
1585         }else{
1586           if(SUIT_ViewManager* aViewManager = myApplication->getViewManager(SVTK_Viewer::Type(),true)){
1587             myResult = aViewManager->getActiveView();
1588             myView3D->myViewManager = aViewManager;
1589           }
1590         }
1591       }else{
1592         if(SUIT_ViewManager* aViewManager = myApplication->activeViewManager()){
1593           if(SUIT_ViewWindow* aView = aViewManager->getActiveView()){
1594             if(dynamic_cast<SVTK_ViewWindow*>(aView)){
1595               myView3D->myViewManager = aViewManager;
1596               myResult = aViewManager->getActiveView();
1597             }
1598           }
1599         }else{
1600           if(SUIT_ViewManager* aViewManager = myApplication->getViewManager(SVTK_Viewer::Type(),false)){
1601             myView3D->myViewManager = aViewManager;
1602             myResult = aViewManager->getActiveView();
1603           }
1604         }
1605       }
1606     }
1607   };
1608
1609   Storable* View3D_i::Create (int theNew)
1610   {
1611     if (MYDEBUG) MESSAGE("View3D_i::Create");
1612     SUIT_ViewWindow* aVW = ProcessEvent(new TCreateView3dEvent(myApplication, this, theNew));
1613     if (aVW) {
1614       SetViewWindow(aVW);
1615       return this;
1616     }
1617     return NULL;
1618   }
1619
1620   void View3D_i::Update()
1621   {
1622     class TEvent: public SALOME_Event
1623     {
1624       SUIT_ViewWindow* myViewWindow;
1625     public:
1626       TEvent(SUIT_ViewWindow* theViewWindow):
1627         myViewWindow(theViewWindow)
1628       {}
1629       virtual void Execute()
1630       {
1631         SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(myViewWindow);
1632         vtkRenderer* aRenderer = aViewWindow->getRenderer();
1633         vtkActorCollection* anActors = aRenderer->GetActors();
1634         anActors->InitTraversal();
1635         while (vtkActor *anAct = anActors->GetNextActor()) {
1636           if (VISU_ActorBase* anActor = dynamic_cast<VISU_ActorBase*>(anAct)) {
1637             if (anActor->GetVisibility()) 
1638               anActor->UpdateFromFactory();
1639           }
1640         }
1641         RepaintView(myViewWindow);
1642       }
1643     };
1644
1645     if (SUIT_ViewWindow* aViewWindow = GetViewWindow())
1646       ProcessVoidEvent(new TEvent(aViewWindow));
1647   }
1648
1649   bool View3D_i::SaveViewParams (SUIT_ViewManager* theViewManager, const std::string& theName)
1650   {
1651     MESSAGE("View3D_i::SaveViewParams()");
1652
1653     if (!theViewManager || theName == "")
1654       return false;
1655
1656     _PTR(Study) aCStudy;
1657     if (SUIT_Study* aSStudy = theViewManager->study()) {
1658       if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
1659         aCStudy = aStudy->studyDS();
1660       }
1661     }
1662     if (!aCStudy)
1663       return false;
1664
1665     if (theName != "") {
1666       std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName.c_str(), "VISU");
1667       _PTR(GenericAttribute) anAttr;
1668       int iEnd = aList.size();
1669       for (int i = 0; i < iEnd; i++) {
1670         _PTR(SObject) anObj = aList[i];
1671         string anEntry = anObj->GetID();
1672         if(MYDEBUG) MESSAGE("View3D_i::SaveViewParams - anEntry = " << anEntry);
1673         if (anObj->FindAttribute(anAttr, "AttributeString")) {
1674           _PTR(AttributeString) aCmnt (anAttr);
1675           string aComm (aCmnt->Value());
1676           if (MYDEBUG) MESSAGE("View3D_i::SaveViewPoint - aComm = " << aComm);
1677           if (aComm.compare(View3D_i::myComment) >= 0) {
1678             aCmnt->SetValue(ToString(theViewManager->getActiveView()).c_str());
1679             return true;
1680           }
1681         }
1682       }
1683     }
1684     _PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy);
1685     string aSComponentEntry = aSComponent->GetID();
1686     string anEntry = CreateAttributes(aCStudy, 
1687                                       aSComponentEntry.c_str(), 
1688                                       "", 
1689                                       "", 
1690                                       theName, 
1691                                       "",
1692                                       ToString(theViewManager->getActiveView()).c_str());
1693     return true;
1694   }
1695
1696   class TSaveViewParamsEvent: public SALOME_Event
1697   {
1698     SUIT_ViewManager* myViewMgr;
1699     std::string       myName;
1700   public:
1701     TSaveViewParamsEvent (SUIT_ViewManager* theViewManager,
1702                           const std::string& theName):
1703       myViewMgr(theViewManager),
1704       myName(theName)
1705     {}
1706
1707     virtual void Execute()
1708     {
1709       myResult = View3D_i::SaveViewParams(myViewMgr, myName);
1710     }
1711     typedef CORBA::Boolean TResult;
1712     TResult myResult;
1713   };
1714
1715   CORBA::Boolean View3D_i::SaveViewParams (const char* theViewParamsName)
1716   {
1717     return ProcessEvent(new TSaveViewParamsEvent (myViewManager, theViewParamsName));
1718   }
1719
1720   bool View3D_i::RestoreViewParams (SUIT_ViewManager* theViewManager, const std::string& theName)
1721   {
1722     _PTR(Study) aCStudy;
1723     if (SUIT_Study* aSStudy = theViewManager->study()) {
1724       if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
1725         aCStudy = aStudy->studyDS();
1726       }
1727     }
1728     if (!aCStudy)
1729       return false;
1730
1731     std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName, "VISU");
1732     _PTR(GenericAttribute) anAttr;
1733     int iEnd = aList.size();
1734     if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - iEnd = " << iEnd);
1735     for (int i = 0; i < iEnd; i++) {
1736       _PTR(SObject) anObj = aList[i];
1737       string anEntry = anObj->GetID();
1738       if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - anEntry = " << anEntry);
1739       Storable::TRestoringMap aMap = Storable::GetStorableMap(anObj);
1740       if (Storable::FindValue(aMap, "myComment") == View3D_i::myComment.c_str()) {
1741         Restore(theViewManager->getActiveView(), aMap);
1742         return true;
1743       }
1744     }
1745     return false;
1746   }
1747
1748   class TRestoreViewParamsEvent: public SALOME_Event
1749   {
1750     SUIT_ViewManager* myViewMgr;
1751     std::string       myName;
1752   public:
1753     TRestoreViewParamsEvent (SUIT_ViewManager* theViewManager,
1754                              const std::string& theName):
1755       myViewMgr(theViewManager),
1756       myName(theName)
1757     {}
1758
1759     virtual void Execute()
1760     {
1761       myResult = View3D_i::RestoreViewParams(myViewMgr, myName);
1762     }
1763     typedef CORBA::Boolean TResult;
1764     TResult myResult;
1765   };
1766
1767   CORBA::Boolean View3D_i::RestoreViewParams (const char* theViewParamsName)
1768   {
1769     return ProcessEvent(new TRestoreViewParamsEvent (myViewManager, theViewParamsName));
1770   }
1771
1772   void View3D_i::Restore (SUIT_ViewWindow* theViewWindow,
1773                           const Storable::TRestoringMap& theMap)
1774   {
1775     SALOMEDS::Color aColor;
1776     aColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
1777     aColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
1778     aColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
1779
1780     double aPosition[3];
1781     aPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
1782     aPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
1783     aPosition[2] = VISU::Storable::FindValue(theMap,"myPosition[2]").toDouble();
1784
1785     double aFocalPnt[3];
1786     aFocalPnt[0] = VISU::Storable::FindValue(theMap,"myFocalPnt[0]").toDouble();
1787     aFocalPnt[1] = VISU::Storable::FindValue(theMap,"myFocalPnt[1]").toDouble();
1788     aFocalPnt[2] = VISU::Storable::FindValue(theMap,"myFocalPnt[2]").toDouble();
1789
1790     double aViewUp[3];
1791     aViewUp[0] = VISU::Storable::FindValue(theMap,"myViewUp[0]").toDouble();
1792     aViewUp[1] = VISU::Storable::FindValue(theMap,"myViewUp[1]").toDouble();
1793     aViewUp[2] = VISU::Storable::FindValue(theMap,"myViewUp[2]").toDouble();
1794
1795     double aParallelScale = VISU::Storable::FindValue(theMap,"myParallelScale").toDouble();
1796
1797     double aScaleFactor[3];
1798     aScaleFactor[0] = VISU::Storable::FindValue(theMap,"myScaleFactor[0]").toDouble();
1799     aScaleFactor[1] = VISU::Storable::FindValue(theMap,"myScaleFactor[1]").toDouble();
1800     aScaleFactor[2] = VISU::Storable::FindValue(theMap,"myScaleFactor[2]").toDouble();
1801
1802     SetBackground(theViewWindow,aColor);
1803     SetPointOfView(theViewWindow,aPosition);
1804     SetViewUp(theViewWindow,aViewUp);
1805     SetFocalPoint(theViewWindow,aFocalPnt);
1806     SetParallelScale(theViewWindow,aParallelScale);
1807     ScaleView(theViewWindow,VISU::View3D::XAxis,aScaleFactor[0]);
1808     ScaleView(theViewWindow,VISU::View3D::YAxis,aScaleFactor[1]);
1809     ScaleView(theViewWindow,VISU::View3D::ZAxis,aScaleFactor[2]);
1810   }
1811
1812
1813   string View3D_i::ToString (SUIT_ViewWindow* theViewWindow)
1814   {
1815     ostringstream strOut;
1816     Storable::DataToStream(strOut, "myComment", myComment.c_str());
1817     ToStream(theViewWindow, strOut);
1818     strOut << ends;
1819     if(MYDEBUG) MESSAGE("View3D_i::ToString - " << strOut.str());
1820     return strOut.str();
1821   }
1822
1823   void View3D_i::ToStream (SUIT_ViewWindow* theViewWindow, std::ostringstream& theStr)
1824   {
1825     vtkFloatingPointType backint[3];
1826     GetRenderer(theViewWindow)->GetBackground(backint);
1827     Storable::DataToStream(theStr,"myColor.R",backint[0]);
1828     Storable::DataToStream(theStr,"myColor.G",backint[1]);
1829     Storable::DataToStream(theStr,"myColor.B",backint[2]);
1830
1831     double aPosition[3];
1832     GetPointOfView(theViewWindow,aPosition);
1833     Storable::DataToStream(theStr,"myPosition[0]",aPosition[0]);
1834     Storable::DataToStream(theStr,"myPosition[1]",aPosition[1]);
1835     Storable::DataToStream(theStr,"myPosition[2]",aPosition[2]);
1836
1837     double aFocalPnt[3];
1838     GetFocalPoint(theViewWindow,aFocalPnt);
1839     Storable::DataToStream(theStr,"myFocalPnt[0]",aFocalPnt[0]);
1840     Storable::DataToStream(theStr,"myFocalPnt[1]",aFocalPnt[1]);
1841     Storable::DataToStream(theStr,"myFocalPnt[2]",aFocalPnt[2]);
1842
1843     double aViewUp[3];
1844     GetCamera(theViewWindow)->GetViewUp(aViewUp);
1845     Storable::DataToStream(theStr,"myViewUp[0]",aViewUp[0]);
1846     Storable::DataToStream(theStr,"myViewUp[1]",aViewUp[1]);
1847     Storable::DataToStream(theStr,"myViewUp[2]",aViewUp[2]);
1848
1849     Storable::DataToStream(theStr,"myParallelScale",GetParallelScale(theViewWindow));
1850
1851     double aScaleFactor[3];
1852     (dynamic_cast<SVTK_ViewWindow*>(theViewWindow))->GetScale(aScaleFactor);
1853     Storable::DataToStream(theStr,"myScaleFactor[0]",aScaleFactor[0]);
1854     Storable::DataToStream(theStr,"myScaleFactor[1]",aScaleFactor[1]);
1855     Storable::DataToStream(theStr,"myScaleFactor[2]",aScaleFactor[2]);
1856   }
1857
1858   void View3D_i::ToStream(std::ostringstream& theStr)
1859   {
1860     SUIT_ViewWindow* aVW = GetViewWindow();
1861     if (aVW)
1862       ToStream(aVW, theStr);
1863   }
1864
1865   void View3D_i::Close()
1866   {
1867     //jfa: may be need to be enclosed in SALOME_Event?
1868     SUIT_ViewWindow* aVW = GetViewWindow();
1869     if (aVW)
1870       aVW->close();
1871     //QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
1872     //int aPos = aViews.find(myViewWindow);
1873     //if (aPos >= 0)
1874     //  myViewWindow->close();
1875   }
1876
1877   View3D_i::~View3D_i()
1878   {
1879     if(MYDEBUG) MESSAGE("View3D_i::~View3D_i");
1880   }
1881
1882   void View3D_i::SetTitle (const char* theTitle)
1883   {
1884     SUIT_ViewWindow* aVW = GetViewWindow();
1885     if (aVW)
1886       ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
1887                        (aVW,&SUIT_ViewWindow::setWindowTitle,QString(theTitle)));
1888   }
1889
1890   char* View3D_i::GetTitle()
1891   {
1892     SUIT_ViewWindow* aVW = GetViewWindow();
1893     if (aVW)
1894       return CORBA::string_dup(aVW->windowTitle().toLatin1().data());
1895     return CORBA::string_dup("");
1896   }
1897
1898   void View3D_i::SetBackground (SUIT_ViewWindow* theViewWindow,
1899                                 const SALOMEDS::Color& theColor)
1900   {
1901     //jfa: may be need to be enclosed in SALOME_Event?
1902     int aColor[3];
1903     aColor[0] = int(255.0*theColor.R);
1904     aColor[1] = int(255.0*theColor.G);
1905     aColor[2] = int(255.0*theColor.B);
1906     QColor aNewColor (aColor[0],aColor[1],aColor[2]);
1907     (dynamic_cast<SVTK_ViewWindow*>(theViewWindow))->setBackgroundColor(aNewColor);
1908   }
1909
1910   SALOMEDS::Color View3D_i::GetBackground (SUIT_ViewWindow* theViewWindow)
1911   {
1912     SALOMEDS::Color aColor;
1913     vtkFloatingPointType backint[3];
1914     GetRenderer(theViewWindow)->GetBackground(backint);
1915     aColor.R = backint[0];  aColor.G = backint[1];  aColor.B = backint[2];
1916     return aColor;
1917   }
1918
1919   class TUpdateViewerEvent: public SALOME_Event
1920   {
1921     SUIT_ViewWindow* myVW;
1922     Prs3d_i* myPrs3d;
1923     int myDisplaing;
1924   public:
1925     TUpdateViewerEvent(SUIT_ViewWindow* theViewWindow,
1926                        Prs3d_i* thePrs3d,
1927                        int theDisplaing):
1928       myVW(theViewWindow),
1929       myPrs3d(thePrs3d),
1930       myDisplaing(theDisplaing)
1931     {}
1932     virtual void Execute(){
1933       UpdateViewer(myVW, myDisplaing, myPrs3d);
1934     }
1935   };
1936
1937   class TDisplayTableEvent: public SALOME_Event
1938   {
1939     SUIT_ViewWindow* myVW;
1940     PointMap3d_i* myTable;
1941     int myDisplaying;
1942   public:
1943     TDisplayTableEvent( SUIT_ViewWindow* theView,
1944                         PointMap3d_i* theTable,
1945                         int theDisplaying ) :
1946       myVW (theView),
1947       myTable (theTable),
1948       myDisplaying (theDisplaying)
1949     {}
1950     virtual void Execute() {
1951       SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(myVW);
1952       VISU_PointMap3dActor* anActor = myTable->CreateActor();
1953       myTable->UpdateActor( anActor );
1954       aViewWindow->AddActor( anActor );
1955     }
1956   };
1957
1958   void View3D_i::EraseAll()
1959   {
1960     if(MYDEBUG) MESSAGE("View3D_i::EraseAll");
1961     SUIT_ViewWindow* aVW = GetViewWindow();
1962     if (aVW)
1963       ProcessVoidEvent(new TUpdateViewerEvent(aVW,NULL,eEraseAll));
1964   }
1965
1966   void View3D_i::DisplayAll()
1967   {
1968     if(MYDEBUG) MESSAGE("View3D_i::DisplayAll");
1969     SUIT_ViewWindow* aVW = GetViewWindow();
1970     if (aVW)
1971       ProcessVoidEvent(new TUpdateViewerEvent(aVW,NULL,eDisplayAll));
1972   }
1973
1974   void View3D_i::Erase (PrsObject_ptr thePrsObj)
1975   {
1976     if(MYDEBUG) MESSAGE("View3D_i::Erase");
1977     SUIT_ViewWindow* aVW = GetViewWindow();
1978     CORBA::Object_ptr anObj = thePrsObj;
1979     Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in());
1980     if (aVW && aPrs)
1981       ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eErase));
1982   }
1983
1984   void View3D_i::Display (PrsObject_ptr thePrsObj)
1985   {
1986     if(MYDEBUG) MESSAGE("View3D_i::Display");
1987     SUIT_ViewWindow* aVW = GetViewWindow();
1988     CORBA::Object_ptr anObj = thePrsObj;
1989     Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in());
1990     if (aVW && aPrs)
1991       ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eDisplay));
1992     else if (aVW && !aPrs) {
1993       PointMap3d_i* aTable = dynamic_cast<PointMap3d_i*>(VISU::GetServant(anObj).in());
1994       if (aTable)
1995         ProcessVoidEvent(new TDisplayTableEvent(aVW, aTable, eDisplay));
1996     }
1997   }
1998
1999   void View3D_i::DisplayOnly (PrsObject_ptr thePrsObj)
2000   {
2001     if(MYDEBUG) MESSAGE("View3D_i::DisplayOnly");
2002     SUIT_ViewWindow* aVW = GetViewWindow();
2003     CORBA::Object_ptr anObj = thePrsObj;
2004     Prs3d_i* aPrs =  dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in());
2005     if (aVW && aPrs)
2006       ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eDisplayOnly));
2007     else if (aVW && !aPrs) {
2008       PointMap3d_i* aTable = dynamic_cast<PointMap3d_i*>(VISU::GetServant(anObj).in());
2009       if (aTable)
2010         ProcessVoidEvent(new TDisplayTableEvent(aVW, aTable, eDisplayOnly));
2011     }
2012   }
2013
2014   void View3D_i::FitAll()
2015   {
2016     SUIT_ViewWindow* aVW = GetViewWindow();
2017     if (aVW) {
2018       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
2019                        (dynamic_cast<SVTK_ViewWindow*>(aVW), &SVTK_ViewWindow::onFitAll));
2020       Update();
2021     }
2022   }
2023
2024   void View3D_i::SetView (VISU::View3D::ViewType theType)
2025   {
2026     SUIT_ViewWindow* aVW = GetViewWindow();
2027     if (!aVW)
2028       return;
2029
2030     switch (theType) {
2031     case VISU::View3D::FRONT :
2032       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
2033                        (dynamic_cast<SVTK_ViewWindow*>(aVW), &SVTK_ViewWindow::onFrontView));
2034       break;
2035     case VISU::View3D::BACK :
2036       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
2037                        (dynamic_cast<SVTK_ViewWindow*>(aVW), &SVTK_ViewWindow::onBackView));
2038       break;
2039     case VISU::View3D::LEFT :
2040       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
2041                        (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onLeftView));
2042       break;
2043     case VISU::View3D::RIGHT :
2044       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
2045                        (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onRightView));
2046       break;
2047     case VISU::View3D::TOP :
2048       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
2049                        (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onTopView));
2050       break;
2051     case VISU::View3D::BOTTOM :
2052       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
2053                        (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onBottomView));
2054       break;
2055     }
2056     Update();
2057   }
2058
2059   class TSet3DViewParamEvent: public SALOME_Event
2060   {
2061   public:
2062     typedef void (*TFun)(SUIT_ViewWindow* theViewWindow, const CORBA::Double theParam[3]);
2063     TSet3DViewParamEvent (TFun theFun,
2064                           SUIT_ViewWindow* theViewWindow,
2065                           const CORBA::Double theParam[3]):
2066       myFun(theFun),
2067       myVW(theViewWindow),
2068       myParam(theParam)
2069     {}
2070     virtual void Execute() {
2071       myFun(myVW,myParam);
2072     }
2073   private:
2074     TFun myFun;
2075     SUIT_ViewWindow* myVW;
2076     const CORBA::Double* myParam;
2077   };
2078
2079   void View3D_i::SetPointOfView (SUIT_ViewWindow* theViewWindow,
2080                                  const CORBA::Double thePosition[3])
2081   {
2082     //jfa: may be need to be enclosed in SALOME_Event?
2083     GetCamera(theViewWindow)->SetPosition(thePosition);
2084   }
2085
2086   void View3D_i::SetPointOfView (const VISU::View3D::XYZ thePosition)
2087   {
2088     if(MYDEBUG) MESSAGE("View3D_i::SetPointOfView");
2089     SUIT_ViewWindow* aVW = GetViewWindow();
2090     if (aVW)
2091       ProcessVoidEvent(new TSet3DViewParamEvent(&View3D_i::SetPointOfView,aVW,thePosition));
2092   }
2093
2094   void View3D_i::GetPointOfView (SUIT_ViewWindow* theViewWindow,
2095                                  CORBA::Double thePosition[3])
2096   {
2097     GetCamera(theViewWindow)->GetPosition(thePosition);
2098   }
2099
2100   VISU::View3D::XYZ_slice* View3D_i::GetPointOfView()
2101   {
2102     if(MYDEBUG) MESSAGE("View3D_i::GetPointOfView");
2103     CORBA::Double aPosition[3];
2104     SUIT_ViewWindow* aVW = GetViewWindow();
2105     if (aVW)
2106       GetPointOfView(aVW,aPosition);
2107     return VISU::View3D::XYZ_dup(aPosition);
2108   }
2109
2110   void View3D_i::SetViewUp (SUIT_ViewWindow* theViewWindow,
2111                             const CORBA::Double theViewUp[3])
2112   {
2113     GetCamera(theViewWindow)->SetViewUp(theViewUp);
2114   }
2115
2116   void View3D_i::SetViewUp (const VISU::View3D::XYZ theViewUp)
2117   {
2118     if(MYDEBUG) MESSAGE("View3D_i::SetViewUp");
2119     SUIT_ViewWindow* aVW = GetViewWindow();
2120     if (aVW)
2121       ProcessVoidEvent(new TSet3DViewParamEvent(&View3D_i::SetViewUp,aVW,theViewUp));
2122   }
2123
2124   void View3D_i::GetViewUp (SUIT_ViewWindow* theViewWindow,
2125                             CORBA::Double theViewUp[3])
2126   {
2127     GetCamera(theViewWindow)->GetViewUp(theViewUp);
2128   }
2129
2130   VISU::View3D::XYZ_slice* View3D_i::GetViewUp()
2131   {
2132     if(MYDEBUG) MESSAGE("View3D_i::GetViewUp");
2133     CORBA::Double aViewUp[3];
2134     SUIT_ViewWindow* aVW = GetViewWindow();
2135     if (aVW)
2136       GetCamera(aVW)->GetViewUp(aViewUp);
2137     return VISU::View3D::XYZ_dup(aViewUp);
2138   }
2139
2140   void View3D_i::SetFocalPoint (SUIT_ViewWindow* theViewWindow,
2141                                 const CORBA::Double theFocalPnt[3])
2142   {
2143     GetCamera(theViewWindow)->SetFocalPoint(theFocalPnt);
2144   }
2145
2146   void View3D_i::SetFocalPoint (const VISU::View3D::XYZ theCoord)
2147   {
2148     if(MYDEBUG) MESSAGE("View3D_i::SetFocalPoint");
2149     SUIT_ViewWindow* aVW = GetViewWindow();
2150     if (aVW)
2151       ProcessVoidEvent(new TSet3DViewParamEvent(&View3D_i::SetFocalPoint,aVW,theCoord));
2152   }
2153
2154
2155   void View3D_i::GetFocalPoint (SUIT_ViewWindow* theViewWindow,
2156                                 CORBA::Double theFocalPnt[3])
2157   {
2158     GetCamera(theViewWindow)->GetFocalPoint(theFocalPnt);
2159   }
2160
2161   VISU::View3D::XYZ_slice* View3D_i::GetFocalPoint()
2162   {
2163     if(MYDEBUG) MESSAGE("View3D_i::GetFocalPoint");
2164     CORBA::Double aFocalPnt[3];
2165     SUIT_ViewWindow* aVW = GetViewWindow();
2166     if (aVW)
2167       GetFocalPoint(aVW,aFocalPnt);
2168     return VISU::View3D::XYZ_dup(aFocalPnt);
2169   }
2170
2171   class TSetViewParamEvent: public SALOME_Event
2172   {
2173   public:
2174     typedef void (*TFun)(SUIT_ViewWindow* theViewWindow, CORBA::Double theParam);
2175     TSetViewParamEvent (TFun theFun,
2176                         SUIT_ViewWindow* theViewWindow,
2177                         CORBA::Double theParam):
2178       myFun(theFun),
2179       myVW(theViewWindow),
2180       myParam(theParam)
2181     {}
2182     virtual void Execute()
2183     {
2184       myFun(myVW,myParam);
2185     }
2186   private:
2187     TFun myFun;
2188     SUIT_ViewWindow* myVW;
2189     CORBA::Double myParam;
2190   };
2191
2192   void View3D_i::SetParallelScale (SUIT_ViewWindow* theViewWindow,
2193                                    CORBA::Double theScale)
2194   {
2195     GetCamera(theViewWindow)->SetParallelScale(theScale);
2196   }
2197
2198   void View3D_i::SetParallelScale (CORBA::Double theScale)
2199   {
2200     if(MYDEBUG) MESSAGE("View3D_i::SetParallelScale");
2201     SUIT_ViewWindow* aVW = GetViewWindow();
2202     if (aVW)
2203       ProcessVoidEvent(new TSetViewParamEvent(&View3D_i::SetParallelScale,aVW,theScale));
2204   }
2205
2206   CORBA::Double View3D_i::GetParallelScale (SUIT_ViewWindow* theViewWindow)
2207   {
2208     return GetCamera(theViewWindow)->GetParallelScale();
2209   }
2210
2211   CORBA::Double View3D_i::GetParallelScale()
2212   {
2213     if(MYDEBUG) MESSAGE("View3D_i::GetParallelScale");
2214     SUIT_ViewWindow* aVW = GetViewWindow();
2215     if (aVW)
2216       return GetParallelScale(aVW);
2217     return 1.0;
2218   }
2219
2220   void View3D_i::ScaleView (SUIT_ViewWindow* theViewWindow,
2221                             VISU::View3D::Axis theAxis, CORBA::Double theParam)
2222   {
2223     SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(theViewWindow);
2224     double aScaleFactor[3];
2225     aViewWindow->GetScale(aScaleFactor);
2226     aScaleFactor[theAxis] = theParam;
2227     aViewWindow->SetScale(aScaleFactor);
2228   }
2229
2230   void SetScaleView (SUIT_ViewWindow* theViewWindow, const CORBA::Double theScale[3])
2231   {
2232     double aScale[3] = {theScale[0], theScale[1], theScale[2]};
2233     (dynamic_cast<SVTK_ViewWindow*>(theViewWindow))->SetScale(aScale);
2234   }
2235
2236   void View3D_i::ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam)
2237   {
2238     if(MYDEBUG) MESSAGE("View3D_i::ScaleView");
2239     SUIT_ViewWindow* aVW = GetViewWindow();
2240     if (aVW) {
2241       double aScale[3];
2242       (dynamic_cast<SVTK_ViewWindow*>(aVW))->GetScale(aScale);
2243       aScale[theAxis] = theParam;
2244       ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,aVW,aScale));
2245     }
2246   }
2247
2248   void View3D_i::RemoveScale()
2249   {
2250     if(MYDEBUG) MESSAGE("View3D_i::RemoveScale");
2251     SUIT_ViewWindow* aVW = GetViewWindow();
2252     if (aVW) {
2253       double aScale[3] = {1.0, 1.0, 1.0};
2254       ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,aVW,aScale));
2255     }
2256   }
2257
2258   //================================================
2259   // Certain presentation view parameters management
2260   //================================================
2261   class TPrsManageEvent: public SALOME_Event
2262   {
2263   protected:
2264     View3D_i* myView3D;
2265     ScalarMap_ptr myPrs;
2266     string myError;
2267
2268     TPrsManageEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
2269       myView3D(theView3D),
2270       myPrs(ScalarMap::_duplicate(thePrs)),
2271       myError("Unknown error occured")
2272     {}
2273     VISU_Actor* GetMyActor()
2274     {
2275       SUIT_ViewWindow* aVW = myView3D->GetViewWindow();
2276       SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aVW);
2277       if (!aVW) {
2278         myError = "Corrupted view window";
2279       } else {
2280         ScalarMap_i* aPrs = dynamic_cast<ScalarMap_i*>(VISU::GetServant(myPrs).in());
2281         if (!aPrs) {
2282           myError = "Corrupted presentation";
2283         } else {
2284           VISU_Actor* anActor = VISU::FindActor(vw, aPrs);
2285           if (!anActor) {
2286             myError = "No actor found. Display the presentation at first.";
2287           } else {
2288             myError = "";
2289             return anActor;
2290           }
2291         }
2292       }
2293       return NULL;
2294     }
2295   };
2296
2297   // Get
2298   class TGetPrsTypeEvent: public TPrsManageEvent {
2299   public:
2300     typedef VISU::PresentationType TResult;
2301     TResult myResult;
2302     TGetPrsTypeEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
2303       TPrsManageEvent(theView3D, thePrs), myResult(VISU::SHRINK) {}
2304     virtual void Execute() {
2305       if (VISU_Actor* anActor = GetMyActor())
2306         myResult = (VISU::PresentationType)anActor->GetRepresentation();
2307     }
2308   };
2309
2310   class TGetShrinkedEvent: public TPrsManageEvent {
2311   public:
2312     typedef bool TResult;
2313     TResult myResult;
2314     TGetShrinkedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
2315       TPrsManageEvent(theView3D, thePrs), myResult(false) {}
2316     virtual void Execute() {
2317       if (VISU_Actor* anActor = GetMyActor()) {
2318         if (anActor->IsShrunkable())
2319           myResult = anActor->IsShrunk();
2320         else
2321           myResult = false;
2322       }
2323     }
2324   };
2325
2326   class TGetShadedEvent: public TPrsManageEvent {
2327   public:
2328     typedef bool TResult;
2329     TResult myResult;
2330     TGetShadedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
2331       TPrsManageEvent(theView3D, thePrs), myResult(false) {}
2332     virtual void Execute() {
2333       if (VISU_Actor* anActor = GetMyActor())
2334         if (VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor))
2335           myResult = aScalarMapActor->IsShading();
2336     }
2337   };
2338
2339   class TGetOpacityEvent: public TPrsManageEvent {
2340   public:
2341     typedef double TResult;
2342     TResult myResult;
2343     TGetOpacityEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
2344       TPrsManageEvent(theView3D, thePrs), myResult(-1.0) {}
2345     virtual void Execute() {
2346       if (VISU_Actor* anActor = GetMyActor()) {
2347         vtkFloatingPointType oldvalue = anActor->GetOpacity();
2348         myResult = (double)oldvalue;
2349       }
2350     }
2351   };
2352
2353   class TGetLineWidthEvent: public TPrsManageEvent {
2354   public:
2355     typedef double TResult;
2356     TResult myResult;
2357     TGetLineWidthEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
2358       TPrsManageEvent(theView3D, thePrs), myResult(-1.0) {}
2359     virtual void Execute() {
2360       if (VISU_Actor* anActor = GetMyActor()) {
2361         vtkFloatingPointType oldvalue = anActor->GetLineWidth();
2362         myResult = (double)oldvalue;
2363       }
2364     }
2365   };
2366
2367   // Set
2368   class TSetPrsTypeEvent: public TPrsManageEvent {
2369   private:
2370     PresentationType myPrsType;
2371   public:
2372     typedef string TResult;
2373     TResult myResult;
2374     TSetPrsTypeEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, PresentationType thePrsType):
2375       TPrsManageEvent(theView3D, thePrs), myPrsType(thePrsType),
2376       myResult("Unknown error occured")
2377     {}
2378     virtual void Execute() {
2379       switch (myPrsType) {
2380       case VISU::INSIDEFRAME:
2381         {
2382           VISU::VISUType aType = myPrs->GetType();
2383           if (aType != VISU::TSCALARMAP &&
2384               aType != VISU::TDEFORMEDSHAPE &&
2385               aType != VISU::TSCALARMAPONDEFORMEDSHAPE &&
2386               aType != VISU::TDEFORMEDSHAPEANDSCALARMAP) {
2387             myResult = "Insideframe representation is not available for this type of presentations.";
2388             return;
2389           }
2390         }
2391         break;
2392       case VISU::SURFACEFRAME:
2393         myResult = "Surfaceframe representation is available only for mesh presentation.";
2394         return;
2395       case VISU::SHRINK:
2396         myResult = "Use SetShrinked() method to shrink/unshrink presentation.";
2397         return;
2398       default:
2399         break;
2400       }
2401       if (VISU_Actor* anActor = GetMyActor()) {
2402         anActor->SetRepresentation((int)myPrsType);
2403         SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
2404         vw->Repaint();
2405         myResult = "";
2406       } else {
2407         myResult = myError;
2408       }
2409     }
2410   };
2411
2412   class TSetShrinkedEvent: public TPrsManageEvent {
2413   private:
2414     bool myIsOn;
2415   public:
2416     typedef string TResult;
2417     TResult myResult;
2418     TSetShrinkedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, bool isOn):
2419       TPrsManageEvent(theView3D, thePrs), myIsOn(isOn),
2420       myResult("Unknown error occured")
2421     {}
2422     virtual void Execute() {
2423       VISU::VISUType aType = myPrs->GetType();
2424       if (aType == VISU::TVECTORS || aType == VISU::TSTREAMLINES) {
2425         myResult = "Shrinked representation is not available for this type of presentations.";
2426       } else {
2427         if (VISU_Actor* anActor = GetMyActor()) {
2428           if (anActor->IsShrunkable()) {
2429             if (myIsOn) anActor->SetShrink();
2430             else        anActor->UnShrink();
2431             SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
2432             vw->Repaint();
2433             myResult = "";
2434           } else {
2435             myResult = "This presentation is not shrunkable.";
2436           }
2437         } else {
2438           myResult = myError;
2439         }
2440       }
2441     }
2442   };
2443
2444   class TSetShadedEvent: public TPrsManageEvent {
2445   private:
2446     bool myIsOn;
2447   public:
2448     typedef string TResult;
2449     TResult myResult;
2450     TSetShadedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, bool isOn):
2451       TPrsManageEvent(theView3D, thePrs), myIsOn(isOn),
2452       myResult("Unknown error occured")
2453     {}
2454     virtual void Execute() {
2455       if (VISU_Actor* anActor = GetMyActor()) {
2456         if (VISU_ScalarMapAct* aScalarMapActor =
2457             dynamic_cast<VISU_ScalarMapAct*>(anActor)) {
2458           aScalarMapActor->SetShading(myIsOn);
2459           SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
2460           vw->Repaint();
2461           myResult = "";
2462         } else {
2463           myResult = "Corrupted actor";
2464         }
2465       } else {
2466         myResult = myError;
2467       }
2468     }
2469   };
2470
2471   class TSetOpacityEvent: public TPrsManageEvent {
2472   private:
2473     double myOpacity;
2474   public:
2475     typedef string TResult;
2476     TResult myResult;
2477     TSetOpacityEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, double theOpacity):
2478       TPrsManageEvent(theView3D, thePrs), myOpacity(theOpacity),
2479       myResult("Unknown error occured")
2480     {}
2481     virtual void Execute() {
2482       VISU::VISUType aType = myPrs->GetType();
2483       if (aType == VISU::TVECTORS || aType == VISU::TSTREAMLINES) {
2484         myResult = "Opacity is meaningless for this type of presentations.";
2485         return;
2486       }
2487       if (VISU_Actor* anActor = GetMyActor()) {
2488         anActor->SetOpacity((vtkFloatingPointType)myOpacity);
2489         SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
2490         vw->Repaint();
2491         myResult = "";
2492       } else {
2493         myResult = myError;
2494       }
2495     }
2496   };
2497
2498   class TSetLineWidthEvent: public TPrsManageEvent {
2499   private:
2500     double myLineWidth;
2501   public:
2502     typedef string TResult;
2503     TResult myResult;
2504     TSetLineWidthEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, double theLineWidth):
2505       TPrsManageEvent(theView3D, thePrs), myLineWidth(theLineWidth),
2506       myResult("Unknown error occured")
2507     {}
2508     virtual void Execute() {
2509       if (myPrs->GetType() == VISU::TVECTORS) {
2510         myResult = "Line Width is meaningless for Vectors presentation.";
2511         return;
2512       }
2513       if (VISU_Actor* anActor = GetMyActor()) {
2514         anActor->SetLineWidth((vtkFloatingPointType)myLineWidth);
2515         SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
2516         vw->Repaint();
2517         myResult = "";
2518       } else {
2519         myResult = myError;
2520       }
2521     }
2522   };
2523
2524   class TSetQuadratic2DPresentationTypeEvent: public TPrsManageEvent {
2525   private:
2526     Quadratic2DPresentationType myPrsType;
2527   public:
2528     typedef string TResult;
2529     TResult myResult;
2530     TSetQuadratic2DPresentationTypeEvent(View3D_i* theView3D,
2531                                          ScalarMap_ptr thePrs,
2532                                          Quadratic2DPresentationType theType):
2533       TPrsManageEvent(theView3D, thePrs), myPrsType(theType),
2534       myResult("Unknown error occured")
2535     {}
2536     virtual void Execute() 
2537     {
2538       VISU::VISUType aType = myPrs->GetType();
2539       if (aType != VISU::TSCALARMAP &&
2540           aType != VISU::TDEFORMEDSHAPE &&
2541           aType != VISU::TSCALARMAPONDEFORMEDSHAPE &&
2542           aType != VISU::TDEFORMEDSHAPEANDSCALARMAP) {
2543         myResult = "2D Quadratic element representation is not available for this type of presentations.";
2544         return;
2545       }
2546       if (VISU_Actor* anActor = GetMyActor()) {
2547         if(myPrsType == VISU::LINES)
2548           anActor->SetQuadratic2DRepresentation(VISU_Actor::eLines);
2549         else if(myPrsType == VISU::ARCS)
2550           anActor->SetQuadratic2DRepresentation(VISU_Actor::eArcs);
2551         
2552         SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
2553         vw->Repaint();
2554         myResult = "";
2555       } else {
2556         myResult = myError;
2557       }
2558     }
2559   };
2560
2561   class TGetQuadratic2DPresentationTypeEvent: public TPrsManageEvent {
2562   public:
2563     typedef VISU::Quadratic2DPresentationType TResult;
2564     TResult myResult;
2565     TGetQuadratic2DPresentationTypeEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
2566       TPrsManageEvent(theView3D, thePrs), myResult(VISU::LINES) {}
2567     virtual void Execute() {
2568       if (VISU_Actor* anActor = GetMyActor()) {
2569         if(anActor->GetQuadratic2DRepresentation() == VISU_Actor::eLines)
2570           myResult = VISU::LINES;
2571         else if(anActor->GetQuadratic2DRepresentation() == VISU_Actor::eArcs)
2572           myResult = VISU::ARCS;
2573       }
2574     }
2575   };
2576
2577   PresentationType View3D_i::GetPresentationType(ScalarMap_ptr thePrs)
2578   {
2579     return ProcessEvent(new TGetPrsTypeEvent(this,thePrs));
2580   }
2581   CORBA::Boolean View3D_i::IsShrinked(ScalarMap_ptr thePrs)
2582   {
2583     return ProcessEvent(new TGetShrinkedEvent(this,thePrs));
2584   }
2585   CORBA::Boolean View3D_i::IsShaded(ScalarMap_ptr thePrs)
2586   {
2587     return ProcessEvent(new TGetShadedEvent(this,thePrs));
2588   }
2589   CORBA::Double View3D_i::GetOpacity(ScalarMap_ptr thePrs)
2590   {
2591     return ProcessEvent(new TGetOpacityEvent(this,thePrs));
2592   }
2593   CORBA::Double View3D_i::GetLineWidth(ScalarMap_ptr thePrs)
2594   {
2595     return ProcessEvent(new TGetLineWidthEvent(this,thePrs));
2596   }
2597
2598   Quadratic2DPresentationType View3D_i::GetQuadratic2DPresentationType(ScalarMap_ptr thePrs)
2599   {
2600     return ProcessEvent(new TGetQuadratic2DPresentationTypeEvent(this,thePrs));
2601   }
2602   
2603   char* View3D_i::SetPresentationType(ScalarMap_ptr thePrs, PresentationType thePrsType)
2604   {
2605     string aRet = ProcessEvent(new TSetPrsTypeEvent(this,thePrs,thePrsType));
2606     return CORBA::string_dup(aRet.c_str());
2607   }
2608   char* View3D_i::SetShrinked(ScalarMap_ptr thePrs, CORBA::Boolean isShrinked)
2609   {
2610     string aRet = ProcessEvent(new TSetShrinkedEvent(this,thePrs,isShrinked));
2611     return CORBA::string_dup(aRet.c_str());
2612   }
2613   char* View3D_i::SetShaded(ScalarMap_ptr thePrs, CORBA::Boolean isShaded)
2614   {
2615     string aRet = ProcessEvent(new TSetShadedEvent(this,thePrs,isShaded));
2616     return CORBA::string_dup(aRet.c_str());
2617   }
2618   char* View3D_i::SetOpacity(ScalarMap_ptr thePrs, CORBA::Double theOpacity)
2619   {
2620     string aRet = ProcessEvent(new TSetOpacityEvent(this,thePrs,theOpacity));
2621     return CORBA::string_dup(aRet.c_str());
2622   }
2623   char* View3D_i::SetLineWidth(ScalarMap_ptr thePrs, CORBA::Double theLineWidth)
2624   {
2625     string aRet = ProcessEvent(new TSetLineWidthEvent(this,thePrs,theLineWidth));
2626     return CORBA::string_dup(aRet.c_str());
2627   }
2628   
2629   char* View3D_i::SetQuadratic2DPresentationType(ScalarMap_ptr thePrs, Quadratic2DPresentationType theType)
2630   {
2631     string aRet = ProcessEvent(new TSetQuadratic2DPresentationTypeEvent(this,thePrs,theType));
2632     return CORBA::string_dup(aRet.c_str());
2633   }
2634 }
2635
2636