# Visualization
TKV2d
V2d

# V2d_View Class Reference

Defines the application object view for the 2D Viewer,
V2d_Viewer. The functions in this framework manage
the origin and the size of the scene displayed in the view (zoom, panning, etc.).
.

`#include <V2d_View.hxx>`

Inheritance diagram for V2d_View:

[legend]

## Public Member Functions

Standard_EXPORT | V2d_View (const Handle(Aspect_WindowDriver)&aWindowDriver, const Handle(V2d_Viewer)&aViewer, const Quantity_Length aXCenter=0, const Quantity_Length aYCenter=0, const Quantity_Length aSize=1000)
| Creates a view which represents a portion of the user space. This portion is defined by the point (aXCenter,aYCenter) which will be represent at the center of the window and by aSize. aWindowDriver defines a window and a driver. .
Standard_EXPORT void | SetDefaultPosition (const Quantity_Length aXCenter=0, const Quantity_Length aYCenter=0, const Quantity_Length aSize=1000)
| Defines the default position aXCenter, aYCenter and the size aSize used in the Reset function. .
Standard_EXPORT void | Fitall ()
| Automatic Zoom-Panning. Objects visible in the view are visualised so as to occupy the maximum amount of space while respecting the initial height/width ratio. Updates the view. The resulting space also takes into account a default margin that can be modified with SetFitallRatio. The view is updated. .
Standard_EXPORT void | WindowFit (const Standard_Integer aX1, const Standard_Integer aY1, const Standard_Integer aX2, const Standard_Integer aY2)
| The point of the graphic view corresponding to the middle of the window aX1,aY1,aX2,aY2 (in pixel coordinates) comes to the center of the window. Updates the view //! Warning! raises BadValue from Viewer if aX1 = aX2 or aY1 = aY2; .
Standard_EXPORT void | Fit (const Quantity_Length aX1, const Quantity_Length aY1, const Quantity_Length aX2, const Quantity_Length aY2, const Standard_Boolean UseMinimum=Standard_True)
| The point of the graphic view corresponding to the middle of the window aX1,aY1,aX2,aY2 (in user coordinates) comes to the center of the window. If UseMinimum is true the smallest dimension of the rectangle will be zoom to occupy the view. If not the greatest dimension wiil be used. Updates the view //! Warning! raises BadValue from Viewer if aX1 = aX2 or aY1 = aY2; .
Standard_EXPORT void | SetFitallRatio (const Quantity_Ratio aRatio)
| Sets the 10 mm default margin aRatio which is taken into account by the Fitall function. Exceptions Viewer_BadValue if aRatio is less than 0 or greater than or equal to 1. .
Standard_EXPORT void | Zoom (const Quantity_Factor Zoom)
| Increases the size of the portion of user-space by a factor of Zoom and updates the view. //! Warning! raises BadValue from Viewer if aRatio <= 0. .
Standard_EXPORT void | Zoom (const Standard_Integer aX1, const Standard_Integer aY1, const Standard_Integer aX2, const Standard_Integer aY2, const Quantity_Ratio aCoefficient=0.005)
| Increases the size of the portion of user-space by a zoom factor which is calculated from the two screen points aX1, aY1 and aX2, aY2 so that Z = 1/(1 + C x D) where: - C is the coefficient aCoefficient and - D is the distance between the two points aX1,aY1 and aX2,aY2. .
Standard_EXPORT void | Zoom (const Standard_Integer aX, const Standard_Integer aY, const Quantity_Ratio aCoefficient=0.005)
| Increases the size of the portion of user-space by a zoom factor which is calculated from the current point aX,aY and the screen center. The default factor is 0.005. .
Standard_EXPORT void | Magnify (const Handle(V2d_View)&anOriginView, const Standard_Integer X1, const Standard_Integer Y1, const Standard_Integer X2, const Standard_Integer Y2)
| Defines the default view mapping from two screen points in a previous view anOriginView. The view is updated. .
Standard_EXPORT void | Translate (const Quantity_Length dx, const Quantity_Length dy)
| Translates the dx,dy center of the objects space. .
Standard_EXPORT void | Place (const Standard_Integer x, const Standard_Integer y, const Quantity_Factor aZoomFactor=1)
| places the point of the view corresponding at the pixel position x,y at the center of the window and updates the view.
Standard_EXPORT void | ScreenPlace (const Quantity_Length x, const Quantity_Length y, const Quantity_Factor aZoomFactor=1)
| Places the center of the object's space in the center of the window according to the zoom factor. The view is updated. .
Standard_EXPORT void | Pan (const Standard_Integer dx, const Standard_Integer dy)
| Translates the center of the object's space and updates the view. The translation is specified in screen coordinates. .
Standard_EXPORT Quantity_Length | Convert (const Standard_Integer V) const
| Converts a screen value into the view space value V. .
Standard_EXPORT void | Convert (const Standard_Integer X, const Standard_Integer Y, Quantity_Length &ViewX, Quantity_Length &ViewY) const
| Converts the screen space coordinates X, Y into the view space coordinates ViewX, ViewY. .
Standard_EXPORT void | Convert (const Quantity_Length ViewX, const Quantity_Length ViewY, Standard_Integer &X, Standard_Integer &Y) const
| Converts the view space coordinates ViewX, ViewY into the screen space coordinates X, Y. .
Standard_EXPORT Quantity_Length | Convert (const Quantity_Length aDriverSize) const
| returns a view size from a driver size.
Standard_EXPORT void | Reset ()
| Resets the viewmapping of the view and updates the view. .
Standard_EXPORT void | Previous ()
| switches the view to its previous viewmapping and updates the view.
Standard_EXPORT void | DisableStorePrevious ()
| Disables the Previous function in this framework. .
Standard_EXPORT void | EnableStorePrevious ()
| Enables the Previous function in this framework. .
Standard_EXPORT void | Update () const
| Clears the window and redraws all primitives. .
Standard_EXPORT void | UpdateNew () const
| draws the objects created since the last update.
Standard_EXPORT void | RestoreArea (const Standard_Integer Xc, const Standard_Integer Yc, const Standard_Integer Width, const Standard_Integer Height) const
| Restores The Window Area defined by his center and PIXEL size from the BackingStored Window Warning This function only works if the window is double-buffered. .
Standard_EXPORT void | Restore () const
| Restores the full window area from the backing stored window. Warning This function only works if the window is double-buffered. .
Standard_EXPORT void | Dump () const
Standard_EXPORT void | Dump (const Standard_CString aFileName) const
Standard_EXPORT Handle_Graphic2d_DisplayList | Pick (const Standard_Integer X, const Standard_Integer Y, const Standard_Integer aPrecision)
| From the X, Y coordinates, returns the list of picked graphic objects within the precision value aPrecision. .
Standard_EXPORT Handle_Graphic2d_DisplayList | PickByCircle (const Standard_Integer X, const Standard_Integer Y, const Standard_Integer Radius)
Standard_EXPORT Handle_Graphic2d_DisplayList | Pick (const Standard_Integer Xmin, const Standard_Integer Ymin, const Standard_Integer Xmax, const Standard_Integer Ymax, const Graphic2d_PickMode aPickMode=Graphic2d_PM_INCLUDE)
| Returns the list of the picked graphic objects. .
Standard_EXPORT void | Erase ()
| Removes all the graphic objects from the view. .
Standard_EXPORT void | MustBeResized (const V2d_TypeOfWindowResizingEffect anEffect)
| indicates that the window in which the view is drawn has been resized and updates the view.
Standard_EXPORT void | HasBeenMoved ()
| Indicates whether the window associated with the view has been moved or not. .
Standard_EXPORT void | Plot (const Handle(PlotMgt_PlotterDriver)&aPlotterDriver, const Quantity_Length aXCenter, const Quantity_Length aYCenter, const Quantity_Factor aScale=1.0) const
| Plots the view to a plotter aPlotterDriver centered through aXCenter, aYCenter with the plotting scale aScale. .
Standard_EXPORT void | Plot (const Handle(PlotMgt_PlotterDriver)&aPlotterDriver, const Quantity_Factor aScale=1.0) const
| plot a view as on screen. Note: if <ascale> is zero then plots exactly what is on the screen
Standard_EXPORT void | PlotScreen (const Handle(PlotMgt_PlotterDriver)&aPlotterDriver) const
| Plots the view to a plotter according to the current size and center of the view. .
Standard_EXPORT void | ScreenCopy (const Handle(PlotMgt_PlotterDriver)&aPlotterDriver, const Standard_Boolean fWhiteBackground=Standard_True, const Quantity_Factor aScale=1.0)
| dump the view
Standard_EXPORT void | PostScriptOutput (const Standard_CString aFile, const Quantity_Length aWidth, const Quantity_Length aHeight, const Quantity_Length aXCenter, const Quantity_Length aYCenter, const Quantity_Factor aScale, const Aspect_TypeOfColorSpace aTypeOfColorSpace) const
| Plots the view to the PostScript file aFile according to a paper format specified by the arguments aWidth, aHeight, aXCenter, aYCenter with the scale aScale. .
Standard_EXPORT void | ScreenPostScriptOutput (const Standard_CString aFile, const Quantity_Length aWidth, const Quantity_Length aHeight, const Aspect_TypeOfColorSpace aTypeOfColorSpace) const
| Plots the view to the PostScript file aFile according to the paper format specified by the arguments aWidth, aHeight. This is done by keeping the same view size and center. .
Standard_EXPORT void | Hit (const Standard_Integer X, const Standard_Integer Y, Quantity_Length &gx, Quantity_Length &gy) const
| From the X,Y point, returns the nearest point gx,gy on the grid. .
Standard_EXPORT void | ShowHit (const Standard_Integer X, const Standard_Integer Y)
| shows the point matching the grid. if the hit has already been shown, it is first erased. Does not update the view.
Standard_EXPORT void | EraseHit ()
| erases the hit point and updates the view.
Standard_EXPORT void | SetDefaultHighlightColor (const Standard_Integer aColorIndex)
| Defines the default override color of objects or primitives using Highlight() methods. .
Standard_EXPORT void | SetDeflection (const Quantity_Length aDeflection)
| Updates the drawing precision factor aDeflection for curves and circles. .
Standard_EXPORT Quantity_Length | Deflection () const
| Returns the current deflection coefficient. .
Standard_EXPORT Handle_Graphic2d_View | View () const
| Returns the associated Grahic2d view with this view. .
Standard_EXPORT Handle_V2d_Viewer | Viewer () const
| Returns the parent viewer of this view. .
Standard_EXPORT Handle_Aspect_WindowDriver | Driver () const
| Returns the window driver handle associated with this view. .
Standard_EXPORT Quantity_Factor | Zoom () const
| returns the current zoom factor of the view.
Standard_EXPORT void | Center (Quantity_Length &aX, Quantity_Length &aY) const
| returns the current point of the user space being at the center of the view.
Standard_EXPORT Quantity_Length | Size () const
| Returns the current size of the view. .
Standard_EXPORT Quantity_NameOfColor | Color () const
| returns the background color of the view.
Standard_EXPORT void | Color (Quantity_Color &color) const
| returns the background color of the view.
Standard_EXPORT void | Scroll (Standard_Integer &XCenter, Standard_Integer &YCenter, Standard_Integer &DX, Standard_Integer &DY)
Standard_EXPORT Standard_Integer | DefaultHighlightColor () const
| Returns the default override color of objects or primitives using Highlight() methods. Warning: Returns -1 when the color index is not defined. .
Standard_EXPORT void | Fit (const Standard_Integer aX1, const Standard_Integer aY1, const Standard_Integer aX2, const Standard_Integer aY2)
| idem than WindowFit
Standard_EXPORT void | SetBackground (const Quantity_NameOfColor aNameColor)
| Defines the color of view's background .
Standard_EXPORT void | SetBackground (const Quantity_Color &color)
| Defines the color of view's background .
Standard_EXPORT Standard_Boolean | SetBackground (const Standard_CString aNameFile, const Aspect_FillMethod aMethod=Aspect_FM_CENTERED)
| Loads the view background from an image file <aname> defined with a supported format XWD,GIF or BMP and returns TRUE if the operation is successfull. .
Standard_EXPORT const | Handle (Standard_Type)&DynamicType() const

