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