Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:30

0001 // Created on: 1992-01-15
0002 // Created by: GG
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _V3d_View_HeaderFile
0018 #define _V3d_View_HeaderFile
0019 
0020 #include <Graphic3d_ClipPlane.hxx>
0021 #include <Graphic3d_Texture2D.hxx>
0022 #include <Graphic3d_TypeOfShadingModel.hxx>
0023 #include <Image_PixMap.hxx>
0024 #include <Quantity_TypeOfColor.hxx>
0025 #include <V3d_ImageDumpOptions.hxx>
0026 #include <V3d_Viewer.hxx>
0027 #include <V3d_Trihedron.hxx>
0028 #include <V3d_TypeOfAxe.hxx>
0029 #include <V3d_TypeOfOrientation.hxx>
0030 #include <V3d_TypeOfView.hxx>
0031 #include <V3d_TypeOfVisualization.hxx>
0032 
0033 class Aspect_Grid;
0034 class Aspect_Window;
0035 class Graphic3d_Group;
0036 class Graphic3d_Structure;
0037 class Graphic3d_TextureEnv;
0038 
0039 DEFINE_STANDARD_HANDLE(V3d_View, Standard_Transient)
0040 
0041 //! Defines the application object VIEW for the
0042 //! VIEWER application.
0043 //! The methods of this class allow the editing
0044 //! and inquiring the parameters linked to the view.
0045 //! Provides a set of services common to all types of view.
0046 //! Warning: The default parameters are defined by the class
0047 //! Viewer (Example : SetDefaultViewSize()).
0048 //! Certain methods are mouse oriented, and it is
0049 //! necessary to know the difference between the start and
0050 //! the continuation of this gesture in putting the method
0051 //! into operation.
0052 //! Example : Shifting the eye-view along the screen axes.
0053 //!
0054 //! View->Move(10.,20.,0.,True)     (Starting motion)
0055 //! View->Move(15.,-5.,0.,False)    (Next motion)
0056 class V3d_View : public Standard_Transient
0057 {
0058   DEFINE_STANDARD_RTTIEXT(V3d_View, Standard_Transient)
0059 public:
0060 
0061   //! Initializes the view.
0062   Standard_EXPORT V3d_View (const Handle(V3d_Viewer)& theViewer, const V3d_TypeOfView theType = V3d_ORTHOGRAPHIC);
0063 
0064   //! Initializes the view by copying.
0065   Standard_EXPORT V3d_View (const Handle(V3d_Viewer)& theViewer, const Handle(V3d_View)& theView);
0066 
0067   //! Default destructor.
0068   Standard_EXPORT virtual ~V3d_View();
0069 
0070   //! Activates the view in the specified Window
0071   //! If <aContext> is not NULL the graphic context is used
0072   //! to draw something in this view.
0073   //! Otherwise an internal graphic context is created.
0074   //! Warning: The view is centered and resized to preserve
0075   //! the height/width ratio of the window.
0076   Standard_EXPORT void SetWindow (const Handle(Aspect_Window)& theWindow,
0077                                   const Aspect_RenderingContext theContext = NULL);
0078 
0079   //! Activates the view as subview of another view.
0080   //! @param[in] theParentView parent view to put subview into
0081   //! @param[in] theSize subview dimensions;
0082   //!                    values >= 2   define size in pixels,
0083   //!                    values <= 1.0 define size as a fraction of parent view
0084   //! @param[in] theCorner corner within parent view
0085   //! @param[in] theOffset offset from the corner;
0086   //!                      values >= 1   define offset in pixels,
0087   //!                      values <  1.0 define offset as a fraction of parent view
0088   //! @param[in] theMargins subview margins in pixels
0089   //!
0090   //! Example: to split parent view horizontally into 2 subview,
0091   //! define one subview with Size=(0.5,1.0),Offset=(0.0,0.0), and 2nd with Size=(0.5,1.0),Offset=(5.0,0.0);
0092   Standard_EXPORT void SetWindow (const Handle(V3d_View)& theParentView,
0093                                   const Graphic3d_Vec2d& theSize,
0094                                   Aspect_TypeOfTriedronPosition theCorner = Aspect_TOTP_LEFT_UPPER,
0095                                   const Graphic3d_Vec2d& theOffset = Graphic3d_Vec2d(),
0096                                   const Graphic3d_Vec2i& theMargins = Graphic3d_Vec2i());
0097 
0098   Standard_EXPORT void SetMagnify (const Handle(Aspect_Window)& theWindow,
0099                                    const Handle(V3d_View)& thePreviousView,
0100                                    const Standard_Integer theX1,
0101                                    const Standard_Integer theY1,
0102                                    const Standard_Integer theX2,
0103                                    const Standard_Integer theY2);
0104 
0105   //! Destroys the view.
0106   Standard_EXPORT void Remove();
0107 
0108   //! Deprecated, Redraw() should be used instead.
0109   Standard_EXPORT void Update() const;
0110 
0111   //! Redisplays the view even if there has not
0112   //! been any modification.
0113   //! Must be called if the view is shown.
0114   //! (Ex: DeIconification ) .
0115   Standard_EXPORT virtual void Redraw() const;
0116 
0117   //! Updates layer of immediate presentations.
0118   Standard_EXPORT virtual void RedrawImmediate() const;
0119 
0120   //! Invalidates view content but does not redraw it.
0121   Standard_EXPORT void Invalidate() const;
0122 
0123   //! Returns true if cached view content has been invalidated.
0124   Standard_EXPORT Standard_Boolean IsInvalidated() const;
0125 
0126   //! Returns true if immediate layer content has been invalidated.
0127   Standard_Boolean IsInvalidatedImmediate() const { return myIsInvalidatedImmediate; }
0128 
0129   //! Invalidates view content within immediate layer but does not redraw it.
0130   void InvalidateImmediate() { myIsInvalidatedImmediate = Standard_True; }
0131 
0132   //! Must be called when the window supporting the
0133   //! view changes size.
0134   //! if the view is not mapped on a window.
0135   //! Warning: The view is centered and resized to preserve
0136   //! the height/width ratio of the window.
0137   Standard_EXPORT void MustBeResized();
0138 
0139   //! Must be called when the window supporting the
0140   //! view is mapped or unmapped.
0141   Standard_EXPORT void DoMapping();
0142 
0143   //! Returns the status of the view regarding
0144   //! the displayed structures inside
0145   //! Returns True is The View is empty
0146   Standard_EXPORT Standard_Boolean IsEmpty() const;
0147 
0148   //! Updates the lights of the view.
0149   Standard_EXPORT void UpdateLights() const;
0150 
0151   //! Sets the automatic z-fit mode and its parameters.
0152   //! The auto z-fit has extra parameters which can controlled from application level
0153   //! to ensure that the size of viewing volume will be sufficiently large to cover
0154   //! the depth of unmanaged objects, for example, transformation persistent ones.
0155   //! @param theScaleFactor [in] the scale factor for Z-range.
0156   //! The range between Z-min, Z-max projection volume planes
0157   //! evaluated by z fitting method will be scaled using this coefficient.
0158   //! Program error exception is thrown if negative or zero value
0159   //! is passed.
0160   Standard_EXPORT void SetAutoZFitMode (const Standard_Boolean theIsOn, const Standard_Real theScaleFactor = 1.0);
0161 
0162   //! returns TRUE if automatic z-fit mode is turned on.
0163   Standard_Boolean AutoZFitMode() const { return myAutoZFitIsOn; }
0164 
0165   //! returns scale factor parameter of automatic z-fit mode.
0166   Standard_Real AutoZFitScaleFactor() const { return myAutoZFitScaleFactor; }
0167 
0168   //! If automatic z-range fitting is turned on, adjusts Z-min and Z-max
0169   //! projection volume planes with call to ZFitAll.
0170   Standard_EXPORT void AutoZFit() const;
0171 
0172   //! Change Z-min and Z-max planes of projection volume to match the
0173   //! displayed objects.
0174   Standard_EXPORT void ZFitAll (const Standard_Real theScaleFactor = 1.0) const;
0175 
0176 public:
0177 
0178   //! Defines the background color of the view by the color definition type and the three corresponding values.
0179   Standard_EXPORT void SetBackgroundColor (const Quantity_TypeOfColor theType,
0180                                            const Standard_Real theV1,
0181                                            const Standard_Real theV2,
0182                                            const Standard_Real theV3);
0183 
0184   //! Defines the background color of the view.
0185   Standard_EXPORT void SetBackgroundColor (const Quantity_Color& theColor);
0186 
0187   //! Defines the gradient background colors of the view by supplying the colors
0188   //! and the fill method (horizontal by default).
0189   Standard_EXPORT void SetBgGradientColors (const Quantity_Color& theColor1,
0190                                             const Quantity_Color& theColor2,
0191                                             const Aspect_GradientFillMethod theFillStyle = Aspect_GradientFillMethod_Horizontal,
0192                                             const Standard_Boolean theToUpdate = Standard_False);
0193 
0194   //! Defines the gradient background fill method of the view.
0195   Standard_EXPORT void SetBgGradientStyle (const Aspect_GradientFillMethod theMethod = Aspect_GradientFillMethod_Horizontal,
0196                                            const Standard_Boolean theToUpdate = Standard_False);
0197 
0198   //! Defines the background texture of the view by supplying the texture image file name
0199   //! and fill method (centered by default).
0200   Standard_EXPORT void SetBackgroundImage (const Standard_CString theFileName,
0201                                            const Aspect_FillMethod theFillStyle = Aspect_FM_CENTERED,
0202                                            const Standard_Boolean theToUpdate = Standard_False);
0203 
0204   //! Defines the background texture of the view by supplying the texture and fill method (centered by default)
0205   Standard_EXPORT void SetBackgroundImage (const Handle(Graphic3d_Texture2D)& theTexture,
0206                                            const Aspect_FillMethod theFillStyle = Aspect_FM_CENTERED,
0207                                            const Standard_Boolean theToUpdate = Standard_False);
0208 
0209   //! Defines the textured background fill method of the view.
0210   Standard_EXPORT void SetBgImageStyle (const Aspect_FillMethod theFillStyle,
0211                                         const Standard_Boolean theToUpdate = Standard_False);
0212 
0213   //! Sets environment cubemap as background.
0214   //! @param theCubeMap cubemap source to be set as background
0215   //! @param theToUpdatePBREnv defines whether IBL maps will be generated or not (see 'GeneratePBREnvironment')
0216   Standard_EXPORT void SetBackgroundCubeMap (const Handle(Graphic3d_CubeMap)& theCubeMap,
0217                                              Standard_Boolean                 theToUpdatePBREnv = Standard_True,
0218                                              Standard_Boolean                 theToUpdate = Standard_False);
0219 
0220   //! Returns skydome aspect;
0221   const Aspect_SkydomeBackground& BackgroundSkydome() const { return myView->BackgroundSkydome(); }
0222 
0223   //! Sets skydome aspect
0224   //! @param theAspect cubemap generation parameters
0225   //! @param theToUpdatePBREnv defines whether IBL maps will be generated or not
0226   Standard_EXPORT void SetBackgroundSkydome (const Aspect_SkydomeBackground& theAspect,
0227                                              Standard_Boolean theToUpdatePBREnv = Standard_True);
0228 
0229   //! Returns TRUE if IBL (Image Based Lighting) from background cubemap is enabled.
0230   Standard_EXPORT Standard_Boolean IsImageBasedLighting() const;
0231 
0232   //! Enables or disables IBL (Image Based Lighting) from background cubemap.
0233   //! Has no effect if PBR is not used.
0234   //! @param[in] theToEnableIBL enable or disable IBL from background cubemap
0235   //! @param[in] theToUpdate redraw the view
0236   Standard_EXPORT void SetImageBasedLighting (Standard_Boolean theToEnableIBL,
0237                                               Standard_Boolean theToUpdate = Standard_False);
0238 
0239   //! Activates IBL from background cubemap.
0240   void GeneratePBREnvironment (Standard_Boolean theToUpdate = Standard_False) { SetImageBasedLighting (Standard_True, theToUpdate); }
0241 
0242   //! Disables IBL from background cubemap; fills PBR specular probe and irradiance map with white color.
0243   void ClearPBREnvironment (Standard_Boolean theToUpdate = Standard_False) { SetImageBasedLighting (Standard_True, theToUpdate); }
0244 
0245   //! Sets the environment texture to use. No environment texture by default.
0246   Standard_EXPORT void SetTextureEnv (const Handle(Graphic3d_TextureEnv)& theTexture);
0247 
0248   //! Definition of an axis from its origin and
0249   //! its orientation .
0250   //! This will be the current axis for rotations and movements.
0251   //! Warning! raises BadValue from V3d if the vector normal is NULL. .
0252   Standard_EXPORT void SetAxis (const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
0253                                 const Standard_Real Vx, const Standard_Real Vy, const Standard_Real Vz);
0254 
0255 public:
0256 
0257   //! Defines the visualization type in the view.
0258   Standard_EXPORT void SetVisualization (const V3d_TypeOfVisualization theType);
0259 
0260   //! Activates theLight in the view.
0261   Standard_EXPORT void SetLightOn (const Handle(V3d_Light)& theLight);
0262 
0263   //! Activates all the lights defined in this view.
0264   Standard_EXPORT void SetLightOn();
0265 
0266   //! Deactivate theLight in this view.
0267   Standard_EXPORT void SetLightOff (const Handle(V3d_Light)& theLight);
0268 
0269   //! Deactivate all the Lights defined in this view.
0270   Standard_EXPORT void SetLightOff();
0271 
0272   //! Returns TRUE when the light is active in this view.
0273   Standard_EXPORT Standard_Boolean IsActiveLight (const Handle(V3d_Light)& theLight) const;
0274 
0275   //! sets the immediate update mode and returns the previous one.
0276   Standard_EXPORT Standard_Boolean SetImmediateUpdate (const Standard_Boolean theImmediateUpdate);
0277 
0278   //! Returns trihedron object.
0279   const Handle(V3d_Trihedron)& Trihedron (bool theToCreate = true)
0280   {
0281     if (myTrihedron.IsNull() && theToCreate)
0282     {
0283       myTrihedron = new V3d_Trihedron();
0284     }
0285     return myTrihedron;
0286   }
0287 
0288   //! Customization of the ZBUFFER Triedron.
0289   //! XColor,YColor,ZColor - colors of axis
0290   //! SizeRatio - ratio of decreasing of the trihedron size when its physical
0291   //! position comes out of the view
0292   //! AxisDiametr - diameter relatively to axis length
0293   //! NbFacettes - number of facets of cylinders and cones
0294   Standard_EXPORT void ZBufferTriedronSetup (const Quantity_Color& theXColor = Quantity_NOC_RED,
0295                                              const Quantity_Color& theYColor = Quantity_NOC_GREEN,
0296                                              const Quantity_Color& theZColor = Quantity_NOC_BLUE1,
0297                                              const Standard_Real theSizeRatio = 0.8,
0298                                              const Standard_Real theAxisDiametr = 0.05,
0299                                              const Standard_Integer theNbFacettes = 12);
0300 
0301   //! Display of the Triedron.
0302   //! Initialize position, color and length of Triedron axes.
0303   //! The scale is a percent of the window width.
0304   Standard_EXPORT void TriedronDisplay (const Aspect_TypeOfTriedronPosition thePosition = Aspect_TOTP_CENTER,
0305                                         const Quantity_Color& theColor = Quantity_NOC_WHITE,
0306                                         const Standard_Real theScale = 0.02,
0307                                         const V3d_TypeOfVisualization theMode = V3d_WIREFRAME);
0308 
0309   //! Erases the Triedron.
0310   Standard_EXPORT void TriedronErase();
0311 
0312   //! Returns data of a graduated trihedron.
0313   Standard_EXPORT const Graphic3d_GraduatedTrihedron& GetGraduatedTrihedron() const;
0314 
0315   //! Displays a graduated trihedron.
0316   Standard_EXPORT void GraduatedTrihedronDisplay (const Graphic3d_GraduatedTrihedron& theTrihedronData);
0317 
0318   //! Erases a graduated trihedron from the view.
0319   Standard_EXPORT void GraduatedTrihedronErase();
0320 
0321   //! modify the Projection of the view perpendicularly to
0322   //! the privileged plane of the viewer.
0323   Standard_EXPORT void SetFront();
0324 
0325   //! Rotates the eye about the coordinate system of
0326   //! reference of the screen
0327   //! for which the origin is the view point of the projection,
0328   //! with a relative angular value in RADIANS with respect to
0329   //! the initial position expressed by Start = Standard_True
0330   //! Warning! raises BadValue from V3d
0331   //! If the eye, the view point, or the high point are
0332   //! aligned or confused.
0333   Standard_EXPORT void Rotate (const Standard_Real Ax, const Standard_Real Ay, const Standard_Real Az, const Standard_Boolean Start = Standard_True);
0334 
0335   //! Rotates the eye about the coordinate system of
0336   //! reference of the screen
0337   //! for which the origin is Gravity point {X,Y,Z},
0338   //! with a relative angular value in RADIANS with respect to
0339   //! the initial position expressed by Start = Standard_True
0340   //! If the eye, the view point, or the high point are
0341   //! aligned or confused.
0342   Standard_EXPORT void Rotate (const Standard_Real Ax, const Standard_Real Ay, const Standard_Real Az,
0343                                const Standard_Real X,  const Standard_Real Y,  const Standard_Real Z,
0344                                const Standard_Boolean Start = Standard_True);
0345 
0346   //! Rotates the eye about one of the coordinate axes of
0347   //! of the view for which the origin is the Gravity point{X,Y,Z}
0348   //! with an relative angular value in RADIANS with
0349   //! respect to the initial position expressed by
0350   //! Start = Standard_True
0351   Standard_EXPORT void Rotate (const V3d_TypeOfAxe Axe,
0352                                const Standard_Real Angle,
0353                                const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
0354                                const Standard_Boolean Start = Standard_True);
0355 
0356   //! Rotates the eye about one of the coordinate axes of
0357   //! of the view for which the origin is the view point of the
0358   //! projection with an relative angular value in RADIANS with
0359   //! respect to the initial position expressed by
0360   //! Start = Standard_True
0361   Standard_EXPORT void Rotate (const V3d_TypeOfAxe Axe, const Standard_Real Angle, const Standard_Boolean Start = Standard_True);
0362 
0363   //! Rotates the eye around the current axis a relative
0364   //! angular value in RADIANS with respect to the initial
0365   //! position expressed by Start = Standard_True
0366   Standard_EXPORT void Rotate (const Standard_Real Angle, const Standard_Boolean Start = Standard_True);
0367 
0368   //! Movement of the eye parallel to the coordinate system
0369   //! of reference of the screen a distance relative to the
0370   //! initial position expressed by Start = Standard_True.
0371   Standard_EXPORT void Move (const Standard_Real Dx, const Standard_Real Dy, const Standard_Real Dz, const Standard_Boolean Start = Standard_True);
0372 
0373   //! Movement of the eye parallel to one of the axes of the
0374   //! coordinate system of reference of the view a distance
0375   //! relative to the initial position expressed by
0376   //! Start = Standard_True.
0377   Standard_EXPORT void Move (const V3d_TypeOfAxe Axe, const Standard_Real Length, const Standard_Boolean Start = Standard_True);
0378 
0379   //! Movement of the eye parllel to the current axis
0380   //! a distance relative to the initial position
0381   //! expressed by Start = Standard_True
0382   Standard_EXPORT void Move (const Standard_Real Length, const Standard_Boolean Start = Standard_True);
0383 
0384   //! Movement of the ye and the view point parallel to the
0385   //! frame of reference of the screen a distance relative
0386   //! to the initial position expressed by
0387   //! Start = Standard_True
0388   Standard_EXPORT void Translate (const Standard_Real Dx, const Standard_Real Dy, const Standard_Real Dz, const Standard_Boolean Start = Standard_True);
0389 
0390   //! Movement of the eye and the view point parallel to one
0391   //! of the axes of the fame of reference of the view a
0392   //! distance relative to the initial position
0393   //! expressed by Start = Standard_True
0394   Standard_EXPORT void Translate (const V3d_TypeOfAxe Axe, const Standard_Real Length, const Standard_Boolean Start = Standard_True);
0395 
0396   //! Movement of the eye and view point parallel to
0397   //! the current axis a distance relative to the initial
0398   //! position expressed by Start = Standard_True
0399   Standard_EXPORT void Translate (const Standard_Real Length, const Standard_Boolean Start = Standard_True);
0400 
0401   //! places the point of the view corresponding
0402   //! at the pixel position x,y at the center of the window
0403   //! and updates the view.
0404   Standard_EXPORT void Place (const Standard_Integer theXp, const Standard_Integer theYp, const Standard_Real theZoomFactor = 1);
0405 
0406   //! Rotation of the view point around the frame of reference
0407   //! of the screen for which the origin is the eye of the
0408   //! projection with a relative angular value in RADIANS
0409   //! with respect to the initial position expressed by
0410   //! Start = Standard_True
0411   Standard_EXPORT void Turn (const Standard_Real Ax, const Standard_Real Ay, const Standard_Real Az, const Standard_Boolean Start = Standard_True);
0412 
0413   //! Rotation of the view point around one of the axes of the
0414   //! frame of reference of the view for which the origin is
0415   //! the eye of the projection with an angular value in
0416   //! RADIANS relative to the initial position expressed by
0417   //! Start = Standard_True
0418   Standard_EXPORT void Turn (const V3d_TypeOfAxe Axe, const Standard_Real Angle, const Standard_Boolean Start = Standard_True);
0419 
0420   //! Rotation of the view point around the current axis an
0421   //! angular value in RADIANS relative to the initial
0422   //! position expressed by Start = Standard_True
0423   Standard_EXPORT void Turn (const Standard_Real Angle, const Standard_Boolean Start = Standard_True);
0424 
0425   //! Defines the angular position of the high point of
0426   //! the reference frame of the view with respect to the
0427   //! Y screen axis with an absolute angular value in
0428   //! RADIANS.
0429   Standard_EXPORT void SetTwist (const Standard_Real Angle);
0430 
0431   //! Defines the position of the eye..
0432   Standard_EXPORT void SetEye (const Standard_Real X, const Standard_Real Y, const Standard_Real Z);
0433 
0434   //! Defines the Depth of the eye from the view point
0435   //! without update the projection .
0436   Standard_EXPORT void SetDepth (const Standard_Real Depth);
0437 
0438   //! Defines the orientation of the projection.
0439   Standard_EXPORT void SetProj (const Standard_Real Vx, const Standard_Real Vy, const Standard_Real Vz);
0440 
0441   //! Defines the orientation of the projection .
0442   //! @param theOrientation camera direction
0443   //! @param theIsYup       flag indicating Y-up (TRUE) or Z-up (FALSE) convention
0444   Standard_EXPORT void SetProj (const V3d_TypeOfOrientation theOrientation,
0445                                 const Standard_Boolean theIsYup = Standard_False);
0446 
0447   //! Defines the position of the view point.
0448   Standard_EXPORT void SetAt (const Standard_Real X, const Standard_Real Y, const Standard_Real Z);
0449 
0450   //! Defines the orientation of the high point.
0451   Standard_EXPORT void SetUp (const Standard_Real Vx, const Standard_Real Vy, const Standard_Real Vz);
0452 
0453   //! Defines the orientation(SO) of the high point.
0454   Standard_EXPORT void SetUp (const V3d_TypeOfOrientation Orientation);
0455 
0456   //! Saves the current state of the orientation of the view
0457   //! which will be the return state at ResetViewOrientation.
0458   Standard_EXPORT void SetViewOrientationDefault();
0459 
0460   //! Resets the orientation of the view.
0461   //! Updates the view
0462   Standard_EXPORT void ResetViewOrientation();
0463 
0464   //! Translates the center of the view along "x" and "y" axes of
0465   //! view projection. Can be used to perform interactive panning operation.
0466   //! In that case the DXv, DXy parameters specify panning relative to the
0467   //! point where the operation is started.
0468   //! @param theDXv [in] the relative panning on "x" axis of view projection, in view space coordinates.
0469   //! @param theDYv [in] the relative panning on "y" axis of view projection, in view space coordinates.
0470   //! @param theZoomFactor [in] the zooming factor.
0471   //! @param theToStart [in] pass TRUE when starting panning to remember view
0472   //! state prior to panning for relative arguments. If panning is started,
0473   //! passing {0, 0} for {theDXv, theDYv} will return view to initial state.
0474   //! Performs update of view.
0475   Standard_EXPORT void Panning (const Standard_Real theDXv, const Standard_Real theDYv, const Standard_Real theZoomFactor = 1, const Standard_Boolean theToStart = Standard_True);
0476 
0477   //! Relocates center of screen to the point, determined by
0478   //! {Xp, Yp} pixel coordinates relative to the bottom-left corner of
0479   //! screen. To calculate pixel coordinates for any point from world
0480   //! coordinate space, it can be projected using "Project".
0481   //! @param theXp [in] the x coordinate.
0482   //! @param theYp [in] the y coordinate.
0483   Standard_EXPORT void SetCenter (const Standard_Integer theXp, const Standard_Integer theYp);
0484 
0485   //! Defines the view projection size in its maximum dimension,
0486   //! keeping the initial height/width ratio unchanged.
0487   Standard_EXPORT void SetSize (const Standard_Real theSize);
0488 
0489   //! Defines the Depth size of the view
0490   //! Front Plane will be set to Size/2.
0491   //! Back  Plane will be set to -Size/2.
0492   //! Any Object located Above the Front Plane or
0493   //! behind the Back Plane will be Clipped .
0494   //! NOTE than the XY Size of the View is NOT modified .
0495   Standard_EXPORT void SetZSize (const Standard_Real SetZSize);
0496 
0497   //! Zooms the view by a factor relative to the initial
0498   //! value expressed by Start = Standard_True
0499   //! Updates the view.
0500   Standard_EXPORT void SetZoom (const Standard_Real Coef, const Standard_Boolean Start = Standard_True);
0501 
0502   //! Zooms the view by a factor relative to the value
0503   //! initialised by SetViewMappingDefault().
0504   //! Updates the view.
0505   Standard_EXPORT void SetScale (const Standard_Real Coef);
0506 
0507   //! Sets  anisotropic (axial)  scale  factors  <Sx>, <Sy>, <Sz>  for  view <me>.
0508   //! Anisotropic  scaling  operation  is  performed  through  multiplying
0509   //! the current view  orientation  matrix  by  a  scaling  matrix:
0510   //! || Sx  0   0   0 ||
0511   //! || 0   Sy  0   0 ||
0512   //! || 0   0   Sz  0 ||
0513   //! || 0   0   0   1 ||
0514   //! Updates the view.
0515   Standard_EXPORT void SetAxialScale (const Standard_Real Sx, const Standard_Real Sy, const Standard_Real Sz);
0516 
0517   //! Adjust view parameters to fit the displayed scene, respecting height / width ratio.
0518   //! The Z clipping range (depth range) is fitted if AutoZFit flag is TRUE.
0519   //! Throws program error exception if margin coefficient is < 0 or >= 1.
0520   //! Updates the view.
0521   //! @param theMargin [in] the margin coefficient for view borders.
0522   //! @param theToUpdate [in] flag to perform view update.
0523   Standard_EXPORT void FitAll (const Standard_Real theMargin = 0.01, const Standard_Boolean theToUpdate = Standard_True);
0524 
0525   //! Adjust view parameters to fit the displayed scene, respecting height / width ratio
0526   //! according to the custom bounding box given.
0527   //! Throws program error exception if margin coefficient is < 0 or >= 1.
0528   //! Updates the view.
0529   //! @param theBox [in] the custom bounding box to fit.
0530   //! @param theMargin [in] the margin coefficient for view borders.
0531   //! @param theToUpdate [in] flag to perform view update.
0532   Standard_EXPORT void FitAll (const Bnd_Box& theBox, const Standard_Real theMargin = 0.01, const Standard_Boolean theToUpdate = Standard_True);
0533 
0534   //! Adjusts the viewing volume so as not to clip the displayed objects by front and back
0535   //! and back clipping planes. Also sets depth value automatically depending on the
0536   //! calculated Z size and Aspect parameter.
0537   //! NOTE than the original XY size of the view is NOT modified .
0538   Standard_EXPORT void DepthFitAll (const Standard_Real Aspect = 0.01, const Standard_Real Margin = 0.01);
0539 
0540   //! Centers the defined projection window so that it occupies
0541   //! the maximum space while respecting the initial
0542   //! height/width ratio.
0543   //! NOTE than the original Z size of the view is NOT modified .
0544   Standard_EXPORT void FitAll (const Standard_Real theMinXv, const Standard_Real theMinYv, const Standard_Real theMaxXv, const Standard_Real theMaxYv);
0545 
0546   //! Centers the defined PIXEL window so that it occupies
0547   //! the maximum space while respecting the initial height/width ratio.
0548   //! NOTE than the original Z size of the view is NOT modified.
0549   //! @param theMinXp [in] pixel coordinates of minimal corner on x screen axis.
0550   //! @param theMinYp [in] pixel coordinates of minimal corner on y screen axis.
0551   //! @param theMaxXp [in] pixel coordinates of maximal corner on x screen axis.
0552   //! @param theMaxYp [in] pixel coordinates of maximal corner on y screen axis.
0553   Standard_EXPORT void WindowFit (const Standard_Integer theMinXp, const Standard_Integer theMinYp, const Standard_Integer theMaxXp, const Standard_Integer theMaxYp);
0554 
0555   //! Saves the current view mapping. This will be the
0556   //! state returned from ResetViewmapping.
0557   Standard_EXPORT void SetViewMappingDefault();
0558 
0559   //! Resets the centering of the view.
0560   //! Updates the view
0561   Standard_EXPORT void ResetViewMapping();
0562 
0563   //! Resets the centering and the orientation of the view.
0564   Standard_EXPORT void Reset (const Standard_Boolean theToUpdate = Standard_True);
0565 
0566   //! Converts the PIXEL value
0567   //! to a value in the projection plane.
0568   Standard_EXPORT Standard_Real Convert (const Standard_Integer Vp) const;
0569 
0570   //! Converts the point PIXEL into a point projected
0571   //! in the reference frame of the projection plane.
0572   Standard_EXPORT void Convert (const Standard_Integer Xp, const Standard_Integer Yp,
0573                                 Standard_Real& Xv, Standard_Real& Yv) const;
0574 
0575   //! Converts tha value of the projection plane into
0576   //! a PIXEL value.
0577   Standard_EXPORT Standard_Integer Convert (const Standard_Real Vv) const;
0578 
0579   //! Converts the point defined in the reference frame
0580   //! of the projection plane into a point PIXEL.
0581   Standard_EXPORT void Convert (const Standard_Real Xv, const Standard_Real Yv,
0582                                 Standard_Integer& Xp, Standard_Integer& Yp) const;
0583 
0584   //! Converts the projected point into a point
0585   //! in the reference frame of the view corresponding
0586   //! to the intersection with the projection plane
0587   //! of the eye/view point vector.
0588   Standard_EXPORT void Convert (const Standard_Integer Xp, const Standard_Integer Yp,
0589                                 Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
0590 
0591   //! Converts the projected point into a point
0592   //! in the reference frame of the view corresponding
0593   //! to the intersection with the projection plane
0594   //! of the eye/view point vector and returns the
0595   //! projection ray for further computations.
0596   Standard_EXPORT void ConvertWithProj (const Standard_Integer Xp, const Standard_Integer Yp,
0597                                         Standard_Real& X,  Standard_Real& Y,  Standard_Real& Z,
0598                                         Standard_Real& Vx, Standard_Real& Vy, Standard_Real& Vz) const;
0599 
0600   //! Converts the projected point into the nearest grid point
0601   //! in the reference frame of the view corresponding
0602   //! to the intersection with the projection plane
0603   //! of the eye/view point vector and display the grid marker.
0604   //! Warning: When the grid is not active the result is identical to the above Convert() method.
0605   //! How to use:
0606   //! 1) Enable the grid echo display
0607   //! myViewer->SetGridEcho(Standard_True);
0608   //! 2) When application receive a move event:
0609   //! 2.1) Check if any object is detected
0610   //! if( myInteractiveContext->MoveTo(x,y) == AIS_SOD_Nothing ) {
0611   //! 2.2) Check if the grid is active
0612   //! if( myViewer->Grid()->IsActive() ) {
0613   //! 2.3) Display the grid echo and gets the grid point
0614   //! myView->ConvertToGrid(x,y,X,Y,Z);
0615   //! myView->Viewer()->ShowGridEcho (myView, Graphic3d_Vertex (X,Y,Z));
0616   //! myView->RedrawImmediate();
0617   //! 2.4) Else this is the standard case
0618   //! } else myView->Convert(x,y,X,Y,Z);
0619   Standard_EXPORT void ConvertToGrid (const Standard_Integer Xp, const Standard_Integer Yp,
0620                                       Standard_Real& Xg, Standard_Real& Yg, Standard_Real& Zg) const;
0621 
0622   //! Converts the point into the nearest grid point
0623   //! and display the grid marker.
0624   Standard_EXPORT void ConvertToGrid (const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
0625                                       Standard_Real& Xg, Standard_Real& Yg, Standard_Real& Zg) const;
0626 
0627   //! Projects the point defined in the reference frame of
0628   //! the view into the projected point in the associated window.
0629   Standard_EXPORT void Convert (const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
0630                                 Standard_Integer& Xp, Standard_Integer& Yp) const;
0631 
0632   //! Converts the point defined in the user space of
0633   //! the view to the projection plane at the depth
0634   //! relative to theZ.
0635   Standard_EXPORT void Project (const Standard_Real theX,
0636                                 const Standard_Real theY,
0637                                 const Standard_Real theZ,
0638                                 Standard_Real& theXp,
0639                                 Standard_Real& theYp) const;
0640 
0641   //! Converts the point defined in the user space of
0642   //! the view to the projection plane at the depth
0643   //! relative to theZ.
0644   Standard_EXPORT void Project (const Standard_Real theX,
0645                                 const Standard_Real theY,
0646                                 const Standard_Real theZ,
0647                                 Standard_Real& theXp,
0648                                 Standard_Real& theYp,
0649                                 Standard_Real& theZp) const;
0650 
0651   //! Returns the Background color values of the view
0652   //! depending of the color Type.
0653   Standard_EXPORT void BackgroundColor (const Quantity_TypeOfColor Type, Standard_Real& V1, Standard_Real& V2, Standard_Real& V3) const;
0654 
0655   //! Returns the Background color object of the view.
0656   Standard_EXPORT Quantity_Color BackgroundColor() const;
0657 
0658   //! Returns the gradient background colors of the view.
0659   Standard_EXPORT void GradientBackgroundColors (Quantity_Color& theColor1, Quantity_Color& theColor2) const;
0660 
0661   //! Returns the gradient background of the view.
0662   Standard_EXPORT Aspect_GradientBackground GradientBackground() const;
0663 
0664   //! Returns the current value of the zoom expressed with
0665   //! respect to SetViewMappingDefault().
0666   Standard_EXPORT Standard_Real Scale() const;
0667 
0668   //! Returns the current values of the anisotropic (axial) scale factors.
0669   Standard_EXPORT void AxialScale (Standard_Real& Sx, Standard_Real& Sy, Standard_Real& Sz) const;
0670 
0671   //! Returns the height and width of the view.
0672   Standard_EXPORT void Size (Standard_Real& Width, Standard_Real& Height) const;
0673 
0674   //! Returns the Depth of the view .
0675   Standard_EXPORT Standard_Real ZSize() const;
0676 
0677   //! Returns the position of the eye.
0678   Standard_EXPORT void Eye (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
0679 
0680   //! Returns the position of point which emanating the projections.
0681   void FocalReferencePoint (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const { Eye (X,Y,Z); }
0682 
0683   //! Returns the coordinate of the point (Xpix,Ypix)
0684   //! in the view (XP,YP,ZP), and the projection vector of the
0685   //! view passing by the point (for PerspectiveView).
0686   Standard_EXPORT void ProjReferenceAxe (const Standard_Integer Xpix, const Standard_Integer Ypix,
0687                                          Standard_Real& XP, Standard_Real& YP, Standard_Real& ZP,
0688                                          Standard_Real& VX, Standard_Real& VY, Standard_Real& VZ) const;
0689 
0690   //! Returns the Distance between the Eye and View Point.
0691   Standard_EXPORT Standard_Real Depth() const;
0692 
0693   //! Returns the projection vector.
0694   Standard_EXPORT void Proj (Standard_Real& Vx, Standard_Real& Vy, Standard_Real& Vz) const;
0695 
0696   //! Returns the position of the view point.
0697   Standard_EXPORT void At (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
0698 
0699   //! Returns the vector giving the position of the high point.
0700   Standard_EXPORT void Up (Standard_Real& Vx, Standard_Real& Vy, Standard_Real& Vz) const;
0701 
0702   //! Returns in RADIANS the orientation of the view around
0703   //! the visual axis measured from the Y axis of the screen.
0704   Standard_EXPORT Standard_Real Twist() const;
0705 
0706   //! Returns the current shading model; Graphic3d_TypeOfShadingModel_Phong by default.
0707   Standard_EXPORT Graphic3d_TypeOfShadingModel ShadingModel() const;
0708 
0709   //! Defines the shading model for the visualization.
0710   Standard_EXPORT void SetShadingModel (const Graphic3d_TypeOfShadingModel theShadingModel);
0711 
0712   Standard_EXPORT Handle(Graphic3d_TextureEnv) TextureEnv() const;
0713 
0714   //! Returns the current visualisation mode.
0715   Standard_EXPORT V3d_TypeOfVisualization Visualization() const;
0716 
0717   //! Returns a list of active lights.
0718   const V3d_ListOfLight& ActiveLights() const { return myActiveLights; }
0719 
0720   //! Return iterator for defined lights.
0721   V3d_ListOfLightIterator ActiveLightIterator() const { return V3d_ListOfLightIterator (myActiveLights); }
0722 
0723   //! Returns the MAX number of light associated to the view.
0724   Standard_EXPORT Standard_Integer LightLimit() const;
0725 
0726   //! Returns the viewer in which the view has been created.
0727   Handle(V3d_Viewer) Viewer() const { return MyViewer; }
0728 
0729   //! Returns True if MyView is associated with a window .
0730   Standard_EXPORT Standard_Boolean IfWindow() const;
0731 
0732   //! Returns the Aspect Window associated with the view.
0733   const Handle(Aspect_Window)& Window() const { return MyWindow; }
0734 
0735   //! Returns the Type of the View
0736   Standard_EXPORT V3d_TypeOfView Type() const;
0737 
0738   //! Translates the center of the view along "x" and "y" axes of
0739   //! view projection. Can be used to perform interactive panning operation.
0740   //! In that case the DXp, DXp parameters specify panning relative to the
0741   //! point where the operation is started.
0742   //! @param theDXp [in] the relative panning on "x" axis of view projection, in pixels.
0743   //! @param theDYp [in] the relative panning on "y" axis of view projection, in pixels.
0744   //! @param theZoomFactor [in] the zooming factor.
0745   //! @param theToStart [in] pass TRUE when starting panning to remember view
0746   //! state prior to panning for relative arguments. Passing 0 for relative
0747   //! panning parameter should return view panning to initial state.
0748   //! Performs update of view.
0749   Standard_EXPORT void Pan (const Standard_Integer theDXp, const Standard_Integer theDYp, const Standard_Real theZoomFactor = 1, const Standard_Boolean theToStart = Standard_True);
0750 
0751   //! Zoom the view according to a zoom factor computed
0752   //! from the distance between the 2 mouse position.
0753   //! @param theXp1 [in] the x coordinate of first mouse position, in pixels.
0754   //! @param theYp1 [in] the y coordinate of first mouse position, in pixels.
0755   //! @param theXp2 [in] the x coordinate of second mouse position, in pixels.
0756   //! @param theYp2 [in] the y coordinate of second mouse position, in pixels.
0757   Standard_EXPORT void Zoom (const Standard_Integer theXp1, const Standard_Integer theYp1, const Standard_Integer theXp2, const Standard_Integer theYp2);
0758 
0759   //! Defines starting point for ZoomAtPoint view operation.
0760   //! @param theXp [in] the x mouse coordinate, in pixels.
0761   //! @param theYp [in] the y mouse coordinate, in pixels.
0762   Standard_EXPORT void StartZoomAtPoint (const Standard_Integer theXp, const Standard_Integer theYp);
0763 
0764   //! Zooms the model at a pixel defined by the method StartZoomAtPoint().
0765   Standard_EXPORT void ZoomAtPoint (const Standard_Integer theMouseStartX, const Standard_Integer theMouseStartY, const Standard_Integer theMouseEndX, const Standard_Integer theMouseEndY);
0766 
0767   //! Performs  anisotropic scaling  of  <me>  view  along  the  given  <Axis>.
0768   //! The  scale  factor  is  calculated on a basis of
0769   //! the mouse pointer displacement <Dx,Dy>.
0770   //! The  calculated  scale  factor  is  then  passed  to  SetAxialScale(Sx,  Sy,  Sz)  method.
0771   Standard_EXPORT void AxialScale (const Standard_Integer Dx, const Standard_Integer Dy, const V3d_TypeOfAxe Axis);
0772 
0773   //! Begin the rotation of the view around the screen axis
0774   //! according to the mouse position <X,Y>.
0775   //! Warning: Enable rotation around the Z screen axis when <zRotationThreshold>
0776   //! factor is > 0 soon the distance from the start point and the center
0777   //! of the view is > (medium viewSize * <zRotationThreshold> ).
0778   //! Generally a value of 0.4 is usable to rotate around XY screen axis
0779   //! inside the circular threshold area and to rotate around Z screen axis
0780   //! outside this area.
0781   Standard_EXPORT void StartRotation (const Standard_Integer X, const Standard_Integer Y, const Standard_Real zRotationThreshold = 0.0);
0782 
0783   //! Continues the rotation of the view
0784   //! with an angle computed from the last and new mouse position <X,Y>.
0785   Standard_EXPORT void Rotation (const Standard_Integer X, const Standard_Integer Y);
0786 
0787   //! Change View Plane Distance for Perspective Views
0788   //! Warning! raises TypeMismatch from Standard if the view
0789   //! is not a perspective view.
0790   Standard_EXPORT void SetFocale (const Standard_Real Focale);
0791 
0792   //! Returns the View Plane Distance for Perspective Views
0793   Standard_EXPORT Standard_Real Focale() const;
0794 
0795   //! Returns the associated Graphic3d view.
0796   const Handle(Graphic3d_CView)& View() const { return myView; }
0797 
0798   //! Switches computed HLR mode in the view.
0799   Standard_EXPORT void SetComputedMode (const Standard_Boolean theMode);
0800 
0801   //! Returns the computed HLR mode state.
0802   Standard_EXPORT Standard_Boolean ComputedMode() const;
0803 
0804   //! idem than WindowFit
0805   void WindowFitAll (const Standard_Integer Xmin, const Standard_Integer Ymin, const Standard_Integer Xmax, const Standard_Integer Ymax)
0806   {
0807     WindowFit (Xmin, Ymin, Xmax, Ymax);
0808   }
0809 
0810   //! Transform camera eye, center and scale to fit in the passed bounding box specified in WCS.
0811   //! @param theCamera [in] the camera
0812   //! @param theBox    [in] the bounding box
0813   //! @param theMargin [in] the margin coefficient for view borders
0814   //! @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);
0815   //!                           in this case only the center of camera is adjusted
0816   //! @param theToEnlargeIfLine [in] when TRUE - in cases when the whole bounding box projected into thin line going along Z-axis of screen,
0817   //!                                the view plane is enlarged such thatwe see the whole line on rotation, otherwise only the center of camera is adjusted.
0818   //! @return TRUE if the fit all operation can be done
0819   Standard_EXPORT Standard_Boolean FitMinMax (const Handle(Graphic3d_Camera)& theCamera,
0820                                               const Bnd_Box& theBox,
0821                                               const Standard_Real theMargin,
0822                                               const Standard_Real theResolution = 0.0,
0823                                               const Standard_Boolean theToEnlargeIfLine = Standard_True) const;
0824 
0825   //! Defines or Updates the definition of the
0826   //! grid in <me>
0827   Standard_EXPORT void SetGrid (const gp_Ax3& aPlane, const Handle(Aspect_Grid)& aGrid);
0828 
0829   //! Defines or Updates the activity of the
0830   //! grid in <me>
0831   Standard_EXPORT void SetGridActivity (const Standard_Boolean aFlag);
0832 
0833   //! Dumps the full contents of the View into the image file. This is an alias for ToPixMap() with Image_AlienPixMap.
0834   //! @param theFile destination image file (image format is determined by file extension like .png, .bmp, .jpg)
0835   //! @param theBufferType buffer to dump
0836   //! @return FALSE when the dump has failed
0837   Standard_EXPORT Standard_Boolean Dump (const Standard_CString theFile, const Graphic3d_BufferType& theBufferType = Graphic3d_BT_RGB);
0838 
0839   //! Dumps the full contents of the view to a pixmap with specified parameters.
0840   //! Internally this method calls Redraw() with an offscreen render buffer of requested target size (theWidth x theHeight),
0841   //! so that there is no need resizing a window control for making a dump of different size.
0842   Standard_EXPORT Standard_Boolean ToPixMap (Image_PixMap&               theImage,
0843                                              const V3d_ImageDumpOptions& theParams);
0844 
0845   //! Dumps the full contents of the view to a pixmap.
0846   //! Internally this method calls Redraw() with an offscreen render buffer of requested target size (theWidth x theHeight),
0847   //! so that there is no need resizing a window control for making a dump of different size.
0848   //! @param theImage          target image, will be re-allocated to match theWidth x theHeight
0849   //! @param theWidth          target image width
0850   //! @param theHeight         target image height
0851   //! @param theBufferType     type of the view buffer to dump (color / depth)
0852   //! @param theToAdjustAspect when true, active view aspect ratio will be overridden by (theWidth / theHeight)
0853   //! @param theStereoOptions  how to dump stereographic camera
0854   Standard_Boolean ToPixMap (Image_PixMap& theImage,
0855                              const Standard_Integer theWidth,
0856                              const Standard_Integer theHeight,
0857                              const Graphic3d_BufferType& theBufferType     = Graphic3d_BT_RGB,
0858                              const Standard_Boolean      theToAdjustAspect = Standard_True,
0859                              const V3d_StereoDumpOptions theStereoOptions  = V3d_SDO_MONO)
0860   {
0861     V3d_ImageDumpOptions aParams;
0862     aParams.Width  = theWidth;
0863     aParams.Height = theHeight;
0864     aParams.BufferType = theBufferType;
0865     aParams.StereoOptions  = theStereoOptions;
0866     aParams.ToAdjustAspect = theToAdjustAspect;
0867     return ToPixMap (theImage, aParams);
0868   }
0869 
0870   //! Manages display of the back faces
0871   Standard_EXPORT void SetBackFacingModel (const Graphic3d_TypeOfBackfacingModel theModel = Graphic3d_TypeOfBackfacingModel_Auto);
0872 
0873   //! Returns current state of the back faces display; Graphic3d_TypeOfBackfacingModel_Auto by default,
0874   //! which means that backface culling is defined by each presentation.
0875   Standard_EXPORT Graphic3d_TypeOfBackfacingModel BackFacingModel() const;
0876 
0877   //! Adds clip plane to the view. The composition of clip planes truncates the
0878   //! rendering space to convex volume. Number of supported clip planes can be consulted
0879   //! by PlaneLimit method of associated Graphic3d_GraphicDriver.
0880   //! Please be aware that the planes which exceed the limit are ignored during rendering.
0881   //! @param thePlane [in] the clip plane to be added to view.
0882   Standard_EXPORT virtual void AddClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane);
0883 
0884   //! Removes clip plane from the view.
0885   //! @param thePlane [in] the clip plane to be removed from view.
0886   Standard_EXPORT virtual void RemoveClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane);
0887 
0888   //! Get clip planes.
0889   //! @return sequence clip planes that have been set for the view
0890   Standard_EXPORT const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const;
0891 
0892   //! Sets sequence of clip planes to the view. The planes that have been set
0893   //! before are removed from the view. The composition of clip planes
0894   //! truncates the rendering space to convex volume. Number of supported
0895   //! clip planes can be consulted by InquirePlaneLimit method of
0896   //! Graphic3d_GraphicDriver. Please be aware that the planes that
0897   //! exceed the limit are ignored during rendering.
0898   //! @param thePlanes [in] the clip planes to set.
0899   Standard_EXPORT void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes);
0900 
0901   //! Returns the MAX number of clipping planes associated to the view.
0902   Standard_EXPORT Standard_Integer PlaneLimit() const;
0903 
0904   //! Change camera used by view.
0905   Standard_EXPORT void SetCamera (const Handle(Graphic3d_Camera)& theCamera);
0906 
0907   //! Returns camera object of the view.
0908   //! @return: handle to camera object, or NULL if 3D view does not use
0909   //! the camera approach.
0910   Standard_EXPORT const Handle(Graphic3d_Camera)& Camera() const;
0911 
0912   //! Return default camera.
0913   const Handle(Graphic3d_Camera)& DefaultCamera() const { return myDefaultCamera; }
0914 
0915   //! Returns current rendering parameters and effect settings.
0916   //! By default it returns default parameters of current viewer.
0917   //! To define view-specific settings use method V3d_View::ChangeRenderingParams().
0918   //! @sa V3d_Viewer::DefaultRenderingParams()
0919   Standard_EXPORT const Graphic3d_RenderingParams& RenderingParams() const;
0920 
0921   //! Returns reference to current rendering parameters and effect settings.
0922   Standard_EXPORT Graphic3d_RenderingParams& ChangeRenderingParams();
0923 
0924   //! @return flag value of objects culling mechanism
0925   Standard_Boolean IsCullingEnabled() const { return RenderingParams().FrustumCullingState == Graphic3d_RenderingParams::FrustumCulling_On; }
0926 
0927   //! Turn on/off automatic culling of objects outside frustum (ON by default)
0928   void SetFrustumCulling (Standard_Boolean theMode) { ChangeRenderingParams().FrustumCullingState = theMode ? Graphic3d_RenderingParams::FrustumCulling_On : Graphic3d_RenderingParams::FrustumCulling_Off; }
0929 
0930   //! Fill in the dictionary with diagnostic info.
0931   //! Should be called within rendering thread.
0932   //!
0933   //! This API should be used only for user output or for creating automated reports.
0934   //! The format of returned information (e.g. key-value layout)
0935   //! is NOT part of this API and can be changed at any time.
0936   //! Thus application should not parse returned information to weed out specific parameters.
0937   //! @param theDict  destination map for information
0938   //! @param theFlags defines the information to be retrieved
0939   Standard_EXPORT void DiagnosticInformation (TColStd_IndexedDataMapOfStringString& theDict,
0940                                               Graphic3d_DiagnosticInfo theFlags) const;
0941 
0942   //! Returns string with statistic performance info.
0943   Standard_EXPORT TCollection_AsciiString StatisticInformation() const;
0944 
0945   //! Fills in the dictionary with statistic performance info.
0946   Standard_EXPORT void StatisticInformation (TColStd_IndexedDataMapOfStringString& theDict) const;
0947 
0948   //! Returns the Objects number and the gravity center of ALL viewable points in the view
0949   Standard_EXPORT gp_Pnt GravityPoint() const;
0950 
0951   //! Dumps the content of me into the stream
0952   Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
0953 
0954 public: //! @name subvew management
0955 
0956   //! Return TRUE if this is a subview of another view.
0957   bool IsSubview() const { return myParentView != nullptr; }
0958 
0959   //! Return parent View or NULL if this is not a subview.
0960   V3d_View* ParentView() { return myParentView; }
0961 
0962   //! Return subview list.
0963   const NCollection_Sequence<Handle(V3d_View)>& Subviews() const { return mySubviews; }
0964 
0965   //! Pick subview from the given 2D point.
0966   Standard_EXPORT Handle(V3d_View) PickSubview (const Graphic3d_Vec2i& thePnt) const;
0967 
0968   //! Add subview to the list.
0969   Standard_EXPORT void AddSubview (const Handle(V3d_View)& theView);
0970 
0971   //! Remove subview from the list.
0972   Standard_EXPORT bool RemoveSubview (const V3d_View* theView);
0973 
0974 public: //! @name deprecated methods
0975 
0976   //! Returns True if One light more can be
0977   //! activated in this View.
0978   Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
0979   Standard_EXPORT Standard_Boolean IfMoreLights() const;
0980 
0981   //! initializes an iteration on the active Lights.
0982   Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
0983   void InitActiveLights() { myActiveLightsIterator.Initialize (myActiveLights); }
0984 
0985   //! returns true if there are more active Light(s) to return.
0986   Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
0987   Standard_Boolean MoreActiveLights() const { return myActiveLightsIterator.More(); }
0988 
0989   //! Go to the next active Light (if there is not, ActiveLight will raise an exception)
0990   Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
0991   void NextActiveLights() { myActiveLightsIterator.Next(); }
0992 
0993   Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
0994   const Handle(V3d_Light)& ActiveLight() const { return myActiveLightsIterator.Value(); }
0995 
0996 protected:
0997 
0998   Standard_EXPORT void ImmediateUpdate() const;
0999 
1000   //! Scales camera to fit the view frame of defined width and height
1001   //! keeping the aspect. For orthogonal camera the method changes scale,
1002   //! for perspective adjusts Eye location about the Center point.
1003   //! @param theSizeXv [in] size of viewport frame on "x" axis.
1004   //! @param theSizeYv [in] size of viewport frame on "y" axis.
1005   Standard_EXPORT void Scale (const Handle(Graphic3d_Camera)& theCamera, const Standard_Real theSizeXv, const Standard_Real theSizeYv) const;
1006 
1007   Standard_EXPORT void Translate (const Handle(Graphic3d_Camera)& theCamera, const Standard_Real theDXv, const Standard_Real theDYv) const;
1008 
1009 private:
1010 
1011   //! Modifies the aspect ratio of the camera when
1012   //! the associated window is defined or resized.
1013   Standard_EXPORT void SetRatio();
1014 
1015   //! Determines the screen axes in the reference
1016   //! framework of the view.
1017   Standard_EXPORT static Standard_Boolean screenAxis (const gp_Dir& theVpn, const gp_Dir& theVup,
1018                                                       gp_Vec& theXaxe, gp_Vec& theYaxe, gp_Vec& theZaxe);
1019   
1020   //! Transforms the Vertex V according to the matrice Matrix .
1021   Standard_EXPORT static gp_XYZ TrsPoint (const Graphic3d_Vertex& V, const TColStd_Array2OfReal& Matrix);
1022   
1023   //! Returns the objects number and the projection window
1024   //! of the objects contained in the view.
1025   Standard_EXPORT Standard_Integer MinMax (Standard_Real& Umin, Standard_Real& Vmin, Standard_Real& Umax, Standard_Real& Vmax) const;
1026   
1027   //! Returns the objects number and the box encompassing
1028   //! the objects contained in the view
1029   Standard_EXPORT Standard_Integer MinMax (Standard_Real& Xmin, Standard_Real& Ymin, Standard_Real& Zmin, Standard_Real& Xmax, Standard_Real& Ymax, Standard_Real& Zmax) const;
1030   
1031   Standard_EXPORT void Init();
1032   
1033   //! Returns a new vertex when the grid is activated.
1034   Standard_EXPORT Graphic3d_Vertex Compute (const Graphic3d_Vertex& AVertex) const;
1035 
1036 protected:
1037 
1038   Standard_Real myOldMouseX;
1039   Standard_Real myOldMouseY;
1040   gp_Dir myCamStartOpUp;
1041   gp_Dir myCamStartOpDir;
1042   gp_Pnt myCamStartOpEye;
1043   gp_Pnt myCamStartOpCenter;
1044   Handle(Graphic3d_Camera) myDefaultCamera;
1045   Handle(Graphic3d_CView) myView;
1046   Standard_Boolean myImmediateUpdate;
1047   mutable Standard_Boolean myIsInvalidatedImmediate;
1048 
1049 private:
1050 
1051   V3d_Viewer* MyViewer;
1052 
1053   NCollection_Sequence<Handle(V3d_View)> mySubviews;
1054   V3d_View* myParentView;
1055 
1056   V3d_ListOfLight myActiveLights;
1057   gp_Dir myDefaultViewAxis;
1058   gp_Pnt myDefaultViewPoint;
1059   Handle(Aspect_Window) MyWindow;
1060   V3d_ListOfLight::Iterator myActiveLightsIterator;
1061   Standard_Integer sx;
1062   Standard_Integer sy;
1063   Standard_Real rx;
1064   Standard_Real ry;
1065   gp_Pnt myRotateGravity;
1066   Standard_Boolean myComputedMode;
1067   Standard_Boolean SwitchSetFront;
1068   Standard_Boolean myZRotation;
1069   Standard_Integer MyZoomAtPointX;
1070   Standard_Integer MyZoomAtPointY;
1071   Handle(V3d_Trihedron) myTrihedron;
1072   Handle(Aspect_Grid) MyGrid;
1073   gp_Ax3 MyPlane;
1074   TColStd_Array2OfReal MyTrsf;
1075   Handle(Graphic3d_Structure) MyGridEchoStructure;
1076   Handle(Graphic3d_Group) MyGridEchoGroup;
1077   gp_Vec myXscreenAxis;
1078   gp_Vec myYscreenAxis;
1079   gp_Vec myZscreenAxis;
1080   gp_Dir myViewAxis;
1081   Graphic3d_Vertex myGravityReferencePoint;
1082   Standard_Boolean myAutoZFitIsOn;
1083   Standard_Real myAutoZFitScaleFactor;
1084 
1085 };
1086 
1087 #endif // _V3d_View_HeaderFile