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
20 #ifndef HYDROGUI_DISPLAYER_H
21 #define HYDROGUI_DISPLAYER_H
23 #include "HYDROGUI_AbstractDisplayer.h"
29 class HYDROGUI_PrsDriver;
30 class SUIT_ViewWindow;
31 class vtkWorldPointPicker;
34 * \class HYDROGUI_Displayer
35 * \brief Class intended to create, display and update the presentations in 2D graphics viewer.
37 class HYDROGUI_Displayer : public HYDROGUI_AbstractDisplayer
42 * \param theModule module object
44 HYDROGUI_Displayer( HYDROGUI_Module* theModule );
49 virtual ~HYDROGUI_Displayer();
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 * Get the current cursor view position and save it in the displayer
67 * to be used in the obtaining the view coordinates of the cursor.
68 * \param theViewWindow a view window. If a view window is null, an active view is used
69 * only OCC and VTK views are processed
71 void SaveCursorViewPosition( SUIT_ViewWindow* theViewWindow = 0 );
73 * \brief Get the coodinates from the view window, projected on XOY plane
74 * \param theViewWindow a view window
75 * \param theXCoordinate a X coordinate
76 * \param theXCoordinate an Y coordinate
77 * \param theXCoordinate a Z coordinate, has a zero value because of the plane
78 * \return true if the coordinates are got
80 bool GetCursorViewCoordinates( SUIT_ViewWindow* theViewWindow,
81 double& theXCoordinate,
82 double& theYCoordinate,
83 double& theZCoordinate );
86 * \brief Erase all viewer objects.
87 * \param theViewerId viewer identifier
89 void EraseAll( const int theViewerId );
92 * \brief Erase the specified viewer objects.
93 * \param theObjs sequence of objects to erase
94 * \param theViewerId viewer identifier
96 void Erase( const HYDROData_SequenceOfObjects& theObjs,
97 const int theViewerId );
100 * \brief Display the specified viewer objects.
101 * \param theObjs sequence of objects to display
102 * \param theViewerId viewer identifier
103 * \param theIsForced flag used to update all objects, including the unchanged ones
104 * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
106 void Display( const HYDROData_SequenceOfObjects& theObjs,
107 const int theViewerId,
108 const bool theIsForced,
109 const bool theDoFitAll );
113 * \brief Purge all invalid objects in the viewer.
114 * \param theViewerId viewer identifier
116 void purgeObjects( const int theViewerId );
120 * \brief Get the presentation driver for the specified data object.
121 * \param theObj data object
123 HYDROGUI_PrsDriver* getDriver( const Handle(HYDROData_Entity)& theObj );
126 typedef QMap< ObjectKind, HYDROGUI_PrsDriver* > PrsDriversMap;
127 PrsDriversMap myPrsDriversMap;
128 vtkNew<vtkWorldPointPicker> myPicker;
131 bool myIsPositionSaved;