new Route(points, options)
Usage
// 浏览器
<script type="text/javascript" src="https://iclient.supermap.io/dist/openlayers/iclient-ol.js"></script>
<script>
  new ol.supermap.Route(points, options);
  
  // 弃用的写法
  new SuperMap.Route(points, options);
</script>
// ES6 Import
import { Route } from '@supermapgis/iclient-ol';
new Route(points, options);
        
        
        | Name | Type | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
points | 
            
            
            Array.<Geometry> | 
                
                 形成路由对象的线数组。  | 
        ||||||||||||||||||
options | 
            
            
            Object | 
                
                 参数。 
  | 
        
Extends
Members
- 
    
boundsBounds
 - 
    
    
几何对象的范围。
 - 
    
centernumber
 - 
    
    
路由对象的中心点。
 - 
    
componentsArray.<Geometry>
 - 
    
    
存储几何对象的数组。
 - 
    
componentTypesArray.<string>
 - 
    
    
components 存储的几何对象所支持的几何类型数组。
- Default Value: LineString
 
 
idnumber
路由对象在数据库中的 ID。
lengthnumber
路由对象的长度。单位与数据集的单位相同。
maxMnumber
最大线性度量值,即所有结点到起始点的量算距离中最大值。
minMnumber
最小线性度量值,即所有结点到起始点的量算距离中最小值。
parentGeometry
父类几何对象。
partsArray.<number>
服务端几何对象中各个子对象所包含的节点个数。
pointsArray.<Object>
路由对象的所有路由点。
Example
(start code)
[
 {
     "measure": 0,
     "y": -4377.027184298267,
     "x": 4020.0045221720466
 },
 {
     "measure": 37.33288381391519,
     "y": -4381.569363260499,
     "x": 4057.0600591960642
 }
]
(end)
    
    
    
SRIDnumber
投影坐标参数。通过该参数,服务器判断几何对象的坐标参考系是否与数据集相同,如果不同,则在数据入库前进行投影变换。
Example
var geometry= new Geometry();
geometry. SRID=4326;
    
    
    
stylestring
路由对象的样式。
typestring
服务端几何对象类型。
Methods
- 
    
static fromJson(jsonObject){Route}
common/iServer/Route.js, line 187 - 
    
    
将 JSON 对象转换为 Route 对象。
Name Type Description jsonObjectObject 可选 JSON 对象表示的路由对象。
Returns:
Type Description Route 转化后的 Route 对象。  - 
    
inherited addComponent(component, index){boolean}
common/commontypes/geometry/Collection.js, line 126 - 
    
    
添加几何对象到集合中。如果设置了 componentTypes 类型,则添加的几何对象必须是 componentTypes 中的类型。
Name Type Description componentGeometry 待添加的几何对象。
indexnumber 可选 几何对象插入的位置。
Returns:
Type Description boolean 是否添加成功。  - 
    
inherited addComponents(components)
common/commontypes/geometry/Collection.js, line 109 - 
    
    
给几何图形对象添加元素。
Name Type Description componentsArray.<Geometry> 几何对象组件。
Example
var geometryCollection = new GeometryCollection(); geometryCollection.addComponents(new SuerpMap.Geometry.Point(10,10)); - 
    
inherited calculateBounds()
common/commontypes/geometry/Collection.js, line 88 - 
    
    
通过遍历数组重新计算边界,在遍历每一子项中时调用 extend 方法。
 - 
    
inherited clearBounds()
common/commontypes/Geometry.js, line 85 - 
    
    
清除几何对象的边界。 如果该对象有父类,也会清除父类几何对象的边界。
 - 
    
inherited clone(){GeometryCollection}
common/commontypes/geometry/Collection.js, line 58 - 
    
    
克隆当前几何对象。
Returns:
Type Description GeometryCollection 克隆的几何对象集合。  - 
    
inherited destroy()
common/iServer/Route.js, line 167 - 
    
    
销毁几何图形。
 - 
    
inherited equals(geometry){boolean}
common/commontypes/geometry/Collection.js, line 203 - 
    
    
判断两个几何对象是否相等。如果所有的 components 具有相同的坐标,则认为是相等的。
Name Type Description geometryGeometry 需要判断的几何对象。
Returns:
Type Description boolean 输入的几何对象与当前几何对象是否相等。  - 
    
inherited extendBounds(newBounds)
common/commontypes/Geometry.js, line 98 - 
    
    
扩展现有边界以包含新边界。如果尚未设置几何边界,则设置新边界。
Name Type Description newBoundsBounds 几何对象的边界。
 - 
    
inherited getArea(){number}
common/commontypes/geometry/Collection.js, line 190 - 
    
    
计算几何对象的面积。注意,这个方法在 GeometryPolygon 类中需要重写。
Returns:
Type Description number 几何图形的面积,是几何对象中所有组成部分的面积之和。  - 
    
    
获得几何图形的边界。如果没有设置边界,可通过计算获得。
Returns:
Type Description Bounds 几何对象的边界。  - 
    
inherited getComponentsString(){string}
common/commontypes/geometry/Collection.js, line 75 - 
    
    
获取 components 字符串。
Returns:
Type Description string components 字符串。  - 
    
inherited getVertices(nodes){Array}
common/commontypes/geometry/Collection.js, line 229 - 
    
    
返回几何对象的所有结点的列表。
Name Type Description nodesboolean 可选 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
Returns:
Type Description Array 几何对象的顶点列表。  - 
    
inherited removeComponent(component){boolean}
common/commontypes/geometry/Collection.js, line 175 - 
    
    
从集合中移除几何对象。
Name Type Description componentGeometry 要移除的几何对象。
Returns:
Type Description boolean 几何对象是否移除成功。  - 
    
inherited removeComponents(components){boolean}
common/commontypes/geometry/Collection.js, line 157 - 
    
    
清除几何对象。
Name Type Description componentsArray.<Geometry> 需要清除的几何对象。
Returns:
Type Description boolean 元素是否被删除。  - 
    
inherited setBounds(bounds)
common/commontypes/Geometry.js, line 73 - 
    
    
设置几何对象的边界。
Name Type Description boundsBounds 范围。
 - 
    
toJson(){Object}
common/iServer/Route.js, line 114 - 
    
    
转换为 JSON 对象。
Returns:
Type Description Object JSON 对象。