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 
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 #include <gp_Ax3.hxx>
27 #include <Graphic3d_StructureManager.hxx>
28 #include <Graphic3d_Vertex.hxx>
29 #include <Graphic3d_ZLayerSettings.hxx>
30 #include <TColStd_MapOfInteger.hxx>
31 #include <TColStd_ListIteratorOfListOfTransient.hxx>
32 #include <TColStd_SequenceOfInteger.hxx>
33 #include <TCollection_AsciiString.hxx>
34 #include <TCollection_ExtendedString.hxx>
35 #include <V3d_ListOfLight.hxx>
36 #include <V3d_ListOfView.hxx>
37 #include <V3d_TypeOfOrientation.hxx>
38 #include <V3d_TypeOfView.hxx>
39 #include <V3d_TypeOfVisualization.hxx>
40 #include <Quantity_Color.hxx>
41 
42 class Aspect_Grid;
43 class Graphic3d_AspectMarker3d;
44 class Graphic3d_GraphicDriver;
45 class Graphic3d_Group;
46 class Graphic3d_Structure;
47 class V3d_BadValue;
48 class V3d_CircularGrid;
49 class V3d_RectangularGrid;
50 class V3d_View;
51 class Quantity_Color;
52 
53 //! Defines services on Viewer type objects.
54 //! The methods of this class allow editing and
55 //! interrogation of the parameters linked to the viewer
56 //! its friend classes (View,light,plane).
57 class V3d_Viewer : public Standard_Transient
58 {
59   friend class V3d_View;
60   DEFINE_STANDARD_RTTIEXT(V3d_Viewer, Standard_Transient)
61 public:
62 
63   //! Create a Viewer with the given graphic driver and with default parameters:
64   //! - View orientation: V3d_XposYnegZpos
65   //! - View background: Quantity_NOC_GRAY30
66   //! - Shading model: V3d_GOURAUD
67   Standard_EXPORT V3d_Viewer (const Handle(Graphic3d_GraphicDriver)& theDriver);
68 
69   //! Returns True if One View more can be defined in this Viewer.
70   Standard_EXPORT Standard_Boolean IfMoreViews() const;
71 
72   //! Creates a view in the viewer according to its default parameters.
73   Standard_EXPORT Handle(V3d_View) CreateView();
74 
75   //! Activates all of the views of a viewer attached to a window.
76   Standard_EXPORT void SetViewOn();
77 
78   //! Activates a particular view in the Viewer.
79   //! Must be call if the Window attached to the view has been Deiconified.
80   Standard_EXPORT void SetViewOn (const Handle(V3d_View)& theView);
81 
82   //! Deactivates all the views of a Viewer
83   //! attached to a window.
84   Standard_EXPORT void SetViewOff();
85 
86   //! Deactivates a particular view in the Viewer.
87   //! Must be call if the Window attached to the view
88   //! has been Iconified .
89   Standard_EXPORT void SetViewOff (const Handle(V3d_View)& theView);
90 
91   //! Deprecated, Redraw() should be used instead.
Update()92   void Update() { Redraw(); }
93 
94   //! Redraws all the views of the Viewer even if no
95   //! modification has taken place. Must be called if
96   //! all the views of the Viewer are exposed, as for
97   //! example in a global DeIconification.
98   Standard_EXPORT void Redraw() const;
99 
100   //! Updates layer of immediate presentations.
101   Standard_EXPORT void RedrawImmediate() const;
102 
103   //! Invalidates viewer content but does not redraw it.
104   Standard_EXPORT void Invalidate() const;
105 
106   //! Suppresses the Viewer.
107   Standard_EXPORT void Remove();
108 
109   //! Return Graphic Driver instance.
Handle(Graphic3d_GraphicDriver)110   const Handle(Graphic3d_GraphicDriver)& Driver() const { return myDriver; }
111 
112   //! Returns the structure manager associated to this viewer.
StructureManager() const113   Handle(Graphic3d_StructureManager) StructureManager() const { return myStructureManager; }
114 
115   //! Return default Rendering Parameters.
116   //! By default these parameters are set in a new V3d_View.
DefaultRenderingParams() const117   const Graphic3d_RenderingParams& DefaultRenderingParams() const { return myDefaultRenderingParams; }
118 
119   //! Set default Rendering Parameters.
SetDefaultRenderingParams(const Graphic3d_RenderingParams & theParams)120   void SetDefaultRenderingParams (const Graphic3d_RenderingParams& theParams) { myDefaultRenderingParams = theParams; }
121 
122   //! Defines the default background colour of views
123   //! attached to the viewer by supplying the color object
SetDefaultBackgroundColor(const Quantity_Color & theColor)124   void SetDefaultBackgroundColor (const Quantity_Color& theColor) { myBackground.SetColor (theColor); }
125 
126   //! Returns the gradient background of the view.
GetGradientBackground() const127   const Aspect_GradientBackground& GetGradientBackground() const { return myGradientBackground; }
128 
129   //! Defines the default gradient background colours of views
130   //! attached to the viewer by supplying the colour objects
SetDefaultBgGradientColors(const Quantity_Color & theColor1,const Quantity_Color & theColor2,const Aspect_GradientFillMethod theFillStyle=Aspect_GradientFillMethod_Horizontal)131   void SetDefaultBgGradientColors (const Quantity_Color& theColor1,
132                                    const Quantity_Color& theColor2,
133                                    const Aspect_GradientFillMethod theFillStyle = Aspect_GradientFillMethod_Horizontal)
134   {
135     myGradientBackground.SetColors (theColor1, theColor2, theFillStyle);
136   }
137 
138   //! Returns the default size of the view.
DefaultViewSize() const139   Standard_Real DefaultViewSize() const { return myViewSize; }
140 
141   //! Gives a default size for the creation of views of the viewer.
142   Standard_EXPORT void SetDefaultViewSize (const Standard_Real theSize);
143 
144   //! Returns the default Projection.
DefaultViewProj() const145   V3d_TypeOfOrientation DefaultViewProj() const { return myViewProj; }
146 
147   //! Sets the default projection for creating views in the viewer.
SetDefaultViewProj(const V3d_TypeOfOrientation theOrientation)148   void SetDefaultViewProj (const V3d_TypeOfOrientation theOrientation) { myViewProj = theOrientation; }
149 
150   //! Returns the default type of Visualization.
DefaultVisualization() const151   V3d_TypeOfVisualization DefaultVisualization() const { return myVisualization; }
152 
153   //! Gives the default visualization mode.
SetDefaultVisualization(const V3d_TypeOfVisualization theType)154   void SetDefaultVisualization (const V3d_TypeOfVisualization theType) { myVisualization = theType; }
155 
156   //! Returns the default type of Shading; Graphic3d_TypeOfShadingModel_Phong by default.
DefaultShadingModel() const157   Graphic3d_TypeOfShadingModel DefaultShadingModel() const { return myDefaultRenderingParams.ShadingModel; }
158 
159   //! Gives the default type of SHADING.
SetDefaultShadingModel(const Graphic3d_TypeOfShadingModel theType)160   void SetDefaultShadingModel (const Graphic3d_TypeOfShadingModel theType) { myDefaultRenderingParams.ShadingModel = theType; }
161 
162   //! Returns the default type of View (orthographic or perspective projection) to be returned by CreateView() method.
DefaultTypeOfView() const163   V3d_TypeOfView DefaultTypeOfView() const { return myDefaultTypeOfView; }
164 
165   //! Set the default type of View (orthographic or perspective projection) to be returned by CreateView() method.
SetDefaultTypeOfView(const V3d_TypeOfView theType)166   void SetDefaultTypeOfView (const V3d_TypeOfView theType) { myDefaultTypeOfView = theType; }
167 
168   //! Returns the default background colour object.
DefaultBackgroundColor() const169   Quantity_Color DefaultBackgroundColor() const { return myBackground.Color(); }
170 
171   //! Returns the gradient background colour objects of the view.
DefaultBgGradientColors(Quantity_Color & theColor1,Quantity_Color & theColor2) const172   void DefaultBgGradientColors (Quantity_Color& theColor1, Quantity_Color& theColor2) const { myGradientBackground.Colors (theColor1, theColor2); }
173 
174   //! Return all Z layer ids in sequence ordered by overlay level from lowest layer to highest ( foreground ).
175   //! The first layer ID in sequence is the default layer that can't be removed.
176   Standard_EXPORT void GetAllZLayers (TColStd_SequenceOfInteger& theLayerSeq) const;
177 
178   //! Add a new top-level Z layer to all managed views and get its ID as <theLayerId> value.
179   //! The Z layers are controlled entirely by viewer, it is not possible to add a layer to a particular view.
180   //! Custom layers will be inserted before Graphic3d_ZLayerId_Top (e.g. between Graphic3d_ZLayerId_Default and before Graphic3d_ZLayerId_Top).
181   //! @param theLayerId [out] id of created layer
182   //! @param theSettings [in] new layer settings
183   //! @return FALSE if the layer can not be created
AddZLayer(Graphic3d_ZLayerId & theLayerId,const Graphic3d_ZLayerSettings & theSettings=Graphic3d_ZLayerSettings ())184   Standard_Boolean AddZLayer (Graphic3d_ZLayerId& theLayerId,
185                               const Graphic3d_ZLayerSettings& theSettings = Graphic3d_ZLayerSettings())
186   {
187     return InsertLayerBefore (theLayerId, theSettings, Graphic3d_ZLayerId_Top);
188   }
189 
190   //! Add a new top-level Z layer to all managed views and get its ID as <theLayerId> value.
191   //! The Z layers are controlled entirely by viewer, it is not possible to add a layer to a particular view.
192   //! Layer rendering order is defined by its position in list (altered by theLayerAfter)
193   //! and IsImmediate() flag (all layers with IsImmediate() flag are drawn afterwards);
194   //! @param theNewLayerId [out] id of created layer; layer id is arbitrary and does not depend on layer position in the list
195   //! @param theSettings    [in] new layer settings
196   //! @param theLayerAfter  [in] id of layer to append new layer before
197   //! @return FALSE if the layer can not be created
198   Standard_EXPORT Standard_Boolean InsertLayerBefore (Graphic3d_ZLayerId& theNewLayerId,
199                                                       const Graphic3d_ZLayerSettings& theSettings,
200                                                       const Graphic3d_ZLayerId theLayerAfter);
201 
202   //! Add a new top-level Z layer to all managed views and get its ID as <theLayerId> value.
203   //! The Z layers are controlled entirely by viewer, it is not possible to add a layer to a particular view.
204   //! Layer rendering order is defined by its position in list (altered by theLayerAfter)
205   //! and IsImmediate() flag (all layers with IsImmediate() flag are drawn afterwards);
206   //! @param theNewLayerId [out] id of created layer; layer id is arbitrary and does not depend on layer position in the list
207   //! @param theSettings    [in] new layer settings
208   //! @param theLayerBefore [in] id of layer to append new layer after
209   //! @return FALSE if the layer can not be created
210   Standard_EXPORT Standard_Boolean InsertLayerAfter (Graphic3d_ZLayerId& theNewLayerId,
211                                                      const Graphic3d_ZLayerSettings& theSettings,
212                                                      const Graphic3d_ZLayerId theLayerBefore);
213 
214   //! Remove Z layer with ID <theLayerId>.
215   //! Method returns Standard_False if the layer can not be removed or doesn't exists.
216   //! By default, there are always default bottom-level layer that can't be removed.
217   Standard_EXPORT Standard_Boolean RemoveZLayer (const Graphic3d_ZLayerId theLayerId);
218 
219   //! Returns the settings of a single Z layer.
220   Standard_EXPORT const Graphic3d_ZLayerSettings& ZLayerSettings (const Graphic3d_ZLayerId theLayerId) const;
221 
222   //! Sets the settings for a single Z layer.
223   Standard_EXPORT void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId, const Graphic3d_ZLayerSettings& theSettings);
224 
225 public:
226 
227   //! Return a list of active views.
ActiveViews() const228   const V3d_ListOfView& ActiveViews() const { return myActiveViews; }
229 
230   //! Return an iterator for active views.
ActiveViewIterator() const231   V3d_ListOfViewIterator ActiveViewIterator() const { return V3d_ListOfViewIterator (myActiveViews); }
232 
233   //! returns true if there is only one active view.
LastActiveView() const234   Standard_Boolean LastActiveView() const { return myActiveViews.Extent() == 1; }
235 
236 public:
237 
238   //! Return a list of defined views.
DefinedViews() const239   const V3d_ListOfView& DefinedViews() const { return myDefinedViews; }
240 
241   //! Return an iterator for defined views.
DefinedViewIterator() const242   V3d_ListOfViewIterator DefinedViewIterator() const { return V3d_ListOfViewIterator (myDefinedViews); }
243 
244 public: //! @name lights management
245 
246   //! Defines default lights:
247   //!  positional-light 0.3 0. 0.
248   //!  directional-light V3d_XnegYposZpos
249   //!  directional-light V3d_XnegYneg
250   //!  ambient-light
251   Standard_EXPORT void SetDefaultLights();
252 
253   //! Activates MyLight in the viewer.
254   Standard_EXPORT void SetLightOn (const Handle(V3d_Light)& theLight);
255 
256   //! Activates all the lights defined in this viewer.
257   Standard_EXPORT void SetLightOn();
258 
259   //! Deactivates MyLight in this viewer.
260   Standard_EXPORT void SetLightOff (const Handle(V3d_Light)& theLight);
261 
262   //! Deactivate all the Lights defined in this viewer.
263   Standard_EXPORT void SetLightOff();
264 
265   //! Adds Light in Sequence Of Lights.
266   Standard_EXPORT void AddLight (const Handle(V3d_Light)& theLight);
267 
268   //! Delete Light in Sequence Of Lights.
269   Standard_EXPORT void DelLight (const Handle(V3d_Light)& theLight);
270 
271   //! Updates the lights of all the views of a viewer.
272   Standard_EXPORT void UpdateLights();
273 
274   Standard_EXPORT Standard_Boolean IsGlobalLight (const Handle(V3d_Light)& TheLight) const;
275 
276   //! Return a list of active lights.
ActiveLights() const277   const V3d_ListOfLight& ActiveLights() const { return myActiveLights; }
278 
279   //! Return an iterator for defined lights.
ActiveLightIterator() const280   V3d_ListOfLightIterator ActiveLightIterator() const { return V3d_ListOfLightIterator (myActiveLights); }
281 
282 public:
283 
284   //! Return a list of defined lights.
DefinedLights() const285   const V3d_ListOfLight& DefinedLights() const { return myDefinedLights; }
286 
287   //! Return an iterator for defined lights.
DefinedLightIterator() const288   V3d_ListOfLightIterator DefinedLightIterator() const { return V3d_ListOfLightIterator (myDefinedLights); }
289 
290 public: //! @name objects management
291 
292   //! Erase all Objects in All the views.
293   Standard_EXPORT void Erase() const;
294 
295   //! UnHighlight all Objects in All the views.
296   Standard_EXPORT void UnHighlight() const;
297 
298 public:
299 
300   //! returns true if the computed mode can be used.
ComputedMode() const301   Standard_Boolean ComputedMode() const { return myComputedMode; }
302 
303   //! Set if the computed mode can be used.
SetComputedMode(const Standard_Boolean theMode)304   void SetComputedMode (const Standard_Boolean theMode) { myComputedMode = theMode; }
305 
306   //! returns true if by default the computed mode must be used.
DefaultComputedMode() const307   Standard_Boolean DefaultComputedMode() const { return myDefaultComputedMode; }
308 
309   //! Set if by default the computed mode must be used.
SetDefaultComputedMode(const Standard_Boolean theMode)310   void SetDefaultComputedMode (const Standard_Boolean theMode) { myDefaultComputedMode = theMode; }
311 
312 public: //! @name privileged plane management
313 
PrivilegedPlane() const314   const gp_Ax3& PrivilegedPlane() const { return myPrivilegedPlane; }
315 
316   Standard_EXPORT void SetPrivilegedPlane (const gp_Ax3& thePlane);
317 
318   Standard_EXPORT void DisplayPrivilegedPlane (const Standard_Boolean theOnOff, const Standard_Real theSize = 1);
319 
320 public: //! @name grid management
321 
322   //! Activates the grid in all views of <me>.
323   Standard_EXPORT void ActivateGrid (const Aspect_GridType aGridType, const Aspect_GridDrawMode aGridDrawMode);
324 
325   //! Deactivates the grid in all views of <me>.
326   Standard_EXPORT void DeactivateGrid();
327 
328   //! Show/Don't show grid echo to the hit point.
329   //! If TRUE,the grid echo will be shown at ConvertToGrid() time.
330   Standard_EXPORT void SetGridEcho (const Standard_Boolean showGrid = Standard_True);
331 
332   //! Show grid echo <aMarker> to the hit point.
333   //! Warning: When the grid echo marker is not set,
334   //! a default marker is build with the attributes:
335   //! marker type : Aspect_TOM_STAR
336   //! marker color : Quantity_NOC_GRAY90
337   //! marker size : 3.0
338   Standard_EXPORT void SetGridEcho (const Handle(Graphic3d_AspectMarker3d)& aMarker);
339 
340   //! Returns TRUE when grid echo must be displayed at hit point.
GridEcho() const341   Standard_Boolean GridEcho() const { return myGridEcho; }
342 
343   //! Returns Standard_True if a grid is activated in <me>.
344   Standard_EXPORT Standard_Boolean IsGridActive();
345 
346   //! Returns the defined grid in <me>.
Grid(bool theToCreate=true)347   Handle(Aspect_Grid) Grid (bool theToCreate = true) { return Grid (myGridType, theToCreate); }
348 
349   //! Returns the defined grid in <me>.
350   Standard_EXPORT Handle(Aspect_Grid) Grid (Aspect_GridType theGridType, bool theToCreate = true);
351 
352   //! Returns the current grid type defined in <me>.
GridType() const353   Aspect_GridType GridType() const { return myGridType; }
354 
355   //! Returns the current grid draw mode defined in <me>.
356   Standard_EXPORT Aspect_GridDrawMode GridDrawMode();
357 
358   //! Returns the definition of the rectangular grid.
359   Standard_EXPORT void RectangularGridValues (Standard_Real& theXOrigin, Standard_Real& theYOrigin,
360                                               Standard_Real& theXStep, Standard_Real& theYStep,
361                                               Standard_Real& theRotationAngle);
362 
363   //! Sets the definition of the rectangular grid.
364   //! <XOrigin>, <YOrigin> defines the origin of the grid.
365   //! <XStep> defines the interval between 2 vertical lines.
366   //! <YStep> defines the interval between 2 horizontal lines.
367   //! <RotationAngle> defines the rotation angle of the grid.
368   Standard_EXPORT void SetRectangularGridValues (const Standard_Real XOrigin, const Standard_Real YOrigin, const Standard_Real XStep, const Standard_Real YStep, const Standard_Real RotationAngle);
369 
370   //! Returns the definition of the circular grid.
371   Standard_EXPORT void CircularGridValues (Standard_Real& theXOrigin, Standard_Real& theYOrigin,
372                                            Standard_Real& theRadiusStep,
373                                            Standard_Integer& theDivisionNumber,
374                                            Standard_Real& theRotationAngle);
375 
376   //! Sets the definition of the circular grid.
377   //! <XOrigin>, <YOrigin> defines the origin of the grid.
378   //! <RadiusStep> defines the interval between 2 circles.
379   //! <DivisionNumber> defines the section number of one half circle.
380   //! <RotationAngle> defines the rotation angle of the grid.
381   Standard_EXPORT void SetCircularGridValues (const Standard_Real XOrigin, const Standard_Real YOrigin, const Standard_Real RadiusStep, const Standard_Integer DivisionNumber, const Standard_Real RotationAngle);
382 
383   //! Returns the location and the size of the grid.
384   Standard_EXPORT void CircularGridGraphicValues (Standard_Real& theRadius,
385                                                   Standard_Real& theOffSet);
386 
387   //! Sets the location and the size of the grid.
388   //! <XSize> defines the width of the grid.
389   //! <YSize> defines the height of the grid.
390   //! <OffSet> defines the displacement along the plane normal.
391   Standard_EXPORT void SetCircularGridGraphicValues (const Standard_Real Radius, const Standard_Real OffSet);
392 
393   //! Returns the location and the size of the grid.
394   Standard_EXPORT void RectangularGridGraphicValues (Standard_Real& theXSize, Standard_Real& theYSize,
395                                                      Standard_Real& theOffSet);
396 
397   //! Sets the location and the size of the grid.
398   //! <XSize> defines the width of the grid.
399   //! <YSize> defines the height of the grid.
400   //! <OffSet> defines the displacement along the plane normal.
401   Standard_EXPORT void SetRectangularGridGraphicValues (const Standard_Real XSize, const Standard_Real YSize, const Standard_Real OffSet);
402 
403   //! Display grid echo at requested point in the view.
404   Standard_EXPORT void ShowGridEcho (const Handle(V3d_View)& theView, const Graphic3d_Vertex& thePoint);
405 
406   //! Temporarly hide grid echo.
407   Standard_EXPORT void HideGridEcho (const Handle(V3d_View)& theView);
408 
409 public: //! @name deprecated methods
410 
411   //! Returns Standard_True if a grid is activated in <me>.
412   Standard_DEPRECATED ("Deprecated method - IsGridActive() should be used instead")
IsActive()413   Standard_Boolean IsActive() { return IsGridActive(); }
414 
415   //! Initializes an internal iterator on the active views.
416   Standard_DEPRECATED ("Deprecated method - ActiveViews() should be used instead")
InitActiveViews()417   void InitActiveViews() { myActiveViewsIterator.Initialize (myActiveViews); }
418 
419   //! Returns true if there are more active view(s) to return.
420   Standard_DEPRECATED ("Deprecated method - ActiveViews() should be used instead")
MoreActiveViews() const421   Standard_Boolean MoreActiveViews() const { return myActiveViewsIterator.More(); }
422 
423   //! Go to the next active view (if there is not, ActiveView will raise an exception)
424   Standard_DEPRECATED ("Deprecated method - ActiveViews() should be used instead")
NextActiveViews()425   void NextActiveViews() { if (!myActiveViews.IsEmpty()) myActiveViewsIterator.Next(); }
426 
427   Standard_DEPRECATED ("Deprecated method - ActiveViews() should be used instead")
Handle(V3d_View)428   const Handle(V3d_View)& ActiveView() const { return myActiveViewsIterator.Value(); }
429 
430   //! Initializes an internal iterator on the Defined views.
431   Standard_DEPRECATED ("Deprecated method - DefinedViews() should be used instead")
InitDefinedViews()432   void InitDefinedViews() { myDefinedViewsIterator.Initialize (myDefinedViews); }
433 
434   //! returns true if there are more Defined view(s) to return.
435   Standard_DEPRECATED ("Deprecated method - DefinedViews() should be used instead")
MoreDefinedViews() const436   Standard_Boolean MoreDefinedViews() const { return myDefinedViewsIterator.More(); }
437 
438   //! Go to the next Defined view (if there is not, DefinedView will raise an exception)
439   Standard_DEPRECATED ("Deprecated method - DefinedViews() should be used instead")
NextDefinedViews()440   void NextDefinedViews() { if (!myDefinedViews.IsEmpty()) myDefinedViewsIterator.Next(); }
441 
442   Standard_DEPRECATED ("Deprecated method - DefinedViews() should be used instead")
Handle(V3d_View)443   const Handle(V3d_View)& DefinedView() const { return myDefinedViewsIterator.Value(); }
444 
445   //! Initializes an internal iteratator on the active Lights.
446   Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
InitActiveLights()447   void InitActiveLights() { myActiveLightsIterator.Initialize (myActiveLights); }
448 
449   //! returns true if there are more active Light(s) to return.
450   Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
MoreActiveLights() const451   Standard_Boolean MoreActiveLights() const { return myActiveLightsIterator.More(); }
452 
453   //! Go to the next active Light (if there is not, ActiveLight() will raise an exception)
454   Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
NextActiveLights()455   void NextActiveLights() { myActiveLightsIterator.Next(); }
456 
457   Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
Handle(V3d_Light)458   const Handle(V3d_Light)& ActiveLight() const { return myActiveLightsIterator.Value(); }
459 
460   //! Initializes an internal iterattor on the Defined Lights.
461   Standard_DEPRECATED ("Deprecated method - DefinedLights() should be used instead")
InitDefinedLights()462   void InitDefinedLights() { myDefinedLightsIterator.Initialize (myDefinedLights); }
463 
464   //! Returns true if there are more Defined Light(s) to return.
465   Standard_DEPRECATED ("Deprecated method - DefinedLights() should be used instead")
MoreDefinedLights() const466   Standard_Boolean MoreDefinedLights() const { return myDefinedLightsIterator.More(); }
467 
468   //! Go to the next Defined Light (if there is not, DefinedLight() will raise an exception)
469   Standard_DEPRECATED ("Deprecated method - DefinedLights() should be used instead")
NextDefinedLights()470   void NextDefinedLights() { if (!myDefinedLights.IsEmpty()) myDefinedLightsIterator.Next(); }
471 
472   Standard_DEPRECATED ("Deprecated method - DefinedLights() should be used instead")
Handle(V3d_Light)473   const Handle(V3d_Light)& DefinedLight() const { return myDefinedLightsIterator.Value(); }
474 
475   //! Dumps the content of me into the stream
476   Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
477 
478 private:
479 
480   //! Returns the default background colour.
GetBackgroundColor() const481   const Aspect_Background& GetBackgroundColor() const { return myBackground; }
482 
483   //! Adds View in Sequence Of Views.
484   Standard_EXPORT void AddView (const Handle(V3d_View)& theView);
485 
486   //! Delete View in Sequence Of Views.
487   Standard_EXPORT void DelView (const Handle(V3d_View)& theView);
488 
489 private:
490 
491   Handle(Graphic3d_GraphicDriver) myDriver;
492   Handle(Graphic3d_StructureManager) myStructureManager;
493   TColStd_MapOfInteger myLayerIds;
494   Aspect_GenId myZLayerGenId;
495 
496   V3d_ListOfView  myDefinedViews;
497   V3d_ListOfView  myActiveViews;
498   V3d_ListOfLight myDefinedLights;
499   V3d_ListOfLight myActiveLights;
500 
501   Aspect_Background myBackground;
502   Aspect_GradientBackground myGradientBackground;
503   Standard_Real myViewSize;
504   V3d_TypeOfOrientation myViewProj;
505   V3d_TypeOfVisualization myVisualization;
506   V3d_TypeOfView myDefaultTypeOfView;
507   Graphic3d_RenderingParams myDefaultRenderingParams;
508 
509   V3d_ListOfView::Iterator  myActiveViewsIterator;
510   V3d_ListOfView::Iterator  myDefinedViewsIterator;
511   V3d_ListOfLight::Iterator myActiveLightsIterator;
512   V3d_ListOfLight::Iterator myDefinedLightsIterator;
513 
514   Standard_Boolean myComputedMode;
515   Standard_Boolean myDefaultComputedMode;
516 
517   gp_Ax3 myPrivilegedPlane;
518   Handle(Graphic3d_Structure) myPlaneStructure;
519   Standard_Boolean myDisplayPlane;
520   Standard_Real myDisplayPlaneLength;
521 
522   Handle(V3d_RectangularGrid) myRGrid;
523   Handle(V3d_CircularGrid) myCGrid;
524   Aspect_GridType myGridType;
525   Standard_Boolean myGridEcho;
526   Handle(Graphic3d_Structure) myGridEchoStructure;
527   Handle(Graphic3d_Group) myGridEchoGroup;
528   Handle(Graphic3d_AspectMarker3d) myGridEchoAspect;
529   Graphic3d_Vertex myGridEchoLastVert;
530 
531 };
532 
533 DEFINE_STANDARD_HANDLE(V3d_Viewer, Standard_Transient)
534 
535 #endif // _V3d_Viewer_HeaderFile
536