## Private Member Functions

Standard_EXPORT void | StoreCurrent ()
Standard_EXPORT void | MapToCenter ()

## Private Attributes

Handle_Aspect_WindowDriver | myWindowDriver
V2d_ViewerPointer | myViewer
Standard_Real | myFitallRatio
Standard_Real | myDeflection
Handle_Graphic2d_ViewMapping | myViewMapping
Standard_Real | myXPosition
Standard_Real | myYPosition
Standard_Real | myScale
Standard_Real | myPreviousX
Standard_Real | myPreviousY
Standard_Real | myPreviousSize
Standard_Real | myPreviousXPosition
Standard_Real | myPreviousYPosition
Standard_Real | myPreviousScale
Standard_Boolean | myEnablePrevious
Handle_Graphic2d_GraphicObject | myHitPoint
Handle_Graphic2d_Buffer | myHitBuf
Standard_Real | myWidth
Standard_Real | myHeight
Standard_Real | pxmin
Standard_Real | pymin
Standard_Real | pxmax
Standard_Real | pymax

## Constructor & Destructor Documentation

Standard_EXPORT V2d_View::V2d_View | ( | const Handle(Aspect_WindowDriver)& | aWindowDriver,
|  | const Handle(V2d_Viewer)& | aViewer,
|  | const Quantity_Length | aXCenter = `0`,
|  | const Quantity_Length | aYCenter = `0`,
|  | const Quantity_Length | aSize = `1000`
| ) |

