geometry.base.LinearRing

Extends IBaseLinearRingGeometry.

The "Closed contour" base geometry.

Constructor | Fields | Events | Methods

Constructor

geometry.base.LinearRing([coordinates[, fillRule]])

Parameters:

Parameter

Default value

Description

coordinates

[]

Type: Number[][]

Geometry coordinates.

fillRule

"evenOdd"

Type: String

String ID that defines the polygon fill rule. Accepts one of two values:

  • evenOdd - Algorithm that checks whether a point is located in the fill area by drawing a ray from this point to infinity in any direction, and counting the number of contour segments in this shape that are crossed by this ray. If the number is odd, the point is inside it; if even, the point is outside it.
  • nonZero - Algorithm that checks whether a point is located in the fill area by drawing a ray from this point to infinity in any direction, and checking the points at which a segment of the shape crosses this ray. Starting from zero, one is added each time a segment crosses the ray from left to right, and one is subtracted each time a segment crosses the ray from right to left. If the result equals zero, the point is inside the contour. Otherwise, it is outside it.

Example:

var linearRing = new ymaps.geometry.base.LinearRing([
    [0, 0], [0, 10], [10, 10], [10, 0], [0, 0]
]);
//...
linearRing.set(1, [5, 10]);

Fields

Name

Type

Description

events

event.Manager

Geometry event manager.

Events

Name

Description

change

Changed coordinates. Instance of the Event class. Names of fields that are available via the Event.get method:

  • oldCoordinates - Old coordinates
  • newCoordinates - New coordinates.
  • oldFillRule - Old fill rule.
  • newFillRule - New fill rule.

Inherited from ILinearRingGeometryAccess.

Methods

Name

Returns

Description

contains(position)

Boolean

Checks whether the passed point is located inside the contour.

Inherited from ILinearRingGeometryAccess.

freeze()

IFreezable

Switches the object to "frozen" mode.

Inherited from IFreezable.

get(index)

Number[]

Returns coordinates of the point with the specified index.

Inherited from ILinearRingGeometryAccess.

getBounds()

Number[][]|null

Returns coordinates of the two opposite corners of the area that surrounds the geometry. The first item in the array is the corner with the smallest coordinate values relative to the rest of the points in the area; the second item is the corner with the largest coordinate values.

Inherited from IBaseGeometry.

getChildGeometry(index)

IPointGeometryAccess

Creates and returns an IPointGeometryAccess object for the specified contour on the polyline.

Inherited from ILinearRingGeometryAccess.

getClosest(anchorPosition)

Object

Searches for a point on the contour closest to the anchorPosition.

Inherited from ILinearRingGeometryAccess.

getCoordinates()

Number[][]

Returns an array of geometry coordinates.

Inherited from ILinearRingGeometryAccess.

getFillRule()

String

Returns ID of the fill rule.

Inherited from ILinearRingGeometryAccess.

getLength()

Integer

Returns the number of points in the geometry.

Inherited from ILinearRingGeometryAccess.

getType()

String

Returns the "LinearRing" string.

Inherited from IBaseLinearRingGeometry.

insert(index, coordinates)

ILinearRingGeometryAccess

Adds a new point with the specified index.

Inherited from ILinearRingGeometryAccess.

isFrozen()

Boolean

Returns true if the object is in "frozen" mode, otherwise false.

Inherited from IFreezable.

remove(index)

Number[]

Removes the point with the specified index.

Inherited from ILinearRingGeometryAccess.

set(index, coordinates)

ILinearRingGeometryAccess

Sets coordinates of the point with the specified index.

Inherited from ILinearRingGeometryAccess.

setCoordinates(coordinates)

ILinearRingGeometryAccess

Sets an array of geometry coordinates.

Inherited from ILinearRingGeometryAccess.

setFillRule(fillRule)

ILinearRingGeometryAccess

Sets the contour fill rule.

Inherited from ILinearRingGeometryAccess.

splice(index, number)

Number[][]

Deletes a defined number of points, starting from the specified index. New points can be added in place of the deleted ones. Coordinates of the new points can be passed as additional arguments after the "number" parameter.

Inherited from ILinearRingGeometryAccess.

unfreeze()

IFreezable

Switches the object to active mode.

Inherited from IFreezable.

Fields details

events

{event.Manager} events

Geometry event manager.