Salome HOME
refs #453: scalar bar is invisible
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_AbstractDisplayer.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_ABSTRACT_DISPLAYER_H
24 #define HYDROGUI_ABSTRACT_DISPLAYER_H
25
26 #include <HYDROData_Entity.h>
27
28 class HYDROGUI_Module;
29 class SUIT_ViewManager;
30
31 /**
32  * \class HYDROGUI_DataModel
33  * \brief Class intended to create, display and update the presentations.
34  */
35 class HYDROGUI_AbstractDisplayer
36 {
37 public:
38   /**
39    * \brief Constructor.
40    * \param theModule module object
41    */
42   HYDROGUI_AbstractDisplayer( HYDROGUI_Module* theModule );
43
44   /**
45    * \brief Destructor.
46    */
47   virtual ~HYDROGUI_AbstractDisplayer();
48
49 public:
50   /**
51    * \brief Check if this displayer is applicable to the given view manager.
52    * The view manager method getType is used.
53    * \param theViewerId viewer identifier
54    */
55   virtual bool     IsApplicable( const int theViewerId ) const;
56
57   /**
58    * \brief Check if this displayer is applicable to the given view manager.
59    * The view manager method getType is used.
60    * \param theViewMgr the view manager to check
61    */
62   virtual bool     IsApplicable( const SUIT_ViewManager* theViewMgr ) const;
63
64   /**
65    * \brief Update all objects in the viewer.
66    * \param theViewerId viewer identifier
67    * \param theIsInit flag used for initial update
68    * \param theIsForced flag used to update all objects, including the unchanged ones
69    */
70   virtual void     UpdateAll( const int theViewerId,
71                               const bool theIsInit,
72                               const bool theIsForced,
73                               const bool theDoFitAll );
74
75   /**
76    * \brief Force the specified objects to be updated.
77    * \param theObjs sequence of objects to update
78    * \param theViewerId viewer identifier
79    */
80   virtual void     SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
81                                 const int theViewerId ) = 0;
82
83   /**
84    * \brief Get the applicable viewer type.
85    */
86   virtual QString  GetType() const = 0;
87
88 protected:
89   /**
90    * \brief Update and display all objects in the viewer.
91    * \param theViewerId viewer identifier
92    * \param theIsForced flag used to update all objects, including the unchanged ones
93    */
94   virtual void     DisplayAll( const int theViewerId,
95                                const bool theIsForced,
96                                const bool theDoFitAll );
97
98   /**
99    * \brief Update the specified viewer objects.
100    * \param theObjs sequence of objects to update
101    * \param theViewerId viewer identifier
102    * \param theIsForced flag used to update all objects, including the unchanged ones
103    * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
104    */
105   virtual void     Update( const HYDROData_SequenceOfObjects& theObjs,
106                            const int theViewerId,
107                            const bool theIsForced,
108                            const bool theDoFitAll );
109
110   /**
111    * \brief Erase all viewer objects.
112    * \param theViewerId viewer identifier
113    */
114   virtual void     EraseAll( const int theViewerId ) = 0;
115
116   /**
117    * \brief Erase the specified viewer objects.
118    * \param theObjs sequence of objects to erase
119    * \param theViewerId viewer identifier
120    */
121   virtual void     Erase( const HYDROData_SequenceOfObjects& theObjs,
122                           const int theViewerId ) = 0;
123
124   /**
125    * \brief Display the specified viewer objects.
126    * \param theObjs sequence of objects to display
127    * \param theViewerId viewer identifier
128    * \param theIsForced flag used to update all objects, including the unchanged ones
129    * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
130    */
131   virtual void     Display( const HYDROData_SequenceOfObjects& theObjs,
132                             const int theViewerId,
133                             const bool theIsForced,
134                             const bool theDoFitAll ) = 0;
135
136 protected:
137   /**
138    * \brief Purge all invalid objects in the viewer.
139    * \param theViewerId viewer identifier
140    */
141   virtual void     purgeObjects( const int theViewerId ) = 0;
142
143   HYDROGUI_Module* module() const {return myModule;}
144
145 private:
146   HYDROGUI_Module* myModule;
147 };
148
149 #endif