Salome HOME
Implement automatic coloring of land cover maps 1) by colors of Strickler types selec...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_AbstractDisplayer.h
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #ifndef HYDROGUI_ABSTRACT_DISPLAYER_H
20 #define HYDROGUI_ABSTRACT_DISPLAYER_H
21
22 #include <HYDROData_Entity.h>
23
24 class HYDROGUI_Module;
25 class SUIT_ViewManager;
26
27 /**
28  * \class HYDROGUI_DataModel
29  * \brief Class intended to create, display and update the presentations.
30  */
31 class HYDROGUI_AbstractDisplayer
32 {
33 public:
34   /**
35    * \brief Constructor.
36    * \param theModule module object
37    */
38   HYDROGUI_AbstractDisplayer( HYDROGUI_Module* theModule );
39
40   /**
41    * \brief Destructor.
42    */
43   virtual ~HYDROGUI_AbstractDisplayer();
44
45 public:
46   /**
47    * \brief Check if this displayer is applicable to the given view manager.
48    * The view manager method getType is used.
49    * \param theViewerId viewer identifier
50    */
51   virtual bool     IsApplicable( const int theViewerId ) const;
52
53   /**
54    * \brief Check if this displayer is applicable to the given view manager.
55    * The view manager method getType is used.
56    * \param theViewMgr the view manager to check
57    */
58   virtual bool     IsApplicable( const SUIT_ViewManager* theViewMgr ) const;
59
60   /**
61    * \brief Update all objects in the viewer.
62    * \param theViewerId viewer identifier
63    * \param theIsInit flag used for initial update
64    * \param theIsForced flag used to update all objects, including the unchanged ones
65    */
66   virtual void     UpdateAll( const int theViewerId,
67                               const bool theIsInit,
68                               const bool theIsForced,
69                               const bool theDoFitAll );
70
71   /**
72    * \brief Force the specified objects to be updated.
73    * \param theObjs sequence of objects to update
74    * \param theViewerId viewer identifier
75    */
76   virtual void     SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
77                                 const int theViewerId ) = 0;
78
79   /**
80    * \brief Get the applicable viewer type.
81    */
82   virtual QString  GetType() const = 0;
83
84   HYDROGUI_Module* module() const {return myModule;}
85
86 protected:
87   /**
88    * \brief Update and display all objects in the viewer.
89    * \param theViewerId viewer identifier
90    * \param theIsForced flag used to update all objects, including the unchanged ones
91    */
92   virtual void     DisplayAll( const int theViewerId,
93                                const bool theIsForced,
94                                const bool theDoFitAll );
95
96   /**
97    * \brief Update the specified viewer objects.
98    * \param theObjs sequence of objects to update
99    * \param theViewerId viewer identifier
100    * \param theIsForced flag used to update all objects, including the unchanged ones
101    * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
102    */
103   virtual void     Update( const HYDROData_SequenceOfObjects& theObjs,
104                            const int theViewerId,
105                            const bool theIsForced,
106                            const bool theDoFitAll );
107
108   /**
109    * \brief Erase all viewer objects.
110    * \param theViewerId viewer identifier
111    */
112   virtual void     EraseAll( const int theViewerId ) = 0;
113
114   /**
115    * \brief Erase the specified viewer objects.
116    * \param theObjs sequence of objects to erase
117    * \param theViewerId viewer identifier
118    */
119   virtual void     Erase( const HYDROData_SequenceOfObjects& theObjs,
120                           const int theViewerId ) = 0;
121
122   /**
123    * \brief Display the specified viewer objects.
124    * \param theObjs sequence of objects to display
125    * \param theViewerId viewer identifier
126    * \param theIsForced flag used to update all objects, including the unchanged ones
127    * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
128    */
129   virtual void     Display( const HYDROData_SequenceOfObjects& theObjs,
130                             const int theViewerId,
131                             const bool theIsForced,
132                             const bool theDoFitAll ) = 0;
133
134 protected:
135   /**
136    * \brief Purge all invalid objects in the viewer.
137    * \param theViewerId viewer identifier
138    */
139   virtual void     purgeObjects( const int theViewerId ) = 0;
140
141   //HYDROGUI_Module* module() const {return myModule;}
142
143 private:
144   HYDROGUI_Module* myModule;
145 };
146
147 #endif