Class: LineString

SuperMap.Geometry.LineString

The geometry object line string class.

new SuperMap.Geometry.LineString(points)

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

An array of points used to generate the linestring

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

Bounds of the geometric object.

componentsArray.<SuperMap.Geometry>

The component parts of this geometry.

componentTypeArray.<string>

The geometry format array supported by geometry object on the components storage.

Default Value:
["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"]

componentTypesArray.<string>

The geometry format array supported by geometry object on the components storage.

Default Value:
["SuperMap.Geometry.Point"]

idstring

The unique identifier of the geometric object.

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

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;

Methods

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

LineString.js, line 99

draw circular arc according to three points.

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

The incoming string of initial points to be calculated.

Returns:
Type Description
Array.<SuperMap.Geometry.Point> Calculate to the corresponding arc control 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);

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

LineString.js, line 248

Draw different types of curves according to the type of point. The type of the point have the LTypeArc, the LTypeCurve and the NONE.

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

The incoming string of initial points to be calculated.

Returns:
Type Description
Array.<SuperMap.Geometry.Point> Calculate to the corresponding lineEPS control point.
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}

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 addPoint(point, index)

MultiPoint.js, line 29

Add a point that encapsulates the SuperMap.Geometry.Collection.addComponent method.

Name Type Description
point SuperMap.Geometry.Point

Point to be added

index number optional

Optional index.

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 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.

getSortedSegments(){Array}

LineString.js, line 40
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}

LineString.js, line 78

Return a list of all vertices in the 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.

removeComponent(point){boolean}

LineString.js, line 26

Only allows removal of a point if there are three or more points in the linestring. (otherwise the result would be just a single point)

Name Type Description
point SuperMap.Geometry.Point

The point to be removed。

Returns:
Type Description
boolean The component was removed.

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 removePoint(point)

MultiPoint.js, line 40

Remove the point and encapsulate the SuperMap.Geometry.Collection.removeComponent method.

Name Type Description
point SuperMap.Geometry.Point

Point to be removed.

inherited setBounds(bounds)

Geometry.js, line 70

Set bounds of the geometric object.

Name Type Description
bounds SuperMap.Bounds

bounds.