## Member Function Documentation

Standard_EXPORT void V2d_View::Center | ( | Quantity_Length & | aX,
|  | Quantity_Length & | aY
| ) | const

Standard_EXPORT void V2d_View::Color | ( | Quantity_Color & | color | ) | const

Standard_EXPORT Quantity_NameOfColor V2d_View::Color | ( |  | ) | const

Standard_EXPORT Quantity_Length V2d_View::Convert | ( | const Quantity_Length | aDriverSize | ) | const

Standard_EXPORT void V2d_View::Convert | ( | const Quantity_Length | ViewX,
|  | const Quantity_Length | ViewY,
|  | Standard_Integer & | X,
|  | Standard_Integer & | Y
| ) | const

Standard_EXPORT void V2d_View::Convert | ( | const Standard_Integer | X,
|  | const Standard_Integer | Y,
|  | Quantity_Length & | ViewX,
|  | Quantity_Length & | ViewY
| ) | const

Standard_EXPORT Quantity_Length V2d_View::Convert | ( | const Standard_Integer | V | ) | const

Standard_EXPORT Standard_Integer V2d_View::DefaultHighlightColor | ( |  | ) | const

Standard_EXPORT Quantity_Length V2d_View::Deflection | ( |  | ) | const

Standard_EXPORT void V2d_View::DisableStorePrevious | ( |  | ) |

