27 #ifndef GEOM_DISPLAYER_H
28 #define GEOM_DISPLAYER_H
33 #include <SALOME_InteractiveObject.hxx>
41 class SALOME_OCCViewType;
43 #include <TopoDS_Shape.hxx>
44 #include <Quantity_Color.hxx>
45 #include <LightApp_Displayer.h>
46 #include <LightApp_Study.h>
47 #include <Aspect_TypeOfMarker.hxx>
48 #if OCC_VERSION_MAJOR >= 7
49 #include <AIS_ColorScale.hxx>
51 #include <TCollection_AsciiString.hxx>
52 #include <TColStd_MapOfInteger.hxx>
53 #include <Basics_OCCTVersion.hxx>
58 #include <SALOMEconfig.h>
59 #include CORBA_CLIENT_HEADER(GEOM_Gen)
61 #define GEOM_ALLOBJECTS -1 // Selection of all objects is activated
62 #define GEOM_PREVIEW -2 // Definition for preview selection
63 #define GEOM_ALLSHAPES -3 // Selection of all shapes is activated
64 #define GEOM_ALLGEOM -4 // Selection of all geom objects is activated
68 class LightApp_SelectionMgr;
69 class SalomeApp_Study;
70 class SalomeApp_Application;
83 virtual bool canBeDisplayed(
const QString& ,
const QString& )
const;
87 const bool updateViewer =
true,
88 SALOME_View* theViewFrame = 0 );
92 void Display ( GEOM::GEOM_BaseObject_ptr theObj,
93 const bool updateViewer =
true );
96 const bool updateViewer =
true,
97 const bool checkActiveViewer =
true );
100 const bool theUpdateViewer,
101 SALOME_View* theViewFrame );
104 const bool forced =
false,
105 const bool updateViewer =
true,
106 SALOME_View* theViewFrame = 0 );
108 void Erase ( GEOM::GEOM_BaseObject_ptr theObj,
109 const bool forced =
false,
110 const bool updateViewer =
true,
111 SALOME_View* theViewFrame = 0);
114 const bool eraseOnlyChildren =
false);
118 void Display (
const SALOME_ListIO& theIOList,
119 const bool updateViewer =
true );
121 void Erase (
const SALOME_ListIO& theIOList,
122 const bool forced =
false,
123 const bool updateViewer =
true );
125 void Redisplay (
const SALOME_ListIO& theIOList,
126 const bool updateViewer =
true,
127 const bool checkActiveViewer =
true );
129 void Redisplay (
const SALOME_ListIO& theIOList,
130 const bool theUpdateViewer,
131 SALOME_View* theViewFrame );
134 void UpdateVisibility( SALOME_View*,
const SALOME_Prs*,
bool );
137 SALOME_Prs* BuildPrs ( GEOM::GEOM_Object_ptr );
138 SALOME_Prs* BuildPrs (
const TopoDS_Shape& );
142 void SetColor (
const int );
144 int GetColor ()
const;
145 bool HasColor ()
const;
147 double SetTransparency (
const double );
148 double UnsetTransparency();
149 double GetTransparency ()
const;
150 bool HasTransparency ()
const;
153 void SetTexture (
const std::string& );
154 bool HasTexture ()
const;
155 std::string GetTexture ()
const;
158 void SetWidth (
const double );
160 double GetWidth ()
const;
161 bool HasWidth ()
const;
164 void SetIsosWidth (
const int );
165 int GetIsosWidth ()
const;
166 bool HasIsosWidth ()
const;
169 int SetNbIsos(
const int );
171 int GetNbIsos()
const;
172 bool HasNbIsos()
const;
176 int SetIsosColor (
const int );
177 int UnsetIsosColor();
178 int GetIsosColor ()
const;
179 bool HasIsosColor ()
const;
182 int SetDisplayMode(
const int );
183 int GetDisplayMode()
const;
184 int UnsetDisplayMode();
185 bool HasDisplayMode()
const;
188 void SetName(
const char* theName );
192 virtual void Update( SALOME_OCCPrs* );
193 virtual void Update( SALOME_VTKPrs* );
194 virtual void BeforeDisplay( SALOME_View*,
const SALOME_OCCPrs* );
195 virtual void AfterDisplay ( SALOME_View*,
const SALOME_OCCPrs* );
196 virtual void BeforeErase ( SALOME_View*,
const SALOME_OCCPrs* );
197 virtual void AfterErase ( SALOME_View*,
const SALOME_OCCPrs* );
200 void SetToActivate(
const bool );
201 bool ToActivate()
const;
206 void LocalSelection(
const SALOME_ListIO& theIOList,
const std::list<int> );
207 void LocalSelection(
const SALOME_ListIO& theIOList,
const int );
208 void GlobalSelection(
const int =
GEOM_ALLOBJECTS,
const bool =
false );
209 void GlobalSelection(
const TColStd_MapOfInteger&,
const bool =
false,
const QList<int>* = 0 );
211 SalomeApp_Study* getStudy()
const;
213 static SALOMEDS::Color getUniqueColor(
const QList<SALOMEDS::Color>& );
217 static SALOMEDS::Color getColor(GEOM::GEOM_Object_var aGeomObject,
bool& hasColor);
223 static bool isCompoundOfVertices(
const TopoDS_Shape& theShape );
227 virtual SALOME_Prs* buildSubshapePresentation(
const TopoDS_Shape& aShape,
232 void UpdateColorScale(
const bool theIsRedisplayFieldSteps =
false,
const bool updateViewer =
true );
238 virtual SALOME_Prs* buildPresentation(
const QString&, SALOME_View* = 0 );
244 void setShape(
const TopoDS_Shape& theShape );
248 const int theFieldDimension,
249 const QList<QVariant>& theFieldStepData,
250 const TCollection_AsciiString& theFieldStepName,
251 const double theFieldStepRangeMin,
252 const double theFieldStepRangeMax );
255 void internalReset();
257 void clearTemporary( LightApp_SelectionMgr* theSelMgr );
262 Quantity_Color qColorFromResources(
const QString&,
const QColor& );
263 QColor colorFromResources(
const QString&,
const QColor& );
265 void updateActorProperties(
GEOM_Actor*,
bool );
269 PropMap getObjectProperties( SalomeApp_Study*,
const QString&, SALOME_View* = 0 );
270 PropMap getDefaultPropertyMap();
273 void readFieldStepInfo( GEOM::GEOM_FieldStep_var theGeomFieldStep );
274 QList<QVariant> groupFieldData(
const QList<QVariant>& theFieldStepData,
275 const int theFieldNbComponents,
276 const bool theIsString,
277 double& theFieldStepRangeMin,
278 double& theFieldStepRangeMax );
281 static Standard_Integer HueFromValue(
const Standard_Integer aValue,
282 const Standard_Integer aMin,
283 const Standard_Integer aMax );
286 static Standard_Boolean FindColor(
const Standard_Real aValue,
287 const Standard_Real aMin,
288 const Standard_Real aMax,
289 const Standard_Integer ColorsCount,
294 TopoDS_Shape myShape;
296 int myFieldDimension;
297 QList<QVariant> myFieldStepData;
298 TCollection_AsciiString myFieldStepName;
299 double myFieldStepRangeMin;
300 double myFieldStepRangeMax;
302 std::
string myTexture;
304 SALOME_View* myViewFrame;
305 #if OCC_VERSION_MAJOR >= 7
306 Handle(AIS_ColorScale) myColorScale;
330 #endif // GEOM_DISPLAYER_H