Cadcorp SIS API Methods

MeasureRoute Method

Description

Measures the best route between two positions.

Syntax

Visual Basic
Public Function MeasureRoute( _
   ByVal x1 As Double, _
   ByVal y1 As Double, _
   ByVal z1 As Double, _
   ByVal x2 As Double, _
   ByVal y2 As Double, _
   ByVal z2 As Double, _
   ByVal propertyName As String, _
   ByVal filter As String, _
   ByVal locusNoGo As String, _
   ByVal bCreateLine As Integer _
) As Double

Parameters

x1
The x coordinate of the start point of the route.
 
y1
The y coordinate of the start point of the route.
 
z1
The z coordinate of the start point of the route.
 
x2
The x coordinate of the end point of the route.
 
y2
The y coordinate of the end point of the route.
 
z2
The z coordinate of the end point of the route.
 
propertyName
The expression, or simple property, to use in the route finding calculation as the "cost" of a Link item. For example, using the simple property Length will find the shortest route, and using the expression "_length#/Speed#", provided each Link has a user-defined Speed# property, will find the quickest route. Any expression may be used, although if a string expression is used it must be a string representation of a numeric value. See Property Expressions Syntax for details.

This method can find a route over any geometry, not just Link/Node topology, by specifying an empty string for this argument. In this case, the shortest route is always found.
 
filter
Optionally specifies a named Filter which all items must pass to be considered as part of the route.
 
locusNoGo
Optionally specifies a named Spatial Filter through which the route cannot pass.
 
bCreateLine
True    Create a LineString item which follows the route found.
False    Do not create a LineString item.

Return Type

The total of the expression results for each link in the route, e.g. with _length#/Speed#, the return value is the total time. If the default expression is used the return value is the length of the route found.

The named Spatial Filter used will normally have its testing mode set to exclude any items which cross it, using a call similar to the following:

CreateLocusFromItem("SpatialFilter",SIS_GT_INTERSECT,SIS_GM_GEOMETRY)

Remarks

Available: GEO MM ME MD OM OD OV SISpy

Group:

Example

Distance = sis.MeasureRoute (100, 150, 0, 500, 300, 0, "_length#", "A Roads only", "NoGo", True)

It would be possible to use GetPosEx to generate a snap position.


Send comments on this topic.

Click to return to www.cadcorp.com

© Copyright 2000-2017 Computer Aided Development Corporation Limited (Cadcorp).