Class: LinearRing

SuperMap.Geometry.LinearRing

A Linear Ring is a special LineString which is closed. It closes itself automatically on every addPoint/removePoint by adding a copy of the first point as the last point. Also, as it is the first in the line family to close itself, a getArea() function is defined to calculate the enclosed area of the linearRing.

new SuperMap.Geometry.LinearRing(points)

LinearRing.js, line 4
Name Type Description
points Array.<SuperMap.Geometry.Point>

The point of forming a linear ring.

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 linearRing = new SuperMap.Geometry.LinearRing(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. Empty representation type is unrestricted.

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

addComponent(point, index){boolean}

LinearRing.js, line 34

Adds a point to geometry components. If the point is to be added to the end of the components array and it is the same as the last point already in that array, the duplicate point is not added. This has the effect of closing the ring if it is not already closed, and doing the right thing if it is already closed. This behavior can be overridden by calling the method with a non-null index as the second argument.

Name Type Description
point SuperMap.Geometry.Point

Point Object.

index integer optional

Index into the array to insert the component

Returns:
Type Description
boolean Was the Point successfully added.

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.

getArea(){float}

LinearRing.js, line 83

The area is positive if the ring is oriented CW, otherwise it will be negative.

Returns:
Type Description
float The signed area for a ring.

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

LinearRing.js, line 102

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.

removeComponent(point){boolean}

LinearRing.js, line 62

Removes a point from geometry components.

Name Type Description
point SuperMap.Geometry.Point

Point Object.

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.