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