Salome HOME
1) HYDRO: Import Image operation.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Displayer.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_DISPLAYER_H
24 #define HYDROGUI_DISPLAYER_H
25
26 #include <HYDROData_Object.h>
27
28 #include <QMap>
29
30 class HYDROGUI_Module;
31 class HYDROGUI_PrsDriver;
32
33 class GraphicsView_Viewer;
34
35 /**
36  * \class HYDROGUI_DataModel
37  * \brief Class intended to create, display and update the presentations.
38  */
39 class HYDROGUI_Displayer
40 {
41 public:
42   /**
43    * \brief Constructor.
44    * \param theModule module object
45    */
46   HYDROGUI_Displayer( HYDROGUI_Module* theModule );
47
48   /**
49    * \brief Destructor.
50    */
51   virtual ~HYDROGUI_Displayer();
52
53 public:
54   /**
55    * \brief Force the specified objects to be updated.
56    * \param theObjs sequence of objects to update
57    * \param theViewerId viewer identifier
58    */
59   void                            SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
60                                                const int theViewerId );
61
62   /**
63    * \brief Update all objects in the viewer.
64    * \param theViewerId viewer identifier
65    * \param theIsInit flag used for initial update
66    * \param theIsForced flag used to update all objects, including the unchanged ones
67    */
68   void                            UpdateAll( const int theViewerId,
69                                              const bool theIsInit,
70                                              const bool theIsForced );
71
72 protected:
73   /**
74    * \brief Erase all viewer objects.
75    * \param theViewerId viewer identifier
76    */
77   void                            EraseAll( const int theViewerId );
78
79   /**
80    * \brief Update and display all objects in the viewer.
81    * \param theViewerId viewer identifier
82    * \param theIsForced flag used to update all objects, including the unchanged ones
83    */
84   void                            DisplayAll( const int theViewerId,
85                                               const bool theIsForced );
86
87   /**
88    * \brief Update the specified viewer objects.
89    * \param theObjs sequence of objects to update
90    * \param theViewerId viewer identifier
91    * \param theIsForced flag used to update all objects, including the unchanged ones
92    */
93   void                            Update( const HYDROData_SequenceOfObjects& theObjs,
94                                           const int theViewerId,
95                                           const bool theIsForced );
96
97   /**
98    * \brief Erase the specified viewer objects.
99    * \param theObjs sequence of objects to erase
100    * \param theViewerId viewer identifier
101    */
102   void                            Erase( const HYDROData_SequenceOfObjects& theObjs,
103                                          const int theViewerId );
104
105   /**
106    * \brief Display the specified viewer objects.
107    * \param theObjs sequence of objects to display
108    * \param theViewerId viewer identifier
109    * \param theIsForced flag used to update all objects, including the unchanged ones
110    */
111   void                            Display( const HYDROData_SequenceOfObjects& theObjs,
112                                            const int theViewerId,
113                                            const bool theIsForced );
114
115 private:
116   /**
117    * \brief Purge all invalid objects in the viewer.
118    * \param theViewerId viewer identifier
119    */
120   void                            purgeObjects( const int theViewerId );
121
122   /**
123    * \brief Get the presentation driver for the specified data object.
124    * \param theObj data object
125    */
126   HYDROGUI_PrsDriver*             getDriver( const Handle(HYDROData_Object)& theObj );
127
128 private:
129   HYDROGUI_Module*                myModule;
130
131   typedef QMap< ObjectKind, HYDROGUI_PrsDriver* > PrsDriversMap;
132   PrsDriversMap                   myPrsDriversMap;
133 };
134
135 #endif