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