Standard_EXPORT Handle_Aspect_WindowDriver V2d_View::Driver | ( |  | ) | const

Standard_EXPORT void V2d_View::Dump | ( | const Standard_CString | aFileName | ) | const

Standard_EXPORT void V2d_View::Dump | ( |  | ) | const

Standard_EXPORT void V2d_View::EnableStorePrevious | ( |  | ) |

Standard_EXPORT void V2d_View::Erase | ( |  | ) |

Standard_EXPORT void V2d_View::EraseHit | ( |  | ) |

Standard_EXPORT void V2d_View::Fit | ( | const Standard_Integer | aX1,
|  | const Standard_Integer | aY1,
|  | const Standard_Integer | aX2,
|  | const Standard_Integer | aY2
| ) |

Standard_EXPORT void V2d_View::Fit | ( | const Quantity_Length | aX1,
|  | const Quantity_Length | aY1,
|  | const Quantity_Length | aX2,
|  | const Quantity_Length | aY2,
|  | const Standard_Boolean | UseMinimum = `Standard_True`
| ) |

Standard_EXPORT void V2d_View::Fitall | ( |  | ) |

Standard_EXPORT const V2d_View::Handle | ( | Standard_Type |  | ) | const

| Reimplemented from Viewer_View.

Standard_EXPORT void V2d_View::HasBeenMoved | ( |  | ) |

Standard_EXPORT void V2d_View::Hit | ( | const Standard_Integer | X,
|  | const Standard_Integer | Y,
|  | Quantity_Length & | gx,
|  | Quantity_Length & | gy
| ) | const

Standard_EXPORT void V2d_View::Magnify | ( | const Handle(V2d_View)& | anOriginView,
|  | const Standard_Integer | X1,
|  | const Standard_Integer | Y1,
|  | const Standard_Integer | X2,
|  | const Standard_Integer | Y2
| ) |

