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 <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Real.hxx>
26 #include <Graphic3d_Camera.hxx>
27 #include <V3d_ViewerPointer.hxx>
28 #include <V3d_ListOfTransient.hxx>
29 #include <Visual3d_ContextView.hxx>
30 #include <Aspect_Background.hxx>
31 #include <Aspect_GradientBackground.hxx>
32 #include <Graphic3d_Vector.hxx>
33 #include <Graphic3d_Vertex.hxx>
34 #include <TColStd_ListIteratorOfListOfTransient.hxx>
35 #include <Standard_Integer.hxx>
36 #include <Standard_Boolean.hxx>
38 #include <TColStd_Array2OfReal.hxx>
39 #include <MMgt_TShared.hxx>
40 #include <V3d_Viewer.hxx>
41 #include <V3d_TypeOfView.hxx>
42 #include <Aspect_RenderingContext.hxx>
43 #include <Aspect_GraphicCallbackProc.hxx>
44 #include <Standard_Address.hxx>
45 #include <Quantity_TypeOfColor.hxx>
46 #include <Quantity_Parameter.hxx>
47 #include <Quantity_NameOfColor.hxx>
48 #include <Aspect_GradientFillMethod.hxx>
49 #include <Standard_CString.hxx>
50 #include <Aspect_FillMethod.hxx>
51 #include <V3d_Coordinate.hxx>
52 #include <V3d_TypeOfShadingModel.hxx>
53 #include <V3d_TypeOfSurfaceDetail.hxx>
54 #include <V3d_TypeOfVisualization.hxx>
55 #include <Quantity_Length.hxx>
56 #include <V3d_TypeOfZclipping.hxx>
57 #include <Aspect_TypeOfTriedronPosition.hxx>
58 #include <Aspect_TypeOfTriedronEcho.hxx>
59 #include <Graphic3d_GraduatedTrihedron.hxx>
60 #include <Quantity_PlaneAngle.hxx>
61 #include <V3d_TypeOfAxe.hxx>
62 #include <Quantity_Factor.hxx>
63 #include <V3d_TypeOfOrientation.hxx>
64 #include <Quantity_Coefficient.hxx>
65 #include <Quantity_Ratio.hxx>
66 #include <Graphic3d_BufferType.hxx>
67 #include <Aspect_Handle.hxx>
68 #include <Aspect_PrintAlgo.hxx>
69 #include <Image_PixMap.hxx>
70 #include <V3d_StereoDumpOptions.hxx>
71 #include <V3d_TypeOfBackfacingModel.hxx>
72 #include <Graphic3d_ClipPlane.hxx>
73 #include <Graphic3d_SequenceOfHClipPlane.hxx>
74 #include <Graphic3d_RenderingParams.hxx>
79 class Graphic3d_Structure;
80 class Graphic3d_Group;
82 class Standard_TypeMismatch;
83 class Standard_MultiplyDefined;
87 class Graphic3d_TextureEnv;
89 class Aspect_ColorScale;
91 class Aspect_GradientBackground;
93 class Graphic3d_Vector;
98 DEFINE_STANDARD_HANDLE(V3d_View, MMgt_TShared)
100 //! Defines the application object VIEW for the
101 //! VIEWER application.
102 //! The methods of this class allow the editing
103 //! and inquiring the parameters linked to the view.
104 //! (Projection,Mapping,Zclipping,DepthCueing,AntiAliasing
105 //! et Conversions) .
106 //! Provides a set of services common to all types of view.
107 //! Warning: The default parameters are defined by the class
108 //! Viewer (Example : SetDefaultViewSize()).
109 //! Certain methods are mouse oriented, and it is
110 //! necessary to know the difference between the start and
111 //! the continuation of this gesture in putting the method
113 //! Example : Shifting the eye-view along the screen axes.
115 //! View->Move(10.,20.,0.,True) (Starting motion)
116 //! View->Move(15.,-5.,0.,False) (Next motion)
117 class V3d_View : public MMgt_TShared
123 //! Initializes the view.
124 Standard_EXPORT V3d_View(const Handle(V3d_Viewer)& VM, const V3d_TypeOfView Type = V3d_ORTHOGRAPHIC);
126 //! Initializes the view by copying.
127 Standard_EXPORT V3d_View(const Handle(V3d_Viewer)& theVM, const Handle(V3d_View)& theView);
129 //! Activates the view in the window specified and Map the
130 //! Window to the screen.
131 //! Warning! raises MultiplyDefined from Standard
132 //! if the view is already activated in a window.
133 //! Warning: The view is centered and resized to preserve
134 //! the height/width ratio of the window.
135 Standard_EXPORT void SetWindow (const Handle(Aspect_Window)& IdWin);
137 //! Activates the view in the specified Window
138 //! If <aContext> is not NULL the graphic context is used
139 //! to draw something in this view.
140 //! Otherwise an internal graphic context is created.
141 //! If <aDisplayCB> is not NULL then a user display CB is
142 //! call at the end of the OCC graphic traversal and just
143 //! before the swap of buffers. The <aClientData> is pass
144 //! to this call back.
145 //! Warning! raises MultiplyDefined from Standard
146 //! if the view is already activated in a window.
147 //! Warning: The view is centered and resized to preserve
148 //! the height/width ratio of the window.
149 Standard_EXPORT void SetWindow (const Handle(Aspect_Window)& aWindow, const Aspect_RenderingContext aContext, const Aspect_GraphicCallbackProc& aDisplayCB, const Standard_Address aClientData);
151 Standard_EXPORT void SetMagnify (const Handle(Aspect_Window)& IdWin, const Handle(V3d_View)& aPreviousView, const Standard_Integer x1, const Standard_Integer y1, const Standard_Integer x2, const Standard_Integer y2);
153 //! Destroys the view.
154 Standard_EXPORT void Remove() const;
156 //! Deprecated, Redraw() should be used instead.
157 Standard_EXPORT void Update() const;
159 //! Redisplays the view even if there has not
160 //! been any modification.
161 //! Must be called if the view is shown.
162 //! (Ex: DeIconification ) .
163 Standard_EXPORT void Redraw() const;
165 //! Updates layer of immediate presentations.
166 Standard_EXPORT void RedrawImmediate() const;
168 //! Invalidates view content but does not redraw it.
169 Standard_EXPORT void Invalidate() const;
171 //! Redisplays the view area after esxposure.
172 //! [x,y] define the min xy area position
173 //! [width,height] the size of the area in pixel unit.
174 Standard_EXPORT void Redraw (const Standard_Integer x, const Standard_Integer y, const Standard_Integer width, const Standard_Integer height) const;
176 //! Must be called when the window supporting the
177 //! view changes size.
178 //! if the view is not mapped on a window.
179 //! Warning: The view is centered and resized to preserve
180 //! the height/width ratio of the window.
181 Standard_EXPORT void MustBeResized();
183 //! Must be called when the window supporting the
184 //! view is mapped or unmapped.
185 Standard_EXPORT void DoMapping();
187 //! Returns the status of the view regarding
188 //! the displayed structures inside
189 //! Returns True is The View is empty
190 Standard_EXPORT Standard_Boolean IsEmpty() const;
192 //! Updates the lights of the view. The view is redrawn.
193 Standard_EXPORT void UpdateLights() const;
195 //! If automatic z-range fitting is turned on, adjusts Z-min and Z-max
196 //! projection volume planes with call to ZFitAll.
197 Standard_EXPORT void AutoZFit();
199 //! Change Z-min and Z-max planes of projection volume to match the
200 //! displayed objects.
201 Standard_EXPORT void ZFitAll (const Standard_Real theScaleFactor = 1.0);
203 //! Defines the background colour of the view
205 //! the colour definition type,
206 //! and the three corresponding values.
207 Standard_EXPORT void SetBackgroundColor (const Quantity_TypeOfColor Type, const Quantity_Parameter V1, const Quantity_Parameter V2, const Quantity_Parameter V3);
209 //! Defines the background colour of the view
211 //! the colour object.
212 Standard_EXPORT void SetBackgroundColor (const Quantity_Color& Color);
214 //! Defines the background colour of the view
216 //! the colour name in the form Quantity_NOC_xxxx .
217 Standard_EXPORT void SetBackgroundColor (const Quantity_NameOfColor Name);
219 //! Defines the gradient background colours of the view
221 //! two colour objects,
222 //! and fill method (horizontal by default)
223 Standard_EXPORT void SetBgGradientColors (const Quantity_Color& Color1, const Quantity_Color& Color2, const Aspect_GradientFillMethod FillStyle = Aspect_GFM_HOR, const Standard_Boolean update = Standard_False);
225 //! Defines the gradient background colours of the view
227 //! two colour names in the form Quantity_NOC_xxxx,
228 //! and fill method (horizontal by default)
229 Standard_EXPORT void SetBgGradientColors (const Quantity_NameOfColor Color1, const Quantity_NameOfColor Color2, const Aspect_GradientFillMethod FillStyle = Aspect_GFM_HOR, const Standard_Boolean update = Standard_False);
231 //! Defines the gradient background fill method of the view
232 Standard_EXPORT void SetBgGradientStyle (const Aspect_GradientFillMethod AMethod = Aspect_GFM_HOR, const Standard_Boolean update = Standard_False);
234 //! Defines the background texture of the view
236 //! texture image file name,
237 //! and fill method (centered by default)
238 Standard_EXPORT void SetBackgroundImage (const Standard_CString FileName, const Aspect_FillMethod FillStyle = Aspect_FM_CENTERED, const Standard_Boolean update = Standard_False);
240 //! Defines the textured background fill method of the view
241 Standard_EXPORT void SetBgImageStyle (const Aspect_FillMethod FillStyle, const Standard_Boolean update = Standard_False);
243 //! Definition of an axis from its origin and
244 //! its orientation .
245 //! This will be the current axis for rotations and movements.
246 //! Warning! raises BadValue from V3d if the vector normal is NULL. .
247 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);
249 //! Defines the shading model for the
250 //! visualisation ZBUFFER mode.
251 //! Various models are available.
252 Standard_EXPORT void SetShadingModel (const V3d_TypeOfShadingModel Model);
254 //! select the kind of rendering for texture mapping
255 //! no texture mapping by default
256 Standard_EXPORT void SetSurfaceDetail (const V3d_TypeOfSurfaceDetail SurfaceDetail);
258 //! set the environment texture to use
259 //! no environment texture by default
260 Standard_EXPORT void SetTextureEnv (const Handle(Graphic3d_TextureEnv)& ATexture);
262 //! Defines the visualisation mode in the view.
263 Standard_EXPORT void SetVisualization (const V3d_TypeOfVisualization Mode);
265 //! Activates antialiasing in the view.
266 Standard_EXPORT void SetAntialiasingOn();
268 //! Desactivates antialiasing in the view.
269 Standard_EXPORT void SetAntialiasingOff();
271 //! Defines the depth of the medium clipping plane.
272 Standard_EXPORT void SetZClippingDepth (const Quantity_Length Depth);
274 //! Defines the thicknes around the medium clippling plane. .
275 Standard_EXPORT void SetZClippingWidth (const Quantity_Length Width);
277 //! Defines the type of ZClipping.
278 Standard_EXPORT void SetZClippingType (const V3d_TypeOfZclipping Type);
280 //! Defines the depth of the medium plane.
281 Standard_EXPORT void SetZCueingDepth (const Quantity_Length Depth);
283 //! Defines the thickness around the medium plane.
284 Standard_EXPORT void SetZCueingWidth (const Quantity_Length Width);
286 //! Activates ZCueing in the view.
287 Standard_EXPORT void SetZCueingOn();
289 //! Desactivates ZCueing in the view.
290 Standard_EXPORT void SetZCueingOff();
292 //! Activates MyLight in the view.
293 Standard_EXPORT void SetLightOn (const Handle(V3d_Light)& MyLight);
295 //! Activates all the lights defined in this view.
296 Standard_EXPORT void SetLightOn();
298 //! Desactivate MyLight in this view.
299 Standard_EXPORT void SetLightOff (const Handle(V3d_Light)& MyLight);
301 //! Deactivate all the Lights defined in this view.
302 Standard_EXPORT void SetLightOff();
304 //! Returns TRUE when the light is active in this view.
305 Standard_EXPORT Standard_Boolean IsActiveLight (const Handle(V3d_Light)& aLight) const;
307 //! sets the immediate update mode and returns the previous one.
308 Standard_EXPORT Standard_Boolean SetImmediateUpdate (const Standard_Boolean theImmediateUpdate);
310 //! Customization of the ZBUFFER Triedron.
311 //! XColor,YColor,ZColor - colors of axis
312 //! SizeRatio - ratio of decreasing of the trihedron size when its phisical
313 //! position comes out of the view
314 //! AxisDiametr - diameter relatively to axis length
315 //! NbFacettes - number of facettes of cylinders and cones
316 Standard_EXPORT void ZBufferTriedronSetup (const Quantity_NameOfColor XColor = Quantity_NOC_RED, const Quantity_NameOfColor YColor = Quantity_NOC_GREEN, const Quantity_NameOfColor ZColor = Quantity_NOC_BLUE1, const Standard_Real SizeRatio = 0.8, const Standard_Real AxisDiametr = 0.05, const Standard_Integer NbFacettes = 12);
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 APosition = Aspect_TOTP_CENTER, const Quantity_NameOfColor AColor = Quantity_NOC_WHITE, const Standard_Real AScale = 0.02, const V3d_TypeOfVisualization AMode = V3d_WIREFRAME);
323 //! Erases the Triedron.
324 Standard_EXPORT void TriedronErase();
326 //! Highlights the echo zone of the Triedron.
327 Standard_EXPORT void TriedronEcho (const Aspect_TypeOfTriedronEcho AType = Aspect_TOTE_NONE);
329 //! Returns data of a graduated trihedron.
330 Standard_EXPORT const Graphic3d_GraduatedTrihedron& GetGraduatedTrihedron() const;
332 //! Displays a graduated trihedron.
333 Standard_EXPORT void GraduatedTrihedronDisplay (const Graphic3d_GraduatedTrihedron& theTrigedronData);
335 //! Erases a graduated trihedron from the view.
336 Standard_EXPORT void GraduatedTrihedronErase();
338 Standard_EXPORT void SetLayerMgr (const Handle(V3d_LayerMgr)& aMgr);
340 Standard_EXPORT void ColorScaleDisplay();
342 Standard_EXPORT void ColorScaleErase();
344 Standard_EXPORT Standard_Boolean ColorScaleIsDisplayed() const;
346 Standard_EXPORT Handle(Aspect_ColorScale) ColorScale() const;
348 //! modify the Projection of the view perpendicularly to
349 //! the privileged plane of the viewer.
350 Standard_EXPORT void SetFront();
352 //! Rotates the eye about the coordinate system of
353 //! reference of the screen
354 //! for which the origin is the view point of the projection,
355 //! with a relative angular value in RADIANS with respect to
356 //! the initial position expressed by Start = Standard_True
357 //! Warning! raises BadValue from V3d
358 //! If the eye, the view point, or the high point are
359 //! aligned or confused.
360 Standard_EXPORT void Rotate (const Quantity_PlaneAngle Ax, const Quantity_PlaneAngle Ay, const Quantity_PlaneAngle Az, const Standard_Boolean Start = Standard_True);
362 //! Rotates the eye about the coordinate system of
363 //! reference of the screen
364 //! for which the origin is Gravity point {X,Y,Z},
365 //! with a relative angular value in RADIANS with respect to
366 //! the initial position expressed by Start = Standard_True
367 //! If the eye, the view point, or the high point are
368 //! aligned or confused.
369 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);
371 //! Rotates the eye about one of the coordinate axes of
372 //! of the view for which the origin is the Gravity point{X,Y,Z}
373 //! 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 V3d_Coordinate X, const V3d_Coordinate Y, const V3d_Coordinate Z, const Standard_Boolean Start = Standard_True);
378 //! Rotates the eye about one of the coordinate axes of
379 //! of the view for which the origin is the view point of the
380 //! projection with an relative angular value in RADIANS with
381 //! respect to the initial position expressed by
382 //! Start = Standard_True
383 Standard_EXPORT void Rotate (const V3d_TypeOfAxe Axe, const Quantity_PlaneAngle Angle, const Standard_Boolean Start = Standard_True);
385 //! Rotates the eye around the current axis a relative
386 //! angular value in RADIANS with respect to the initial
387 //! position expressed by Start = Standard_True
388 Standard_EXPORT void Rotate (const Quantity_PlaneAngle Angle, const Standard_Boolean Start = Standard_True);
390 //! Movement of the eye parallel to the coordinate system
391 //! of reference of the screen a distance relative to the
392 //! initial position expressed by Start = Standard_True.
393 Standard_EXPORT void Move (const Quantity_Length Dx, const Quantity_Length Dy, const Quantity_Length Dz, const Standard_Boolean Start = Standard_True);
395 //! Movement of the eye parallel to one of the axes of the
396 //! coordinate system of reference of the view a distance
397 //! relative to the initial position expressed by
398 //! Start = Standard_True.
399 Standard_EXPORT void Move (const V3d_TypeOfAxe Axe, const Quantity_Length Length, const Standard_Boolean Start = Standard_True);
401 //! Movement of the eye parllel to the current axis
402 //! a distance relative to the initial position
403 //! expressed by Start = Standard_True
404 Standard_EXPORT void Move (const Quantity_Length Length, const Standard_Boolean Start = Standard_True);
406 //! Movement of the ye and the view point parallel to the
407 //! frame of reference of the screen a distance relative
408 //! to the initial position expressed by
409 //! Start = Standard_True
410 Standard_EXPORT void Translate (const Quantity_Length Dx, const Quantity_Length Dy, const Quantity_Length Dz, const Standard_Boolean Start = Standard_True);
412 //! Movement of the eye and the view point parallel to one
413 //! of the axes of the fame of reference of the view a
414 //! distance relative to the initial position
415 //! expressed by Start = Standard_True
416 Standard_EXPORT void Translate (const V3d_TypeOfAxe Axe, const Quantity_Length Length, const Standard_Boolean Start = Standard_True);
418 //! Movement of the eye and view point parallel to
419 //! the current axis a distance relative to the initial
420 //! position expressed by Start = Standard_True
421 Standard_EXPORT void Translate (const Quantity_Length Length, const Standard_Boolean Start = Standard_True);
423 //! places the point of the view corresponding
424 //! at the pixel position x,y at the center of the window
425 //! and updates the view.
426 Standard_EXPORT void Place (const Standard_Integer theXp, const Standard_Integer theYp, const Quantity_Factor theZoomFactor = 1);
428 //! Rotation of the view point around the frame of reference
429 //! of the screen for which the origin is the eye of the
430 //! projection with a relative angular value in RADIANS
431 //! with respect to the initial position expressed by
432 //! Start = Standard_True
433 Standard_EXPORT void Turn (const Quantity_PlaneAngle Ax, const Quantity_PlaneAngle Ay, const Quantity_PlaneAngle Az, const Standard_Boolean Start = Standard_True);
435 //! Rotation of the view point around one of the axes of the
436 //! frame of reference of the view for which the origin is
437 //! the eye of the projection with an angular value in
438 //! RADIANS relative to the initial position expressed by
439 //! Start = Standard_True
440 Standard_EXPORT void Turn (const V3d_TypeOfAxe Axe, const Quantity_PlaneAngle Angle, const Standard_Boolean Start = Standard_True);
442 //! Rotation of the view point around the current axis an
443 //! angular value in RADIANS relative to the initial
444 //! position expressed by Start = Standard_True
445 Standard_EXPORT void Turn (const Quantity_PlaneAngle Angle, const Standard_Boolean Start = Standard_True);
447 //! Defines the angular position of the high point of
448 //! the reference frame of the view with respect to the
449 //! Y screen axis with an absolute angular value in
451 Standard_EXPORT void SetTwist (const Quantity_PlaneAngle Angle);
453 //! Defines the position of the eye..
454 Standard_EXPORT void SetEye (const V3d_Coordinate X, const V3d_Coordinate Y, const V3d_Coordinate Z);
456 //! Defines the Depth of the eye from the view point
457 //! without update the projection .
458 Standard_EXPORT void SetDepth (const Quantity_Length Depth);
460 //! Defines the orientation of the projection.
461 Standard_EXPORT void SetProj (const Quantity_Parameter Vx, const Quantity_Parameter Vy, const Quantity_Parameter Vz);
463 //! Defines the orientation of the projection .
464 Standard_EXPORT void SetProj (const V3d_TypeOfOrientation Orientation);
466 //! Defines the position of the view point.
467 Standard_EXPORT void SetAt (const V3d_Coordinate X, const V3d_Coordinate Y, const V3d_Coordinate Z);
469 //! Defines the orientation of the high point.
470 Standard_EXPORT void SetUp (const Quantity_Parameter Vx, const Quantity_Parameter Vy, const Quantity_Parameter Vz);
472 //! Defines the orientation(SO) of the high point.
473 Standard_EXPORT void SetUp (const V3d_TypeOfOrientation Orientation);
475 //! Saves the current state of the orientation of the view
476 //! which will be the return state at ResetViewOrientation.
477 Standard_EXPORT void SetViewOrientationDefault();
479 //! Resets the orientation of the view.
481 Standard_EXPORT void ResetViewOrientation();
483 //! Translates the center of the view along "x" and "y" axes of
484 //! view projection. Can be used to perform interactive panning operation.
485 //! In that case the DXv, DXy parameters specify panning relative to the
486 //! point where the operation is started.
487 //! @param theDXv [in] the relative panning on "x" axis of view projection, in view space coordinates.
488 //! @param theDYv [in] the relative panning on "y" axis of view projection, in view space coordinates.
489 //! @param theZoomFactor [in] the zooming factor.
490 //! @param theToStart [in] pass TRUE when starting panning to remember view
491 //! state prior to panning for relative arguments. If panning is started,
492 //! passing {0, 0} for {theDXv, theDYv} will return view to initial state.
493 //! Performs update of view.
494 Standard_EXPORT void Panning (const Standard_Real theDXv, const Standard_Real theDYv, const Quantity_Factor theZoomFactor = 1, const Standard_Boolean theToStart = Standard_True);
496 //! Relocates center of screen to the point, determined by
497 //! {Xp, Yp} pixel coordinates relative to the bottom-left corner of
498 //! screen. To calculate pixel coordinates for any point from world
499 //! coordinate space, it can be projected using "Project".
500 //! @param theXp [in] the x coordinate.
501 //! @param theYp [in] the y coordinate.
502 Standard_EXPORT void SetCenter (const Standard_Integer theXp, const Standard_Integer theYp);
504 //! Defines the view projection size in its maximum dimension,
505 //! keeping the inital height/width ratio unchanged.
506 Standard_EXPORT void SetSize (const Quantity_Length theSize);
508 //! Defines the Depth size of the view
509 //! Front Plane will be set to Size/2.
510 //! Back Plane will be set to -Size/2.
511 //! Any Object located Above the Front Plane or
512 //! behind the Back Plane will be Clipped .
513 //! NOTE than the XY Size of the View is NOT modified .
514 Standard_EXPORT void SetZSize (const Quantity_Length Size);
516 //! Zooms the view by a factor relative to the initial
517 //! value expressed by Start = Standard_True
518 //! Updates the view.
519 Standard_EXPORT void SetZoom (const Quantity_Factor Coef, const Standard_Boolean Start = Standard_True);
521 //! Zooms the view by a factor relative to the value
522 //! initialised by SetViewMappingDefault().
523 //! Updates the view.
524 Standard_EXPORT void SetScale (const Quantity_Factor Coef);
526 //! Sets anisotropic (axial) scale factors <Sx>, <Sy>, <Sz> for view <me>.
527 //! Anisotropic scaling operation is performed through multiplying
528 //! the current view orientation matrix by a scaling matrix:
533 //! Updates the view.
534 Standard_EXPORT void SetAxialScale (const Standard_Real Sx, const Standard_Real Sy, const Standard_Real Sz);
536 //! Adjust view parameters to fit the displayed scene, respecting height / width ratio.
537 //! The Z clipping range (depth range) is fitted if AutoZFit flag is TRUE.
538 //! Throws program error exception if margin coefficient is < 0 or >= 1.
539 //! Updates the view.
540 //! @param theMargin [in] the margin coefficient for view borders.
541 //! @param theToUpdate [in] flag to perform view update.
542 Standard_EXPORT void FitAll (const Quantity_Coefficient theMargin = 0.01, const Standard_Boolean theToUpdate = Standard_True);
544 //! Adjust view parameters to fit the displayed scene, respecting height / width ratio
545 //! according to the custom bounding box given.
546 //! Throws program error exception if margin coefficient is < 0 or >= 1.
547 //! Updates the view.
548 //! @param theBox [in] the custom bounding box to fit.
549 //! @param theMargin [in] the margin coefficient for view borders.
550 //! @param theToUpdate [in] flag to perform view update.
551 Standard_EXPORT void FitAll (const Bnd_Box& theBox, const Quantity_Coefficient theMargin = 0.01, const Standard_Boolean theToUpdate = Standard_True);
553 //! Adjusts the viewing volume so as not to clip the displayed objects by front and back
554 //! and back clipping planes. Also sets depth value automatically depending on the
555 //! calculated Z size and Aspect parameter.
556 //! NOTE than the original XY size of the view is NOT modified .
557 Standard_EXPORT void DepthFitAll (const Quantity_Coefficient Aspect = 0.01, const Quantity_Coefficient Margin = 0.01);
559 //! Centers the defined projection window so that it occupies
560 //! the maximum space while respecting the initial
561 //! height/width ratio.
562 //! NOTE than the original Z size of the view is NOT modified .
563 Standard_EXPORT void FitAll (const Standard_Real theMinXv, const Standard_Real theMinYv, const Standard_Real theMaxXv, const Standard_Real theMaxYv);
565 //! Centers the defined PIXEL window so that it occupies
566 //! the maximum space while respecting the initial height/width ratio.
567 //! NOTE than the original Z size of the view is NOT modified.
568 //! @param theMinXp [in] pixel coordinates of minimal corner on x screen axis.
569 //! @param theMinYp [in] pixel coordinates of minimal corner on y screen axis.
570 //! @param theMaxXp [in] pixel coordinates of maximal corner on x screen axis.
571 //! @param theMaxYp [in] pixel coordinates of maximal corner on y screen axis.
572 Standard_EXPORT void WindowFit (const Standard_Integer theMinXp, const Standard_Integer theMinYp, const Standard_Integer theMaxXp, const Standard_Integer theMaxYp);
574 //! Saves the current view mapping. This will be the
575 //! state returned from ResetViewmapping.
576 Standard_EXPORT void SetViewMappingDefault();
578 //! Resets the centering of the view.
580 Standard_EXPORT void ResetViewMapping();
582 //! Resets the centering and the orientation of the view
584 Standard_EXPORT void Reset (const Standard_Boolean update = Standard_True);
586 //! Converts the PIXEL value
587 //! to a value in the projection plane.
588 Standard_EXPORT Quantity_Length Convert (const Standard_Integer Vp) const;
590 //! Converts the point PIXEL into a point projected
591 //! in the reference frame of the projection plane.
592 Standard_EXPORT void Convert (const Standard_Integer Xp, const Standard_Integer Yp, V3d_Coordinate& Xv, V3d_Coordinate& Yv) const;
594 //! Converts tha value of the projection plane into
596 Standard_EXPORT Standard_Integer Convert (const Quantity_Length Vv) const;
598 //! Converts the point defined in the reference frame
599 //! of the projection plane into a point PIXEL.
600 Standard_EXPORT void Convert (const V3d_Coordinate Xv, const V3d_Coordinate Yv, Standard_Integer& Xp, Standard_Integer& Yp) const;
602 //! Converts the projected point into a point
603 //! in the reference frame of the view corresponding
604 //! to the intersection with the projection plane
605 //! of the eye/view point vector.
606 Standard_EXPORT void Convert (const Standard_Integer Xp, const Standard_Integer Yp, V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z) const;
608 //! Converts the projected point into a point
609 //! in the reference frame of the view corresponding
610 //! to the intersection with the projection plane
611 //! of the eye/view point vector and returns the
612 //! projection ray for further computations.
613 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;
615 //! Converts the projected point into the nearest grid point
616 //! in the reference frame of the view corresponding
617 //! to the intersection with the projection plane
618 //! of the eye/view point vector and display the grid marker.
619 //! Warning: When the grid is not active the result is identical to the above Convert() method.
621 //! 1) Enable the grid echo display
622 //! myViewer->SetGridEcho(Standard_True);
623 //! 2) When application receive a move event:
624 //! 2.1) Check if any object is detected
625 //! if( myInteractiveContext->MoveTo(x,y) == AIS_SOD_Nothing ) {
626 //! 2.2) Check if the grid is active
627 //! if( myViewer->Grid()->IsActive() ) {
628 //! 2.3) Display the grid echo and gets the grid point
629 //! myView->ConvertToGrid(x,y,X,Y,Z);
630 //! myView->Viewer()->ShowGridEcho (myView, Graphic3d_Vertex (X,Y,Z));
631 //! myView->RedrawImmediate();
632 //! 2.4) Else this is the standard case
633 //! } else myView->Convert(x,y,X,Y,Z);
634 Standard_EXPORT void ConvertToGrid (const Standard_Integer Xp, const Standard_Integer Yp, V3d_Coordinate& Xg, V3d_Coordinate& Yg, V3d_Coordinate& Zg) const;
636 //! Converts the point into the nearest grid point
637 //! and display the grid marker.
638 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;
640 //! Projects the point defined in the reference frame of
641 //! the view into the projected point in the associated window.
642 Standard_EXPORT void Convert (const V3d_Coordinate X, const V3d_Coordinate Y, const V3d_Coordinate Z, Standard_Integer& Xp, Standard_Integer& Yp) const;
644 //! Converts the point defined in the user space of
645 //! the view to the projected view plane point at z 0.
646 Standard_EXPORT void Project (const V3d_Coordinate X, const V3d_Coordinate Y, const V3d_Coordinate Z, V3d_Coordinate& Xp, V3d_Coordinate& Yp) const;
648 //! Returns the Background color values of the view
649 //! depending of the color Type.
650 Standard_EXPORT void BackgroundColor (const Quantity_TypeOfColor Type, Quantity_Parameter& V1, Quantity_Parameter& V2, Quantity_Parameter& V3) const;
652 //! Returns the Background color object of the view.
653 Standard_EXPORT Quantity_Color BackgroundColor() const;
655 //! Returns the gradient background colour objects of the view.
656 Standard_EXPORT void GradientBackgroundColors (Quantity_Color& Color1, Quantity_Color& Color2) const;
658 //! Returns the gradient background of the view.
659 Standard_EXPORT Aspect_GradientBackground GradientBackground() const;
661 //! Returns the current value of the zoom expressed with
662 //! respect to SetViewMappingDefault().
663 Standard_EXPORT Quantity_Factor Scale() const;
665 //! Returns the current values of the anisotropic (axial) scale factors.
666 Standard_EXPORT void AxialScale (Standard_Real& Sx, Standard_Real& Sy, Standard_Real& Sz) const;
668 //! Returns the height and width of the view.
669 Standard_EXPORT void Size (Quantity_Length& Width, Quantity_Length& Height) const;
671 //! Returns the Depth of the view .
672 Standard_EXPORT Standard_Real ZSize() const;
674 //! Returns the position of the eye.
675 Standard_EXPORT void Eye (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z) const;
677 //! Returns the position of point which emanating the
679 Standard_EXPORT void FocalReferencePoint (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z) const;
681 //! Returns the coordinate of the point (Xpix,Ypix)
682 //! in the view (XP,YP,ZP), and the projection vector of the
683 //! view passing by the point (for PerspectiveView).
684 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;
686 //! Returns the Distance between the Eye and View Point.
687 Standard_EXPORT Quantity_Length Depth() const;
689 //! Returns the projection vector.
690 Standard_EXPORT void Proj (Quantity_Parameter& Vx, Quantity_Parameter& Vy, Quantity_Parameter& Vz) const;
692 //! Returns the position of the view point.
693 Standard_EXPORT void At (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z) const;
695 //! Returns the vector giving the position of the high point.
696 Standard_EXPORT void Up (Quantity_Parameter& Vx, Quantity_Parameter& Vy, Quantity_Parameter& Vz) const;
698 //! Returns in RADIANS the orientation of the view around
699 //! the visual axis measured from the Y axis of the screen.
700 Standard_EXPORT Quantity_PlaneAngle Twist() const;
702 //! Returns the current shading model.
703 Standard_EXPORT V3d_TypeOfShadingModel ShadingModel() const;
705 Standard_EXPORT V3d_TypeOfSurfaceDetail SurfaceDetail() const;
707 Standard_EXPORT Handle(Graphic3d_TextureEnv) TextureEnv() const;
709 //! Returns the current visualisation mode.
710 Standard_EXPORT V3d_TypeOfVisualization Visualization() const;
712 //! Indicates if the antialiasing is active (True) or
713 //! inactive (False).
714 Standard_EXPORT Standard_Boolean Antialiasing() const;
716 //! Returns activity and information on the Zcueing.
717 //! <Depth> : Depth of plane.
718 //! <Width> : Thickness around the plane.
719 Standard_EXPORT Standard_Boolean ZCueing (Quantity_Length& Depth, Quantity_Length& Width) const;
721 //! Returns current information on the ZClipping.
722 //! <Depth> : Depth of plane.
723 //! <Width> : Thickness around the plane.
724 //! <TypeOfZclipping> : "BACK"
728 Standard_EXPORT V3d_TypeOfZclipping ZClipping (Quantity_Length& Depth, Quantity_Length& Width) const;
730 //! Returns True if One light more can be
731 //! activated in this View.
732 Standard_EXPORT Standard_Boolean IfMoreLights() const;
734 //! initializes an iteration on the active Lights.
735 Standard_EXPORT void InitActiveLights();
737 //! returns true if there are more active Light(s) to return.
738 Standard_EXPORT Standard_Boolean MoreActiveLights() const;
740 //! Go to the next active Light
741 //! (if there is not, ActiveLight will raise an exception)
742 Standard_EXPORT void NextActiveLights();
744 Standard_EXPORT Handle(V3d_Light) ActiveLight() const;
746 //! Returns the viewer in which the view has been created.
747 Standard_EXPORT Handle(V3d_Viewer) Viewer() const;
749 //! Returns True if MyView is associated with a window .
750 Standard_EXPORT Standard_Boolean IfWindow() const;
752 //! Returns the Aspect Window associated with the view.
753 Standard_EXPORT Handle(Aspect_Window) Window() const;
755 //! Returns the Type of the View
756 Standard_EXPORT V3d_TypeOfView Type() const;
758 //! Translates the center of the view along "x" and "y" axes of
759 //! view projection. Can be used to perform interactive panning operation.
760 //! In that case the DXp, DXp parameters specify panning relative to the
761 //! point where the operation is started.
762 //! @param theDXp [in] the relative panning on "x" axis of view projection, in pixels.
763 //! @param theDYp [in] the relative panning on "y" axis of view projection, in pixels.
764 //! @param theZoomFactor [in] the zooming factor.
765 //! @param theToStart [in] pass TRUE when starting panning to remember view
766 //! state prior to panning for relative arguments. Passing 0 for relative
767 //! panning parameter should return view panning to initial state.
768 //! Performs update of view.
769 Standard_EXPORT void Pan (const Standard_Integer theDXp, const Standard_Integer theDYp, const Quantity_Factor theZoomFactor = 1, const Standard_Boolean theToStart = Standard_True);
771 //! Zoom the view according to a zoom factor computed
772 //! from the distance between the 2 mouse position.
773 //! @param theXp1 [in] the x coordinate of first mouse position, in pixels.
774 //! @param theYp1 [in] the y coordinate of first mouse position, in pixels.
775 //! @param theXp2 [in] the x coordinate of second mouse position, in pixels.
776 //! @param theYp2 [in] the y coordinate of second mouse position, in pixels.
777 Standard_EXPORT void Zoom (const Standard_Integer theXp1, const Standard_Integer theYp1, const Standard_Integer theXp2, const Standard_Integer theYp2);
779 //! Defines starting point for ZoomAtPoint view operation.
780 //! @param theXp [in] the x mouse coordinate, in pixels.
781 //! @param theYp [in] the y mouse coordinate, in pixels.
782 Standard_EXPORT void StartZoomAtPoint (const Standard_Integer theXp, const Standard_Integer theYp);
784 //! Zooms the model at a pixel defined by the method StartZoomAtPoint().
785 Standard_EXPORT void ZoomAtPoint (const Standard_Integer theMouseStartX, const Standard_Integer theMouseStartY, const Standard_Integer theMouseEndX, const Standard_Integer theMouseEndY);
787 //! Performs anisotropic scaling of <me> view along the given <Axis>.
788 //! The scale factor is calculated on a basis of
789 //! the mouse pointer displacement <Dx,Dy>.
790 //! The calculated scale factor is then passed to SetAxialScale(Sx, Sy, Sz) method.
791 Standard_EXPORT void AxialScale (const Standard_Integer Dx, const Standard_Integer Dy, const V3d_TypeOfAxe Axis);
793 //! Begin the rotation of the view around the screen axis
794 //! according to the mouse position <X,Y>.
795 //! Warning: Enable rotation around the Z screen axis when <zRotationThreshold>
796 //! factor is > 0 soon the distance from the start point and the center
797 //! of the view is > (medium viewSize * <zRotationThreshold> ).
798 //! Generally a value of 0.4 is usable to rotate around XY screen axis
799 //! inside the circular threshold area and to rotate around Z screen axis
800 //! outside this area.
801 Standard_EXPORT void StartRotation (const Standard_Integer X, const Standard_Integer Y, const Quantity_Ratio zRotationThreshold = 0.0);
803 //! Continues the rotation of the view
804 //! with an angle computed from the last and new mouse position <X,Y>.
805 Standard_EXPORT void Rotation (const Standard_Integer X, const Standard_Integer Y);
807 //! Change View Plane Distance for Perspective Views
808 //! Warning! raises TypeMismatch from Standard if the view
809 //! is not a perspective view.
810 Standard_EXPORT void SetFocale (const Quantity_Length Focale);
812 //! Returns the View Plane Distance for Perspective Views
813 Standard_EXPORT Quantity_Length Focale() const;
815 //! Returns the associated Visual3d view.
816 Standard_EXPORT Handle(Visual3d_View) View() const;
818 //! Switches computed HLR mode in the view
819 Standard_EXPORT void SetComputedMode (const Standard_Boolean aMode);
821 //! Returns the computed HLR mode state
822 Standard_EXPORT Standard_Boolean ComputedMode() const;
824 //! idem than WindowFit
825 Standard_EXPORT void WindowFitAll (const Standard_Integer Xmin, const Standard_Integer Ymin, const Standard_Integer Xmax, const Standard_Integer Ymax);
827 //! Defines or Updates the definition of the
829 Standard_EXPORT void SetGrid (const gp_Ax3& aPlane, const Handle(Aspect_Grid)& aGrid);
831 //! Defines or Updates the graphic definition of the
833 Standard_EXPORT void SetGridGraphicValues (const Handle(Aspect_Grid)& aGrid);
835 //! Defines or Updates the activity of the
837 Standard_EXPORT void SetGridActivity (const Standard_Boolean aFlag);
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);
845 //! print the contents of the view to printer with preview.
846 //! <hPrnDC> : 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
850 //! <showDialog> : If hPrnDC == 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 <showDialog> to FALSE.
855 //! <showBackground> : 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 //! <filename>: If != NULL, then the view will be printed to a file.
859 //! <printAlgorithm>: 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 hPrnDC = 0, const Standard_Boolean showDialog = Standard_True, const Standard_Boolean showBackground = Standard_True, const Standard_CString filename = NULL, const Aspect_PrintAlgo printAlgorithm = Aspect_PA_STRETCH) const;
871 //! Dumps the full contents of the view
872 //! to a pixmap of pixel size <theWidth> * <theHeight> and
873 //! buffer type <theBufferType>. If <theToKeepAspect> is true
874 //! the aspect ratio of view will be kept if <theWidth> and <theHeight>
875 //! define another ratio.
876 //! Pixmap will be automatically (re)allocated when needed.
877 //! When dumping stereographic camera - the corresponding
878 //! middle-point monographic projection will be used for dumping by default.
879 //! <theStereoOptions> flags are to be used for dumping then left or
880 //! right eye projections.
881 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);
883 //! Manages display of the back faces
884 //! When <aModel> is TOBM_AUTOMATIC the object backfaces
885 //! are displayed only for surface objects and
886 //! never displayed for solid objects.
887 //! this was the previous mode.
888 //! <aModel> is TOBM_ALWAYS_DISPLAYED the object backfaces
889 //! are always displayed both for surfaces or solids.
890 //! <aModel> is TOBM_NEVER_DISPLAYED the object backfaces
891 //! are never displayed.
892 Standard_EXPORT void SetBackFacingModel (const V3d_TypeOfBackfacingModel aModel = V3d_TOBM_AUTOMATIC);
894 //! Returns current state of the back faces display
895 Standard_EXPORT V3d_TypeOfBackfacingModel BackFacingModel() const;
897 //! turns on/off opengl lighting, currently used in triedron displaying
898 Standard_EXPORT void EnableGLLight (const Standard_Boolean enable = Standard_True) const;
900 //! returns the current state of the gl lighting
901 //! currently used in triedron displaying
902 Standard_EXPORT Standard_Boolean IsGLLightEnabled() const;
904 //! Adds clip plane to the view. The composition of clip planes truncates the
905 //! rendering space to convex volume. Number of supported clip planes can be consulted
906 //! by PlaneLimit method of associated Visual3d_View. Please be aware that the planes
907 //! which exceed the limit are ignored during rendering.
908 //! @param thePlane [in] the clip plane to be added to view.
909 Standard_EXPORT virtual void AddClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane);
911 //! Removes clip plane from the view.
912 //! @param thePlane [in] the clip plane to be removed from view.
913 Standard_EXPORT virtual void RemoveClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane);
915 //! Sets sequence of clip planes to the view. The planes that have been set
916 //! before are removed from the view. The composition of clip planes
917 //! truncates the rendering space to convex volume. Number of supported
918 //! clip planes can be consulted by PlaneLimit method of associated
919 //! Visual3d_View. Please be aware that the planes which exceed the limit
920 //! are ignored during rendering.
921 //! @param thePlanes [in] the clip planes to set.
922 Standard_EXPORT void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes);
925 //! @return sequence clip planes that have been set for the view
926 Standard_EXPORT const Graphic3d_SequenceOfHClipPlane& GetClipPlanes() const;
928 //! Change camera used by view.
929 Standard_EXPORT void SetCamera (const Handle(Graphic3d_Camera)& theCamera);
931 //! Returns camera object of the view.
932 //! @return: handle to camera object, or NULL if 3D view does not use
933 //! the camera approach.
934 Standard_EXPORT const Handle(Graphic3d_Camera)& Camera() const;
936 //! Returns current rendering parameters and effect settings.
937 Standard_EXPORT const Graphic3d_RenderingParams& RenderingParams() const;
939 //! Returns reference to current rendering parameters and effect settings.
940 Standard_EXPORT Graphic3d_RenderingParams& ChangeRenderingParams();
942 //! @return flag value of objects culling mechanism
943 Standard_EXPORT Standard_Boolean IsCullingEnabled() const;
945 //! Turn on/off automatic culling of objects outside frustrum (ON by default)
946 Standard_EXPORT void SetFrustumCulling (const Standard_Boolean theMode);
950 //! Activates all of the views of a viewer attached
952 Standard_EXPORT void V3d_Viewer::SetViewOn();
954 //! Activates a particular view in the Viewer .
955 //! Must be call if the Window attached to the view
956 //! has been Deiconified .
957 Standard_EXPORT void V3d_Viewer::SetViewOn (const Handle(V3d_View)& View);
959 //! Deactivates all the views of a Viewer
960 //! attached to a window.
961 Standard_EXPORT void V3d_Viewer::SetViewOff();
963 //! Deactivates a particular view in the Viewer.
964 //! Must be call if the Window attached to the view
965 //! has been Iconified .
966 Standard_EXPORT void V3d_Viewer::SetViewOff (const Handle(V3d_View)& View);
969 DEFINE_STANDARD_RTTI(V3d_View,MMgt_TShared)
974 Standard_EXPORT void ImmediateUpdate() const;
976 //! Transform camera eye, center and scale to fit in the
977 //! passed bounding box specified in WCS.
978 //! @param theCamera [in] the camera.
979 //! @param theBox [in] the bounding box.
980 //! @param theMargin [in] the margin coefficient for view borders.
981 //! @param theResolution [in] the minimum size of projection of
982 //! bounding box in Xv or Yv direction when it considered to
983 //! be a thin plane or point (without a volume).
984 //! In this case only the center of camera is adjusted.
985 //! @param theToEnlargeIfLine [in] if passed TRUE - in cases when the
986 //! whole bounding box projected into thin line going along
987 //! Z-axis of screen, the view plane is enlarged such that
988 //! we see the whole line on rotation, otherwise only the
989 //! center of camera is adjusted.
990 //! @return TRUE if the fit all operation can be done.
991 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;
993 //! Scales camera to fit the view frame of defined width and height
994 //! keeping the aspect. For orthogonal camera the method changes scale,
995 //! for perspective adjusts Eye location about the Center point.
996 //! @param theSizeXv [in] size of viewport frame on "x" axis.
997 //! @param theSizeYv [in] size of viewport frame on "y" axis.
998 Standard_EXPORT void Scale (const Handle(Graphic3d_Camera)& theCamera, const Standard_Real theSizeXv, const Standard_Real theSizeYv) const;
1000 Standard_EXPORT void Translate (const Handle(Graphic3d_Camera)& theCamera, const Standard_Real theDXv, const Standard_Real theDYv) const;
1002 Standard_Real myOldMouseX;
1003 Standard_Real myOldMouseY;
1004 gp_Dir myCamStartOpUp;
1005 gp_Pnt myCamStartOpEye;
1006 Standard_Real myCamStartOpBnd[6];
1007 gp_Pnt myCamStartOpCenter;
1008 Handle(Graphic3d_Camera) myCamera;
1009 Handle(Visual3d_View) MyView;
1010 Standard_Boolean myImmediateUpdate;
1016 //! Change the scale factor and position of the view
1017 //! such as the bounding box <Umin, Vmin, Umax, Vmax> is contains
1019 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);
1021 //! Determines the screen axes in the reference
1022 //! framework of the view.
1023 Standard_EXPORT static Standard_Boolean ScreenAxis (const gp_Dir& Vpn, const gp_Dir& Vup, Graphic3d_Vector& Xaxe, Graphic3d_Vector& Yaxe, Graphic3d_Vector& Zaxe);
1025 //! Transforms the Vertex V according to the matrice Matrix .
1026 Standard_EXPORT static Graphic3d_Vertex TrsPoint (const Graphic3d_Vertex& V, const TColStd_Array2OfReal& Matrix);
1028 //! Returns the objects number and the projection window
1029 //! of the objects contained in the view.
1030 Standard_EXPORT Standard_Integer MinMax (V3d_Coordinate& Umin, V3d_Coordinate& Vmin, V3d_Coordinate& Umax, V3d_Coordinate& Vmax) const;
1032 //! Returns the objects number and the box encompassing
1033 //! the objects contained in the view
1034 Standard_EXPORT Standard_Integer MinMax (V3d_Coordinate& Xmin, V3d_Coordinate& Ymin, V3d_Coordinate& Zmin, V3d_Coordinate& Xmax, V3d_Coordinate& Ymax, V3d_Coordinate& Zmax) const;
1036 //! Returns the Objects number and the gravity center
1037 //! of ALL viewable points in the view
1038 Standard_EXPORT void Gravity (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z) const;
1040 Standard_EXPORT void Init();
1042 //! Returns a new vertex when the grid is activated.
1043 Standard_EXPORT Graphic3d_Vertex Compute (const Graphic3d_Vertex& AVertex) const;
1045 V3d_ViewerPointer MyViewer;
1046 V3d_ListOfTransient MyActiveLights;
1047 Visual3d_ContextView MyViewContext;
1048 Aspect_Background MyBackground;
1049 Aspect_GradientBackground MyGradientBackground;
1050 Graphic3d_Vector MyDefaultViewAxis;
1051 Graphic3d_Vertex MyDefaultViewPoint;
1052 Handle(Aspect_Window) MyWindow;
1053 TColStd_ListIteratorOfListOfTransient myActiveLightsIterator;
1054 Standard_Integer sx;
1055 Standard_Integer sy;
1061 Standard_Boolean myComputedMode;
1062 Standard_Boolean SwitchSetFront;
1063 Standard_Integer MyZoomAtPointX;
1064 Standard_Integer MyZoomAtPointY;
1065 Handle(Aspect_Grid) MyGrid;
1067 Handle(V3d_LayerMgr) MyLayerMgr;
1068 TColStd_Array2OfReal MyTrsf;
1069 Handle(Graphic3d_Structure) MyGridEchoStructure;
1070 Handle(Graphic3d_Group) MyGridEchoGroup;
1071 Graphic3d_Vector myXscreenAxis;
1072 Graphic3d_Vector myYscreenAxis;
1073 Graphic3d_Vector myZscreenAxis;
1074 Graphic3d_Vector myViewAxis;
1075 Graphic3d_Vertex myGravityReferencePoint;
1086 #endif // _V3d_View_HeaderFile