Salome HOME
- Bathymethries are colored now by all colors (including red etc.)
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_VTKPrsDisplayer.h
1 // Copyright (C) 2007-2013  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 #ifndef HYDROGUI_VTKPRSDISPLAYER_H
24 #define HYDROGUI_VTKPRSDISPLAYER_H
25
26 #include "HYDROGUI_AbstractDisplayer.h"
27 #include <vtkNew.h>
28 #include <vtkScalarBarActor.h>
29
30 class HYDROGUI_VTKPrsDriver;
31
32 /**
33  * \class HYDROGUI_VTKPrsDisplayer
34  * \brief Class intended to create, display and update the presentations in VTK viewer.
35  */
36 class HYDROGUI_VTKPrsDisplayer : public HYDROGUI_AbstractDisplayer
37 {
38 public:
39   /**
40    * \brief Constructor.
41    * \param theModule module object
42    */
43   HYDROGUI_VTKPrsDisplayer( HYDROGUI_Module* theModule );
44
45   /**
46    * \brief Destructor.
47    */
48   virtual ~HYDROGUI_VTKPrsDisplayer();
49
50   /**
51    * \brief Force the specified objects to be updated.
52    * \param theObjs sequence of objects to update
53    * \param theViewerId viewer identifier
54    */
55   void             SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
56                                 const int theViewerId );
57
58   /**
59    * \brief Get the applicable viewer type.
60    */
61   virtual QString  GetType() const;
62
63   /**
64    * \brief Set the range of Z values for the color legend bar.
65    */
66   void             SetZRange( double theRange[] );
67
68   /**
69    * \brief Get the range of Z values for the color legend bar.
70    */
71   double*          GetZRange() const;
72
73 protected:
74   /**
75    * \brief Erase all viewer objects.
76    * \param theViewerId viewer identifier
77    */
78   void             EraseAll( const int theViewerId );
79
80   /**
81    * \brief Erase the specified viewer objects.
82    * \param theObjs sequence of objects to erase
83    * \param theViewerId viewer identifier
84    */
85   void             Erase( const HYDROData_SequenceOfObjects& theObjs,
86                           const int theViewerId );
87
88   /**
89    * \brief Display the specified viewer objects.
90    * \param theObjs sequence of objects to display
91    * \param theViewerId viewer identifier
92    * \param theIsForced flag used to update all objects, including the unchanged ones
93    * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
94    */
95   void             Display( const HYDROData_SequenceOfObjects& theObjs,
96                             const int theViewerId,
97                             const bool theIsForced,
98                             const bool theDoFitAll );
99
100 protected:
101   /**
102    * \brief Purge all invalid objects in the viewer.
103    * \param theViewerId viewer identifier
104    */
105   void             purgeObjects( const int theViewerId );
106
107 private:
108   /**
109    * \brief Get the presentation driver for the specified data object.
110    * \param theObj data object
111    */
112   HYDROGUI_VTKPrsDriver* getDriver( const Handle(HYDROData_Entity)& theObj );
113
114   HYDROGUI_VTKPrsDriver*      myDriver;
115
116   vtkNew< vtkScalarBarActor > myScalarBar; //!< The colors legend presentation
117 };
118
119 #endif