Version: 9.16.0
GEOM_Displayer.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, 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, or (at your option) any later version.
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// GEOM GEOMGUI : GUI for Geometry component
24// File : GEOM_Displayer.h
25// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
26//
27#ifndef GEOM_DISPLAYER_H
28#define GEOM_DISPLAYER_H
29
30#include "GEOM_GEOMGUI.hxx"
31#include <GEOM_AISShape.hxx>
32
33#include <SALOME_InteractiveObject.hxx>
34
35class GEOM_Actor;
36class SALOME_ListIO;
37class SALOME_View;
38class SALOME_Prs;
39class SALOME_OCCPrs;
40class SALOME_VTKPrs;
41class SALOME_PV3DPrs;
42class SALOME_OCCViewType;
43
44#include <TopoDS_Shape.hxx>
45#include <Quantity_Color.hxx>
46#include <LightApp_Displayer.h>
47#include <LightApp_Study.h>
48#include <Aspect_TypeOfMarker.hxx>
49#include <TCollection_AsciiString.hxx>
50#include <TColStd_MapOfInteger.hxx>
51#include <QList>
52
53#include <list>
54
55#include <SALOMEconfig.h>
56#include CORBA_CLIENT_HEADER(GEOM_Gen)
57
58#define GEOM_ALLOBJECTS -1 // Selection of all objects is activated
59#define GEOM_PREVIEW -2 // Definition for preview selection
60#define GEOM_ALLSHAPES -3 // Selection of all shapes is activated
61#define GEOM_ALLGEOM -4 // Selection of all geom objects is activated
62
63typedef std::list<GEOM::GEOM_Object_ptr> ObjectList;
64
65class LightApp_SelectionMgr;
66class SalomeApp_Study;
67class SalomeApp_Application;
69class gp_Ax3;
70
72{
73
74public:
75 /* Constructor */
77 /* Destructor */
78 virtual ~GEOM_Displayer();
79
80 virtual bool canBeDisplayed( const QString& /*entry*/, const QString& /*viewer_type*/ ) const;
81
82 /* Display/Erase object methods */
83 void Display ( const Handle(SALOME_InteractiveObject)& theIO,
84 const bool updateViewer = true,
85 SALOME_View* theViewFrame = 0 );
86
87 // This overloaded Display() method can be useful for operations
88 // not using dialog boxes.
89 void Display ( GEOM::GEOM_BaseObject_ptr theObj,
90 const bool updateViewer = true );
91
92 void Redisplay ( const Handle(SALOME_InteractiveObject)& theIO,
93 const bool updateViewer = true,
94 const bool checkActiveViewer = true );
95
96 void Redisplay ( const Handle(SALOME_InteractiveObject)& theIO,
97 const bool theUpdateViewer,
98 SALOME_View* theViewFrame );
99
100 void Erase ( const Handle(SALOME_InteractiveObject)& theIO,
101 const bool forced = false,
102 const bool updateViewer = true,
103 SALOME_View* theViewFrame = 0 );
104
105 void Erase ( GEOM::GEOM_BaseObject_ptr theObj,
106 const bool forced = false,
107 const bool updateViewer = true,
108 SALOME_View* theViewFrame = 0);
109
110 void EraseWithChildren(const Handle(SALOME_InteractiveObject)& theIO,
111 const bool eraseOnlyChildren = false);
112
113 /* Display/Erase list of objects methods */
114
115 void Display ( const SALOME_ListIO& theIOList,
116 const bool updateViewer = true );
117
118 void Erase ( const SALOME_ListIO& theIOList,
119 const bool forced = false,
120 const bool updateViewer = true );
121
122 void Redisplay ( const SALOME_ListIO& theIOList,
123 const bool updateViewer = true,
124 const bool checkActiveViewer = true );
125
126 void Redisplay ( const SALOME_ListIO& theIOList,
127 const bool theUpdateViewer,
128 SALOME_View* theViewFrame );
129
130 /* Update visibility state */
131 void UpdateVisibility( SALOME_View*, const SALOME_Prs*, bool );
132
133 /* build presentation according to the current viewer type*/
134 SALOME_Prs* BuildPrs ( GEOM::GEOM_Object_ptr );
135 SALOME_Prs* BuildPrs ( const TopoDS_Shape& );
136
137 /* Set color for shape displaying. If it is equal -1 then default color is used.
138 Available values are from Quantity_NameOfColor enumeration */
139 void SetColor ( const int );
140 void UnsetColor();
141 int GetColor () const;
142 bool HasColor () const;
143
144 double SetTransparency ( const double );
145 double UnsetTransparency();
146 double GetTransparency () const;
147 bool HasTransparency () const;
148
149 /* Set texture for shape displaying. */
150 void SetTexture ( const std::string& );
151 bool HasTexture () const;
152 std::string GetTexture () const;
153
154 /* Set width for shape displaying. If it is equal -1 then default width is used. */
155 void SetWidth ( const double );
156 void UnsetWidth();
157 double GetWidth () const;
158 bool HasWidth () const;
159
160 /* Set width for iso-lines displaying. If it is equal -1 then default width is used. */
161 void SetIsosWidth ( const int );
162 int GetIsosWidth () const;
163 bool HasIsosWidth () const;
164
165 /* Set nb iso-libes for displaying. Use -1 to set default values. */
166 int SetNbIsos( const int );
167 int UnsetNbIsos();
168 int GetNbIsos() const;
169 bool HasNbIsos() const;
170
171 /* Set color for iso-lines displaying. If it is equal -1 then default color is used.
172 Available values are from Quantity_NameOfColor enumeration */
173 int SetIsosColor ( const int );
174 int UnsetIsosColor();
175 int GetIsosColor () const;
176 bool HasIsosColor () const;
177
178 /* Set display mode shape displaying. If it is equal -1 then display mode is used. */
179 int SetDisplayMode( const int );
180 int GetDisplayMode() const;
181 int UnsetDisplayMode();
182 bool HasDisplayMode() const;
183
184 /* Sets name - for temporary objects only */
185 void SetName( const char* theName );
186 void UnsetName();
187
188 /* Reimplemented from SALOME_Displayer */
189 virtual void Update( SALOME_OCCPrs* );
190 virtual void Update( SALOME_VTKPrs* );
191 virtual void Update( SALOME_PV3DPrs* );
192 virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCPrs* );
193 virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCPrs* );
194 virtual void BeforeErase ( SALOME_View*, const SALOME_OCCPrs* );
195 virtual void AfterErase ( SALOME_View*, const SALOME_OCCPrs* );
196
197 /* This methods is used for activisation/deactivisation of objects to be displayed*/
198 void SetToActivate( const bool );
199 bool ToActivate() const;
200
201 /* Activate/Deactivate selection*/
202 void LocalSelection( const Handle(SALOME_InteractiveObject)&, const std::list<int> );
203 void LocalSelection( const Handle(SALOME_InteractiveObject)&, const int );
204 void LocalSelection( const SALOME_ListIO& theIOList, const std::list<int> );
205 void LocalSelection( const SALOME_ListIO& theIOList, const int );
206 void GlobalSelection( const int = GEOM_ALLOBJECTS, const bool = false );
207 void GlobalSelection( const TColStd_MapOfInteger&, const bool = false, const QList<int>* = 0 );
208
209 SalomeApp_Study* getStudy() const;
210
211 static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& );
212
213 /*Get color of the geom object*/
214 static SALOMEDS::Color getColor(GEOM::GEOM_Object_var aGeomObject, bool& hasColor);
215
216 /* Get minimum or maximum enclosed shape type */
217 static int getMinMaxShapeType( const TopoDS_Shape& shape, bool ismin );
218
219 /* Check if the object is a vertex or a compound of vertices */
220 static bool isCompoundOfVertices( const TopoDS_Shape& theShape );
221
222
223 /* Builds presentation of not published object */
224 virtual SALOME_Prs* buildSubshapePresentation(const TopoDS_Shape& aShape,
225 const QString&,
226 SALOME_View* = 0);
227
228 /* Update visibility and parameters of the currently selected field step's color scale */
229 void UpdateColorScale();
230 bool SetUpdateColorScale(bool);
231
232protected:
233 /* internal methods */
234 /* Builds presentation according to the current viewer type */
235 virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 );
236
237 /* Sets interactive object */
238 void setIO( const Handle(SALOME_InteractiveObject)& theIO );
239
240 /* Sets shape */
241 void setShape( const TopoDS_Shape& theShape );
242
243 /* Sets field step information */
244 void setFieldStepInfo( const GEOM::field_data_type theFieldDataType,
245 const int theFieldDimension,
246 const QList<QVariant>& theFieldStepData,
247 const TCollection_AsciiString& theFieldStepName,
248 const double theFieldStepRangeMin,
249 const double theFieldStepRangeMax );
250
251 /* Resets internal data */
252 void internalReset();
253
254 void clearTemporary( LightApp_SelectionMgr* theSelMgr );
255
256 SUIT_SelectionFilter* getFilter( const int theMode );
257 SUIT_SelectionFilter* getComplexFilter( const QList<int>* );
258
259 Quantity_Color qColorFromResources( const QString&, const QColor& );
260 QColor colorFromResources( const QString&, const QColor& );
261 void updateShapeProperties( const Handle(GEOM_AISShape)&, bool );
262 void updateActorProperties( GEOM_Actor*, bool );
263 void updateDimensions( const Handle(SALOME_InteractiveObject)&, SALOME_OCCPrs*, const gp_Ax3& );
264 void updateShapeAnnotations( const Handle(SALOME_InteractiveObject)&, SALOME_OCCPrs*, const gp_Ax3& );
265
266 PropMap getObjectProperties( const QString&, SALOME_View* = 0 );
267 PropMap getDefaultPropertyMap();
268
269 /* Methods for reading the field step information */
270 void readFieldStepInfo( GEOM::GEOM_FieldStep_var theGeomFieldStep );
271 QList<QVariant> groupFieldData( const QList<QVariant>& theFieldStepData,
272 const int theFieldNbComponents,
273 const bool theIsString,
274 double& theFieldStepRangeMin,
275 double& theFieldStepRangeMax );
276
277protected:
279 TopoDS_Shape myShape;
282 QList<QVariant> myFieldStepData;
283 TCollection_AsciiString myFieldStepName;
287 std::string myName;
288 std::string myTexture;
290 SALOME_View* myViewFrame;
291 bool myUpdateColorScale; // IPAL54049
292
293 // Attributes
294 Quantity_Color myShadingColor;
296 double myWidth;
303 Aspect_TypeOfMarker myTypeOfMarker;
307
308private:
309 SalomeApp_Application* myApp;
310 friend class GEOM_Swig;
311};
312
313#endif // GEOM_DISPLAYER_H
314
Handle(TColStd_HSequenceOfTransient) AdvancedEngine_IOperations
Create a T-shape object with specified caracteristics for the main and the incident pipes (radius,...
Definition: AdvancedEngine_IOperations.cxx:1907
std::list< GEOM::GEOM_Object_ptr > ObjectList
Definition: GEOM_Displayer.h:63
#define GEOM_ALLOBJECTS
Definition: GEOM_Displayer.h:58
#define GEOMGUI_EXPORT
Definition: GEOM_GEOMGUI.hxx:36
static GEOM::shape_type getMinMaxShapeType(const TopoDS_Shape &shape, bool ismin)
Definition: GEOM_Object_i.cc:130
....
Definition: GEOM_AISShape.hxx:44
This class allows to display an OpenCASCADE CAD model in a VTK viewer.
Definition: GEOM_Actor.h:60
Definition: GEOM_Displayer.h:72
double myFieldStepRangeMax
Definition: GEOM_Displayer.h:285
int myType
Definition: GEOM_Displayer.h:289
int myNbIsos
Definition: GEOM_Displayer.h:298
double myFieldStepRangeMin
Definition: GEOM_Displayer.h:284
int myIsosColor
Definition: GEOM_Displayer.h:299
SALOME_View * myViewFrame
Definition: GEOM_Displayer.h:290
double myTransparency
Definition: GEOM_Displayer.h:305
void updateShapeAnnotations(const Handle(SALOME_InteractiveObject)&, SALOME_OCCPrs *, const gp_Ax3 &)
int myDisplayMode
Definition: GEOM_Displayer.h:301
SalomeApp_Application * myApp
Definition: GEOM_Displayer.h:309
int myColor
Definition: GEOM_Displayer.h:295
double myScaleOfMarker
Definition: GEOM_Displayer.h:304
bool myUpdateColorScale
Definition: GEOM_Displayer.h:291
std::string myNameInObjBrowser
Definition: GEOM_Displayer.h:286
GEOM::field_data_type myFieldDataType
Definition: GEOM_Displayer.h:280
double myWidth
Definition: GEOM_Displayer.h:296
TCollection_AsciiString myFieldStepName
Definition: GEOM_Displayer.h:283
bool myHasDisplayMode
Definition: GEOM_Displayer.h:302
std::string myName
Definition: GEOM_Displayer.h:287
QList< QVariant > myFieldStepData
Definition: GEOM_Displayer.h:282
Aspect_TypeOfMarker myTypeOfMarker
Definition: GEOM_Displayer.h:303
int myFieldDimension
Definition: GEOM_Displayer.h:281
TopoDS_Shape myShape
Definition: GEOM_Displayer.h:279
int myIsosWidth
Definition: GEOM_Displayer.h:297
std::string myTexture
Definition: GEOM_Displayer.h:288
Handle(SALOME_InteractiveObject) myIO
bool myToActivate
Definition: GEOM_Displayer.h:300
bool myIsRedisplayed
Definition: GEOM_Displayer.h:306
Quantity_Color myShadingColor
Definition: GEOM_Displayer.h:294
Definition: libGEOM_Swig.h:35
@ Color
Definition: GEOM_Constants.h:40
field_data_type
Type of field data.
Definition: GEOM_Gen.idl:191