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