Salome HOME
Fix on Bug PAL7927
[modules/visu.git] / src / VISU_I / VISU_ViewManager_i.hh
index 0ba521676d033b0b7f20d95f8afe534420c7db4c..c647ea6de970d61784c081cf850d952fea59e778 100644 (file)
@@ -1,8 +1,26 @@
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//  VISU OBJECT : interactive object for VISU entities implementation
 //
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 //
 //
-//  File   : VISU_ViewManager_i.hxx
+//  File   : VISU_ViewManager_i.hh
 //  Author : Alexey PETROV
 //  Module : VISU
 
 #define VISU_ViewManager_i_HeaderFile
 
 #include "VISUConfig.hh"
+
 class QAD_Study;
 class QAD_StudyFrame;
+
 class VTKViewer_ViewFrame;
-class Plot2d_ViewFrame;
 class SALOMEGUI_TableDlg;
+class Plot2d_ViewFrame;
+
 class VISU_Actor;
+
 class vtkRenderer;
 class vtkCamera;
 
@@ -29,11 +51,11 @@ namespace VISU{
     virtual ~ViewManager_i() {};
     virtual VISU::VISUType GetType() { return VISU::TVIEWMANAGER;};
 
-    virtual View3D_ptr Create3DView();
-    virtual View_ptr   GetCurrentView();
+    virtual View3D_ptr    Create3DView();
+    virtual View_ptr      GetCurrentView();
     virtual TableView_ptr CreateTableView(VISU::Table_ptr theTable);
-    virtual XYPlot_ptr CreateXYPlot();
-    virtual void Destroy(View_ptr theView);
+    virtual XYPlot_ptr    CreateXYPlot();
+    virtual void          Destroy(View_ptr theView);
 
   protected:
     SALOMEDS::Study_var myStudyDocument;
@@ -43,10 +65,23 @@ namespace VISU{
   class View_i : public virtual POA_VISU::View,
                  public virtual Storable
   {
-  protected:
-    QAD_Study* myStudy;
-    string myName;
   public:
+    QAD_Study*      myStudy;
+    QAD_StudyFrame* myStudyFrame;
+
+  public:
+    virtual void ShowPart( VISU::View::ViewRepresentation ViewRepr, CORBA::Boolean state  );
+    virtual CORBA::Boolean IsPartShown( VISU::View::ViewRepresentation ViewRepr );
+    virtual void SetViewWidth(CORBA::Long Width);
+    virtual void SetViewHeight(CORBA::Long Height);
+    virtual CORBA::Long GetViewWidth();
+    virtual CORBA::Long GetViewHeight();
+    virtual void SetViewPositionHorizontal(VISU::View::ViewPosition ViewPosHor);
+    virtual void SetViewPositionVertical(VISU::View::ViewPosition ViewPosVer);
+
+    virtual void SetRelativePosition( CORBA::Double x, CORBA::Double y );
+    virtual void SetRelativeSize( CORBA::Double x, CORBA::Double y );
+
     View_i(SALOMEDS::Study_ptr theStudy);
     virtual ~View_i();
     virtual void SetBackground(const SALOMEDS::Color& theColor);
@@ -66,8 +101,9 @@ namespace VISU{
     virtual void Close() = 0;
     virtual void ToStream(std::ostringstream& theStr);
     virtual const char* GetComment() const;
+
   public:
-    virtual const char* View_i::GetEntry();
+    virtual std::string View_i::GetEntry();
   };
 
   //===========================================================================
@@ -75,6 +111,7 @@ namespace VISU{
                    public virtual View_i
   {
   public:
+    typedef VISU::XYPlot TInterface;
     XYPlot_i(SALOMEDS::Study_ptr theStudy);
     virtual ~XYPlot_i();
     virtual VISU::VISUType GetType() { return VISU::TXYPLOT;};
@@ -126,7 +163,6 @@ namespace VISU{
 
     virtual void Close();
   protected:
-    QAD_StudyFrame*   myStudyFrame;
     Plot2d_ViewFrame* myView;
   public:
     virtual Storable* Create(int theNew);
@@ -137,6 +173,7 @@ namespace VISU{
                       public virtual View_i
   {
   public:
+    typedef VISU::TableView TInterface;
     TableView_i(SALOMEDS::Study_ptr theStudy);
     virtual ~TableView_i();
     virtual VISU::VISUType GetType() { return VISU::TTABLEVIEW;};
@@ -148,7 +185,7 @@ namespace VISU{
   protected:
     SALOMEGUI_TableDlg* myView;
   public:
-    virtual Storable* Create(VISU::Table_var theTable);
+    virtual Storable* Create(VISU::Table_ptr theTable);
   };
 
   //===========================================================================
@@ -156,6 +193,7 @@ namespace VISU{
                    public virtual View_i
   {
   public:
+    typedef VISU::View3D TInterface;
     View3D_i(SALOMEDS::Study_ptr theStudy);
     virtual ~View3D_i();
     virtual VISU::VISUType GetType() { return VISU::TVIEW3D;};
@@ -214,33 +252,34 @@ namespace VISU{
     virtual void ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam);
     virtual void RemoveScale();
 
-    virtual QString GenerateViewParamsName();
+    static std::string ToString(QAD_StudyFrame* theStudyFrame);
+    static void ToStream(QAD_StudyFrame* theStudyFrame, std::ostringstream& theStr);
+    static bool SaveViewParams(QAD_StudyFrame* theStudyFrame, const char* theName);
     virtual CORBA::Boolean SaveViewParams(const char* theName);
+    static QString GenerateViewParamsName();
+
+    static void Restore(QAD_StudyFrame* theStudyFrame, const Storable::TRestoringMap& theMap);
+    static bool RestoreViewParams(QAD_StudyFrame* theStudyFrame, const char* theName);
     virtual CORBA::Boolean RestoreViewParams(const char* theName);
 
     virtual void Close();
-  protected:
-    QAD_StudyFrame* myStudyFrame;
-    //SALOMEDS::Color myColor;
-    //CORBA::Double myPosition[3], myFocalPnt[3], myViewUp[3], myParallelScale, myScaleFactor[3];
 
-    //Storable* Build(int theRestoring);
+  protected:
     static int myNbViewParams;
 
   public:
     virtual Storable* Create(int theNew);
-    virtual Storable* Restore(const Storable::TRestoringMap& theMap) throw(std::logic_error&);
     virtual void ToStream(std::ostringstream& theStr);
     virtual const char* GetComment() const;
-    static const string myComment;
+    static const std::string myComment;
     QAD_StudyFrame* GetStudyFrame() const { return myStudyFrame;}
   };
-  //Storable* View3DRestore(SALOMEDS::SComponent_var& theSComponent, SALOMEDS::Study_var& theStudy,
-  //                     const char* thePrefix, const Storable::TRestoringMap& theMap);
 
   VTKViewer_ViewFrame* GetViewFrame(QAD_StudyFrame* theStudyFrame);
   vtkRenderer* GetRenderer(QAD_StudyFrame* theStudyFrame);
   vtkCamera* GetCamera(QAD_StudyFrame* theStudyFrame);
+
+  void RepaintView(VTKViewer_ViewFrame* theViewFrame);
   void RepaintView(QAD_StudyFrame* theStudyFrame);
 
   enum Displaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};