Class: Route

SuperMap.Route

  • The Route class. The route objects are a series of ordered x, y coordinate pairs with the attribute values, where the M value is the distance attribute (the distance to the known point) of this node.

new SuperMap.Route(points, options)

Route.js, line 8
Name Type Description
points Array.<SuperMap.Geometry>

The array of line that form a routing object

options Object

The parameters.

Name Type Description
id number

The route object ID in the database.

length number

The length of the route object.

maxM number optional

The maximum linear measurement value, that is, the maximum value in the calculation distance from all the nodes to the starting point.

minM number optional

The minimum linear measurement value, that is, the minimum value in the calculation distance from all the nodes to the starting point.

type string optional

Geometry type on server.

Extends

Members

Bounds of the geometric object.

centernumber

The center of the route object

componentsArray.<SuperMap.Geometry>

The component parts of this geometry.

componentTypesArray.<string>

The arrray of geometry object supported by the geometry object that saved by the components.

Default Value:
SuperMap.Geometry.LineString

idnumber

The route object ID in the database.

lengthnumber

The length of the route object, in the same unit as the data set.

maxMnumber

The maximum linear measurement value, that is, the maximum value in the calculation distance from all the nodes to the starting point.

minMnumber

The minimum linear measurement value, that is, the minimum value in the calculation distance from all the nodes to the starting point.

This is set when a Geometry is added as component of another geometry

partsArray.<number>

The number of nodes contained in each sub object in a server - side geometric object.

pointsArray.<Object>

All routing points of a routing object.

Example
(start code)
[
 {
     "measure": 0,
     "y": -4377.027184298267,
     "x": 4020.0045221720466
 },
 {
     "measure": 37.33288381391519,
     "y": -4381.569363260499,
     "x": 4057.0600591960642
 }
]
(end)

SRIDinterger

Projection coordinate parameter. By this parameter, server will determine whether the geometry object's coordinate reference is as the same as dataset, if not, then change projection before adding into database.

Example
var geometry= new SuperMap.Geometry();
  geometry. SRID=4326;

stylestring

Style of the route object

typestring

Type of the geometry object on the server.

Methods

SuperMap.Route.fromJson(jsonObject){SuperMap.Route}

Route.js, line 181

Transform the JSON object to the SuperMap.Route object.

Name Type Description
jsonObject Object optional

the JSON object.

Returns:
Type Description
SuperMap.Route the SuperMap.Route object.

inherited addComponent(component, index){boolean}

Collection.js, line 120

Add a geometry to this collection. If the componentTypes is set,the type of the geometry that to be added must on the componentTypes.

Name Type Description
component SuperMap.Geometry

The geometry to be added.

index int optional

The position of the insert of a geometric object.

Returns:
Type Description
boolean Whether or not to add success.

inherited addComponents(components)

Collection.js, line 103

Add components to this geometry.

Name Type Description
components Array.<SuperMap.Geometry>

An array of geometries to add.

Example
var collection = new SuperMap.Geometry.Collection();
collection.addComponents(new SuerpMap.Geometry.Point(10,10));

inherited calculateBounds()

Collection.js, line 82

Recalculate the bounds by traversing array, Call the extend method when traversing each subitem.

inherited clearBounds()

Geometry.js, line 82

clear bounds of the geometric object. If the object has a parent class, it also clears the bounds of the parent class geometry object.

inherited clone(){SuperMap.Geometry.Collection}

Collection.js, line 52

Clone this geometry.

Returns:
Type Description
SuperMap.Geometry.Collection An exact clone of this collection.

inherited destroy()

Collection.js, line 42

Destroy this geometry.

inherited destroy()

Collection.js, line 42

Destroy this geometry.

inherited equals(geometry){boolean}

Collection.js, line 197

Determine whether another geometry is equivalent to this one. Geometries are considered equivalent if all components have the same coordinates.

Name Type Description
geometry SuperMap.Geometry

The geometry to determined.

Returns:
Type Description
boolean Whether the input geometry is equal to the current geometry.

inherited extendBounds(newBounds)

Geometry.js, line 95

Extend the existing bounds to include the new bounds. If geometry's bounds is not yet set, then set a new Bounds.

Name Type Description
newBounds SuperMap.Bounds

New bounds.

inherited getArea(){number}

Collection.js, line 184

Calculate the area of this geometry. Note how this function is overridden in SuperMap.Geometry.Polygon.

Returns:
Type Description
number The area of the collection by summing its parts.

inherited getBounds(){SuperMap.Bounds}

Geometry.js, line 112

Gets the boundary of the geometric graphic. If not set, it can be acquired through computing.

Returns:
Type Description
SuperMap.Bounds Returns the bounds of the geometry.

inherited getComponentsString(){string}

Collection.js, line 69

Get the components string.

Returns:
Type Description
string the components string.

inherited getVertices(nodes){Array}

Collection.js, line 223

Return a list of all points in this geometry.

Name Type Description
nodes boolean optional

For lines, only return vertices that are endpoints. If false, for lines, only vertices that are not endpoints will be returned. If not provided, all vertices will be returned.

Returns:
Type Description
Array A list of all vertices in the geometry.

inherited removeComponent(component){boolean}

Collection.js, line 169

Remove a component from this geometry.

Name Type Description
component SuperMap.Geometry

The component to be removed

Returns:
Type Description
boolean Whether or not the component is removed successfully.

inherited removeComponents(components){boolean}

Collection.js, line 151

Remove components from this geometry.

Name Type Description
components Array.<SuperMap.Geometry>

The components to be removed.

Returns:
Type Description
boolean Whether or not the components is removed successfully.

inherited setBounds(bounds)

Geometry.js, line 70

Set bounds of the geometric object.

Name Type Description
bounds SuperMap.Bounds

bounds.

toJson(){Object}

Route.js, line 108

Turned to the JSON object.

Returns:
Type Description
Object The JSON object.