Nevron Open Vision Documentation
Pages

This topic contains the following sections:
About Pages

Pages are represented by the NPage class. The pages of a drawing are contained inside the Pages collection of each NDrawing element. Of all pages inside the drawing only one can be active at a time. The active page is controlled by the ActivePageIndex property. By default each drawing is created with a single page that is at the same time the active page of the drawing.

The page is a container element that has the following child items:

Additionally the page contains the currently selected page items inside its Selection attribute.

Zooming

Drawing pages expose a ZoomMode property, which determines the page zoom policy, the options being:

Value Description
Normal Page is displayed with its current zoom (default).
Fit Page is zoomed to fit the drawing view area.
FitToWidth Page is zoomed to fit the drawing view width.
FitToHeight Content is zoomed to fit the drawing view height.

The following code fragment demonstrates how to make the active page of a drawing zoom to fit the available area of a drawing view:

Zoom page to fit drawing view area
Copy Code
drawing.ActivePage.ZoomMode = ENZoomMode.FitToHeight;

To zoom a drawing page programmatically you should make sure its ZoomMode is set to Normal and then modify its ZoomFactor property, where a value of 1 means the page is at 100%, 0.8 means the page is zoomed to 80%, 1.2 means the page is zoomed to 120% and so on. You can also use the ZoomIn() and ZoomOut() methods to zoom the page in and out with the value of the ZoomStep property.

Selection

The selected items of the page are exposed by the NPageSelection attribute. The selection can be configured to operate in two modes via its Mode property, which are:

The first or the last selected node is called selection anchor and can be used by different alignment and resize operations. Whether the first or the last selected node is the selection anchor is controlled by the AnchorMode property. The current selection anchor can be obtained from the AnchorItem property.

The selection class provides a powerful set of methods, which can help you modify the selection. The most important ones are demonstrated in the following example:

Selection Operations
Copy Code
// get the drawing view active page selection
NPageSelection selection = drawingView.ActivePage.Selection;
// make node1 the one and only selected node
selection.SingleSelect(node1);
// append node2 to the current selection
selection.MultiSelect(node2);
// toggle the selection state of the node3 (in this case this will select node3)
selection.ToggleSelect(node3);
// toggle the selection state of the node3 (in this case this will deselect node3)
selection.ToggleSelect(node3);
// deselect node1
selection.Deselect(node1);
// deselect all nodes (in this case only node2)
selection.DeselectAll();
Drawing Scale

NOV Diagram uses the NOV UI measurement unit for all display related measures, which is the DIP (device independent pixel, which is 1/96 of an inch). By default the drawing scale is configured so that 1 DIP equals 1 DIP (identity scale).

Some applications however require to display either too small or too large scenes, which are impossible to visualize without a drawing scale. You must have a large monitor to display a room of 3x3 meters and there is no monitor, which can display something measured in kilometers. In these cases you must use a drawing scale.

Drawing scale is a user defined ratio between the logical unit and a display unit. For example 1 meter = 1 mm is a commonly used Metric drawing scale that is configured like this:

Setting Drawing Scale
Copy Code
NPage activePage = drawingView.ActivePage;
activePage.LogicalLength = new NLength(1, NUnit.Meter);
activePage.DisplayLenght = new NLength(1, NUnit.Millimeter);

Drawing scale helps you work with the document content as if it is measured with the real world measurement unit that you want to use. For example: a room can be defined as a rectangle with width 3 and height 3 meters in logical measurement units like this.

Using Drawing Scale
Copy Code
NBasicShapesFactory basicShapes = new NBasicShapesFactory();
NShape shape = basicShapes.CreateShape(ENBasicShapes.Rectangle);
shape.Width = activePage.LogicalToDisplay(3);
shape.Height = activePage.LogicalToDisplay(3);
activePage.Items.Add(shape);
The rulers, grid and status bar report measurements in the page logical unit.
Send Feedback