Salome HOME
2fc3491e029209c700ab003d8eada2b5b97ffcab
[modules/gui.git] / src / SPlot2d / SPlot2d_ViewModel.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : SPlot2d_ViewModel.h
23 //  Author : Sergey RUIN
24 //  Module : SUIT
25 //
26 #ifndef SPlot2d_ViewModel_H
27 #define SPlot2d_ViewModel_H
28
29 #include "SPlot2d.h"  
30
31 #include "SALOME_Prs.h"
32 #include "Plot2d_ViewModel.h"
33 #include "SALOME_InteractiveObject.hxx"
34 #include "Plot2d_ViewFrame.h"
35 #include "Plot2d_ViewWindow.h"
36 #include "SPlot2d_Curve.h"
37
38 class SPLOT2D_EXPORT SPlot2d_Viewer : public Plot2d_Viewer, public SALOME_View
39
40   Q_OBJECT
41
42 public:
43   static QString Type() { return "Plot2d"; }
44
45   /* Construction/destruction */
46   SPlot2d_Viewer( bool theAutoDel = false );
47   virtual ~SPlot2d_Viewer();
48
49 public:
50   virtual QString          getType() const { return Type(); }
51
52   /*  interactive object management */
53   void highlight( const Handle(SALOME_InteractiveObject)& IObject, bool highlight, bool update = true ) {}
54   void unHighlightAll() {}
55   void rename( const Handle(SALOME_InteractiveObject)&, const QString&, Plot2d_ViewFrame* = 0 );
56   void renameAll( const Handle(SALOME_InteractiveObject)&, const QString& );
57   bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
58
59   virtual   SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
60   
61   /* display */         
62   void Display( const Handle(SALOME_InteractiveObject)& IObject, bool update = true );
63   void DisplayOnly( const Handle(SALOME_InteractiveObject)& IObject );
64   void Erase( const Handle(SALOME_InteractiveObject)& IObject, bool update = true );
65
66   /* Reimplemented from SALOME_View */
67   void                 Display( const SALOME_Prs2d* );
68   void                 Erase( const SALOME_Prs2d*, const bool = false );
69   virtual void         EraseAll(const bool = false);
70   virtual void         Repaint();
71   virtual SALOME_Prs*  CreatePrs( const char* entry = 0 );
72   virtual void         BeforeDisplay( SALOME_Displayer* d );
73   virtual void         AfterDisplay ( SALOME_Displayer* d );
74   virtual bool         isVisible( const Handle(SALOME_InteractiveObject)& IObject );
75
76
77   /* operations */
78   SPlot2d_Curve*                   getCurveByIO( const Handle(SALOME_InteractiveObject)&, Plot2d_ViewFrame* = 0 );
79   Plot2d_ViewFrame*                getActiveViewFrame();
80   Handle(SALOME_InteractiveObject) FindIObject( const char* Entry );
81
82 protected slots:
83   virtual void onLegendClicked( QwtPlotItem* plotItem );
84
85 signals:
86   void legendSelected( const QString& );
87 };
88
89
90 #endif // SPlot2d_ViewModel_H
91
92
93
94