Table of Contents

Class CadView

Namespace
OpenCAD2D
Assembly
OpenCAD2D.Core.dll

What part of a space the canvas shows and at what zoom: the point of the drawing at the centre of the canvas and the pixels one drawing unit takes, and the angle the drawing is turned by on the canvas, nought but through a twisted viewport. Zooming about the cursor and panning are arithmetic on these numbers, so they are tested here with no window.

public sealed class CadView
Inheritance
CadView
Inherited Members

Constructors

CadView(double, double)

Makes a view of a canvas of a size, showing the origin at 1 pixel to the unit.

Properties

CenterX

Gets the X of the point of the drawing at the centre of the canvas.

CenterY

Gets the Y of the point of the drawing at the centre of the canvas.

DrawingToScreen

Gets the transformation from the drawing to the pixels of the canvas, Y up in the drawing becoming Y down on the screen.

Height

Gets the height of the canvas in pixels.

PixelsPerUnit

Gets the pixels one drawing unit takes.

Twist

Gets the angle the drawing is turned by on the canvas, in radians, counter-clockwise: nought but for model space seen through a viewport whose view is twisted, as a viewport twisted by 30 degrees shows the X axis of the world rising at 30 degrees.

VisibleBox

Gets the box of the drawing the canvas shows: through a twisted viewport the box about the canvas turned.

Width

Gets the width of the canvas in pixels.

Methods

DrawingToPixel(double, double, out double, out double)

Gets the pixel of a point of the drawing.

Pan(double, double)

Pans: moves the drawing under the canvas by a number of pixels, as dragging with the middle button does.

Resize(double, double)

Changes the size of the canvas, keeping the centre of the view where it is.

ScreenToDrawing(double, double, out double, out double)

Gets the point of the drawing under a pixel.

ZoomAt(double, double, double)

Zooms about a pixel: the point of the drawing under it stays under it.

ZoomTo(DisplayBox, double)

Shows a box wholly, with a margin, as ZOOM Extents does; through a twisted viewport the box turned.

ZoomToHeight(double, double, double)

Shows a view given by its centre and its height, as AutoCAD keeps the view of a viewport in a drawing (the VPORT record's groups 12, 22 and 40): the height of the canvas covers height units, whatever the canvas's width, so that a canvas twice as wide shows twice the width. The turn of the view is kept.