42cf5bc1 |
1 | // Created on: 1992-01-17 |
2 | // Created by: GG |
3 | // Copyright (c) 1992-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _V3d_Viewer_HeaderFile |
18 | #define _V3d_Viewer_HeaderFile |
19 | |
c357e426 |
20 | #include <Aspect_Background.hxx> |
21 | #include <Aspect_GenId.hxx> |
22 | #include <Aspect_GradientBackground.hxx> |
23 | #include <Aspect_GradientFillMethod.hxx> |
24 | #include <Aspect_GridDrawMode.hxx> |
25 | #include <Aspect_GridType.hxx> |
26 | |
27 | #include <gp_Ax3.hxx> |
28 | #include <Graphic3d_StructureManager.hxx> |
dc89236f |
29 | #include <Graphic3d_TypeOfShadingModel.hxx> |
c357e426 |
30 | #include <Graphic3d_Vertex.hxx> |
31 | #include <Graphic3d_ZLayerSettings.hxx> |
32 | |
42cf5bc1 |
33 | #include <Standard.hxx> |
c357e426 |
34 | #include <Standard_Boolean.hxx> |
35 | #include <Standard_CString.hxx> |
36 | #include <Standard_ExtString.hxx> |
37 | #include <Standard_Integer.hxx> |
38 | #include <Standard_Real.hxx> |
42cf5bc1 |
39 | #include <Standard_Type.hxx> |
40 | |
c357e426 |
41 | #include <TColStd_MapOfInteger.hxx> |
42 | #include <TColStd_ListIteratorOfListOfTransient.hxx> |
43 | #include <TColStd_SequenceOfInteger.hxx> |
42cf5bc1 |
44 | #include <TCollection_AsciiString.hxx> |
c357e426 |
45 | #include <TCollection_ExtendedString.hxx> |
46 | |
6a24c6de |
47 | #include <V3d_ListOfLight.hxx> |
48 | #include <V3d_ListOfView.hxx> |
42cf5bc1 |
49 | #include <V3d_TypeOfOrientation.hxx> |
42cf5bc1 |
50 | #include <V3d_TypeOfView.hxx> |
c357e426 |
51 | #include <V3d_TypeOfVisualization.hxx> |
52 | |
6a24c6de |
53 | #include <Quantity_Color.hxx> |
c357e426 |
54 | |
55 | class Aspect_Grid; |
56 | class Graphic3d_AspectMarker3d; |
42cf5bc1 |
57 | class Graphic3d_GraphicDriver; |
42cf5bc1 |
58 | class Graphic3d_Group; |
c357e426 |
59 | class Graphic3d_Structure; |
42cf5bc1 |
60 | class V3d_BadValue; |
c357e426 |
61 | class V3d_CircularGrid; |
c357e426 |
62 | class V3d_RectangularGrid; |
42cf5bc1 |
63 | class V3d_View; |
64 | class Quantity_Color; |
42cf5bc1 |
65 | |
42cf5bc1 |
66 | //! Defines services on Viewer type objects. |
67 | //! The methods of this class allow editing and |
68 | //! interrogation of the parameters linked to the viewer |
69 | //! its friend classes (View,light,plane). |
6a24c6de |
70 | class V3d_Viewer : public Standard_Transient |
42cf5bc1 |
71 | { |
6a24c6de |
72 | friend class V3d_View; |
6a24c6de |
73 | DEFINE_STANDARD_RTTIEXT(V3d_Viewer, Standard_Transient) |
42cf5bc1 |
74 | public: |
75 | |
6a24c6de |
76 | //! Create a Viewer with the given graphic driver and with default parameters: |
77 | //! - View orientation: V3d_XposYnegZpos |
78 | //! - View background: Quantity_NOC_GRAY30 |
79 | //! - Shading model: V3d_GOURAUD |
80 | Standard_EXPORT V3d_Viewer (const Handle(Graphic3d_GraphicDriver)& theDriver); |
81 | |
82 | //! Returns True if One View more can be defined in this Viewer. |
83 | Standard_EXPORT Standard_Boolean IfMoreViews() const; |
84 | |
85 | //! Creates a view in the viewer according to its default parameters. |
42cf5bc1 |
86 | Standard_EXPORT Handle(V3d_View) CreateView(); |
87 | |
6a24c6de |
88 | //! Activates all of the views of a viewer attached to a window. |
42cf5bc1 |
89 | Standard_EXPORT void SetViewOn(); |
90 | |
6a24c6de |
91 | //! Activates a particular view in the Viewer. |
92 | //! Must be call if the Window attached to the view has been Deiconified. |
93 | Standard_EXPORT void SetViewOn (const Handle(V3d_View)& theView); |
94 | |
42cf5bc1 |
95 | //! Deactivates all the views of a Viewer |
96 | //! attached to a window. |
97 | Standard_EXPORT void SetViewOff(); |
98 | |
99 | //! Deactivates a particular view in the Viewer. |
100 | //! Must be call if the Window attached to the view |
101 | //! has been Iconified . |
6a24c6de |
102 | Standard_EXPORT void SetViewOff (const Handle(V3d_View)& theView); |
42cf5bc1 |
103 | |
104 | //! Deprecated, Redraw() should be used instead. |
6a24c6de |
105 | void Update() { Redraw(); } |
106 | |
42cf5bc1 |
107 | //! Redraws all the views of the Viewer even if no |
108 | //! modification has taken place. Must be called if |
109 | //! all the views of the Viewer are exposed, as for |
110 | //! example in a global DeIconification. |
111 | Standard_EXPORT void Redraw() const; |
112 | |
113 | //! Updates layer of immediate presentations. |
114 | Standard_EXPORT void RedrawImmediate() const; |
115 | |
116 | //! Invalidates viewer content but does not redraw it. |
117 | Standard_EXPORT void Invalidate() const; |
118 | |
119 | //! Suppresses the Viewer. |
120 | Standard_EXPORT void Remove(); |
6a24c6de |
121 | |
122 | //! Return Graphic Driver instance. |
123 | const Handle(Graphic3d_GraphicDriver)& Driver() const { return myDriver; } |
124 | |
125 | //! Returns the structure manager associated to this viewer. |
126 | Handle(Graphic3d_StructureManager) StructureManager() const { return myStructureManager; } |
127 | |
128 | //! Return default Rendering Parameters. |
129 | //! By default these parameters are set in a new V3d_View. |
130 | const Graphic3d_RenderingParams& DefaultRenderingParams() const { return myDefaultRenderingParams; } |
131 | |
132 | //! Set default Rendering Parameters. |
133 | void SetDefaultRenderingParams (const Graphic3d_RenderingParams& theParams) { myDefaultRenderingParams = theParams; } |
134 | |
42cf5bc1 |
135 | //! Defines the default background colour of views |
136 | //! attached to the viewer by supplying the color object |
6a24c6de |
137 | void SetDefaultBackgroundColor (const Quantity_Color& theColor) { myBackground.SetColor (theColor); } |
138 | |
139 | //! Returns the gradient background of the view. |
140 | const Aspect_GradientBackground& GetGradientBackground() const { return myGradientBackground; } |
42cf5bc1 |
141 | |
142 | //! Defines the default gradient background colours of views |
143 | //! attached to the viewer by supplying the colour objects |
6a24c6de |
144 | void SetDefaultBgGradientColors (const Quantity_Color& theColor1, |
145 | const Quantity_Color& theColor2, |
146 | const Aspect_GradientFillMethod theFillStyle = Aspect_GFM_HOR) |
147 | { |
148 | myGradientBackground.SetColors (theColor1, theColor2, theFillStyle); |
149 | } |
150 | |
151 | //! Returns the default size of the view. |
152 | Standard_Real DefaultViewSize() const { return myViewSize; } |
153 | |
154 | //! Gives a default size for the creation of views of the viewer. |
155 | Standard_EXPORT void SetDefaultViewSize (const Standard_Real theSize); |
156 | |
157 | //! Returns the default Projection. |
158 | V3d_TypeOfOrientation DefaultViewProj() const { return myViewProj; } |
159 | |
160 | //! Sets the default projection for creating views in the viewer. |
161 | void SetDefaultViewProj (const V3d_TypeOfOrientation theOrientation) { myViewProj = theOrientation; } |
162 | |
163 | //! Returns the default type of Visualization. |
164 | V3d_TypeOfVisualization DefaultVisualization() const { return myVisualization; } |
165 | |
166 | //! Gives the default visualization mode. |
167 | void SetDefaultVisualization (const V3d_TypeOfVisualization theType) { myVisualization = theType; } |
168 | |
169 | //! Returns the default type of Shading |
dc89236f |
170 | Graphic3d_TypeOfShadingModel DefaultShadingModel() const { return myShadingModel; } |
c357e426 |
171 | |
42cf5bc1 |
172 | //! Gives the default type of SHADING. |
dc89236f |
173 | void SetDefaultShadingModel (const Graphic3d_TypeOfShadingModel theType) { myShadingModel = theType; } |
6a24c6de |
174 | |
9e04ccdc |
175 | //! Returns the default type of View (orthographic or perspective projection) to be returned by CreateView() method. |
176 | V3d_TypeOfView DefaultTypeOfView() const { return myDefaultTypeOfView; } |
177 | |
178 | //! Set the default type of View (orthographic or perspective projection) to be returned by CreateView() method. |
6a24c6de |
179 | void SetDefaultTypeOfView (const V3d_TypeOfView theType) { myDefaultTypeOfView = theType; } |
180 | |
181 | //! Returns the default background colour object. |
182 | Quantity_Color DefaultBackgroundColor() const { return myBackground.Color(); } |
183 | |
184 | //! Returns the gradient background colour objects of the view. |
185 | void DefaultBgGradientColors (Quantity_Color& theColor1, Quantity_Color& theColor2) const { myGradientBackground.Colors (theColor1, theColor2); } |
186 | |
187 | //! Return all Z layer ids in sequence ordered by overlay level from lowest layer to highest ( foreground ). |
188 | //! The first layer ID in sequence is the default layer that can't be removed. |
189 | Standard_EXPORT void GetAllZLayers (TColStd_SequenceOfInteger& theLayerSeq) const; |
190 | |
191 | //! Add a new top-level Z layer to all managed views and get its ID as <theLayerId> value. |
192 | //! The Z layers are controlled entirely by viewer, it is not possible to add a layer to a particular view. |
193 | //! The method returns Standard_False if the layer can not be created. |
194 | //! The layer mechanism allows to display structures in higher layers in overlay of structures in lower layers. |
8f138407 |
195 | Standard_EXPORT Standard_Boolean AddZLayer (Graphic3d_ZLayerId& theLayerId); |
6a24c6de |
196 | |
197 | //! Remove Z layer with ID <theLayerId>. |
198 | //! Method returns Standard_False if the layer can not be removed or doesn't exists. |
199 | //! By default, there are always default bottom-level layer that can't be removed. |
8f138407 |
200 | Standard_EXPORT Standard_Boolean RemoveZLayer (const Graphic3d_ZLayerId theLayerId); |
6a24c6de |
201 | |
202 | //! Returns the settings of a single Z layer. |
8f138407 |
203 | Standard_EXPORT Graphic3d_ZLayerSettings ZLayerSettings (const Graphic3d_ZLayerId theLayerId); |
6a24c6de |
204 | |
205 | //! Sets the settings for a single Z layer. |
8f138407 |
206 | Standard_EXPORT void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId, const Graphic3d_ZLayerSettings& theSettings); |
6a24c6de |
207 | |
208 | public: |
209 | |
210 | //! Return an iterator for active views. |
211 | V3d_ListOfViewIterator ActiveViewIterator() const { return V3d_ListOfViewIterator (myActiveViews); } |
212 | |
213 | //! Initializes an internal iterator on the active views. |
214 | void InitActiveViews() { myActiveViewsIterator.Initialize (myActiveViews); } |
215 | |
216 | //! Returns true if there are more active view(s) to return. |
217 | Standard_Boolean MoreActiveViews() const { return myActiveViewsIterator.More(); } |
218 | |
219 | //! Go to the next active view (if there is not, ActiveView will raise an exception) |
220 | void NextActiveViews() { if (!myActiveViews.IsEmpty()) myActiveViewsIterator.Next(); } |
42cf5bc1 |
221 | |
6a24c6de |
222 | const Handle(V3d_View)& ActiveView() const { return myActiveViewsIterator.Value(); } |
42cf5bc1 |
223 | |
6a24c6de |
224 | //! returns true if there is only one active view. |
225 | Standard_Boolean LastActiveView() const { return myActiveViews.Extent() == 1; } |
226 | |
227 | public: |
228 | |
229 | //! Return an iterator for defined views. |
230 | V3d_ListOfViewIterator DefinedViewIterator() const { return V3d_ListOfViewIterator (myDefinedViews); } |
231 | |
232 | //! Initializes an internal iterator on the Defined views. |
233 | void InitDefinedViews() { myDefinedViewsIterator.Initialize (myDefinedViews); } |
234 | |
235 | //! returns true if there are more Defined view(s) to return. |
236 | Standard_Boolean MoreDefinedViews() const { return myDefinedViewsIterator.More(); } |
237 | |
238 | //! Go to the next Defined view (if there is not, DefinedView will raise an exception) |
239 | void NextDefinedViews() { if (!myDefinedViews.IsEmpty()) myDefinedViewsIterator.Next(); } |
240 | |
241 | const Handle(V3d_View)& DefinedView() const { return myDefinedViewsIterator.Value(); } |
242 | |
243 | public: //! @name lights management |
244 | |
245 | //! Defines default lights: |
246 | //! positional-light 0.3 0. 0. |
247 | //! directional-light V3d_XnegYposZpos |
248 | //! directional-light V3d_XnegYneg |
249 | //! ambient-light |
250 | Standard_EXPORT void SetDefaultLights(); |
251 | |
42cf5bc1 |
252 | //! Activates MyLight in the viewer. |
6a24c6de |
253 | Standard_EXPORT void SetLightOn (const Handle(V3d_Light)& theLight); |
42cf5bc1 |
254 | |
255 | //! Activates all the lights defined in this viewer. |
256 | Standard_EXPORT void SetLightOn(); |
257 | |
c357e426 |
258 | //! Deactivates MyLight in this viewer. |
6a24c6de |
259 | Standard_EXPORT void SetLightOff (const Handle(V3d_Light)& theLight); |
42cf5bc1 |
260 | |
261 | //! Deactivate all the Lights defined in this viewer. |
262 | Standard_EXPORT void SetLightOff(); |
992ed6b3 |
263 | |
264 | //! Adds Light in Sequence Of Lights. |
265 | Standard_EXPORT void AddLight (const Handle(V3d_Light)& theLight); |
266 | |
42cf5bc1 |
267 | //! Delete Light in Sequence Of Lights. |
6a24c6de |
268 | Standard_EXPORT void DelLight (const Handle(V3d_Light)& theLight); |
42cf5bc1 |
269 | |
6a24c6de |
270 | //! Updates the lights of all the views of a viewer. |
271 | Standard_EXPORT void UpdateLights(); |
272 | |
42cf5bc1 |
273 | Standard_EXPORT Standard_Boolean IsGlobalLight (const Handle(V3d_Light)& TheLight) const; |
6a24c6de |
274 | |
275 | //! Return an iterator for defined lights. |
276 | V3d_ListOfLightIterator ActiveLightIterator() const { return V3d_ListOfLightIterator (myActiveLights); } |
277 | |
278 | //! Initializes an internal iteratator on the active Lights. |
279 | void InitActiveLights() { myActiveLightsIterator.Initialize (myActiveLights); } |
280 | |
281 | //! returns true if there are more active Light(s) to return. |
282 | Standard_Boolean MoreActiveLights() const { return myActiveLightsIterator.More(); } |
283 | |
284 | //! Go to the next active Light (if there is not, ActiveLight() will raise an exception) |
285 | void NextActiveLights() { myActiveLightsIterator.Next(); } |
286 | |
287 | const Handle(V3d_Light)& ActiveLight() const { return myActiveLightsIterator.Value(); } |
288 | |
289 | public: |
290 | |
291 | //! Return an iterator for defined lights. |
292 | V3d_ListOfLightIterator DefinedLightIterator() const { return V3d_ListOfLightIterator (myDefinedLights); } |
293 | |
294 | //! Initializes an internal iterattor on the Defined Lights. |
295 | void InitDefinedLights() { myDefinedLightsIterator.Initialize (myDefinedLights); } |
42cf5bc1 |
296 | |
6a24c6de |
297 | //! Returns true if there are more Defined Light(s) to return. |
298 | Standard_Boolean MoreDefinedLights() const { return myDefinedLightsIterator.More(); } |
299 | |
300 | //! Go to the next Defined Light (if there is not, DefinedLight() will raise an exception) |
301 | void NextDefinedLights() { if (!myDefinedLights.IsEmpty()) myDefinedLightsIterator.Next(); } |
302 | |
303 | const Handle(V3d_Light)& DefinedLight() const { return myDefinedLightsIterator.Value(); } |
304 | |
305 | public: //! @name objects management |
306 | |
307 | //! Erase all Objects in All the views. |
308 | Standard_EXPORT void Erase() const; |
309 | |
310 | //! UnHighlight all Objects in All the views. |
311 | Standard_EXPORT void UnHighlight() const; |
312 | |
313 | public: |
314 | |
42cf5bc1 |
315 | //! returns true if the computed mode can be used. |
6a24c6de |
316 | Standard_Boolean ComputedMode() const { return myComputedMode; } |
317 | |
318 | //! Set if the computed mode can be used. |
319 | void SetComputedMode (const Standard_Boolean theMode) { myComputedMode = theMode; } |
320 | |
42cf5bc1 |
321 | //! returns true if by default the computed mode must be used. |
6a24c6de |
322 | Standard_Boolean DefaultComputedMode() const { return myDefaultComputedMode; } |
323 | |
324 | //! Set if by default the computed mode must be used. |
325 | void SetDefaultComputedMode (const Standard_Boolean theMode) { myDefaultComputedMode = theMode; } |
326 | |
327 | public: //! @name privileged plane management |
328 | |
67b3d2a8 |
329 | const gp_Ax3& PrivilegedPlane() const { return myPrivilegedPlane; } |
6a24c6de |
330 | |
331 | Standard_EXPORT void SetPrivilegedPlane (const gp_Ax3& thePlane); |
332 | |
ee2be2a8 |
333 | Standard_EXPORT void DisplayPrivilegedPlane (const Standard_Boolean theOnOff, const Standard_Real theSize = 1); |
6a24c6de |
334 | |
335 | public: //! @name grid management |
336 | |
42cf5bc1 |
337 | //! Activates the grid in all views of <me>. |
338 | Standard_EXPORT void ActivateGrid (const Aspect_GridType aGridType, const Aspect_GridDrawMode aGridDrawMode); |
339 | |
340 | //! Deactivates the grid in all views of <me>. |
341 | Standard_EXPORT void DeactivateGrid(); |
342 | |
343 | //! Show/Don't show grid echo to the hit point. |
344 | //! If TRUE,the grid echo will be shown at ConvertToGrid() time. |
345 | Standard_EXPORT void SetGridEcho (const Standard_Boolean showGrid = Standard_True); |
346 | |
347 | //! Show grid echo <aMarker> to the hit point. |
348 | //! Warning: When the grid echo marker is not set, |
349 | //! a default marker is build with the attributes: |
350 | //! marker type : Aspect_TOM_STAR |
351 | //! marker color : Quantity_NOC_GRAY90 |
352 | //! marker size : 3.0 |
353 | Standard_EXPORT void SetGridEcho (const Handle(Graphic3d_AspectMarker3d)& aMarker); |
354 | |
67b3d2a8 |
355 | //! Returns TRUE when grid echo must be displayed at hit point. |
356 | Standard_Boolean GridEcho() const { return myGridEcho; } |
42cf5bc1 |
357 | |
358 | //! Returns Standard_True if a grid is activated in <me>. |
359 | Standard_EXPORT Standard_Boolean IsActive() const; |
360 | |
361 | //! Returns the defined grid in <me>. |
362 | Standard_EXPORT Handle(Aspect_Grid) Grid() const; |
67b3d2a8 |
363 | |
42cf5bc1 |
364 | //! Returns the current grid type defined in <me>. |
67b3d2a8 |
365 | Aspect_GridType GridType() const { return myGridType; } |
42cf5bc1 |
366 | |
367 | //! Returns the current grid draw mode defined in <me>. |
368 | Standard_EXPORT Aspect_GridDrawMode GridDrawMode() const; |
369 | |
370 | //! Returns the definition of the rectangular grid. |
ee2be2a8 |
371 | Standard_EXPORT void RectangularGridValues (Standard_Real& XOrigin, Standard_Real& YOrigin, Standard_Real& XStep, Standard_Real& YStep, Standard_Real& RotationAngle) const; |
42cf5bc1 |
372 | |
373 | //! Sets the definition of the rectangular grid. |
374 | //! <XOrigin>, <YOrigin> defines the origin of the grid. |
375 | //! <XStep> defines the interval between 2 vertical lines. |
376 | //! <YStep> defines the interval between 2 horizontal lines. |
377 | //! <RotationAngle> defines the rotation angle of the grid. |
ee2be2a8 |
378 | Standard_EXPORT void SetRectangularGridValues (const Standard_Real XOrigin, const Standard_Real YOrigin, const Standard_Real XStep, const Standard_Real YStep, const Standard_Real RotationAngle); |
42cf5bc1 |
379 | |
380 | //! Returns the definition of the circular grid. |
ee2be2a8 |
381 | Standard_EXPORT void CircularGridValues (Standard_Real& XOrigin, Standard_Real& YOrigin, Standard_Real& RadiusStep, Standard_Integer& DivisionNumber, Standard_Real& RotationAngle) const; |
42cf5bc1 |
382 | |
383 | //! Sets the definition of the circular grid. |
384 | //! <XOrigin>, <YOrigin> defines the origin of the grid. |
385 | //! <RadiusStep> defines the interval between 2 circles. |
386 | //! <DivisionNumber> defines the section number of one half circle. |
387 | //! <RotationAngle> defines the rotation angle of the grid. |
ee2be2a8 |
388 | Standard_EXPORT void SetCircularGridValues (const Standard_Real XOrigin, const Standard_Real YOrigin, const Standard_Real RadiusStep, const Standard_Integer DivisionNumber, const Standard_Real RotationAngle); |
42cf5bc1 |
389 | |
390 | //! Returns the location and the size of the grid. |
ee2be2a8 |
391 | Standard_EXPORT void CircularGridGraphicValues (Standard_Real& Radius, Standard_Real& OffSet) const; |
42cf5bc1 |
392 | |
393 | //! Sets the location and the size of the grid. |
394 | //! <XSize> defines the width of the grid. |
395 | //! <YSize> defines the height of the grid. |
396 | //! <OffSet> defines the displacement along the plane normal. |
ee2be2a8 |
397 | Standard_EXPORT void SetCircularGridGraphicValues (const Standard_Real Radius, const Standard_Real OffSet); |
42cf5bc1 |
398 | |
399 | //! Returns the location and the size of the grid. |
ee2be2a8 |
400 | Standard_EXPORT void RectangularGridGraphicValues (Standard_Real& XSize, Standard_Real& YSize, Standard_Real& OffSet) const; |
42cf5bc1 |
401 | |
402 | //! Sets the location and the size of the grid. |
403 | //! <XSize> defines the width of the grid. |
404 | //! <YSize> defines the height of the grid. |
405 | //! <OffSet> defines the displacement along the plane normal. |
ee2be2a8 |
406 | Standard_EXPORT void SetRectangularGridGraphicValues (const Standard_Real XSize, const Standard_Real YSize, const Standard_Real OffSet); |
42cf5bc1 |
407 | |
42cf5bc1 |
408 | //! Display grid echo at requested point in the view. |
409 | Standard_EXPORT void ShowGridEcho (const Handle(V3d_View)& theView, const Graphic3d_Vertex& thePoint); |
42cf5bc1 |
410 | |
411 | //! Temporarly hide grid echo. |
412 | Standard_EXPORT void HideGridEcho (const Handle(V3d_View)& theView); |
c357e426 |
413 | |
6a24c6de |
414 | public: //! @name deprecated methods |
415 | |
416 | Standard_DEPRECATED("This constructor is deprecated") |
417 | Standard_EXPORT V3d_Viewer (const Handle(Graphic3d_GraphicDriver)& theDriver, |
418 | const Standard_ExtString theName, |
419 | const Standard_CString theDomain = "", |
ee2be2a8 |
420 | const Standard_Real theViewSize = 1000.0, |
6a24c6de |
421 | const V3d_TypeOfOrientation theViewProj = V3d_XposYnegZpos, |
87432b82 |
422 | const Quantity_Color& theViewBackground = Quantity_NOC_GRAY30, |
6a24c6de |
423 | const V3d_TypeOfVisualization theVisualization = V3d_ZBUFFER, |
dc89236f |
424 | const Graphic3d_TypeOfShadingModel theShadingModel = Graphic3d_TOSM_VERTEX, |
6a24c6de |
425 | const Standard_Boolean theComputedMode = Standard_True, |
426 | const Standard_Boolean theDefaultComputedMode = Standard_True); |
42cf5bc1 |
427 | |
6a24c6de |
428 | //! Defines the default base colour of views attached |
429 | //! to the Viewer by supplying the type of colour |
430 | //! definition and the three component values. |
431 | Standard_DEPRECATED("This method is deprecated - SetDefaultBackgroundColor() taking Quantity_Color should be used instead") |
432 | void SetDefaultBackgroundColor (const Quantity_TypeOfColor theType, |
ee2be2a8 |
433 | const Standard_Real theV1, |
434 | const Standard_Real theV2, |
435 | const Standard_Real theV3) |
6a24c6de |
436 | { |
437 | Standard_Real aV1 = theV1; |
438 | Standard_Real aV2 = theV2; |
439 | Standard_Real aV3 = theV3; |
440 | if (aV1 < 0.0) aV1 = 0.0; else if (aV1 > 1.0) aV1 = 1.0; |
441 | if (aV2 < 0.0) aV2 = 0.0; else if (aV2 > 1.0) aV2 = 1.0; |
442 | if (aV3 < 0.0) aV3 = 0.0; else if (aV3 > 1.0) aV3 = 1.0; |
443 | SetDefaultBackgroundColor (Quantity_Color (aV1, aV2, aV3, theType)); |
444 | } |
445 | |
446 | Standard_DEPRECATED("This method is deprecated - DefaultBackgroundColor() without arguments should be used instead") |
ee2be2a8 |
447 | void DefaultBackgroundColor (const Quantity_TypeOfColor theType, Standard_Real& theV1, Standard_Real& theV2, Standard_Real& theV3) const |
6a24c6de |
448 | { |
449 | Quantity_Color aColor = DefaultBackgroundColor(); |
450 | aColor.Values (theV1, theV2, theV3, theType) ; |
451 | } |
42cf5bc1 |
452 | |
42cf5bc1 |
453 | private: |
454 | |
42cf5bc1 |
455 | //! Returns the default background colour. |
6a24c6de |
456 | const Aspect_Background& GetBackgroundColor() const { return myBackground; } |
457 | |
42cf5bc1 |
458 | //! Adds View in Sequence Of Views. |
6a24c6de |
459 | Standard_EXPORT void AddView (const Handle(V3d_View)& theView); |
42cf5bc1 |
460 | |
461 | //! Delete View in Sequence Of Views. |
6a24c6de |
462 | Standard_EXPORT void DelView (const Handle(V3d_View)& theView); |
42cf5bc1 |
463 | |
c357e426 |
464 | private: |
465 | |
42cf5bc1 |
466 | Handle(Graphic3d_GraphicDriver) myDriver; |
c357e426 |
467 | Handle(Graphic3d_StructureManager) myStructureManager; |
6a24c6de |
468 | TColStd_MapOfInteger myLayerIds; |
469 | Aspect_GenId myZLayerGenId; |
470 | |
471 | V3d_ListOfView myDefinedViews; |
472 | V3d_ListOfView myActiveViews; |
473 | V3d_ListOfLight myDefinedLights; |
474 | V3d_ListOfLight myActiveLights; |
475 | |
476 | Aspect_Background myBackground; |
477 | Aspect_GradientBackground myGradientBackground; |
478 | Standard_Real myViewSize; |
479 | V3d_TypeOfOrientation myViewProj; |
480 | V3d_TypeOfVisualization myVisualization; |
dc89236f |
481 | Graphic3d_TypeOfShadingModel myShadingModel; |
6a24c6de |
482 | V3d_TypeOfView myDefaultTypeOfView; |
832ae82d |
483 | Graphic3d_RenderingParams myDefaultRenderingParams; |
6a24c6de |
484 | |
485 | V3d_ListOfView::Iterator myActiveViewsIterator; |
486 | V3d_ListOfView::Iterator myDefinedViewsIterator; |
487 | V3d_ListOfLight::Iterator myActiveLightsIterator; |
488 | V3d_ListOfLight::Iterator myDefinedLightsIterator; |
489 | |
42cf5bc1 |
490 | Standard_Boolean myComputedMode; |
491 | Standard_Boolean myDefaultComputedMode; |
6a24c6de |
492 | |
42cf5bc1 |
493 | gp_Ax3 myPrivilegedPlane; |
494 | Handle(Graphic3d_Structure) myPlaneStructure; |
495 | Standard_Boolean myDisplayPlane; |
ee2be2a8 |
496 | Standard_Real myDisplayPlaneLength; |
6a24c6de |
497 | |
42cf5bc1 |
498 | Handle(V3d_RectangularGrid) myRGrid; |
499 | Handle(V3d_CircularGrid) myCGrid; |
500 | Aspect_GridType myGridType; |
501 | Standard_Boolean myGridEcho; |
502 | Handle(Graphic3d_Structure) myGridEchoStructure; |
503 | Handle(Graphic3d_Group) myGridEchoGroup; |
504 | Handle(Graphic3d_AspectMarker3d) myGridEchoAspect; |
505 | Graphic3d_Vertex myGridEchoLastVert; |
6a24c6de |
506 | |
42cf5bc1 |
507 | }; |
508 | |
6a24c6de |
509 | DEFINE_STANDARD_HANDLE(V3d_Viewer, Standard_Transient) |
510 | |
42cf5bc1 |
511 | #endif // _V3d_Viewer_HeaderFile |