1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef HYDROGUI_OCCDISPLAYER_H
24 #define HYDROGUI_OCCDISPLAYER_H
26 #include "HYDROGUI_AbstractDisplayer.h"
29 class Handle(AIS_InteractiveContext);
30 class OCCViewer_ViewManager;
31 class OCCViewer_Viewer;
34 * \class HYDROGUI_OCCDisplayer
35 * \brief Class intended to create, display and update the presentations on OCC viewer.
37 class HYDROGUI_OCCDisplayer : public HYDROGUI_AbstractDisplayer
42 * \param theModule module object
44 HYDROGUI_OCCDisplayer( HYDROGUI_Module* theModule );
49 virtual ~HYDROGUI_OCCDisplayer();
53 * \brief Force the specified objects to be updated.
54 * \param theObjs sequence of objects to update
55 * \param theViewerId viewer identifier
57 void SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
58 const int theViewerId );
61 * \brief Get the applicable viewer type.
63 virtual QString GetType() const;
66 * \brief Add the z layer for preview and returns its index.
67 * \param theMgr OCC view manager
69 int AddPreviewZLayer( OCCViewer_ViewManager* theMgr );
72 * \brief Removes the z layer.
73 * \param theMgr OCC view manager
74 * \param theLayer a layer index
76 void RemoveZLayer( OCCViewer_ViewManager* theMgr,
79 void SetToUpdateColorScale();
83 * \brief Erase all viewer objects.
84 * \param theViewerId viewer identifier
86 void EraseAll( const int theViewerId );
89 * \brief Erase the specified viewer objects.
90 * \param theObjs sequence of objects to erase
91 * \param theViewerId viewer identifier
93 void Erase( const HYDROData_SequenceOfObjects& theObjs,
94 const int theViewerId );
97 * \brief Display the specified viewer objects.
98 * \param theObjs sequence of objects to display
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
103 void Display( const HYDROData_SequenceOfObjects& theObjs,
104 const int theViewerId,
105 const bool theIsForced,
106 const bool theDoFitAll );
110 * \brief Purge all invalid objects in the viewer.
111 * \param theViewerId viewer identifier
113 void purgeObjects( const int theViewerId );
115 void UpdateColorScale( const OCCViewer_Viewer* );
119 * \brief Creates new OCC shape.
120 * \param theViewerId viewer identifier
121 * \param theContext context of OCC viewer
122 * \param theObject data model object
123 * \return pointer to new created shape
125 HYDROGUI_Shape* createShape( const int theViewerId,
126 const Handle(AIS_InteractiveContext)& theContext,
127 const Handle(HYDROData_Entity)& theObject );
130 * \brief Display the specified object.
131 * \param theObject the object to display
132 * \param theViewer the viewer for displaying
133 * \param theIsForced the flag used to update the object shape
134 * \return true in case of success
136 bool Display( const Handle(HYDROData_Entity)& theObject,
137 const OCCViewer_Viewer* theViewer,
138 const bool theIsForced );
141 * \brief Set Z layer to the shape corresponding to the HYDRO data object.
142 * \param theViewer the viewer for Z layer setting
143 * \param theObject the HYDRO object
144 * \param theZLayerId the Z layer ID
146 void SetZLayer( const OCCViewer_Viewer* theViewer,
147 const Handle(HYDROData_Entity)& theObject,
148 const int theZLayerId );
151 bool myToUpdateColorScale;