OpenLayers.Geometry.LinearRing - OpenLayers

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

#### Inherits

- OpenLayers.Geometry.LineString

Summary

OpenLayers. Geometry. LinearRing | A Linear Ring is a special LineString which is closed.
Constructor |
OpenLayers. Geometry. LinearRing | Linear rings are constructed with an array of points.
Functions |
addComponent | Adds a point to geometry components.
removeComponent | Removes a point from geometry components.
move | Moves a collection in place
rotate | Rotate a geometry around some origin
resize | Resize a geometry relative to some origin.
transform | Reproject the components geometry from source to dest.
getArea |
intersects | Determine if the input geometry intersects this one.

### Constructor

### OpenLayers. Geometry. LinearRing

Linear rings are constructed with an array of points. This array can represent a closed or open ring. If the ring is open (the last point does not equal the first point), the constructor will close the ring. If the ring is already closed (the last point does equal the first point), it will be left closed.

#### Parameters

points | {Array(OpenLayers.Geometry.Point)} points

### Functions

### addComponent

> addComponent: function( | point,
> | index | )

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.

#### Parameter

point | {OpenLayers.Geometry.Point}
index | {Integer} Index into the array to insert the component

#### Returns

{Boolean} Was the Point successfully added?

### removeComponent

> removeComponent: function( | point | )

Removes a point from geometry components.

#### Parameters

point | {OpenLayers.Geometry.Point}

### move

> move: function( | x,
> | y | )

Moves a collection in place

#### Parameters

x | {Float} The x-displacement (in map units)
y | {Float} The y-displacement (in map units)

### rotate

> rotate: function( | angle,
> | origin | )

Rotate a geometry around some origin

#### Parameters

angle | {Float} Rotation angle in degrees (measured counterclockwise from the positive x-axis)
origin | {OpenLayers.Geometry.Point} Center point for the rotation

### resize

> resize: function( | scale,
> | origin,
> | ratio | )

Resize a geometry relative to some origin. Use this method to apply a uniform scaling to a geometry.

#### Parameters

scale | {Float} Factor by which to scale the geometry. A scale of 2 doubles the size of the geometry in each dimension (lines, for example, will be twice as long, and polygons will have four times the area).
origin | {OpenLayers.Geometry.Point} Point of origin for resizing
ratio | {Float} Optional x:y ratio for resizing. Default ratio is 1.

### transform

> transform: function( | source,
> | dest | )

Reproject the components geometry from source to dest.

#### Parameters

source | {OpenLayers.Projection}
dest | {OpenLayers.Projection}

#### Returns

{OpenLayers.Geometry}

### getArea

> getArea: function()

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

#### Returns

{Float} The signed area for a ring.

### intersects

> intersects: function( | geometry | )

Determine if the input geometry intersects this one.

#### Parameters

geometry | {OpenLayers.Geometry} Any type of geometry.

#### Returns

{Boolean} The input geometry intersects this one.

> addComponent: function( | point,
> | index | )

Adds a point to geometry components.

> removeComponent: function( | point | )

Removes a point from geometry components.

> move: function( | x,
> | y | )

Moves a collection in place

> rotate: function( | angle,
> | origin | )

Rotate a geometry around some origin

> resize: function( | scale,
> | origin,
> | ratio | )

Resize a geometry relative to some origin.

> transform: function( | source,
> | dest | )

Reproject the components geometry from source to dest.

> getArea: function()

> intersects: function( | geometry | )

Determine if the input geometry intersects this one.
A LineString is a Curve which, once two points have been added to it, can never be less than two points long.
Point geometry class.
Class for coordinate transforms between coordinate systems.
A Geometry is a description of a geographic object.
Close