9f162ac9de736cb68697a8c1d1fa49f8b348ecf1
[occt.git] / src / V3d / V3d_View.hxx
1 // Created on: 1992-01-15
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_View_HeaderFile
18 #define _V3d_View_HeaderFile
19
20 #include <Aspect_Background.hxx>
21 #include <Aspect_FillMethod.hxx>
22 #include <Aspect_GradientBackground.hxx>
23 #include <Aspect_GradientFillMethod.hxx>
24 #include <Aspect_Handle.hxx>
25 #include <Aspect_RenderingContext.hxx>
26 #include <Aspect_TypeOfTriedronPosition.hxx>
27
28 #include <Bnd_Box.hxx>
29
30 #include <gp_Ax3.hxx>
31 #include <gp_Dir.hxx>
32 #include <gp_Pnt.hxx>
33
34 #include <Graphic3d_BufferType.hxx>
35 #include <Graphic3d_Camera.hxx>
36 #include <Graphic3d_ClipPlane.hxx>
37 #include <Graphic3d_CView.hxx>
38 #include <Graphic3d_GraduatedTrihedron.hxx>
39 #include <Graphic3d_RenderingParams.hxx>
40 #include <Graphic3d_SequenceOfHClipPlane.hxx>
41 #include <Graphic3d_TypeOfShadingModel.hxx>
42 #include <Graphic3d_Vertex.hxx>
43
44 #include <Image_PixMap.hxx>
45
46 #include <Standard_Transient.hxx>
47
48 #include <Quantity_TypeOfColor.hxx>
49
50 #include <Standard.hxx>
51 #include <Standard_Address.hxx>
52 #include <Standard_Boolean.hxx>
53 #include <Standard_CString.hxx>
54 #include <Standard_Integer.hxx>
55 #include <Standard_Real.hxx>
56 #include <Standard_Type.hxx>
57
58 #include <TColStd_Array2OfReal.hxx>
59 #include <TColStd_ListIteratorOfListOfTransient.hxx>
60
61 #include <V3d_ImageDumpOptions.hxx>
62 #include <V3d_Trihedron.hxx>
63 #include <V3d_TypeOfAxe.hxx>
64
65 #include <V3d_TypeOfBackfacingModel.hxx>
66 #include <V3d_TypeOfOrientation.hxx>
67 #include <V3d_TypeOfView.hxx>
68 #include <V3d_TypeOfVisualization.hxx>
69 #include <V3d_Viewer.hxx>
70 #include <V3d_ViewerPointer.hxx>
71
72 class Aspect_Grid;
73 class Aspect_Window;
74 class Graphic3d_Group;
75 class Graphic3d_Structure;
76 class Graphic3d_TextureEnv;
77 class Standard_MultiplyDefined;
78 class Standard_TypeMismatch;
79 class V3d_BadValue;
80 class V3d_UnMapped;
81
82 class V3d_View;
83 DEFINE_STANDARD_HANDLE(V3d_View, Standard_Transient)
84
85 //! Defines the application object VIEW for the
86 //! VIEWER application.
87 //! The methods of this class allow the editing
88 //! and inquiring the parameters linked to the view.
89 //! Provides a set of services common to all types of view.
90 //! Warning: The default parameters are defined by the class
91 //! Viewer (Example : SetDefaultViewSize()).
92 //! Certain methods are mouse oriented, and it is
93 //! necessary to know the difference between the start and
94 //! the continuation of this gesture in putting the method
95 //! into operation.
96 //! Example : Shifting the eye-view along the screen axes.
97 //!
98 //! View->Move(10.,20.,0.,True)     (Starting motion)
99 //! View->Move(15.,-5.,0.,False)    (Next motion)
100 class V3d_View : public Standard_Transient
101 {
102
103 public:
104
105   //! Initializes the view.
106   Standard_EXPORT V3d_View (const Handle(V3d_Viewer)& theViewer, const V3d_TypeOfView theType = V3d_ORTHOGRAPHIC);
107
108   //! Initializes the view by copying.
109   Standard_EXPORT V3d_View (const Handle(V3d_Viewer)& theViewer, const Handle(V3d_View)& theView);
110
111   //! Default destructor.
112   Standard_EXPORT virtual ~V3d_View();
113
114   //! Activates the view in the specified Window
115   //! If <aContext> is not NULL the graphic context is used
116   //! to draw something in this view.
117   //! Otherwise an internal graphic context is created.
118   //! Warning: The view is centered and resized to preserve
119   //! the height/width ratio of the window.
120   Standard_EXPORT void SetWindow (const Handle(Aspect_Window)& theWindow,
121                                   const Aspect_RenderingContext theContext = NULL);
122
123   Standard_EXPORT void SetMagnify (const Handle(Aspect_Window)& theWindow,
124                                    const Handle(V3d_View)& thePreviousView,
125                                    const Standard_Integer theX1,
126                                    const Standard_Integer theY1,
127                                    const Standard_Integer theX2,
128                                    const Standard_Integer theY2);
129
130   //! Destroys the view.
131   Standard_EXPORT void Remove() const;
132
133   //! Deprecated, Redraw() should be used instead.
134   Standard_EXPORT void Update() const;
135
136   //! Redisplays the view even if there has not
137   //! been any modification.
138   //! Must be called if the view is shown.
139   //! (Ex: DeIconification ) .
140   Standard_EXPORT virtual void Redraw() const;
141
142   //! Updates layer of immediate presentations.
143   Standard_EXPORT virtual void RedrawImmediate() const;
144
145   //! Invalidates view content but does not redraw it.
146   Standard_EXPORT void Invalidate() const;
147
148   //! Returns true if cached view content has been invalidated.
149   Standard_EXPORT Standard_Boolean IsInvalidated() const;
150
151   //! Returns true if immediate layer content has been invalidated.
152   Standard_Boolean IsInvalidatedImmediate() const { return myIsInvalidatedImmediate; }
153
154   //! Invalidates view content within immediate layer but does not redraw it.
155   void InvalidateImmediate() { myIsInvalidatedImmediate = Standard_True; }
156
157   //! Must be called when the window supporting the
158   //! view changes size.
159   //! if the view is not mapped on a window.
160   //! Warning: The view is centered and resized to preserve
161   //! the height/width ratio of the window.
162   Standard_EXPORT void MustBeResized();
163
164   //! Must be called when the window supporting the
165   //! view is mapped or unmapped.
166   Standard_EXPORT void DoMapping();
167
168   //! Returns the status of the view regarding
169   //! the displayed structures inside
170   //! Returns True is The View is empty
171   Standard_EXPORT Standard_Boolean IsEmpty() const;
172
173   //! Updates the lights of the view.
174   Standard_EXPORT void UpdateLights() const;
175
176   //! Sets the automatic z-fit mode and its parameters.
177   //! The auto z-fit has extra parameters which can controlled from application level
178   //! to ensure that the size of viewing volume will be sufficiently large to cover
179   //! the depth of unmanaged objects, for example, transformation persistent ones.
180   //! @param theScaleFactor [in] the scale factor for Z-range.
181   //! The range between Z-min, Z-max projection volume planes
182   //! evaluated by z fitting method will be scaled using this coefficient.
183   //! Program error exception is thrown if negative or zero value
184   //! is passed.
185   Standard_EXPORT void SetAutoZFitMode (const Standard_Boolean theIsOn, const Standard_Real theScaleFactor = 1.0);
186
187   //! returns TRUE if automatic z-fit mode is turned on.
188   Standard_Boolean AutoZFitMode() const { return myAutoZFitIsOn; }
189
190   //! returns scale factor parameter of automatic z-fit mode.
191   Standard_Real AutoZFitScaleFactor() const { return myAutoZFitScaleFactor; }
192
193   //! If automatic z-range fitting is turned on, adjusts Z-min and Z-max
194   //! projection volume planes with call to ZFitAll.
195   Standard_EXPORT void AutoZFit() const;
196
197   //! Change Z-min and Z-max planes of projection volume to match the
198   //! displayed objects.
199   Standard_EXPORT void ZFitAll (const Standard_Real theScaleFactor = 1.0) const;
200
201   //! Defines the background color of the view by the color definition type and the three corresponding values.
202   Standard_EXPORT void SetBackgroundColor (const Quantity_TypeOfColor theType,
203                                            const Standard_Real theV1,
204                                            const Standard_Real theV2,
205                                            const Standard_Real theV3);
206
207   //! Defines the background color of the view.
208   Standard_EXPORT void SetBackgroundColor (const Quantity_Color& theColor);
209
210   //! Defines the gradient background colors of the view by supplying the colors
211   //! and the fill method (horizontal by default).
212   Standard_EXPORT void SetBgGradientColors (const Quantity_Color& theColor1,
213                                             const Quantity_Color& theColor2,
214                                             const Aspect_GradientFillMethod theFillStyle = Aspect_GFM_HOR,
215                                             const Standard_Boolean theToUpdate = Standard_False);
216
217   //! Defines the gradient background fill method of the view.
218   Standard_EXPORT void SetBgGradientStyle (const Aspect_GradientFillMethod theMethod = Aspect_GFM_HOR,
219                                            const Standard_Boolean theToUpdate = Standard_False);
220
221   //! Defines the background texture of the view by supplying the texture image file name
222   //! and fill method (centered by default).
223   Standard_EXPORT void SetBackgroundImage (const Standard_CString theFileName,
224                                            const Aspect_FillMethod theFillStyle = Aspect_FM_CENTERED,
225                                            const Standard_Boolean theToUpdate = Standard_False);
226
227   //! Defines the textured background fill method of the view.
228   Standard_EXPORT void SetBgImageStyle (const Aspect_FillMethod theFillStyle,
229                                         const Standard_Boolean theToUpdate = Standard_False);
230
231   //! Sets environment cubemap as background.
232   //! @param theCubeMap cubemap source to be set as background
233   //! @param theToUpdatePBREnv defines whether IBL maps will be generated or not (see 'GeneratePBREnvironment')
234   Standard_EXPORT void SetBackgroundCubeMap (const Handle(Graphic3d_CubeMap)& theCubeMap,
235                                              Standard_Boolean                 theToUpdatePBREnv = Standard_True,
236                                              Standard_Boolean                 theToUpdate = Standard_False);
237
238   //! Generates PBR specular probe and irradiance map
239   //! in order to provide environment indirect illumination in PBR shading model (Image Based Lighting).
240   //! The source of environment data is background cubemap.
241   //! If PBR is unavailable it does nothing.
242   //! If PBR is available but there is no cubemap being set to background it clears all IBL maps (see 'ClearPBREnvironment').
243   Standard_EXPORT void GeneratePBREnvironment (Standard_Boolean theToUpdate = Standard_False);
244
245   //! Fills PBR specular probe and irradiance map with white color.
246   //! So that environment indirect illumination will be constant and will be fully controlled by ambient light sources.
247   //! If PBR is unavailable it does nothing.
248   Standard_EXPORT void ClearPBREnvironment (Standard_Boolean theToUpdate = Standard_False);
249
250   //! Definition of an axis from its origin and
251   //! its orientation .
252   //! This will be the current axis for rotations and movements.
253   //! Warning! raises BadValue from V3d if the vector normal is NULL. .
254   Standard_EXPORT void SetAxis (const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
255                                 const Standard_Real Vx, const Standard_Real Vy, const Standard_Real Vz);
256
257   //! Defines the shading model for the visualization. Various models are available.
258   Standard_EXPORT void SetShadingModel (const Graphic3d_TypeOfShadingModel theShadingModel);
259
260   //! Sets the environment texture to use. No environment texture by default.
261   Standard_EXPORT void SetTextureEnv (const Handle(Graphic3d_TextureEnv)& theTexture);
262
263   //! Defines the visualization type in the view.
264   Standard_EXPORT void SetVisualization (const V3d_TypeOfVisualization theType);
265
266   //! Activates theLight in the view.
267   Standard_EXPORT void SetLightOn (const Handle(V3d_Light)& theLight);
268
269   //! Activates all the lights defined in this view.
270   Standard_EXPORT void SetLightOn();
271
272   //! Deactivate theLight in this view.
273   Standard_EXPORT void SetLightOff (const Handle(V3d_Light)& theLight);
274
275   //! Deactivate all the Lights defined in this view.
276   Standard_EXPORT void SetLightOff();
277
278   //! Returns TRUE when the light is active in this view.
279   Standard_EXPORT Standard_Boolean IsActiveLight (const Handle(V3d_Light)& theLight) const;
280
281   //! sets the immediate update mode and returns the previous one.
282   Standard_EXPORT Standard_Boolean SetImmediateUpdate (const Standard_Boolean theImmediateUpdate);
283
284   //! Customization of the ZBUFFER Triedron.
285   //! XColor,YColor,ZColor - colors of axis
286   //! SizeRatio - ratio of decreasing of the trihedron size when its physical
287   //! position comes out of the view
288   //! AxisDiametr - diameter relatively to axis length
289   //! NbFacettes - number of facets of cylinders and cones
290   Standard_EXPORT void ZBufferTriedronSetup (const Quantity_Color& theXColor = Quantity_NOC_RED,
291                                              const Quantity_Color& theYColor = Quantity_NOC_GREEN,
292                                              const Quantity_Color& theZColor = Quantity_NOC_BLUE1,
293                                              const Standard_Real theSizeRatio = 0.8,
294                                              const Standard_Real theAxisDiametr = 0.05,
295                                              const Standard_Integer theNbFacettes = 12);
296
297   //! Display of the Triedron.
298   //! Initialize position, color and length of Triedron axes.
299   //! The scale is a percent of the window width.
300   Standard_EXPORT void TriedronDisplay (const Aspect_TypeOfTriedronPosition thePosition = Aspect_TOTP_CENTER,
301                                         const Quantity_Color& theColor = Quantity_NOC_WHITE,
302                                         const Standard_Real theScale = 0.02,
303                                         const V3d_TypeOfVisualization theMode = V3d_WIREFRAME);
304
305   //! Erases the Triedron.
306   Standard_EXPORT void TriedronErase();
307
308   //! Returns data of a graduated trihedron.
309   Standard_EXPORT const Graphic3d_GraduatedTrihedron& GetGraduatedTrihedron() const;
310
311   //! Displays a graduated trihedron.
312   Standard_EXPORT void GraduatedTrihedronDisplay (const Graphic3d_GraduatedTrihedron& theTrihedronData);
313
314   //! Erases a graduated trihedron from the view.
315   Standard_EXPORT void GraduatedTrihedronErase();
316
317   //! modify the Projection of the view perpendicularly to
318   //! the privileged plane of the viewer.
319   Standard_EXPORT void SetFront();
320
321   //! Rotates the eye about the coordinate system of
322   //! reference of the screen
323   //! for which the origin is the view point of the projection,
324   //! with a relative angular value in RADIANS with respect to
325   //! the initial position expressed by Start = Standard_True
326   //! Warning! raises BadValue from V3d
327   //! If the eye, the view point, or the high point are
328   //! aligned or confused.
329   Standard_EXPORT void Rotate (const Standard_Real Ax, const Standard_Real Ay, const Standard_Real Az, const Standard_Boolean Start = Standard_True);
330
331   //! Rotates the eye about the coordinate system of
332   //! reference of the screen
333   //! for which the origin is Gravity point {X,Y,Z},
334   //! with a relative angular value in RADIANS with respect to
335   //! the initial position expressed by Start = Standard_True
336   //! If the eye, the view point, or the high point are
337   //! aligned or confused.
338   Standard_EXPORT void Rotate (const Standard_Real Ax, const Standard_Real Ay, const Standard_Real Az,
339                                const Standard_Real X,  const Standard_Real Y,  const Standard_Real Z,
340                                const Standard_Boolean Start = Standard_True);
341
342   //! Rotates the eye about one of the coordinate axes of
343   //! of the view for which the origin is the Gravity point{X,Y,Z}
344   //! with an relative angular value in RADIANS with
345   //! respect to the initial position expressed by
346   //! Start = Standard_True
347   Standard_EXPORT void Rotate (const V3d_TypeOfAxe Axe,
348                                const Standard_Real Angle,
349                                const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
350                                const Standard_Boolean Start = Standard_True);
351
352   //! Rotates the eye about one of the coordinate axes of
353   //! of the view for which the origin is the view point of the
354   //! projection with an relative angular value in RADIANS with
355   //! respect to the initial position expressed by
356   //! Start = Standard_True
357   Standard_EXPORT void Rotate (const V3d_TypeOfAxe Axe, const Standard_Real Angle, const Standard_Boolean Start = Standard_True);
358
359   //! Rotates the eye around the current axis a relative
360   //! angular value in RADIANS with respect to the initial
361   //! position expressed by Start = Standard_True
362   Standard_EXPORT void Rotate (const Standard_Real Angle, const Standard_Boolean Start = Standard_True);
363
364   //! Movement of the eye parallel to the coordinate system
365   //! of reference of the screen a distance relative to the
366   //! initial position expressed by Start = Standard_True.
367   Standard_EXPORT void Move (const Standard_Real Dx, const Standard_Real Dy, const Standard_Real Dz, const Standard_Boolean Start = Standard_True);
368
369   //! Movement of the eye parallel to one of the axes of the
370   //! coordinate system of reference of the view a distance
371   //! relative to the initial position expressed by
372   //! Start = Standard_True.
373   Standard_EXPORT void Move (const V3d_TypeOfAxe Axe, const Standard_Real Length, const Standard_Boolean Start = Standard_True);
374
375   //! Movement of the eye parllel to the current axis
376   //! a distance relative to the initial position
377   //! expressed by Start = Standard_True
378   Standard_EXPORT void Move (const Standard_Real Length, const Standard_Boolean Start = Standard_True);
379
380   //! Movement of the ye and the view point parallel to the
381   //! frame of reference of the screen a distance relative
382   //! to the initial position expressed by
383   //! Start = Standard_True
384   Standard_EXPORT void Translate (const Standard_Real Dx, const Standard_Real Dy, const Standard_Real Dz, const Standard_Boolean Start = Standard_True);
385
386   //! Movement of the eye and the view point parallel to one
387   //! of the axes of the fame of reference of the view a
388   //! distance relative to the initial position
389   //! expressed by Start = Standard_True
390   Standard_EXPORT void Translate (const V3d_TypeOfAxe Axe, const Standard_Real Length, const Standard_Boolean Start = Standard_True);
391
392   //! Movement of the eye and view point parallel to
393   //! the current axis a distance relative to the initial
394   //! position expressed by Start = Standard_True
395   Standard_EXPORT void Translate (const Standard_Real Length, const Standard_Boolean Start = Standard_True);
396
397   //! places the point of the view corresponding
398   //! at the pixel position x,y at the center of the window
399   //! and updates the view.
400   Standard_EXPORT void Place (const Standard_Integer theXp, const Standard_Integer theYp, const Standard_Real theZoomFactor = 1);
401
402   //! Rotation of the view point around the frame of reference
403   //! of the screen for which the origin is the eye of the
404   //! projection with a relative angular value in RADIANS
405   //! with respect to the initial position expressed by
406   //! Start = Standard_True
407   Standard_EXPORT void Turn (const Standard_Real Ax, const Standard_Real Ay, const Standard_Real Az, const Standard_Boolean Start = Standard_True);
408
409   //! Rotation of the view point around one of the axes of the
410   //! frame of reference of the view for which the origin is
411   //! the eye of the projection with an angular value in
412   //! RADIANS relative to the initial position expressed by
413   //! Start = Standard_True
414   Standard_EXPORT void Turn (const V3d_TypeOfAxe Axe, const Standard_Real Angle, const Standard_Boolean Start = Standard_True);
415
416   //! Rotation of the view point around the current axis an
417   //! angular value in RADIANS relative to the initial
418   //! position expressed by Start = Standard_True
419   Standard_EXPORT void Turn (const Standard_Real Angle, const Standard_Boolean Start = Standard_True);
420
421   //! Defines the angular position of the high point of
422   //! the reference frame of the view with respect to the
423   //! Y screen axis with an absolute angular value in
424   //! RADIANS.
425   Standard_EXPORT void SetTwist (const Standard_Real Angle);
426
427   //! Defines the position of the eye..
428   Standard_EXPORT void SetEye (const Standard_Real X, const Standard_Real Y, const Standard_Real Z);
429
430   //! Defines the Depth of the eye from the view point
431   //! without update the projection .
432   Standard_EXPORT void SetDepth (const Standard_Real Depth);
433
434   //! Defines the orientation of the projection.
435   Standard_EXPORT void SetProj (const Standard_Real Vx, const Standard_Real Vy, const Standard_Real Vz);
436
437   //! Defines the orientation of the projection .
438   //! @param theOrientation camera direction
439   //! @param theIsYup       flag indicating Y-up (TRUE) or Z-up (FALSE) convention
440   Standard_EXPORT void SetProj (const V3d_TypeOfOrientation theOrientation,
441                                 const Standard_Boolean theIsYup = Standard_False);
442
443   //! Defines the position of the view point.
444   Standard_EXPORT void SetAt (const Standard_Real X, const Standard_Real Y, const Standard_Real Z);
445
446   //! Defines the orientation of the high point.
447   Standard_EXPORT void SetUp (const Standard_Real Vx, const Standard_Real Vy, const Standard_Real Vz);
448
449   //! Defines the orientation(SO) of the high point.
450   Standard_EXPORT void SetUp (const V3d_TypeOfOrientation Orientation);
451
452   //! Saves the current state of the orientation of the view
453   //! which will be the return state at ResetViewOrientation.
454   Standard_EXPORT void SetViewOrientationDefault();
455
456   //! Resets the orientation of the view.
457   //! Updates the view
458   Standard_EXPORT void ResetViewOrientation();
459
460   //! Translates the center of the view along "x" and "y" axes of
461   //! view projection. Can be used to perform interactive panning operation.
462   //! In that case the DXv, DXy parameters specify panning relative to the
463   //! point where the operation is started.
464   //! @param theDXv [in] the relative panning on "x" axis of view projection, in view space coordinates.
465   //! @param theDYv [in] the relative panning on "y" axis of view projection, in view space coordinates.
466   //! @param theZoomFactor [in] the zooming factor.
467   //! @param theToStart [in] pass TRUE when starting panning to remember view
468   //! state prior to panning for relative arguments. If panning is started,
469   //! passing {0, 0} for {theDXv, theDYv} will return view to initial state.
470   //! Performs update of view.
471   Standard_EXPORT void Panning (const Standard_Real theDXv, const Standard_Real theDYv, const Standard_Real theZoomFactor = 1, const Standard_Boolean theToStart = Standard_True);
472
473   //! Relocates center of screen to the point, determined by
474   //! {Xp, Yp} pixel coordinates relative to the bottom-left corner of
475   //! screen. To calculate pixel coordinates for any point from world
476   //! coordinate space, it can be projected using "Project".
477   //! @param theXp [in] the x coordinate.
478   //! @param theYp [in] the y coordinate.
479   Standard_EXPORT void SetCenter (const Standard_Integer theXp, const Standard_Integer theYp);
480
481   //! Defines the view projection size in its maximum dimension,
482   //! keeping the inital height/width ratio unchanged.
483   Standard_EXPORT void SetSize (const Standard_Real theSize);
484
485   //! Defines the Depth size of the view
486   //! Front Plane will be set to Size/2.
487   //! Back  Plane will be set to -Size/2.
488   //! Any Object located Above the Front Plane or
489   //! behind the Back Plane will be Clipped .
490   //! NOTE than the XY Size of the View is NOT modified .
491   Standard_EXPORT void SetZSize (const Standard_Real SetZSize);
492
493   //! Zooms the view by a factor relative to the initial
494   //! value expressed by Start = Standard_True
495   //! Updates the view.
496   Standard_EXPORT void SetZoom (const Standard_Real Coef, const Standard_Boolean Start = Standard_True);
497
498   //! Zooms the view by a factor relative to the value
499   //! initialised by SetViewMappingDefault().
500   //! Updates the view.
501   Standard_EXPORT void SetScale (const Standard_Real Coef);
502
503   //! Sets  anisotropic (axial)  scale  factors  <Sx>, <Sy>, <Sz>  for  view <me>.
504   //! Anisotropic  scaling  operation  is  performed  through  multiplying
505   //! the current view  orientation  matrix  by  a  scaling  matrix:
506   //! || Sx  0   0   0 ||
507   //! || 0   Sy  0   0 ||
508   //! || 0   0   Sz  0 ||
509   //! || 0   0   0   1 ||
510   //! Updates the view.
511   Standard_EXPORT void SetAxialScale (const Standard_Real Sx, const Standard_Real Sy, const Standard_Real Sz);
512
513   //! Adjust view parameters to fit the displayed scene, respecting height / width ratio.
514   //! The Z clipping range (depth range) is fitted if AutoZFit flag is TRUE.
515   //! Throws program error exception if margin coefficient is < 0 or >= 1.
516   //! Updates the view.
517   //! @param theMargin [in] the margin coefficient for view borders.
518   //! @param theToUpdate [in] flag to perform view update.
519   Standard_EXPORT void FitAll (const Standard_Real theMargin = 0.01, const Standard_Boolean theToUpdate = Standard_True);
520
521   //! Adjust view parameters to fit the displayed scene, respecting height / width ratio
522   //! according to the custom bounding box given.
523   //! Throws program error exception if margin coefficient is < 0 or >= 1.
524   //! Updates the view.
525   //! @param theBox [in] the custom bounding box to fit.
526   //! @param theMargin [in] the margin coefficient for view borders.
527   //! @param theToUpdate [in] flag to perform view update.
528   Standard_EXPORT void FitAll (const Bnd_Box& theBox, const Standard_Real theMargin = 0.01, const Standard_Boolean theToUpdate = Standard_True);
529
530   //! Adjusts the viewing volume so as not to clip the displayed objects by front and back
531   //! and back clipping planes. Also sets depth value automatically depending on the
532   //! calculated Z size and Aspect parameter.
533   //! NOTE than the original XY size of the view is NOT modified .
534   Standard_EXPORT void DepthFitAll (const Standard_Real Aspect = 0.01, const Standard_Real Margin = 0.01);
535
536   //! Centers the defined projection window so that it occupies
537   //! the maximum space while respecting the initial
538   //! height/width ratio.
539   //! NOTE than the original Z size of the view is NOT modified .
540   Standard_EXPORT void FitAll (const Standard_Real theMinXv, const Standard_Real theMinYv, const Standard_Real theMaxXv, const Standard_Real theMaxYv);
541
542   //! Centers the defined PIXEL window so that it occupies
543   //! the maximum space while respecting the initial height/width ratio.
544   //! NOTE than the original Z size of the view is NOT modified.
545   //! @param theMinXp [in] pixel coordinates of minimal corner on x screen axis.
546   //! @param theMinYp [in] pixel coordinates of minimal corner on y screen axis.
547   //! @param theMaxXp [in] pixel coordinates of maximal corner on x screen axis.
548   //! @param theMaxYp [in] pixel coordinates of maximal corner on y screen axis.
549   Standard_EXPORT void WindowFit (const Standard_Integer theMinXp, const Standard_Integer theMinYp, const Standard_Integer theMaxXp, const Standard_Integer theMaxYp);
550
551   //! Saves the current view mapping. This will be the
552   //! state returned from ResetViewmapping.
553   Standard_EXPORT void SetViewMappingDefault();
554
555   //! Resets the centering of the view.
556   //! Updates the view
557   Standard_EXPORT void ResetViewMapping();
558
559   //! Resets the centering and the orientation of the view.
560   Standard_EXPORT void Reset (const Standard_Boolean theToUpdate = Standard_True);
561
562   //! Converts the PIXEL value
563   //! to a value in the projection plane.
564   Standard_EXPORT Standard_Real Convert (const Standard_Integer Vp) const;
565
566   //! Converts the point PIXEL into a point projected
567   //! in the reference frame of the projection plane.
568   Standard_EXPORT void Convert (const Standard_Integer Xp, const Standard_Integer Yp,
569                                 Standard_Real& Xv, Standard_Real& Yv) const;
570
571   //! Converts tha value of the projection plane into
572   //! a PIXEL value.
573   Standard_EXPORT Standard_Integer Convert (const Standard_Real Vv) const;
574
575   //! Converts the point defined in the reference frame
576   //! of the projection plane into a point PIXEL.
577   Standard_EXPORT void Convert (const Standard_Real Xv, const Standard_Real Yv,
578                                 Standard_Integer& Xp, Standard_Integer& Yp) const;
579
580   //! Converts the projected point into a point
581   //! in the reference frame of the view corresponding
582   //! to the intersection with the projection plane
583   //! of the eye/view point vector.
584   Standard_EXPORT void Convert (const Standard_Integer Xp, const Standard_Integer Yp,
585                                 Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
586
587   //! Converts the projected point into a point
588   //! in the reference frame of the view corresponding
589   //! to the intersection with the projection plane
590   //! of the eye/view point vector and returns the
591   //! projection ray for further computations.
592   Standard_EXPORT void ConvertWithProj (const Standard_Integer Xp, const Standard_Integer Yp,
593                                         Standard_Real& X,  Standard_Real& Y,  Standard_Real& Z,
594                                         Standard_Real& Vx, Standard_Real& Vy, Standard_Real& Vz) const;
595
596   //! Converts the projected point into the nearest grid point
597   //! in the reference frame of the view corresponding
598   //! to the intersection with the projection plane
599   //! of the eye/view point vector and display the grid marker.
600   //! Warning: When the grid is not active the result is identical to the above Convert() method.
601   //! How to use:
602   //! 1) Enable the grid echo display
603   //! myViewer->SetGridEcho(Standard_True);
604   //! 2) When application receive a move event:
605   //! 2.1) Check if any object is detected
606   //! if( myInteractiveContext->MoveTo(x,y) == AIS_SOD_Nothing ) {
607   //! 2.2) Check if the grid is active
608   //! if( myViewer->Grid()->IsActive() ) {
609   //! 2.3) Display the grid echo and gets the grid point
610   //! myView->ConvertToGrid(x,y,X,Y,Z);
611   //! myView->Viewer()->ShowGridEcho (myView, Graphic3d_Vertex (X,Y,Z));
612   //! myView->RedrawImmediate();
613   //! 2.4) Else this is the standard case
614   //! } else myView->Convert(x,y,X,Y,Z);
615   Standard_EXPORT void ConvertToGrid (const Standard_Integer Xp, const Standard_Integer Yp,
616                                       Standard_Real& Xg, Standard_Real& Yg, Standard_Real& Zg) const;
617
618   //! Converts the point into the nearest grid point
619   //! and display the grid marker.
620   Standard_EXPORT void ConvertToGrid (const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
621                                       Standard_Real& Xg, Standard_Real& Yg, Standard_Real& Zg) const;
622
623   //! Projects the point defined in the reference frame of
624   //! the view into the projected point in the associated window.
625   Standard_EXPORT void Convert (const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
626                                 Standard_Integer& Xp, Standard_Integer& Yp) const;
627
628   //! Converts the point defined in the user space of
629   //! the view to the projection plane at the depth
630   //! relative to theZ.
631   Standard_EXPORT void Project (const Standard_Real theX,
632                                 const Standard_Real theY,
633                                 const Standard_Real theZ,
634                                 Standard_Real& theXp,
635                                 Standard_Real& theYp) const;
636
637   //! Converts the point defined in the user space of
638   //! the view to the projection plane at the depth
639   //! relative to theZ.
640   Standard_EXPORT void Project (const Standard_Real theX,
641                                 const Standard_Real theY,
642                                 const Standard_Real theZ,
643                                 Standard_Real& theXp,
644                                 Standard_Real& theYp,
645                                 Standard_Real& theZp) const;
646
647   //! Returns the Background color values of the view
648   //! depending of the color Type.
649   Standard_EXPORT void BackgroundColor (const Quantity_TypeOfColor Type, Standard_Real& V1, Standard_Real& V2, Standard_Real& V3) const;
650
651   //! Returns the Background color object of the view.
652   Standard_EXPORT Quantity_Color BackgroundColor() const;
653
654   //! Returns the gradient background colors of the view.
655   Standard_EXPORT void GradientBackgroundColors (Quantity_Color& theColor1, Quantity_Color& theColor2) const;
656
657   //! Returns the gradient background of the view.
658   Standard_EXPORT Aspect_GradientBackground GradientBackground() const;
659
660   //! Returns the current value of the zoom expressed with
661   //! respect to SetViewMappingDefault().
662   Standard_EXPORT Standard_Real Scale() const;
663
664   //! Returns the current values of the anisotropic (axial) scale factors.
665   Standard_EXPORT void AxialScale (Standard_Real& Sx, Standard_Real& Sy, Standard_Real& Sz) const;
666
667   //! Returns the height and width of the view.
668   Standard_EXPORT void Size (Standard_Real& Width, Standard_Real& Height) const;
669
670   //! Returns the Depth of the view .
671   Standard_EXPORT Standard_Real ZSize() const;
672
673   //! Returns the position of the eye.
674   Standard_EXPORT void Eye (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
675
676   //! Returns the position of point which emanating the projections.
677   void FocalReferencePoint (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const { Eye (X,Y,Z); }
678
679   //! Returns the coordinate of the point (Xpix,Ypix)
680   //! in the view (XP,YP,ZP), and the projection vector of the
681   //! view passing by the point (for PerspectiveView).
682   Standard_EXPORT void ProjReferenceAxe (const Standard_Integer Xpix, const Standard_Integer Ypix,
683                                          Standard_Real& XP, Standard_Real& YP, Standard_Real& ZP,
684                                          Standard_Real& VX, Standard_Real& VY, Standard_Real& VZ) const;
685
686   //! Returns the Distance between the Eye and View Point.
687   Standard_EXPORT Standard_Real Depth() const;
688
689   //! Returns the projection vector.
690   Standard_EXPORT void Proj (Standard_Real& Vx, Standard_Real& Vy, Standard_Real& Vz) const;
691
692   //! Returns the position of the view point.
693   Standard_EXPORT void At (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
694
695   //! Returns the vector giving the position of the high point.
696   Standard_EXPORT void Up (Standard_Real& Vx, Standard_Real& Vy, Standard_Real& Vz) const;
697
698   //! Returns in RADIANS the orientation of the view around
699   //! the visual axis measured from the Y axis of the screen.
700   Standard_EXPORT Standard_Real Twist() const;
701
702   //! Returns the current shading model.
703   Standard_EXPORT Graphic3d_TypeOfShadingModel ShadingModel() const;
704
705   Standard_EXPORT Handle(Graphic3d_TextureEnv) TextureEnv() const;
706
707   //! Returns the current visualisation mode.
708   Standard_EXPORT V3d_TypeOfVisualization Visualization() const;
709
710   //! Returns True if One light more can be
711   //! activated in this View.
712   Standard_EXPORT Standard_Boolean IfMoreLights() const;
713
714   //! Return iterator for defined lights.
715   V3d_ListOfLightIterator ActiveLightIterator() const { return V3d_ListOfLightIterator (myActiveLights); }
716
717   //! initializes an iteration on the active Lights.
718   void InitActiveLights() { myActiveLightsIterator.Initialize (myActiveLights); }
719
720   //! returns true if there are more active Light(s) to return.
721   Standard_Boolean MoreActiveLights() const { return myActiveLightsIterator.More(); }
722
723   //! Go to the next active Light (if there is not, ActiveLight will raise an exception)
724   void NextActiveLights() { myActiveLightsIterator.Next(); }
725
726   const Handle(V3d_Light)& ActiveLight() const { return myActiveLightsIterator.Value(); }
727
728   //! Returns the MAX number of light associated to the view.
729   Standard_EXPORT Standard_Integer LightLimit() const;
730
731   //! Returns the viewer in which the view has been created.
732   Handle(V3d_Viewer) Viewer() const { return MyViewer; }
733
734   //! Returns True if MyView is associated with a window .
735   Standard_EXPORT Standard_Boolean IfWindow() const;
736
737   //! Returns the Aspect Window associated with the view.
738   const Handle(Aspect_Window)& Window() const { return MyWindow; }
739
740   //! Returns the Type of the View
741   Standard_EXPORT V3d_TypeOfView Type() const;
742
743   //! Translates the center of the view along "x" and "y" axes of
744   //! view projection. Can be used to perform interactive panning operation.
745   //! In that case the DXp, DXp parameters specify panning relative to the
746   //! point where the operation is started.
747   //! @param theDXp [in] the relative panning on "x" axis of view projection, in pixels.
748   //! @param theDYp [in] the relative panning on "y" axis of view projection, in pixels.
749   //! @param theZoomFactor [in] the zooming factor.
750   //! @param theToStart [in] pass TRUE when starting panning to remember view
751   //! state prior to panning for relative arguments. Passing 0 for relative
752   //! panning parameter should return view panning to initial state.
753   //! Performs update of view.
754   Standard_EXPORT void Pan (const Standard_Integer theDXp, const Standard_Integer theDYp, const Standard_Real theZoomFactor = 1, const Standard_Boolean theToStart = Standard_True);
755
756   //! Zoom the view according to a zoom factor computed
757   //! from the distance between the 2 mouse position.
758   //! @param theXp1 [in] the x coordinate of first mouse position, in pixels.
759   //! @param theYp1 [in] the y coordinate of first mouse position, in pixels.
760   //! @param theXp2 [in] the x coordinate of second mouse position, in pixels.
761   //! @param theYp2 [in] the y coordinate of second mouse position, in pixels.
762   Standard_EXPORT void Zoom (const Standard_Integer theXp1, const Standard_Integer theYp1, const Standard_Integer theXp2, const Standard_Integer theYp2);
763
764   //! Defines starting point for ZoomAtPoint view operation.
765   //! @param theXp [in] the x mouse coordinate, in pixels.
766   //! @param theYp [in] the y mouse coordinate, in pixels.
767   Standard_EXPORT void StartZoomAtPoint (const Standard_Integer theXp, const Standard_Integer theYp);
768
769   //! Zooms the model at a pixel defined by the method StartZoomAtPoint().
770   Standard_EXPORT void ZoomAtPoint (const Standard_Integer theMouseStartX, const Standard_Integer theMouseStartY, const Standard_Integer theMouseEndX, const Standard_Integer theMouseEndY);
771
772   //! Performs  anisotropic scaling  of  <me>  view  along  the  given  <Axis>.
773   //! The  scale  factor  is  calculated on a basis of
774   //! the mouse pointer displacement <Dx,Dy>.
775   //! The  calculated  scale  factor  is  then  passed  to  SetAxialScale(Sx,  Sy,  Sz)  method.
776   Standard_EXPORT void AxialScale (const Standard_Integer Dx, const Standard_Integer Dy, const V3d_TypeOfAxe Axis);
777
778   //! Begin the rotation of the view around the screen axis
779   //! according to the mouse position <X,Y>.
780   //! Warning: Enable rotation around the Z screen axis when <zRotationThreshold>
781   //! factor is > 0 soon the distance from the start point and the center
782   //! of the view is > (medium viewSize * <zRotationThreshold> ).
783   //! Generally a value of 0.4 is usable to rotate around XY screen axis
784   //! inside the circular threshold area and to rotate around Z screen axis
785   //! outside this area.
786   Standard_EXPORT void StartRotation (const Standard_Integer X, const Standard_Integer Y, const Standard_Real zRotationThreshold = 0.0);
787
788   //! Continues the rotation of the view
789   //! with an angle computed from the last and new mouse position <X,Y>.
790   Standard_EXPORT void Rotation (const Standard_Integer X, const Standard_Integer Y);
791
792   //! Change View Plane Distance for Perspective Views
793   //! Warning! raises TypeMismatch from Standard if the view
794   //! is not a perspective view.
795   Standard_EXPORT void SetFocale (const Standard_Real Focale);
796
797   //! Returns the View Plane Distance for Perspective Views
798   Standard_EXPORT Standard_Real Focale() const;
799
800   //! Returns the associated Graphic3d view.
801   const Handle(Graphic3d_CView)& View() const { return myView; }
802
803   //! Switches computed HLR mode in the view.
804   Standard_EXPORT void SetComputedMode (const Standard_Boolean theMode);
805
806   //! Returns the computed HLR mode state.
807   Standard_EXPORT Standard_Boolean ComputedMode() const;
808
809   //! idem than WindowFit
810   void WindowFitAll (const Standard_Integer Xmin, const Standard_Integer Ymin, const Standard_Integer Xmax, const Standard_Integer Ymax)
811   {
812     WindowFit (Xmin, Ymin, Xmax, Ymax);
813   }
814
815   //! Transform camera eye, center and scale to fit in the passed bounding box specified in WCS.
816   //! @param theCamera [in] the camera
817   //! @param theBox    [in] the bounding box
818   //! @param theMargin [in] the margin coefficient for view borders
819   //! @param theResolution [in] the minimum size of projection of bounding box in Xv or Yv direction when it considered to be a thin plane or point (without a volume);
820   //!                           in this case only the center of camera is adjusted
821   //! @param theToEnlargeIfLine [in] when TRUE - in cases when the whole bounding box projected into thin line going along Z-axis of screen,
822   //!                                the view plane is enlarged such thatwe see the whole line on rotation, otherwise only the center of camera is adjusted.
823   //! @return TRUE if the fit all operation can be done
824   Standard_EXPORT Standard_Boolean FitMinMax (const Handle(Graphic3d_Camera)& theCamera,
825                                               const Bnd_Box& theBox,
826                                               const Standard_Real theMargin,
827                                               const Standard_Real theResolution = 0.0,
828                                               const Standard_Boolean theToEnlargeIfLine = Standard_True) const;
829
830   //! Defines or Updates the definition of the
831   //! grid in <me>
832   Standard_EXPORT void SetGrid (const gp_Ax3& aPlane, const Handle(Aspect_Grid)& aGrid);
833
834   //! Defines or Updates the activity of the
835   //! grid in <me>
836   Standard_EXPORT void SetGridActivity (const Standard_Boolean aFlag);
837
838   //! Dumps the full contents of the View into the image file. This is an alias for ToPixMap() with Image_AlienPixMap.
839   //! @param theFile destination image file (image format is determined by file extension like .png, .bmp, .jpg)
840   //! @param theBufferType buffer to dump
841   //! @return FALSE when the dump has failed
842   Standard_EXPORT Standard_Boolean Dump (const Standard_CString theFile, const Graphic3d_BufferType& theBufferType = Graphic3d_BT_RGB);
843
844   //! Dumps the full contents of the view to a pixmap with specified parameters.
845   //! Internally this method calls Redraw() with an offscreen render buffer of requested target size (theWidth x theHeight),
846   //! so that there is no need resizing a window control for making a dump of different size.
847   Standard_EXPORT Standard_Boolean ToPixMap (Image_PixMap&               theImage,
848                                              const V3d_ImageDumpOptions& theParams);
849
850   //! Dumps the full contents of the view to a pixmap.
851   //! Internally this method calls Redraw() with an offscreen render buffer of requested target size (theWidth x theHeight),
852   //! so that there is no need resizing a window control for making a dump of different size.
853   //! @param theImage          target image, will be re-allocated to match theWidth x theHeight
854   //! @param theWidth          target image width
855   //! @param theHeight         target image height
856   //! @param theBufferType     type of the view buffer to dump (color / depth)
857   //! @param theToAdjustAspect when true, active view aspect ratio will be overridden by (theWidth / theHeight)
858   //! @param theStereoOptions  how to dump stereographic camera
859   Standard_Boolean ToPixMap (Image_PixMap& theImage,
860                              const Standard_Integer theWidth,
861                              const Standard_Integer theHeight,
862                              const Graphic3d_BufferType& theBufferType     = Graphic3d_BT_RGB,
863                              const Standard_Boolean      theToAdjustAspect = Standard_True,
864                              const V3d_StereoDumpOptions theStereoOptions  = V3d_SDO_MONO)
865   {
866     V3d_ImageDumpOptions aParams;
867     aParams.Width  = theWidth;
868     aParams.Height = theHeight;
869     aParams.BufferType = theBufferType;
870     aParams.StereoOptions  = theStereoOptions;
871     aParams.ToAdjustAspect = theToAdjustAspect;
872     return ToPixMap (theImage, aParams);
873   }
874
875   //! Manages display of the back faces
876   //! When <aModel> is TOBM_AUTOMATIC the object backfaces
877   //! are displayed only for surface objects and
878   //! never displayed for solid objects.
879   //! this was the previous mode.
880   //! <aModel> is TOBM_ALWAYS_DISPLAYED the object backfaces
881   //! are always displayed both for surfaces or solids.
882   //! <aModel> is TOBM_NEVER_DISPLAYED the object backfaces
883   //! are never displayed.
884   Standard_EXPORT void SetBackFacingModel (const V3d_TypeOfBackfacingModel theModel = V3d_TOBM_AUTOMATIC);
885
886   //! Returns current state of the back faces display
887   Standard_EXPORT V3d_TypeOfBackfacingModel BackFacingModel() const;
888
889   //! Adds clip plane to the view. The composition of clip planes truncates the
890   //! rendering space to convex volume. Number of supported clip planes can be consulted
891   //! by PlaneLimit method of associated Graphic3d_GraphicDriver.
892   //! Please be aware that the planes which exceed the limit are ignored during rendering.
893   //! @param thePlane [in] the clip plane to be added to view.
894   Standard_EXPORT virtual void AddClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane);
895
896   //! Removes clip plane from the view.
897   //! @param thePlane [in] the clip plane to be removed from view.
898   Standard_EXPORT virtual void RemoveClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane);
899
900   //! Sets sequence of clip planes to the view. The planes that have been set
901   //! before are removed from the view. The composition of clip planes
902   //! truncates the rendering space to convex volume. Number of supported
903   //! clip planes can be consulted by InquirePlaneLimit method of
904   //! Graphic3d_GraphicDriver. Please be aware that the planes that
905   //! exceed the limit are ignored during rendering.
906   //! @param thePlanes [in] the clip planes to set.
907   Standard_EXPORT void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes);
908
909   Standard_DEPRECATED("This method is deprecated - overload taking Handle should be used instead")
910   void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes)
911   {
912     Handle(Graphic3d_SequenceOfHClipPlane) aPlanes = new Graphic3d_SequenceOfHClipPlane (thePlanes);
913     SetClipPlanes (aPlanes);
914   }
915
916   //! Get clip planes.
917   //! @return sequence clip planes that have been set for the view
918   Standard_EXPORT const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const;
919
920   //! Returns the MAX number of clipping planes associated to the view.
921   Standard_EXPORT Standard_Integer PlaneLimit() const;
922
923   //! Change camera used by view.
924   Standard_EXPORT void SetCamera (const Handle(Graphic3d_Camera)& theCamera);
925
926   //! Returns camera object of the view.
927   //! @return: handle to camera object, or NULL if 3D view does not use
928   //! the camera approach.
929   Standard_EXPORT const Handle(Graphic3d_Camera)& Camera() const;
930
931   //! Return default camera.
932   const Handle(Graphic3d_Camera)& DefaultCamera() const { return myDefaultCamera; }
933
934   //! Returns current rendering parameters and effect settings.
935   //! By default it returns default parameters of current viewer.
936   //! To define view-specific settings use method V3d_View::ChangeRenderingParams().
937   //! @sa V3d_Viewer::DefaultRenderingParams()
938   Standard_EXPORT const Graphic3d_RenderingParams& RenderingParams() const;
939
940   //! Returns reference to current rendering parameters and effect settings.
941   Standard_EXPORT Graphic3d_RenderingParams& ChangeRenderingParams();
942
943   //! @return flag value of objects culling mechanism
944   Standard_Boolean IsCullingEnabled() const { return RenderingParams().FrustumCullingState == Graphic3d_RenderingParams::FrustumCulling_On; }
945
946   //! Turn on/off automatic culling of objects outside frustum (ON by default)
947   void SetFrustumCulling (Standard_Boolean theMode) { ChangeRenderingParams().FrustumCullingState = theMode ? Graphic3d_RenderingParams::FrustumCulling_On : Graphic3d_RenderingParams::FrustumCulling_Off; }
948
949   //! Fill in the dictionary with diagnostic info.
950   //! Should be called within rendering thread.
951   //!
952   //! This API should be used only for user output or for creating automated reports.
953   //! The format of returned information (e.g. key-value layout)
954   //! is NOT part of this API and can be changed at any time.
955   //! Thus application should not parse returned information to weed out specific parameters.
956   //! @param theDict  destination map for information
957   //! @param theFlags defines the information to be retrieved
958   Standard_EXPORT void DiagnosticInformation (TColStd_IndexedDataMapOfStringString& theDict,
959                                               Graphic3d_DiagnosticInfo theFlags) const;
960
961   //! Returns string with statistic performance info.
962   Standard_EXPORT TCollection_AsciiString StatisticInformation() const;
963
964   //! Fills in the dictionary with statistic performance info.
965   Standard_EXPORT void StatisticInformation (TColStd_IndexedDataMapOfStringString& theDict) const;
966
967   //! Returns the Objects number and the gravity center of ALL viewable points in the view
968   Standard_EXPORT gp_Pnt GravityPoint() const;
969
970   DEFINE_STANDARD_RTTIEXT(V3d_View,Standard_Transient)
971
972 protected:
973
974   Standard_EXPORT void ImmediateUpdate() const;
975
976   //! Scales camera to fit the view frame of defined width and height
977   //! keeping the aspect. For orthogonal camera the method changes scale,
978   //! for perspective adjusts Eye location about the Center point.
979   //! @param theSizeXv [in] size of viewport frame on "x" axis.
980   //! @param theSizeYv [in] size of viewport frame on "y" axis.
981   Standard_EXPORT void Scale (const Handle(Graphic3d_Camera)& theCamera, const Standard_Real theSizeXv, const Standard_Real theSizeYv) const;
982
983   Standard_EXPORT void Translate (const Handle(Graphic3d_Camera)& theCamera, const Standard_Real theDXv, const Standard_Real theDYv) const;
984
985 private:
986
987   //! Modifies the aspect ratio of the camera when
988   //! the associated window is defined or resized.
989   Standard_EXPORT void SetRatio();
990
991   //! Determines the screen axes in the reference
992   //! framework of the view.
993   Standard_EXPORT static Standard_Boolean screenAxis (const gp_Dir& theVpn, const gp_Dir& theVup,
994                                                       gp_Vec& theXaxe, gp_Vec& theYaxe, gp_Vec& theZaxe);
995   
996   //! Transforms the Vertex V according to the matrice Matrix .
997   Standard_EXPORT static gp_XYZ TrsPoint (const Graphic3d_Vertex& V, const TColStd_Array2OfReal& Matrix);
998   
999   //! Returns the objects number and the projection window
1000   //! of the objects contained in the view.
1001   Standard_EXPORT Standard_Integer MinMax (Standard_Real& Umin, Standard_Real& Vmin, Standard_Real& Umax, Standard_Real& Vmax) const;
1002   
1003   //! Returns the objects number and the box encompassing
1004   //! the objects contained in the view
1005   Standard_EXPORT Standard_Integer MinMax (Standard_Real& Xmin, Standard_Real& Ymin, Standard_Real& Zmin, Standard_Real& Xmax, Standard_Real& Ymax, Standard_Real& Zmax) const;
1006   
1007   Standard_EXPORT void Init();
1008   
1009   //! Returns a new vertex when the grid is activated.
1010   Standard_EXPORT Graphic3d_Vertex Compute (const Graphic3d_Vertex& AVertex) const;
1011
1012 protected:
1013
1014   Standard_Real myOldMouseX;
1015   Standard_Real myOldMouseY;
1016   gp_Dir myCamStartOpUp;
1017   gp_Dir myCamStartOpDir;
1018   gp_Pnt myCamStartOpEye;
1019   Standard_Real myCamStartOpBnd[6];
1020   gp_Pnt myCamStartOpCenter;
1021   Handle(Graphic3d_Camera) myDefaultCamera;
1022   Handle(Graphic3d_CView) myView;
1023   Standard_Boolean myImmediateUpdate;
1024   mutable Standard_Boolean myIsInvalidatedImmediate;
1025
1026 private:
1027
1028   V3d_ViewerPointer MyViewer;
1029   V3d_ListOfLight myActiveLights;
1030   gp_Dir myDefaultViewAxis;
1031   gp_Pnt myDefaultViewPoint;
1032   Handle(Aspect_Window) MyWindow;
1033   V3d_ListOfLight::Iterator myActiveLightsIterator;
1034   Standard_Integer sx;
1035   Standard_Integer sy;
1036   Standard_Real rx;
1037   Standard_Real ry;
1038   gp_Pnt myRotateGravity;
1039   Standard_Boolean myComputedMode;
1040   Standard_Boolean SwitchSetFront;
1041   Standard_Boolean myZRotation;
1042   Standard_Integer MyZoomAtPointX;
1043   Standard_Integer MyZoomAtPointY;
1044   Handle(V3d_Trihedron) myTrihedron;
1045   Handle(Aspect_Grid) MyGrid;
1046   gp_Ax3 MyPlane;
1047   TColStd_Array2OfReal MyTrsf;
1048   Handle(Graphic3d_Structure) MyGridEchoStructure;
1049   Handle(Graphic3d_Group) MyGridEchoGroup;
1050   gp_Vec myXscreenAxis;
1051   gp_Vec myYscreenAxis;
1052   gp_Vec myZscreenAxis;
1053   gp_Dir myViewAxis;
1054   Graphic3d_Vertex myGravityReferencePoint;
1055   Standard_Boolean myAutoZFitIsOn;
1056   Standard_Real myAutoZFitScaleFactor;
1057
1058 };
1059
1060 #endif // _V3d_View_HeaderFile