Class: LineString

LineString

几何对象线串类。

new SuperMap.Geometry.LineString(points)

common/commontypes/geometry/LineString.js, line 5
Name Type Description
points Array.<SuperMap.Geometry.Point>

用来生成线串的点数组。

Example
var points = [new SuperMap.Geometry.Point(4933.319287022352, -3337.3849141502124),
    new SuperMap.Geometry.Point(4960.9674060199022, -3349.3316322355736),
    new SuperMap.Geometry.Point(5006.0235999418364, -3358.8890067038628),
    new SuperMap.Geometry.Point(5075.3145648369318, -3378.0037556404409),
    new SuperMap.Geometry.Point(5305.19551436013, -3376.9669111768926)],
var roadLine = new SuperMap.Geometry.LineString(points);

Extends

Members

几何对象的范围

componentsArray.<SuperMap.Geometry>

存储几何对象的数组。

readonlycomponentTypesArray.<string>

components存储的的几何对象所支持的几何类型数组,为空表示类型不受限制。

Default Value:

idstring

此几何对象的唯一标示符。

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

SRIDinterger

投影坐标参数。通过该参数,服务器判断Geometry对象的坐标参考系是否与数据集相同,如果不同,则在数据入库前进行投影变换。

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

Methods

staticSuperMap.Geometry.LineString.calculateCircle(points){Array.<SuperMap.Geometry.Point>}

common/commontypes/geometry/LineString.js, line 99

三点画圆弧

Name Type Description
points Array.<SuperMap.Geometry.Point>

传入的待计算的初始点串。

Returns:
Type Description
Array.<SuperMap.Geometry.Point> 计算出相应的圆弧控制点。
Example
var points = [];
points.push(new SuperMap.Geometry.Point(-50,30));
points.push(new SuperMap.Geometry.Point(-30,50));
points.push(new SuperMap.Geometry.Point(2,60));

var circle = SuperMap.Geometry.LineString.calculateCircle(points);

staticSuperMap.Geometry.LineString.createLineEPS(points){Array.<SuperMap.Geometry.Point>}

common/commontypes/geometry/LineString.js, line 249

根据点的类型画出不同类型的曲线 点的类型有三种, LTypeArc, LTypeCurve, NONE

Name Type Description
points Array.<SuperMap.Geometry.Point>

传入的待计算的初始点串。

Returns:
Type Description
Array.<SuperMap.Geometry.Point> 计算出相应的lineEPS控制点。
Example
var points = [];
points.push(new SuperMap.Geometry.Point(-50,30));
points.push(new SuperMap.Geometry.Point(-30,50,"LTypeArc"));
points.push(new SuperMap.Geometry.Point(2,60));
points.push(new SuperMap.Geometry.Point(8,20));

var lineEPS = SuperMap.Geometry.LineString.createLineEPS(points);

inherited addComponent(component, index){Boolean}

common/commontypes/geometry/Collection.js, line 118

添加一个几何对象到集合中。如果设置了componentTypes类型,则添加的几何对象必须是componentTypes中的类型

Name Type Description
component SuperMap.Geometry

待添加的几何对象

index int

几何对象插入的位置

Returns:
Type Description
Boolean 是否添加成功

inherited addComponents(components)

common/commontypes/geometry/Collection.js, line 101

给几何图形对象添加元素。

Name Type Description
components Array.<SuperMap.Geometry>

几何对象组件。

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

inherited addPoint(point, index)

common/commontypes/geometry/MultiPoint.js, line 29

添加点,封装了 SuperMap.Geometry.Collection.addComponent方法。

Name Type Description
point SuperMap.Geometry.Point

添加的点。

index integer

可选的下标。

inherited calculateBounds()

common/commontypes/geometry/Collection.js, line 80

通过遍历数组重新计算边界,在遍历每一子项中时调用 extend 方法。

inherited clearBounds()

common/commontypes/Geometry.js, line 81

清除几何对象的bounds。 如果该对象有父类,也会清除父类几何对象的bounds。

inherited clone(){SuperMap.Geometry.Collection}

common/commontypes/geometry/Collection.js, line 50

克隆当前几何对象。

Returns:
Type Description
SuperMap.Geometry.Collection 克隆的几何对象集合。

inherited destroy()

common/commontypes/geometry/Collection.js, line 40

销毁几何图形。

inherited equals(geometry){Boolean}

common/commontypes/geometry/Collection.js, line 198

判断两个几何图形是否相等。如果所有的 components 具有相同的坐标,则认为是相等的。

Name Type Description
geometry SuperMap.Geometry

需要判断的几何图形。

Returns:
Type Description
Boolean 输入的几何图形与当前几何图形是否相等。

inherited extendBounds(newBounds)

common/commontypes/Geometry.js, line 94

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

-

inherited getArea(){number}

common/commontypes/geometry/Collection.js, line 185

计算几何对象的面积。注意,这个方法在 类中需要重写。

Returns:
Type Description
number 几何图形的面积,是几何对象中所有组成部分的面积之和。

inherited getBounds(){SuperMap.Bounds}

common/commontypes/Geometry.js, line 111

获得几何图形的边界。如果没有设置边界,可通过计算获得。

Returns:
Type Description
SuperMap.Bounds 返回的几何对象的边界。

inherited getComponentsString(){string}

common/commontypes/geometry/Collection.js, line 67

获取components字符串

Returns:
Type Description
string components字符串

getSortedSegments(){Array}

common/commontypes/geometry/LineString.js, line 39
Returns:
Type Description
Array An array of segment objects. Segment objects have properties x1, y1, x2, and y2. The start point is represented by x1 and y1. The end point is represented by x2 and y2. Start and end are ordered so that x1 < x2.

getVertices(nodes){Array}

common/commontypes/geometry/LineString.js, line 77

返回几何图形的所有顶点的列表。

Name Type Description
nodes Boolean

对于线来说,仅仅返回作为端点的顶点,如果设为false,则返回非端点的顶点 如果没有设置此参数,则返回所有顶点。

Returns:
Type Description
Array 几何图形的顶点列表。

removeComponent(point){Boolean}

common/commontypes/geometry/LineString.js, line 25

只有在线串上有三个或更多的点的时候,才会允许移除点(否则结果将会是单一的点)。

Name Type Description
point SuperMap.Geometry.Point

将被删除的点。

Returns:
Type Description
Boolean 删除的点。

inherited removeComponents(components){Boolean}

common/commontypes/geometry/Collection.js, line 151

清除几何对象。

Name Type Description
components Array.<SuperMap.Geometry>

需要清除的几何对象。

Returns:
Type Description
Boolean 元素是否被删除。

inherited removePoint(point)

common/commontypes/geometry/MultiPoint.js, line 40

移除点,封装了 SuperMap.Geometry.Collection.removeComponent 方法。

Name Type Description
point SuperMap.Geometry.Point

移除的点对象。

inherited setBounds(bounds)

common/commontypes/Geometry.js, line 69

设置此几何对象的bounds。

Name Type Description
bounds SuperMap.Bounds

-

inherited toString(){string}

common/commontypes/Geometry.js, line 155

返回geometry对象的字符串表述,需要引入SuperMap.Format.WKT。此方法只能在子类实现,在父类使用会报错。

Returns:
Type Description
string geometry对象的字符串表述(Well-Known Text)