Standard_EXPORT void V2d_View::MapToCenter | ( |  | ) | `[private]`

Standard_EXPORT void V2d_View::MustBeResized | ( | const V2d_TypeOfWindowResizingEffect | anEffect | ) |

Standard_EXPORT void V2d_View::Pan | ( | const Standard_Integer | dx,
|  | const Standard_Integer | dy
| ) |

Standard_EXPORT Handle_Graphic2d_DisplayList V2d_View::Pick | ( | const Standard_Integer | Xmin,
|  | const Standard_Integer | Ymin,
|  | const Standard_Integer | Xmax,
|  | const Standard_Integer | Ymax,
|  | const Graphic2d_PickMode | aPickMode = `Graphic2d_PM_INCLUDE`
| ) |

Standard_EXPORT Handle_Graphic2d_DisplayList V2d_View::Pick | ( | const Standard_Integer | X,
|  | const Standard_Integer | Y,
|  | const Standard_Integer | aPrecision
| ) |

Standard_EXPORT Handle_Graphic2d_DisplayList V2d_View::PickByCircle | ( | const Standard_Integer | X,
|  | const Standard_Integer | Y,
|  | const Standard_Integer | Radius
| ) |

Standard_EXPORT void V2d_View::Place | ( | const Standard_Integer | x,
|  | const Standard_Integer | y,
|  | const Quantity_Factor | aZoomFactor = `1`
| ) | `[virtual]`

| Implements Viewer_View.

Standard_EXPORT void V2d_View::Plot | ( | const Handle(PlotMgt_PlotterDriver)& | aPlotterDriver,
|  | const Quantity_Factor | aScale = `1.0`
| ) | const

Standard_EXPORT void V2d_View::Plot | ( | const Handle(PlotMgt_PlotterDriver)& | aPlotterDriver,
|  | const Quantity_Length | aXCenter,
|  | const Quantity_Length | aYCenter,
|  | const Quantity_Factor | aScale = `1.0`
| ) | const

Standard_EXPORT void V2d_View::PlotScreen | ( | const Handle(PlotMgt_PlotterDriver)& | aPlotterDriver | ) | const

Standard_EXPORT void V2d_View::PostScriptOutput | ( | const Standard_CString | aFile,
|  | const Quantity_Length | aWidth,
|  | const Quantity_Length | aHeight,
|  | const Quantity_Length | aXCenter,
|  | const Quantity_Length | aYCenter,
|  | const Quantity_Factor | aScale,
|  | const Aspect_TypeOfColorSpace | aTypeOfColorSpace
| ) | const

Standard_EXPORT void V2d_View::Previous | ( |  | ) |

Standard_EXPORT void V2d_View::Reset | ( |  | ) |

Standard_EXPORT void V2d_View::Restore | ( |  | ) | const

Standard_EXPORT void V2d_View::RestoreArea | ( | const Standard_Integer | Xc,
|  | const Standard_Integer | Yc,
|  | const Standard_Integer | Width,
|  | const Standard_Integer | Height
| ) | const

Standard_EXPORT void V2d_View::ScreenCopy | ( | const Handle(PlotMgt_PlotterDriver)& | aPlotterDriver,
|  | const Standard_Boolean | fWhiteBackground = `Standard_True`,
|  | const Quantity_Factor | aScale = `1.0`
| ) |

Standard_EXPORT void V2d_View::ScreenPlace | ( | const Quantity_Length | x,
|  | const Quantity_Length | y,
|  | const Quantity_Factor | aZoomFactor = `1`
| ) |

Standard_EXPORT void V2d_View::ScreenPostScriptOutput | ( | const Standard_CString | aFile,
|  | const Quantity_Length | aWidth,
|  | const Quantity_Length | aHeight,
|  | const Aspect_TypeOfColorSpace | aTypeOfColorSpace
| ) | const

Standard_EXPORT void V2d_View::Scroll | ( | Standard_Integer & | XCenter,
|  | Standard_Integer & | YCenter,
|  | Standard_Integer & | DX,
|  | Standard_Integer & | DY
| ) |

Standard_EXPORT Standard_Boolean V2d_View::SetBackground | ( | const Standard_CString | aNameFile,
|  | const Aspect_FillMethod | aMethod = `Aspect_FM_CENTERED`
| ) |

