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.
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.
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
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef HYDROGUI_OCCDISPLAYER_H
20 #define HYDROGUI_OCCDISPLAYER_H
22 #include "HYDROGUI_AbstractDisplayer.h"
25 class AIS_InteractiveContext;
27 class OCCViewer_ViewManager;
28 class OCCViewer_Viewer;
31 * \class HYDROGUI_OCCDisplayer
32 * \brief Class intended to create, display and update the presentations on OCC viewer.
34 class HYDROGUI_OCCDisplayer : public HYDROGUI_AbstractDisplayer
39 * \param theModule module object
41 HYDROGUI_OCCDisplayer( HYDROGUI_Module* theModule );
46 virtual ~HYDROGUI_OCCDisplayer();
50 * \brief Force the specified objects to be updated.
51 * \param theObjs sequence of objects to update
52 * \param theViewerId viewer identifier
54 void SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
55 const int theViewerId );
58 * \brief Get the applicable viewer type.
60 virtual QString GetType() const;
63 * \brief Add the z layer for preview and returns its index.
64 * \param theMgr OCC view manager
66 int AddPreviewZLayer( OCCViewer_ViewManager* theMgr );
69 * \brief Removes the z layer.
70 * \param theMgr OCC view manager
71 * \param theLayer a layer index
73 void RemoveZLayer( OCCViewer_ViewManager* theMgr,
76 void SetToUpdateColorScale();
79 * \brief Get color scale for the viewer.
80 * \param theViewerId viewer identifier
81 * \return the color scale
83 Handle(AIS_ColorScale) GetColorScale( const int theViewerId );
86 void UpdatePolylines( int theViewerId, int theType, int theSize );
90 * \brief Erase all viewer objects.
91 * \param theViewerId viewer identifier
93 void EraseAll( const int theViewerId );
96 * \brief Erase the specified viewer objects.
97 * \param theObjs sequence of objects to erase
98 * \param theViewerId viewer identifier
100 void Erase( const HYDROData_SequenceOfObjects& theObjs,
101 const int theViewerId );
104 * \brief Display the specified viewer objects.
105 * \param theObjs sequence of objects to display
106 * \param theViewerId viewer identifier
107 * \param theIsForced flag used to update all objects, including the unchanged ones
108 * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
110 void Display( const HYDROData_SequenceOfObjects& theObjs,
111 const int theViewerId,
112 const bool theIsForced,
113 const bool theDoFitAll );
117 * \brief Purge all invalid objects in the viewer.
118 * \param theViewerId viewer identifier
120 void purgeObjects( const int theViewerId );
122 void UpdateColorScale( const OCCViewer_Viewer* );
126 * \brief Creates new OCC shape.
127 * \param theViewerId viewer identifier
128 * \param theContext context of OCC viewer
129 * \param theObject data model object
130 * \return pointer to new created shape
132 HYDROGUI_Shape* createShape( const int theViewerId,
133 const Handle(AIS_InteractiveContext)& theContext,
134 const Handle(HYDROData_Entity)& theObject );
137 * \brief Display the specified object.
138 * \param theObject the object to display
139 * \param theViewer the viewer for displaying
140 * \param theIsForced the flag used to update the object shape
141 * \return true in case of success
143 bool Display( const Handle(HYDROData_Entity)& theObject,
144 const OCCViewer_Viewer* theViewer,
145 const bool theIsForced );
148 * \brief Set Z layer to the shape corresponding to the HYDRO data object.
149 * \param theViewer the viewer for Z layer setting
150 * \param theObject the HYDRO object
151 * \param theZLayerId the Z layer ID
153 void SetZLayer( const OCCViewer_Viewer* theViewer,
154 const Handle(HYDROData_Entity)& theObject,
155 const int theZLayerId );
158 bool myToUpdateColorScale;
160 QMap<int, Handle(AIS_ColorScale)> myColorScales;