Open CASCADE Technology  6.5.4
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
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:
Inheritance graph
[legend]

Public Member Functions

 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.

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.

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.

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;

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;

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.

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.

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:

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.

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.

void Translate (const Quantity_Length dx, const Quantity_Length dy)
 Translates the dx,dy center of the objects space.

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.

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.

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.

Quantity_Length Convert (const Standard_Integer V) const
 Converts a screen value into the view space value V.

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.

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.

Quantity_Length Convert (const Quantity_Length aDriverSize) const
 returns a view size from a driver size.

void Reset ()
 Resets the viewmapping of the view and updates the view.

void Previous ()
 switches the view to its previous viewmapping
and updates the view.

void DisableStorePrevious ()
 Disables the Previous function in this framework.

void EnableStorePrevious ()
 Enables the Previous function in this framework.

void Update () const
 Clears the window and redraws all primitives.

void UpdateNew () const
 draws the objects created since the last update.

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.

void Restore () const
 Restores the full window area from the backing stored window.
Warning
This function only works if the window is double-buffered.

void Dump () const
void Dump (const Standard_CString aFileName) const
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.

Handle_Graphic2d_DisplayList PickByCircle (const Standard_Integer X, const Standard_Integer Y, const Standard_Integer Radius)
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.

void Erase ()
 Removes all the graphic objects from the view.

void MustBeResized (const V2d_TypeOfWindowResizingEffect anEffect)
 indicates that the window in which the view is drawn has been resized
and updates the view.

void HasBeenMoved ()
 Indicates whether the window associated with the
view has been moved or not.

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.

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

void PlotScreen (const Handle< PlotMgt_PlotterDriver > &aPlotterDriver) const
 Plots the view to a plotter according to the current
size and center of the view.

void ScreenCopy (const Handle< PlotMgt_PlotterDriver > &aPlotterDriver, const Standard_Boolean fWhiteBackground=Standard_True, const Quantity_Factor aScale=1.0)
 dump the view

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.

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.

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.

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.

void EraseHit ()
 erases the hit point and updates the view.

void SetDefaultHighlightColor (const Standard_Integer aColorIndex)
 Defines the default override color of objects or
primitives using Highlight() methods.

void SetDeflection (const Quantity_Length aDeflection)
 Updates the drawing precision factor aDeflection for
curves and circles.

Quantity_Length Deflection () const
 Returns the current deflection coefficient.

Handle_Graphic2d_View View () const
 Returns the associated Grahic2d view with this view.

Handle_V2d_Viewer Viewer () const
 Returns the parent viewer of this view.

Handle_Aspect_WindowDriver Driver () const
 Returns the window driver handle associated with this view.

Quantity_Factor Zoom () const
 returns the current zoom factor of the view.

void Center (Quantity_Length &aX, Quantity_Length &aY) const
 returns the current point of the user space
being at the center of the view.

Quantity_Length Size () const
 Returns the current size of the view.

Quantity_NameOfColor Color () const
 returns the background color of the view.

void Color (Quantity_Color &color) const
 returns the background color of the view.

void Scroll (Standard_Integer &XCenter, Standard_Integer &YCenter, Standard_Integer &DX, Standard_Integer &DY)
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.

void Fit (const Standard_Integer aX1, const Standard_Integer aY1, const Standard_Integer aX2, const Standard_Integer aY2)
 idem than WindowFit

void SetBackground (const Quantity_NameOfColor aNameColor)
 Defines the color of view's background

void SetBackground (const Quantity_Color &color)
 Defines the color of view's background

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.


Constructor & Destructor Documentation

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

void V2d_View::Color ( Quantity_Color color) const
Handle_Aspect_WindowDriver V2d_View::Driver ( ) const
void V2d_View::Dump ( ) const
void V2d_View::Dump ( const Standard_CString  aFileName) const
Handle_Graphic2d_DisplayList V2d_View::Pick ( const Standard_Integer  X,
const Standard_Integer  Y,
const Standard_Integer  aPrecision 
)
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 
)
Handle_Graphic2d_DisplayList V2d_View::PickByCircle ( const Standard_Integer  X,
const Standard_Integer  Y,
const Standard_Integer  Radius 
)

Implements Viewer_View.

void V2d_View::Plot ( const Handle< PlotMgt_PlotterDriver > &  aPlotterDriver,
const Quantity_Length  aXCenter,
const Quantity_Length  aYCenter,
const Quantity_Factor  aScale = 1.0 
) const
void V2d_View::Plot ( const Handle< PlotMgt_PlotterDriver > &  aPlotterDriver,
const Quantity_Factor  aScale = 1.0 
) const
void V2d_View::ScreenCopy ( const Handle< PlotMgt_PlotterDriver > &  aPlotterDriver,
const Standard_Boolean  fWhiteBackground = Standard_True,
const Quantity_Factor  aScale = 1.0 
)
void V2d_View::SetDefaultPosition ( const Quantity_Length  aXCenter = 0,
const Quantity_Length  aYCenter = 0,
const Quantity_Length  aSize = 1000 
)
void V2d_View::Update ( ) const [virtual]

Implements Viewer_View.

Handle_Graphic2d_View V2d_View::View ( ) const
Handle_V2d_Viewer V2d_View::Viewer ( ) const

Implements Viewer_View.

  • C is the coefficient aCoefficient and
  • D is the distance between the two points aX1,aY1 and aX2,aY2.

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