Standard_EXPORT void V2d_View::SetBackground | ( | const Quantity_Color & | color | ) |

Standard_EXPORT void V2d_View::SetBackground | ( | const Quantity_NameOfColor | aNameColor | ) |

Standard_EXPORT void V2d_View::SetDefaultHighlightColor | ( | const Standard_Integer | aColorIndex | ) |

Standard_EXPORT void V2d_View::SetDefaultPosition | ( | const Quantity_Length | aXCenter = `0`,
|  | const Quantity_Length | aYCenter = `0`,
|  | const Quantity_Length | aSize = `1000`
| ) |

Standard_EXPORT void V2d_View::SetDeflection | ( | const Quantity_Length | aDeflection | ) |

Standard_EXPORT void V2d_View::SetFitallRatio | ( | const Quantity_Ratio | aRatio | ) |

Standard_EXPORT void V2d_View::ShowHit | ( | const Standard_Integer | X,
|  | const Standard_Integer | Y
| ) |

Standard_EXPORT Quantity_Length V2d_View::Size | ( |  | ) | const

Standard_EXPORT void V2d_View::StoreCurrent | ( |  | ) | `[private]`

Standard_EXPORT void V2d_View::Translate | ( | const Quantity_Length | dx,
|  | const Quantity_Length | dy
| ) |

Standard_EXPORT void V2d_View::Update | ( |  | ) | const`[virtual]`

| Implements Viewer_View.

Standard_EXPORT void V2d_View::UpdateNew | ( |  | ) | const

Standard_EXPORT Handle_Graphic2d_View V2d_View::View | ( |  | ) | const

Standard_EXPORT Handle_V2d_Viewer V2d_View::Viewer | ( |  | ) | const

Standard_EXPORT void V2d_View::WindowFit | ( | const Standard_Integer | aX1,
|  | const Standard_Integer | aY1,
|  | const Standard_Integer | aX2,
|  | const Standard_Integer | aY2
| ) | `[virtual]`

| Implements Viewer_View.

Standard_EXPORT Quantity_Factor V2d_View::Zoom | ( |  | ) | const

Standard_EXPORT void V2d_View::Zoom | ( | const Standard_Integer | aX,
|  | const Standard_Integer | aY,
|  | const Quantity_Ratio | aCoefficient = `0.005`
| ) |

Standard_EXPORT void V2d_View::Zoom | ( | const Standard_Integer | aX1,
|  | const Standard_Integer | aY1,
|  | const Standard_Integer | aX2,
|  | const Standard_Integer | aY2,
|  | const Quantity_Ratio | aCoefficient = `0.005`
| ) |

Standard_EXPORT void V2d_View::Zoom | ( | const Quantity_Factor | Zoom | ) |

## Field Documentation

Standard_Real V2d_View::myDeflection `[private]`

Standard_Boolean V2d_View::myEnablePrevious `[private]`

Standard_Real V2d_View::myFitallRatio `[private]`

Standard_Real V2d_View::myHeight `[private]`

Handle_Graphic2d_Buffer V2d_View::myHitBuf `[private]`

Handle_Graphic2d_GraphicObject V2d_View::myHitPoint `[private]`

Standard_Real V2d_View::myPreviousScale `[private]`

Standard_Real V2d_View::myPreviousSize `[private]`

Standard_Real V2d_View::myPreviousX `[private]`

Standard_Real V2d_View::myPreviousXPosition `[private]`

Standard_Real V2d_View::myPreviousY `[private]`

Standard_Real V2d_View::myPreviousYPosition `[private]`

Standard_Real V2d_View::myScale `[private]`

V2d_ViewerPointer V2d_View::myViewer `[private]`

Handle_Graphic2d_ViewMapping V2d_View::myViewMapping `[private]`

Standard_Real V2d_View::myWidth `[private]`

Handle_Aspect_WindowDriver V2d_View::myWindowDriver `[private]`

Standard_Real V2d_View::myXPosition `[private]`

Standard_Real V2d_View::myYPosition `[private]`

Standard_Real V2d_View::pxmax `[private]`

Standard_Real V2d_View::pxmin `[private]`

Standard_Real V2d_View::pymax `[private]`

Standard_Real V2d_View::pymin `[private]`

The documentation for this class was generated from the following file:

- V2d_View.hxx