Salome HOME
Merge with version on tag OCC-V2_1_0d
[modules/visu.git] / src / VISU_I / VISU_ViewManager_i.hh
index 6c847faeda604a221f3efba87832d48d6fbcc40d..c647ea6de970d61784c081cf850d952fea59e778 100644 (file)
@@ -1,19 +1,43 @@
-// File:       VISU_ViewManager_i.hxx
-// Created:    Wed Jan 22 17:52:40 2003
-// Author:     Alexey PETROV
-//             <apo@ivanox.nnov.matra-dtv.fr>
-
+//  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.hh
+//  Author : Alexey PETROV
+//  Module : VISU
 
 #ifndef VISU_ViewManager_i_HeaderFile
 #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;
 
@@ -27,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;
@@ -41,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);
@@ -62,10 +99,11 @@ namespace VISU{
     virtual CORBA::Boolean SavePicture(const char* theFileName);
 
     virtual void Close() = 0;
-    virtual void ToStream(ostrstream& theStr);
+    virtual void ToStream(std::ostringstream& theStr);
     virtual const char* GetComment() const;
+
   public:
-    virtual const char* View_i::GetEntry();
+    virtual std::string View_i::GetEntry();
   };
 
   //===========================================================================
@@ -73,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;};
@@ -124,7 +163,6 @@ namespace VISU{
 
     virtual void Close();
   protected:
-    QAD_StudyFrame*   myStudyFrame;
     Plot2d_ViewFrame* myView;
   public:
     virtual Storable* Create(int theNew);
@@ -135,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;};
@@ -146,7 +185,7 @@ namespace VISU{
   protected:
     SALOMEGUI_TableDlg* myView;
   public:
-    virtual Storable* Create(VISU::Table_var theTable);
+    virtual Storable* Create(VISU::Table_ptr theTable);
   };
 
   //===========================================================================
@@ -154,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;};
@@ -161,8 +201,13 @@ namespace VISU{
     //View interface
     virtual void SetTitle(const char* theTitle);
     virtual char* GetTitle();
+
+    static void SetBackground(QAD_StudyFrame* theStudyFrame, const SALOMEDS::Color& theColor);
     virtual void SetBackground(const SALOMEDS::Color& theColor);
+
+    static SALOMEDS::Color GetBackground(QAD_StudyFrame* theStudyFrame);
     virtual SALOMEDS::Color GetBackground();
+
     virtual void Minimize();
     virtual void Restore();
     virtual void Maximize();
@@ -179,47 +224,62 @@ namespace VISU{
     virtual void FitAll();
     virtual void SetView(VISU::View3D::ViewType theType);
 
+    static void SetPointOfView(QAD_StudyFrame* theStudyFrame, const CORBA::Double thePosition[3]);
     virtual void SetPointOfView(const VISU::View3D::XYZ theCoord);
+
+    static void GetPointOfView(QAD_StudyFrame* theStudyFrame, CORBA::Double thePosition[3]);
     virtual VISU::View3D::XYZ_slice* GetPointOfView();
 
+    static void SetViewUp(QAD_StudyFrame* theStudyFrame, const CORBA::Double theViewUp[3]);
     virtual void SetViewUp(const VISU::View3D::XYZ theDir);
+
+    static void GetViewUp(QAD_StudyFrame* theStudyFrame, CORBA::Double theViewUp[3]);
     virtual VISU::View3D::XYZ_slice* GetViewUp();
 
+    static void SetFocalPoint(QAD_StudyFrame* theStudyFrame, const CORBA::Double theFocalPnt[3]);
     virtual void SetFocalPoint(const VISU::View3D::XYZ theCoord);
+    
+    static void View3D_i::GetFocalPoint(QAD_StudyFrame* theStudyFrame, CORBA::Double theFocalPnt[3]);
     virtual VISU::View3D::XYZ_slice* GetFocalPoint();
 
+    static void SetParallelScale(QAD_StudyFrame* theStudyFrame, CORBA::Double theScale);
     virtual void SetParallelScale(CORBA::Double theScale);
+    
+    static CORBA::Double GetParallelScale(QAD_StudyFrame* theStudyFrame);
     virtual CORBA::Double GetParallelScale();
 
+    static void ScaleView(QAD_StudyFrame* theStudyFrame, VISU::View3D::Axis theAxis, CORBA::Double theParam);
     virtual void ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam);
     virtual void RemoveScale();
 
-    virtual const char*    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(ostrstream& theStr);
+    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};