Nevron Open Vision Documentation
Diagram / Diagram DOM / Drawings / Drawing View and Drawing Document
In This Topic
    Drawing View and Drawing Document
    In This Topic
     About Drawing Views and Drawing Documents

    A drawing document is represented by the NDrawingDocument class, which derives from the NGenericDocument<NDrawing>, which essentially means that the content of a drawing document is an instance of the NDrawing class, which represents a diagram drawing (see Drawings for more information).

    The drawing view is represented by the NDrawingView class, which is essentially a widget that is designed to display the content of a drawing document. In this way you can integrate a drawing inside any NOV UI hierarchy (see UI Overview for more info).

    The drawing document displayed by the drawing view is accessible via the Document property. When a drawing view is created, it by default also creates an empty drawing document inside it.

    The following code creates a drawing view, the document of which has some shapes and is placed inside a stack panel.

    Drawing View Example
    Copy Code
    // create a stack panel
    NStackPanel stack = new NStackPanel();
    stack.Add(new NButton("Some Button"));
    // add a drawing view in the stack panel
    NDrawingView drawingView = new NDrawingView();
    // get the drawing view document and its active page
    NDrawingDocument document = drawingView.Document;
    NPage activePage = document.Content.ActivePage;
    // add a rectangle shape to the active page items
    NShape rectangleShape = new NBasicShapeFactory().CreateShape(ENBasicShape.Rectangle);
    rectangleShape.Text = "My First Shape";
     Drawing View Tools

    The drawing view Interactor is populated with tools that perform different actions upon the drawing view and its content (see the Interactors topic for a fundamental overview of interactors).

    All tools that reside inside in the drawing view Interactor are defined in the Nevron.Nov.Diagram.DrawingTools namespace.

    Most commonly you will have to enable a given tool and disable all others. To do so, use the SingleEnableTool of the interactor:

    Enable the Create Rectangle tool
    Copy Code
    drawingView.Interactor.SingleEnableTool(NCreateRectangleTool.NCreateRectangleToolSchema, true);

    The line of code above will activate the "Create Rectangle" drawing tool and disable all others like shown on the following image:


    To enable and disable tools you can also use the EnableTool, EnableAllTools, DisableTool and DisableAllTools methods.

    Following is a brief overview of all tools:

    Tool Class Description

    General Tools


    A composite tool that aggregates the following atomic tools:

    - creates a horizontal or vertical guideline, if the drags from the drawing view rulers.
    NDragHandleTool - implements the interactive dragging of handles.
    NClickSelectTool - selects the clicked shape
    NRectangleSelectTool - selects the set of shape hit by a visually defined rectangle.
    NMoveTool - moves the currently selected shapes

    NPanTool A tool that implements interactive panning (scrolling) of the currently active page.

    Create Element Tools

    NCreateRectangleTool Creates a rectangle shape inside the active page
    NCreateEllipseTool Creates an ellipse shape inside the active page
    NCreateLineTool Creates either a line segment that continues a previously drawn open figure, or creates a simple line shape.
    NCreateCubicBezierTool Creates either a cubic bezier segment that continues a previously drawn open figure, or creates a simple cubic bezier shape.
    NCreateArcTool Creates either an arc segment that continues a previously drawn open figure, or creates a simple arc shape.
    NCreateEllipticalArcTool Creates either an elliptical arc segment that continues a previously drawn open figure, or creates a simple elliptical arc shape.
    NCreateConnectorTool Creates a routable connector
    NCreateTextTool Creates a text shape

    Ambient Tools

    NContextMenuTool Shows a context menu for the currently selected page items.
    NScrollAndZoomTool Implements mouse wheel scrolling and zooming of the active page.
    NInplaceEditTool Starts in-place editing of the shape that is double clicked.
    NDragDropTargetTool Extends the Drop target functionality of drawing views, by providing them with the ability to handle dropped library clippings, text, images etc.

     Drawing View Commands

    The drawing view Commander is populated with commands that perform different actions upon the drawing view and its content (see the Commanding topic for a fundamental overview of commands).

    All commands that reside inside in the drawing view Commander are defined in the Nevron.Nov.Diagram.DrawingCommands namespace.

    See Also