Nevron Open Vision Documentation
Diagram / Diagram DOM / Drawings / Shapes / Routable Connectors
In This Topic
    Routable Connectors
    In This Topic
     About Routable Connectors

    Routable connectors are represented by the NRoutableConnector class, that derives from NShape. Routable connectors are special shapes, because NOV diagram may perform the following actions with them:

    • Routable connectors can be rerouted to avoid obstacles in their path.
    • The geometry of Routable connectors can be modified by layouts.
     Routable Connector Model

    The routable connector is interesting in the fact that its geometry is defined by a set of points, also known as the routable connector model. The routable connector model is accessible from the Model property. Currently there are two types of routable connector models:

    1. NOrthogonalRoutableConnectorModel - this is the default connector model. When the routable connector is using this model, it can be rerouted in an orthogonal fashion. The orthogonal connector model keeps track of the orientation of individual line segments in order to allow for HV editing of its segments and points.
    2. NPolylineRoutableConnectorModel - this is a more simple connector model that only contains a set of points through which the connector goes through.

    The geometry of routable connectors is automatically updated to reflect the current model state. When the routable connector Model property is set to null (i.e. the connector does not have a model), the geometry is updated as a straight line. Several methods help you work with the connector model more easily:

    • The IsLine, IsPolyline and IsOrthogonal properties help you determine what type of model is the connector currently using.
    • The MakeLine, MakePolyline and MakeOrthogonal methods help you change the connector model.

    Routable connectors with orthogonal connector model can be rerouted to avoid obstacles in their path. This operation is performed by calling the Reroute() method of the connector. It tries to pool the connector for routing on the next document evaluation pass. You can also call the CanReroute() method to determine whether the routing is currently possible.

    In most the cases you want the connector to be automatically rerouted. This is controlled by the RerouteMode property which accepts one of the following values:

    • Never - the route is never automatically rerouted - it is up to the user to manage its points or call the Reroute method.
    • Always - the route is automatically rerouted whenever any of the obstacles have changed (e.g. there is a chance for the route to be rerouted more efficiently)
    • WhenNeeded - The route is rerouted whenever an obstacle is placed on it or the shapes to which it is connected are moved or have changed
     Routing Manager

    The routing of a connector is always performed by the NRoutingManager instance that is accessible from the RoutingManager property of each NPage. The routing manager considers as "obstacles" all 2D shapes. You can instruct the router to allow routes to go through certain 2D shapes either horizontally and/or vertically by setting the RouteThroughHorizontally and/or RouteThroughVertically properties of these shapes.

    To globally disable routing you simply need to set the NRoutingManager-Enabled property to false. By default page routing is enabled. The routing manager will automatically stop to perform routing requests, if the page has more obstacles than the value specified by the NRoutingManager-MaxAvoidedObstacles property.

     Connectors Intersection and Line Jumps

    By default when routable connectors intersect, NOV Diagram shows line jumps:

    You can control various properties of the line jumps from the LineJumps property of the drawing page. For example, to disable line jumps, set the Enabled property of the LineJumps object to false:

    Disable Line Jumps
    Copy Code
    drawingView.ActivePage.LineJumps.Enabled = false;

    If you want to get the intersection points of two routable connectors in page coordinates, use the GetIntersectionPoints method of the NRoutableConnector class. This method returns a list with all intersection points of a routable connector with another routable connector in page coordinates. If the connectors do not intersect, an empty list is returned. The following is an example:

    Get the intersection points of two connectors
    Copy Code
    NList<NPoint> intersectionPoints = routableConnector1.GetIntersectionPoints(routableConnector2);
    See Also