ILinearRingGeometryAccess

Extends IFreezable.

Interface for access to the "Closed contour" geometry.

Constructor | Fields | Events | Methods

Constructor

ILinearRingGeometryAccess()

Fields

Name

Type

Description

events

IEventManager

Event manager for the object.

Inherited from IFreezable.

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.

Methods

Name

Returns

Description

contains(position)

Boolean

Checks whether the passed point is located inside the contour.

freeze()

IFreezable

Switches the object to "frozen" mode.

Inherited from IFreezable.

get(index)

Number[]

Returns coordinates of the point with the specified index.

getChildGeometry(index)

IPointGeometryAccess

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

getClosest(anchorPosition)

Object

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

getCoordinates()

Number[][]

Returns an array of geometry coordinates.

getFillRule()

String

Returns ID of the fill rule.

getLength()

Integer

Returns the number of points in the geometry.

insert(index, coordinates)

ILinearRingGeometryAccess

Adds a new point with the specified index.

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.

set(index, coordinates)

ILinearRingGeometryAccess

Sets coordinates of the point with the specified index.

setCoordinates(coordinates)

ILinearRingGeometryAccess

Sets an array of geometry coordinates.

setFillRule(fillRule)

ILinearRingGeometryAccess

Sets the contour fill rule.

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.

unfreeze()

IFreezable

Switches the object to active mode.

Inherited from IFreezable.

Events details

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.

Methods details

contains

{Boolean} contains(position)

Checks whether the passed point is located inside the contour.

Returns an indicator for whether the point belongs to the contour.

Parameters:

Parameter

Default value

Description

position*

—

Type: Number[]

Coordinates of a point.

* Mandatory parameter/option.

get

{Number[]} get(index)

Returns coordinates of the point with the specified index.

Parameters:

Parameter

Default value

Description

index*

—

Type: Integer

Index of a point.

* Mandatory parameter/option.

getChildGeometry

{IPointGeometryAccess} getChildGeometry(index)

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

Returns the "Point" geometry object that corresponds to the specified endpoint.

Parameters:

Parameter

Default value

Description

index*

—

Type: Integer

Index of a contour vertex.

* Mandatory parameter/option.

getClosest

{Object} getClosest(anchorPosition)

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

Returns an object with the following fields:

  • position - Point on the contour closest to "anchorPosition".
  • distance - Distance from "anchorPosition" to "position".
  • closestPointIndex - Index of the vertex closest to "position".
  • nextPointIndex - Index of the vertex that follows "position".
  • prevPointIndex - Index of the vertex that precedes "position".
    The "nextPointIndex" and "prevPointIndex" fields may be omitted if "position" coincides with one of the contour vertexes.

Parameters:

Parameter

Default value

Description

anchorPosition*

—

Type: Number[]

Coordinates of a point for which the nearest contour vertex is calculated.

* Mandatory parameter/option.

getCoordinates

{Number[][]} getCoordinates()

Returns an array of geometry coordinates.

getFillRule

{String} getFillRule()

Returns ID of the fill rule.

getLength

{Integer} getLength()

Returns the number of points in the geometry.

insert

{ILinearRingGeometryAccess} insert(index, coordinates)

Adds a new point with the specified index.

Returns self-reference.

Parameters:

Parameter

Default value

Description

index*

—

Type: Integer

Index of a point.

coordinates*

—

Type: Number[]

Coordinates of a point.

* Mandatory parameter/option.

remove

{Number[]} remove(index)

Removes the point with the specified index.

Returns the coordinates of a deleted point.

Parameters:

Parameter

Default value

Description

index*

—

Type: Integer

Index of a point.

* Mandatory parameter/option.

set

{ILinearRingGeometryAccess} set(index, coordinates)

Sets coordinates of the point with the specified index.

Returns self-reference.

Parameters:

Parameter

Default value

Description

index*

—

Type: Integer

Index of a point.

coordinates*

—

Type: Number[]

Coordinates of a point.

* Mandatory parameter/option.

setCoordinates

{ILinearRingGeometryAccess} setCoordinates(coordinates)

Sets an array of geometry coordinates.

Returns self-reference.

Parameters:

Parameter

Default value

Description

coordinates*

—

Type: Number[][]

Geometry coordinates.

* Mandatory parameter/option.

setFillRule

{ILinearRingGeometryAccess} setFillRule(fillRule)

Sets the contour fill rule.

Returns self-reference.

Parameters:

Parameter

Default value

Description

fillRule*

—

Type: String

ID of the fill rule.

* Mandatory parameter/option.

splice

{Number[][]} splice(index, 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.

Returns an array of coordinates of deleted points.

Parameters:

Parameter

Default value

Description

index*

—

Type: Integer

The index to start from for removing and adding points.

number*

—

Type: Integer

The number of deleted points.

* Mandatory parameter/option.