1 // Created on: 1992-01-15
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _V3d_View_HeaderFile
18 #define _V3d_View_HeaderFile
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>
28 #include <Bnd_Box.hxx>
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>
44 #include <Image_PixMap.hxx>
46 #include <Standard_Transient.hxx>
48 #include <Quantity_TypeOfColor.hxx>
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>
58 #include <TColStd_Array2OfReal.hxx>
59 #include <TColStd_ListIteratorOfListOfTransient.hxx>
61 #include <V3d_ImageDumpOptions.hxx>
62 #include <V3d_Trihedron.hxx>
63 #include <V3d_TypeOfAxe.hxx>
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>
74 class Graphic3d_Group;
75 class Graphic3d_Structure;
76 class Graphic3d_TextureEnv;
77 class Standard_MultiplyDefined;
78 class Standard_TypeMismatch;
83 DEFINE_STANDARD_HANDLE(V3d_View, Standard_Transient)
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
96 //! Example : Shifting the eye-view along the screen axes.
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
105 //! Initializes the view.
106 Standard_EXPORT V3d_View (const Handle(V3d_Viewer)& theViewer, const V3d_TypeOfView theType = V3d_ORTHOGRAPHIC);
108 //! Initializes the view by copying.
109 Standard_EXPORT V3d_View (const Handle(V3d_Viewer)& theViewer, const Handle(V3d_View)& theView);
111 //! Default destructor.
112 Standard_EXPORT virtual ~V3d_View();
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);
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);
130 //! Destroys the view.
131 Standard_EXPORT void Remove() const;
133 //! Deprecated, Redraw() should be used instead.
134 Standard_EXPORT void Update() const;
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;
142 //! Updates layer of immediate presentations.
143 Standard_EXPORT virtual void RedrawImmediate() const;
145 //! Invalidates view content but does not redraw it.
146 Standard_EXPORT void Invalidate() const;
148 //! Returns true if cached view content has been invalidated.
149 Standard_EXPORT Standard_Boolean IsInvalidated() const;
151 //! Returns true if immediate layer content has been invalidated.
152 Standard_Boolean IsInvalidatedImmediate() const { return myIsInvalidatedImmediate; }
154 //! Invalidates view content within immediate layer but does not redraw it.
155 void InvalidateImmediate() { myIsInvalidatedImmediate = Standard_True; }
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();
164 //! Must be called when the window supporting the
165 //! view is mapped or unmapped.
166 Standard_EXPORT void DoMapping();
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;
173 //! Updates the lights of the view.
174 Standard_EXPORT void UpdateLights() const;
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
185 Standard_EXPORT void SetAutoZFitMode (const Standard_Boolean theIsOn, const Standard_Real theScaleFactor = 1.0);
187 //! returns TRUE if automatic z-fit mode is turned on.
188 Standard_Boolean AutoZFitMode() const { return myAutoZFitIsOn; }
190 //! returns scale factor parameter of automatic z-fit mode.
191 Standard_Real AutoZFitScaleFactor() const { return myAutoZFitScaleFactor; }
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;
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;
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);
207 //! Defines the background color of the view.
208 Standard_EXPORT void SetBackgroundColor (const Quantity_Color& theColor);
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);
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);
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);
227 //! Defines the background texture of the view by supplying the texture and fill method (centered by default)
228 Standard_EXPORT void SetBackgroundImage (const Handle(Graphic3d_Texture2D)& theTexture,
229 const Aspect_FillMethod theFillStyle = Aspect_FM_CENTERED,
230 const Standard_Boolean theToUpdate = Standard_False);
232 //! Defines the textured background fill method of the view.
233 Standard_EXPORT void SetBgImageStyle (const Aspect_FillMethod theFillStyle,
234 const Standard_Boolean theToUpdate = Standard_False);
236 //! Sets environment cubemap as background.
237 //! @param theCubeMap cubemap source to be set as background
238 //! @param theToUpdatePBREnv defines whether IBL maps will be generated or not (see 'GeneratePBREnvironment')
239 Standard_EXPORT void SetBackgroundCubeMap (const Handle(Graphic3d_CubeMap)& theCubeMap,
240 Standard_Boolean theToUpdatePBREnv = Standard_True,
241 Standard_Boolean theToUpdate = Standard_False);
243 //! Generates PBR specular probe and irradiance map
244 //! in order to provide environment indirect illumination in PBR shading model (Image Based Lighting).
245 //! The source of environment data is background cubemap.
246 //! If PBR is unavailable it does nothing.
247 //! If PBR is available but there is no cubemap being set to background it clears all IBL maps (see 'ClearPBREnvironment').
248 Standard_EXPORT void GeneratePBREnvironment (Standard_Boolean theToUpdate = Standard_False);
250 //! Fills PBR specular probe and irradiance map with white color.
251 //! So that environment indirect illumination will be constant and will be fully controlled by ambient light sources.
252 //! If PBR is unavailable it does nothing.
253 Standard_EXPORT void ClearPBREnvironment (Standard_Boolean theToUpdate = Standard_False);
255 //! Definition of an axis from its origin and
256 //! its orientation .
257 //! This will be the current axis for rotations and movements.
258 //! Warning! raises BadValue from V3d if the vector normal is NULL. .
259 Standard_EXPORT void SetAxis (const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
260 const Standard_Real Vx, const Standard_Real Vy, const Standard_Real Vz);
262 //! Defines the shading model for the visualization. Various models are available.
263 Standard_EXPORT void SetShadingModel (const Graphic3d_TypeOfShadingModel theShadingModel);
265 //! Sets the environment texture to use. No environment texture by default.
266 Standard_EXPORT void SetTextureEnv (const Handle(Graphic3d_TextureEnv)& theTexture);
268 //! Defines the visualization type in the view.
269 Standard_EXPORT void SetVisualization (const V3d_TypeOfVisualization theType);
271 //! Activates theLight in the view.
272 Standard_EXPORT void SetLightOn (const Handle(V3d_Light)& theLight);
274 //! Activates all the lights defined in this view.
275 Standard_EXPORT void SetLightOn();
277 //! Deactivate theLight in this view.
278 Standard_EXPORT void SetLightOff (const Handle(V3d_Light)& theLight);
280 //! Deactivate all the Lights defined in this view.
281 Standard_EXPORT void SetLightOff();
283 //! Returns TRUE when the light is active in this view.
284 Standard_EXPORT Standard_Boolean IsActiveLight (const Handle(V3d_Light)& theLight) const;
286 //! sets the immediate update mode and returns the previous one.
287 Standard_EXPORT Standard_Boolean SetImmediateUpdate (const Standard_Boolean theImmediateUpdate);
289 //! Returns trihedron object.
290 const Handle(V3d_Trihedron)& Trihedron() const { return myTrihedron; }
292 //! Customization of the ZBUFFER Triedron.
293 //! XColor,YColor,ZColor - colors of axis
294 //! SizeRatio - ratio of decreasing of the trihedron size when its physical
295 //! position comes out of the view
296 //! AxisDiametr - diameter relatively to axis length
297 //! NbFacettes - number of facets of cylinders and cones
298 Standard_EXPORT void ZBufferTriedronSetup (const Quantity_Color& theXColor = Quantity_NOC_RED,
299 const Quantity_Color& theYColor = Quantity_NOC_GREEN,
300 const Quantity_Color& theZColor = Quantity_NOC_BLUE1,
301 const Standard_Real theSizeRatio = 0.8,
302 const Standard_Real theAxisDiametr = 0.05,
303 const Standard_Integer theNbFacettes = 12);
305 //! Display of the Triedron.
306 //! Initialize position, color and length of Triedron axes.
307 //! The scale is a percent of the window width.
308 Standard_EXPORT void TriedronDisplay (const Aspect_TypeOfTriedronPosition thePosition = Aspect_TOTP_CENTER,
309 const Quantity_Color& theColor = Quantity_NOC_WHITE,
310 const Standard_Real theScale = 0.02,
311 const V3d_TypeOfVisualization theMode = V3d_WIREFRAME);
313 //! Erases the Triedron.
314 Standard_EXPORT void TriedronErase();
316 //! Returns data of a graduated trihedron.
317 Standard_EXPORT const Graphic3d_GraduatedTrihedron& GetGraduatedTrihedron() const;
319 //! Displays a graduated trihedron.
320 Standard_EXPORT void GraduatedTrihedronDisplay (const Graphic3d_GraduatedTrihedron& theTrihedronData);
322 //! Erases a graduated trihedron from the view.
323 Standard_EXPORT void GraduatedTrihedronErase();
325 //! modify the Projection of the view perpendicularly to
326 //! the privileged plane of the viewer.
327 Standard_EXPORT void SetFront();
329 //! Rotates the eye about the coordinate system of
330 //! reference of the screen
331 //! for which the origin is the view point of the projection,
332 //! with a relative angular value in RADIANS with respect to
333 //! the initial position expressed by Start = Standard_True
334 //! Warning! raises BadValue from V3d
335 //! If the eye, the view point, or the high point are
336 //! aligned or confused.
337 Standard_EXPORT void Rotate (const Standard_Real Ax, const Standard_Real Ay, const Standard_Real Az, const Standard_Boolean Start = Standard_True);
339 //! Rotates the eye about the coordinate system of
340 //! reference of the screen
341 //! for which the origin is Gravity point {X,Y,Z},
342 //! with a relative angular value in RADIANS with respect to
343 //! the initial position expressed by Start = Standard_True
344 //! If the eye, the view point, or the high point are
345 //! aligned or confused.
346 Standard_EXPORT void Rotate (const Standard_Real Ax, const Standard_Real Ay, const Standard_Real Az,
347 const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
348 const Standard_Boolean Start = Standard_True);
350 //! Rotates the eye about one of the coordinate axes of
351 //! of the view for which the origin is the Gravity point{X,Y,Z}
352 //! with an relative angular value in RADIANS with
353 //! respect to the initial position expressed by
354 //! Start = Standard_True
355 Standard_EXPORT void Rotate (const V3d_TypeOfAxe Axe,
356 const Standard_Real Angle,
357 const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
358 const Standard_Boolean Start = Standard_True);
360 //! Rotates the eye about one of the coordinate axes of
361 //! of the view for which the origin is the view point of the
362 //! projection with an relative angular value in RADIANS with
363 //! respect to the initial position expressed by
364 //! Start = Standard_True
365 Standard_EXPORT void Rotate (const V3d_TypeOfAxe Axe, const Standard_Real Angle, const Standard_Boolean Start = Standard_True);
367 //! Rotates the eye around the current axis a relative
368 //! angular value in RADIANS with respect to the initial
369 //! position expressed by Start = Standard_True
370 Standard_EXPORT void Rotate (const Standard_Real Angle, const Standard_Boolean Start = Standard_True);
372 //! Movement of the eye parallel to the coordinate system
373 //! of reference of the screen a distance relative to the
374 //! initial position expressed by Start = Standard_True.
375 Standard_EXPORT void Move (const Standard_Real Dx, const Standard_Real Dy, const Standard_Real Dz, const Standard_Boolean Start = Standard_True);
377 //! Movement of the eye parallel to one of the axes of the
378 //! coordinate system of reference of the view a distance
379 //! relative to the initial position expressed by
380 //! Start = Standard_True.
381 Standard_EXPORT void Move (const V3d_TypeOfAxe Axe, const Standard_Real Length, const Standard_Boolean Start = Standard_True);
383 //! Movement of the eye parllel to the current axis
384 //! a distance relative to the initial position
385 //! expressed by Start = Standard_True
386 Standard_EXPORT void Move (const Standard_Real Length, const Standard_Boolean Start = Standard_True);
388 //! Movement of the ye and the view point parallel to the
389 //! frame of reference of the screen a distance relative
390 //! to the initial position expressed by
391 //! Start = Standard_True
392 Standard_EXPORT void Translate (const Standard_Real Dx, const Standard_Real Dy, const Standard_Real Dz, const Standard_Boolean Start = Standard_True);
394 //! Movement of the eye and the view point parallel to one
395 //! of the axes of the fame of reference of the view a
396 //! distance relative to the initial position
397 //! expressed by Start = Standard_True
398 Standard_EXPORT void Translate (const V3d_TypeOfAxe Axe, const Standard_Real Length, const Standard_Boolean Start = Standard_True);
400 //! Movement of the eye and view point parallel to
401 //! the current axis a distance relative to the initial
402 //! position expressed by Start = Standard_True
403 Standard_EXPORT void Translate (const Standard_Real Length, const Standard_Boolean Start = Standard_True);
405 //! places the point of the view corresponding
406 //! at the pixel position x,y at the center of the window
407 //! and updates the view.
408 Standard_EXPORT void Place (const Standard_Integer theXp, const Standard_Integer theYp, const Standard_Real theZoomFactor = 1);
410 //! Rotation of the view point around the frame of reference
411 //! of the screen for which the origin is the eye of the
412 //! projection with a relative angular value in RADIANS
413 //! with respect to the initial position expressed by
414 //! Start = Standard_True
415 Standard_EXPORT void Turn (const Standard_Real Ax, const Standard_Real Ay, const Standard_Real Az, const Standard_Boolean Start = Standard_True);
417 //! Rotation of the view point around one of the axes of the
418 //! frame of reference of the view for which the origin is
419 //! the eye of the projection with an angular value in
420 //! RADIANS relative to the initial position expressed by
421 //! Start = Standard_True
422 Standard_EXPORT void Turn (const V3d_TypeOfAxe Axe, const Standard_Real Angle, const Standard_Boolean Start = Standard_True);
424 //! Rotation of the view point around the current axis an
425 //! angular value in RADIANS relative to the initial
426 //! position expressed by Start = Standard_True
427 Standard_EXPORT void Turn (const Standard_Real Angle, const Standard_Boolean Start = Standard_True);
429 //! Defines the angular position of the high point of
430 //! the reference frame of the view with respect to the
431 //! Y screen axis with an absolute angular value in
433 Standard_EXPORT void SetTwist (const Standard_Real Angle);
435 //! Defines the position of the eye..
436 Standard_EXPORT void SetEye (const Standard_Real X, const Standard_Real Y, const Standard_Real Z);
438 //! Defines the Depth of the eye from the view point
439 //! without update the projection .
440 Standard_EXPORT void SetDepth (const Standard_Real Depth);
442 //! Defines the orientation of the projection.
443 Standard_EXPORT void SetProj (const Standard_Real Vx, const Standard_Real Vy, const Standard_Real Vz);
445 //! Defines the orientation of the projection .
446 //! @param theOrientation camera direction
447 //! @param theIsYup flag indicating Y-up (TRUE) or Z-up (FALSE) convention
448 Standard_EXPORT void SetProj (const V3d_TypeOfOrientation theOrientation,
449 const Standard_Boolean theIsYup = Standard_False);
451 //! Defines the position of the view point.
452 Standard_EXPORT void SetAt (const Standard_Real X, const Standard_Real Y, const Standard_Real Z);
454 //! Defines the orientation of the high point.
455 Standard_EXPORT void SetUp (const Standard_Real Vx, const Standard_Real Vy, const Standard_Real Vz);
457 //! Defines the orientation(SO) of the high point.
458 Standard_EXPORT void SetUp (const V3d_TypeOfOrientation Orientation);
460 //! Saves the current state of the orientation of the view
461 //! which will be the return state at ResetViewOrientation.
462 Standard_EXPORT void SetViewOrientationDefault();
464 //! Resets the orientation of the view.
466 Standard_EXPORT void ResetViewOrientation();
468 //! Translates the center of the view along "x" and "y" axes of
469 //! view projection. Can be used to perform interactive panning operation.
470 //! In that case the DXv, DXy parameters specify panning relative to the
471 //! point where the operation is started.
472 //! @param theDXv [in] the relative panning on "x" axis of view projection, in view space coordinates.
473 //! @param theDYv [in] the relative panning on "y" axis of view projection, in view space coordinates.
474 //! @param theZoomFactor [in] the zooming factor.
475 //! @param theToStart [in] pass TRUE when starting panning to remember view
476 //! state prior to panning for relative arguments. If panning is started,
477 //! passing {0, 0} for {theDXv, theDYv} will return view to initial state.
478 //! Performs update of view.
479 Standard_EXPORT void Panning (const Standard_Real theDXv, const Standard_Real theDYv, const Standard_Real theZoomFactor = 1, const Standard_Boolean theToStart = Standard_True);
481 //! Relocates center of screen to the point, determined by
482 //! {Xp, Yp} pixel coordinates relative to the bottom-left corner of
483 //! screen. To calculate pixel coordinates for any point from world
484 //! coordinate space, it can be projected using "Project".
485 //! @param theXp [in] the x coordinate.
486 //! @param theYp [in] the y coordinate.
487 Standard_EXPORT void SetCenter (const Standard_Integer theXp, const Standard_Integer theYp);
489 //! Defines the view projection size in its maximum dimension,
490 //! keeping the inital height/width ratio unchanged.
491 Standard_EXPORT void SetSize (const Standard_Real theSize);
493 //! Defines the Depth size of the view
494 //! Front Plane will be set to Size/2.
495 //! Back Plane will be set to -Size/2.
496 //! Any Object located Above the Front Plane or
497 //! behind the Back Plane will be Clipped .
498 //! NOTE than the XY Size of the View is NOT modified .
499 Standard_EXPORT void SetZSize (const Standard_Real SetZSize);
501 //! Zooms the view by a factor relative to the initial
502 //! value expressed by Start = Standard_True
503 //! Updates the view.
504 Standard_EXPORT void SetZoom (const Standard_Real Coef, const Standard_Boolean Start = Standard_True);
506 //! Zooms the view by a factor relative to the value
507 //! initialised by SetViewMappingDefault().
508 //! Updates the view.
509 Standard_EXPORT void SetScale (const Standard_Real Coef);
511 //! Sets anisotropic (axial) scale factors <Sx>, <Sy>, <Sz> for view <me>.
512 //! Anisotropic scaling operation is performed through multiplying
513 //! the current view orientation matrix by a scaling matrix:
518 //! Updates the view.
519 Standard_EXPORT void SetAxialScale (const Standard_Real Sx, const Standard_Real Sy, const Standard_Real Sz);
521 //! Adjust view parameters to fit the displayed scene, respecting height / width ratio.
522 //! The Z clipping range (depth range) is fitted if AutoZFit flag is TRUE.
523 //! Throws program error exception if margin coefficient is < 0 or >= 1.
524 //! Updates the view.
525 //! @param theMargin [in] the margin coefficient for view borders.
526 //! @param theToUpdate [in] flag to perform view update.
527 Standard_EXPORT void FitAll (const Standard_Real theMargin = 0.01, const Standard_Boolean theToUpdate = Standard_True);
529 //! Adjust view parameters to fit the displayed scene, respecting height / width ratio
530 //! according to the custom bounding box given.
531 //! Throws program error exception if margin coefficient is < 0 or >= 1.
532 //! Updates the view.
533 //! @param theBox [in] the custom bounding box to fit.
534 //! @param theMargin [in] the margin coefficient for view borders.
535 //! @param theToUpdate [in] flag to perform view update.
536 Standard_EXPORT void FitAll (const Bnd_Box& theBox, const Standard_Real theMargin = 0.01, const Standard_Boolean theToUpdate = Standard_True);
538 //! Adjusts the viewing volume so as not to clip the displayed objects by front and back
539 //! and back clipping planes. Also sets depth value automatically depending on the
540 //! calculated Z size and Aspect parameter.
541 //! NOTE than the original XY size of the view is NOT modified .
542 Standard_EXPORT void DepthFitAll (const Standard_Real Aspect = 0.01, const Standard_Real Margin = 0.01);
544 //! Centers the defined projection window so that it occupies
545 //! the maximum space while respecting the initial
546 //! height/width ratio.
547 //! NOTE than the original Z size of the view is NOT modified .
548 Standard_EXPORT void FitAll (const Standard_Real theMinXv, const Standard_Real theMinYv, const Standard_Real theMaxXv, const Standard_Real theMaxYv);
550 //! Centers the defined PIXEL window so that it occupies
551 //! the maximum space while respecting the initial height/width ratio.
552 //! NOTE than the original Z size of the view is NOT modified.
553 //! @param theMinXp [in] pixel coordinates of minimal corner on x screen axis.
554 //! @param theMinYp [in] pixel coordinates of minimal corner on y screen axis.
555 //! @param theMaxXp [in] pixel coordinates of maximal corner on x screen axis.
556 //! @param theMaxYp [in] pixel coordinates of maximal corner on y screen axis.
557 Standard_EXPORT void WindowFit (const Standard_Integer theMinXp, const Standard_Integer theMinYp, const Standard_Integer theMaxXp, const Standard_Integer theMaxYp);
559 //! Saves the current view mapping. This will be the
560 //! state returned from ResetViewmapping.
561 Standard_EXPORT void SetViewMappingDefault();
563 //! Resets the centering of the view.
565 Standard_EXPORT void ResetViewMapping();
567 //! Resets the centering and the orientation of the view.
568 Standard_EXPORT void Reset (const Standard_Boolean theToUpdate = Standard_True);
570 //! Converts the PIXEL value
571 //! to a value in the projection plane.
572 Standard_EXPORT Standard_Real Convert (const Standard_Integer Vp) const;
574 //! Converts the point PIXEL into a point projected
575 //! in the reference frame of the projection plane.
576 Standard_EXPORT void Convert (const Standard_Integer Xp, const Standard_Integer Yp,
577 Standard_Real& Xv, Standard_Real& Yv) const;
579 //! Converts tha value of the projection plane into
581 Standard_EXPORT Standard_Integer Convert (const Standard_Real Vv) const;
583 //! Converts the point defined in the reference frame
584 //! of the projection plane into a point PIXEL.
585 Standard_EXPORT void Convert (const Standard_Real Xv, const Standard_Real Yv,
586 Standard_Integer& Xp, Standard_Integer& Yp) const;
588 //! Converts the projected point into a point
589 //! in the reference frame of the view corresponding
590 //! to the intersection with the projection plane
591 //! of the eye/view point vector.
592 Standard_EXPORT void Convert (const Standard_Integer Xp, const Standard_Integer Yp,
593 Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
595 //! Converts the projected point into a point
596 //! in the reference frame of the view corresponding
597 //! to the intersection with the projection plane
598 //! of the eye/view point vector and returns the
599 //! projection ray for further computations.
600 Standard_EXPORT void ConvertWithProj (const Standard_Integer Xp, const Standard_Integer Yp,
601 Standard_Real& X, Standard_Real& Y, Standard_Real& Z,
602 Standard_Real& Vx, Standard_Real& Vy, Standard_Real& Vz) const;
604 //! Converts the projected point into the nearest grid point
605 //! in the reference frame of the view corresponding
606 //! to the intersection with the projection plane
607 //! of the eye/view point vector and display the grid marker.
608 //! Warning: When the grid is not active the result is identical to the above Convert() method.
610 //! 1) Enable the grid echo display
611 //! myViewer->SetGridEcho(Standard_True);
612 //! 2) When application receive a move event:
613 //! 2.1) Check if any object is detected
614 //! if( myInteractiveContext->MoveTo(x,y) == AIS_SOD_Nothing ) {
615 //! 2.2) Check if the grid is active
616 //! if( myViewer->Grid()->IsActive() ) {
617 //! 2.3) Display the grid echo and gets the grid point
618 //! myView->ConvertToGrid(x,y,X,Y,Z);
619 //! myView->Viewer()->ShowGridEcho (myView, Graphic3d_Vertex (X,Y,Z));
620 //! myView->RedrawImmediate();
621 //! 2.4) Else this is the standard case
622 //! } else myView->Convert(x,y,X,Y,Z);
623 Standard_EXPORT void ConvertToGrid (const Standard_Integer Xp, const Standard_Integer Yp,
624 Standard_Real& Xg, Standard_Real& Yg, Standard_Real& Zg) const;
626 //! Converts the point into the nearest grid point
627 //! and display the grid marker.
628 Standard_EXPORT void ConvertToGrid (const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
629 Standard_Real& Xg, Standard_Real& Yg, Standard_Real& Zg) const;
631 //! Projects the point defined in the reference frame of
632 //! the view into the projected point in the associated window.
633 Standard_EXPORT void Convert (const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
634 Standard_Integer& Xp, Standard_Integer& Yp) const;
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;
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;
655 //! Returns the Background color values of the view
656 //! depending of the color Type.
657 Standard_EXPORT void BackgroundColor (const Quantity_TypeOfColor Type, Standard_Real& V1, Standard_Real& V2, Standard_Real& V3) const;
659 //! Returns the Background color object of the view.
660 Standard_EXPORT Quantity_Color BackgroundColor() const;
662 //! Returns the gradient background colors of the view.
663 Standard_EXPORT void GradientBackgroundColors (Quantity_Color& theColor1, Quantity_Color& theColor2) const;
665 //! Returns the gradient background of the view.
666 Standard_EXPORT Aspect_GradientBackground GradientBackground() const;
668 //! Returns the current value of the zoom expressed with
669 //! respect to SetViewMappingDefault().
670 Standard_EXPORT Standard_Real Scale() const;
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;
675 //! Returns the height and width of the view.
676 Standard_EXPORT void Size (Standard_Real& Width, Standard_Real& Height) const;
678 //! Returns the Depth of the view .
679 Standard_EXPORT Standard_Real ZSize() const;
681 //! Returns the position of the eye.
682 Standard_EXPORT void Eye (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
684 //! Returns the position of point which emanating the projections.
685 void FocalReferencePoint (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const { Eye (X,Y,Z); }
687 //! Returns the coordinate of the point (Xpix,Ypix)
688 //! in the view (XP,YP,ZP), and the projection vector of the
689 //! view passing by the point (for PerspectiveView).
690 Standard_EXPORT void ProjReferenceAxe (const Standard_Integer Xpix, const Standard_Integer Ypix,
691 Standard_Real& XP, Standard_Real& YP, Standard_Real& ZP,
692 Standard_Real& VX, Standard_Real& VY, Standard_Real& VZ) const;
694 //! Returns the Distance between the Eye and View Point.
695 Standard_EXPORT Standard_Real Depth() const;
697 //! Returns the projection vector.
698 Standard_EXPORT void Proj (Standard_Real& Vx, Standard_Real& Vy, Standard_Real& Vz) const;
700 //! Returns the position of the view point.
701 Standard_EXPORT void At (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
703 //! Returns the vector giving the position of the high point.
704 Standard_EXPORT void Up (Standard_Real& Vx, Standard_Real& Vy, Standard_Real& Vz) const;
706 //! Returns in RADIANS the orientation of the view around
707 //! the visual axis measured from the Y axis of the screen.
708 Standard_EXPORT Standard_Real Twist() const;
710 //! Returns the current shading model.
711 Standard_EXPORT Graphic3d_TypeOfShadingModel ShadingModel() const;
713 Standard_EXPORT Handle(Graphic3d_TextureEnv) TextureEnv() const;
715 //! Returns the current visualisation mode.
716 Standard_EXPORT V3d_TypeOfVisualization Visualization() const;
718 //! Returns a list of active lights.
719 const V3d_ListOfLight& ActiveLights() const { return myActiveLights; }
721 //! Return iterator for defined lights.
722 V3d_ListOfLightIterator ActiveLightIterator() const { return V3d_ListOfLightIterator (myActiveLights); }
724 //! Returns the MAX number of light associated to the view.
725 Standard_EXPORT Standard_Integer LightLimit() const;
727 //! Returns the viewer in which the view has been created.
728 Handle(V3d_Viewer) Viewer() const { return MyViewer; }
730 //! Returns True if MyView is associated with a window .
731 Standard_EXPORT Standard_Boolean IfWindow() const;
733 //! Returns the Aspect Window associated with the view.
734 const Handle(Aspect_Window)& Window() const { return MyWindow; }
736 //! Returns the Type of the View
737 Standard_EXPORT V3d_TypeOfView Type() const;
739 //! Translates the center of the view along "x" and "y" axes of
740 //! view projection. Can be used to perform interactive panning operation.
741 //! In that case the DXp, DXp parameters specify panning relative to the
742 //! point where the operation is started.
743 //! @param theDXp [in] the relative panning on "x" axis of view projection, in pixels.
744 //! @param theDYp [in] the relative panning on "y" axis of view projection, in pixels.
745 //! @param theZoomFactor [in] the zooming factor.
746 //! @param theToStart [in] pass TRUE when starting panning to remember view
747 //! state prior to panning for relative arguments. Passing 0 for relative
748 //! panning parameter should return view panning to initial state.
749 //! Performs update of view.
750 Standard_EXPORT void Pan (const Standard_Integer theDXp, const Standard_Integer theDYp, const Standard_Real theZoomFactor = 1, const Standard_Boolean theToStart = Standard_True);
752 //! Zoom the view according to a zoom factor computed
753 //! from the distance between the 2 mouse position.
754 //! @param theXp1 [in] the x coordinate of first mouse position, in pixels.
755 //! @param theYp1 [in] the y coordinate of first mouse position, in pixels.
756 //! @param theXp2 [in] the x coordinate of second mouse position, in pixels.
757 //! @param theYp2 [in] the y coordinate of second mouse position, in pixels.
758 Standard_EXPORT void Zoom (const Standard_Integer theXp1, const Standard_Integer theYp1, const Standard_Integer theXp2, const Standard_Integer theYp2);
760 //! Defines starting point for ZoomAtPoint view operation.
761 //! @param theXp [in] the x mouse coordinate, in pixels.
762 //! @param theYp [in] the y mouse coordinate, in pixels.
763 Standard_EXPORT void StartZoomAtPoint (const Standard_Integer theXp, const Standard_Integer theYp);
765 //! Zooms the model at a pixel defined by the method StartZoomAtPoint().
766 Standard_EXPORT void ZoomAtPoint (const Standard_Integer theMouseStartX, const Standard_Integer theMouseStartY, const Standard_Integer theMouseEndX, const Standard_Integer theMouseEndY);
768 //! Performs anisotropic scaling of <me> view along the given <Axis>.
769 //! The scale factor is calculated on a basis of
770 //! the mouse pointer displacement <Dx,Dy>.
771 //! The calculated scale factor is then passed to SetAxialScale(Sx, Sy, Sz) method.
772 Standard_EXPORT void AxialScale (const Standard_Integer Dx, const Standard_Integer Dy, const V3d_TypeOfAxe Axis);
774 //! Begin the rotation of the view around the screen axis
775 //! according to the mouse position <X,Y>.
776 //! Warning: Enable rotation around the Z screen axis when <zRotationThreshold>
777 //! factor is > 0 soon the distance from the start point and the center
778 //! of the view is > (medium viewSize * <zRotationThreshold> ).
779 //! Generally a value of 0.4 is usable to rotate around XY screen axis
780 //! inside the circular threshold area and to rotate around Z screen axis
781 //! outside this area.
782 Standard_EXPORT void StartRotation (const Standard_Integer X, const Standard_Integer Y, const Standard_Real zRotationThreshold = 0.0);
784 //! Continues the rotation of the view
785 //! with an angle computed from the last and new mouse position <X,Y>.
786 Standard_EXPORT void Rotation (const Standard_Integer X, const Standard_Integer Y);
788 //! Change View Plane Distance for Perspective Views
789 //! Warning! raises TypeMismatch from Standard if the view
790 //! is not a perspective view.
791 Standard_EXPORT void SetFocale (const Standard_Real Focale);
793 //! Returns the View Plane Distance for Perspective Views
794 Standard_EXPORT Standard_Real Focale() const;
796 //! Returns the associated Graphic3d view.
797 const Handle(Graphic3d_CView)& View() const { return myView; }
799 //! Switches computed HLR mode in the view.
800 Standard_EXPORT void SetComputedMode (const Standard_Boolean theMode);
802 //! Returns the computed HLR mode state.
803 Standard_EXPORT Standard_Boolean ComputedMode() const;
805 //! idem than WindowFit
806 void WindowFitAll (const Standard_Integer Xmin, const Standard_Integer Ymin, const Standard_Integer Xmax, const Standard_Integer Ymax)
808 WindowFit (Xmin, Ymin, Xmax, Ymax);
811 //! Transform camera eye, center and scale to fit in the passed bounding box specified in WCS.
812 //! @param theCamera [in] the camera
813 //! @param theBox [in] the bounding box
814 //! @param theMargin [in] the margin coefficient for view borders
815 //! @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);
816 //! in this case only the center of camera is adjusted
817 //! @param theToEnlargeIfLine [in] when TRUE - in cases when the whole bounding box projected into thin line going along Z-axis of screen,
818 //! the view plane is enlarged such thatwe see the whole line on rotation, otherwise only the center of camera is adjusted.
819 //! @return TRUE if the fit all operation can be done
820 Standard_EXPORT Standard_Boolean FitMinMax (const Handle(Graphic3d_Camera)& theCamera,
821 const Bnd_Box& theBox,
822 const Standard_Real theMargin,
823 const Standard_Real theResolution = 0.0,
824 const Standard_Boolean theToEnlargeIfLine = Standard_True) const;
826 //! Defines or Updates the definition of the
828 Standard_EXPORT void SetGrid (const gp_Ax3& aPlane, const Handle(Aspect_Grid)& aGrid);
830 //! Defines or Updates the activity of the
832 Standard_EXPORT void SetGridActivity (const Standard_Boolean aFlag);
834 //! Dumps the full contents of the View into the image file. This is an alias for ToPixMap() with Image_AlienPixMap.
835 //! @param theFile destination image file (image format is determined by file extension like .png, .bmp, .jpg)
836 //! @param theBufferType buffer to dump
837 //! @return FALSE when the dump has failed
838 Standard_EXPORT Standard_Boolean Dump (const Standard_CString theFile, const Graphic3d_BufferType& theBufferType = Graphic3d_BT_RGB);
840 //! Dumps the full contents of the view to a pixmap with specified parameters.
841 //! Internally this method calls Redraw() with an offscreen render buffer of requested target size (theWidth x theHeight),
842 //! so that there is no need resizing a window control for making a dump of different size.
843 Standard_EXPORT Standard_Boolean ToPixMap (Image_PixMap& theImage,
844 const V3d_ImageDumpOptions& theParams);
846 //! Dumps the full contents of the view to a pixmap.
847 //! Internally this method calls Redraw() with an offscreen render buffer of requested target size (theWidth x theHeight),
848 //! so that there is no need resizing a window control for making a dump of different size.
849 //! @param theImage target image, will be re-allocated to match theWidth x theHeight
850 //! @param theWidth target image width
851 //! @param theHeight target image height
852 //! @param theBufferType type of the view buffer to dump (color / depth)
853 //! @param theToAdjustAspect when true, active view aspect ratio will be overridden by (theWidth / theHeight)
854 //! @param theStereoOptions how to dump stereographic camera
855 Standard_Boolean ToPixMap (Image_PixMap& theImage,
856 const Standard_Integer theWidth,
857 const Standard_Integer theHeight,
858 const Graphic3d_BufferType& theBufferType = Graphic3d_BT_RGB,
859 const Standard_Boolean theToAdjustAspect = Standard_True,
860 const V3d_StereoDumpOptions theStereoOptions = V3d_SDO_MONO)
862 V3d_ImageDumpOptions aParams;
863 aParams.Width = theWidth;
864 aParams.Height = theHeight;
865 aParams.BufferType = theBufferType;
866 aParams.StereoOptions = theStereoOptions;
867 aParams.ToAdjustAspect = theToAdjustAspect;
868 return ToPixMap (theImage, aParams);
871 //! Manages display of the back faces
872 //! When <aModel> is TOBM_AUTOMATIC the object backfaces
873 //! are displayed only for surface objects and
874 //! never displayed for solid objects.
875 //! this was the previous mode.
876 //! <aModel> is TOBM_ALWAYS_DISPLAYED the object backfaces
877 //! are always displayed both for surfaces or solids.
878 //! <aModel> is TOBM_NEVER_DISPLAYED the object backfaces
879 //! are never displayed.
880 Standard_EXPORT void SetBackFacingModel (const V3d_TypeOfBackfacingModel theModel = V3d_TOBM_AUTOMATIC);
882 //! Returns current state of the back faces display
883 Standard_EXPORT V3d_TypeOfBackfacingModel BackFacingModel() const;
885 //! Adds clip plane to the view. The composition of clip planes truncates the
886 //! rendering space to convex volume. Number of supported clip planes can be consulted
887 //! by PlaneLimit method of associated Graphic3d_GraphicDriver.
888 //! Please be aware that the planes which exceed the limit are ignored during rendering.
889 //! @param thePlane [in] the clip plane to be added to view.
890 Standard_EXPORT virtual void AddClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane);
892 //! Removes clip plane from the view.
893 //! @param thePlane [in] the clip plane to be removed from view.
894 Standard_EXPORT virtual void RemoveClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane);
897 //! @return sequence clip planes that have been set for the view
898 Standard_EXPORT const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const;
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);
909 //! Returns the MAX number of clipping planes associated to the view.
910 Standard_EXPORT Standard_Integer PlaneLimit() const;
912 //! Change camera used by view.
913 Standard_EXPORT void SetCamera (const Handle(Graphic3d_Camera)& theCamera);
915 //! Returns camera object of the view.
916 //! @return: handle to camera object, or NULL if 3D view does not use
917 //! the camera approach.
918 Standard_EXPORT const Handle(Graphic3d_Camera)& Camera() const;
920 //! Return default camera.
921 const Handle(Graphic3d_Camera)& DefaultCamera() const { return myDefaultCamera; }
923 //! Returns current rendering parameters and effect settings.
924 //! By default it returns default parameters of current viewer.
925 //! To define view-specific settings use method V3d_View::ChangeRenderingParams().
926 //! @sa V3d_Viewer::DefaultRenderingParams()
927 Standard_EXPORT const Graphic3d_RenderingParams& RenderingParams() const;
929 //! Returns reference to current rendering parameters and effect settings.
930 Standard_EXPORT Graphic3d_RenderingParams& ChangeRenderingParams();
932 //! @return flag value of objects culling mechanism
933 Standard_Boolean IsCullingEnabled() const { return RenderingParams().FrustumCullingState == Graphic3d_RenderingParams::FrustumCulling_On; }
935 //! Turn on/off automatic culling of objects outside frustum (ON by default)
936 void SetFrustumCulling (Standard_Boolean theMode) { ChangeRenderingParams().FrustumCullingState = theMode ? Graphic3d_RenderingParams::FrustumCulling_On : Graphic3d_RenderingParams::FrustumCulling_Off; }
938 //! Fill in the dictionary with diagnostic info.
939 //! Should be called within rendering thread.
941 //! This API should be used only for user output or for creating automated reports.
942 //! The format of returned information (e.g. key-value layout)
943 //! is NOT part of this API and can be changed at any time.
944 //! Thus application should not parse returned information to weed out specific parameters.
945 //! @param theDict destination map for information
946 //! @param theFlags defines the information to be retrieved
947 Standard_EXPORT void DiagnosticInformation (TColStd_IndexedDataMapOfStringString& theDict,
948 Graphic3d_DiagnosticInfo theFlags) const;
950 //! Returns string with statistic performance info.
951 Standard_EXPORT TCollection_AsciiString StatisticInformation() const;
953 //! Fills in the dictionary with statistic performance info.
954 Standard_EXPORT void StatisticInformation (TColStd_IndexedDataMapOfStringString& theDict) const;
956 //! Returns the Objects number and the gravity center of ALL viewable points in the view
957 Standard_EXPORT gp_Pnt GravityPoint() const;
959 //! Dumps the content of me into the stream
960 Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
962 DEFINE_STANDARD_RTTIEXT(V3d_View,Standard_Transient)
964 public: //! @name deprecated methods
966 //! Returns True if One light more can be
967 //! activated in this View.
968 Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
969 Standard_EXPORT Standard_Boolean IfMoreLights() const;
971 //! initializes an iteration on the active Lights.
972 Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
973 void InitActiveLights() { myActiveLightsIterator.Initialize (myActiveLights); }
975 //! returns true if there are more active Light(s) to return.
976 Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
977 Standard_Boolean MoreActiveLights() const { return myActiveLightsIterator.More(); }
979 //! Go to the next active Light (if there is not, ActiveLight will raise an exception)
980 Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
981 void NextActiveLights() { myActiveLightsIterator.Next(); }
983 Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
984 const Handle(V3d_Light)& ActiveLight() const { return myActiveLightsIterator.Value(); }
988 Standard_EXPORT void ImmediateUpdate() const;
990 //! Scales camera to fit the view frame of defined width and height
991 //! keeping the aspect. For orthogonal camera the method changes scale,
992 //! for perspective adjusts Eye location about the Center point.
993 //! @param theSizeXv [in] size of viewport frame on "x" axis.
994 //! @param theSizeYv [in] size of viewport frame on "y" axis.
995 Standard_EXPORT void Scale (const Handle(Graphic3d_Camera)& theCamera, const Standard_Real theSizeXv, const Standard_Real theSizeYv) const;
997 Standard_EXPORT void Translate (const Handle(Graphic3d_Camera)& theCamera, const Standard_Real theDXv, const Standard_Real theDYv) const;
1001 //! Modifies the aspect ratio of the camera when
1002 //! the associated window is defined or resized.
1003 Standard_EXPORT void SetRatio();
1005 //! Determines the screen axes in the reference
1006 //! framework of the view.
1007 Standard_EXPORT static Standard_Boolean screenAxis (const gp_Dir& theVpn, const gp_Dir& theVup,
1008 gp_Vec& theXaxe, gp_Vec& theYaxe, gp_Vec& theZaxe);
1010 //! Transforms the Vertex V according to the matrice Matrix .
1011 Standard_EXPORT static gp_XYZ TrsPoint (const Graphic3d_Vertex& V, const TColStd_Array2OfReal& Matrix);
1013 //! Returns the objects number and the projection window
1014 //! of the objects contained in the view.
1015 Standard_EXPORT Standard_Integer MinMax (Standard_Real& Umin, Standard_Real& Vmin, Standard_Real& Umax, Standard_Real& Vmax) const;
1017 //! Returns the objects number and the box encompassing
1018 //! the objects contained in the view
1019 Standard_EXPORT Standard_Integer MinMax (Standard_Real& Xmin, Standard_Real& Ymin, Standard_Real& Zmin, Standard_Real& Xmax, Standard_Real& Ymax, Standard_Real& Zmax) const;
1021 Standard_EXPORT void Init();
1023 //! Returns a new vertex when the grid is activated.
1024 Standard_EXPORT Graphic3d_Vertex Compute (const Graphic3d_Vertex& AVertex) const;
1028 Standard_Real myOldMouseX;
1029 Standard_Real myOldMouseY;
1030 gp_Dir myCamStartOpUp;
1031 gp_Dir myCamStartOpDir;
1032 gp_Pnt myCamStartOpEye;
1033 gp_Pnt myCamStartOpCenter;
1034 Handle(Graphic3d_Camera) myDefaultCamera;
1035 Handle(Graphic3d_CView) myView;
1036 Standard_Boolean myImmediateUpdate;
1037 mutable Standard_Boolean myIsInvalidatedImmediate;
1041 V3d_ViewerPointer MyViewer;
1042 V3d_ListOfLight myActiveLights;
1043 gp_Dir myDefaultViewAxis;
1044 gp_Pnt myDefaultViewPoint;
1045 Handle(Aspect_Window) MyWindow;
1046 V3d_ListOfLight::Iterator myActiveLightsIterator;
1047 Standard_Integer sx;
1048 Standard_Integer sy;
1051 gp_Pnt myRotateGravity;
1052 Standard_Boolean myComputedMode;
1053 Standard_Boolean SwitchSetFront;
1054 Standard_Boolean myZRotation;
1055 Standard_Integer MyZoomAtPointX;
1056 Standard_Integer MyZoomAtPointY;
1057 Handle(V3d_Trihedron) myTrihedron;
1058 Handle(Aspect_Grid) MyGrid;
1060 TColStd_Array2OfReal MyTrsf;
1061 Handle(Graphic3d_Structure) MyGridEchoStructure;
1062 Handle(Graphic3d_Group) MyGridEchoGroup;
1063 gp_Vec myXscreenAxis;
1064 gp_Vec myYscreenAxis;
1065 gp_Vec myZscreenAxis;
1067 Graphic3d_Vertex myGravityReferencePoint;
1068 Standard_Boolean myAutoZFitIsOn;
1069 Standard_Real myAutoZFitScaleFactor;
1073 #endif // _V3d_View_HeaderFile