Salome HOME
Get rid of Qt classes in the data model.
[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 "HYDROGUI_AbstractDisplayer.h"
27
28 class HYDROGUI_Shape;
29 class Handle(AIS_InteractiveContext);
30 class OCCViewer_ViewManager;
31 class OCCViewer_Viewer;
32
33 /**
34  * \class HYDROGUI_OCCDisplayer
35  * \brief Class intended to create, display and update the presentations on OCC viewer.
36  */
37 class HYDROGUI_OCCDisplayer : public HYDROGUI_AbstractDisplayer
38 {
39 public:
40   /**
41    * \brief Constructor.
42    * \param theModule module object
43    */
44   HYDROGUI_OCCDisplayer( HYDROGUI_Module* theModule );
45
46   /**
47    * \brief Destructor.
48    */
49   virtual ~HYDROGUI_OCCDisplayer();
50
51 public:
52   /**
53    * \brief Force the specified objects to be updated.
54    * \param theObjs sequence of objects to update
55    * \param theViewerId viewer identifier
56    */
57   void                            SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
58                                                const int theViewerId );
59
60   /**
61    * \brief Get the applicable viewer type.
62    */
63   virtual QString  GetType() const;
64
65   /**
66    * \brief Add the z layer for preview and returns its index.
67    * \param theMgr OCC view manager
68    */
69   int                             AddPreviewZLayer( OCCViewer_ViewManager* theMgr );
70
71   /**
72    * \brief Removes the z layer.
73    * \param theMgr OCC view manager
74    * \param theLayer a layer index
75    */
76   void                            RemoveZLayer( OCCViewer_ViewManager* theMgr,
77                                                 const int theLayer );
78
79 protected:
80   /**
81    * \brief Erase all viewer objects.
82    * \param theViewerId viewer identifier
83    */
84   void                            EraseAll( const int theViewerId );
85
86   /**
87    * \brief Erase the specified viewer objects.
88    * \param theObjs sequence of objects to erase
89    * \param theViewerId viewer identifier
90    */
91   void                            Erase( const HYDROData_SequenceOfObjects& theObjs,
92                                          const int theViewerId );
93
94   /**
95    * \brief Display the specified viewer objects.
96    * \param theObjs sequence of objects to display
97    * \param theViewerId viewer identifier
98    * \param theIsForced flag used to update all objects, including the unchanged ones
99    * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
100    */
101   void                            Display( const HYDROData_SequenceOfObjects& theObjs,
102                                            const int theViewerId,
103                                            const bool theIsForced,
104                                            const bool theDoFitAll );
105
106 protected:
107   /**
108    * \brief Purge all invalid objects in the viewer.
109    * \param theViewerId viewer identifier
110    */
111   void                            purgeObjects( const int theViewerId );
112
113 private:
114   /**
115    * \brief Creates new OCC shape.
116    * \param theViewerId viewer identifier
117    * \param theContext context of OCC viewer
118    * \param theObject data model object
119    * \return pointer to new created shape
120    */
121   HYDROGUI_Shape*                 createShape( const int                             theViewerId,
122                                                const Handle(AIS_InteractiveContext)& theContext,
123                                                const Handle(HYDROData_Entity)&       theObject );
124
125    /**
126    * \brief Display the specified object.
127    * \param theObject the object to display
128    * \param theViewer the viewer for displaying
129    * \param theIsForced the flag used to update the object shape
130    * \return true in case of success
131    */
132   bool                            Display( const Handle(HYDROData_Entity)& theObject,
133                                            const OCCViewer_Viewer* theViewer,
134                                            const bool theIsForced );
135
136    /**
137    * \brief Set Z layer to the shape corresponding to the HYDRO data object.
138    * \param theViewer the viewer for Z layer setting
139    * \param theObject the HYDRO object
140    * \param theZLayerId the Z layer ID
141    */
142   void                            SetZLayer( const OCCViewer_Viewer* theViewer,
143                                              const Handle(HYDROData_Entity)& theObject, 
144                                              const int theZLayerId );
145 };
146
147 #endif
148