ICircleGeometryAccess

Extends IFreezable.

Interface for access to the "Circle" geometry.

Constructor | Fields | Events | Methods

Constructor

ICircleGeometryAccess()

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 of the center.
  • newCoordinates - New coordinates of the center.
  • oldRadius - Old radius.
  • newRadius - New radius.

Methods

Name

Returns

Description

contains(position)

Boolean

Checks whether the passed point is located inside the circle.

freeze()

IFreezable

Switches the object to "frozen" mode.

Inherited from IFreezable.

getClosest(anchorPosition)

Object

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

getCoordinates()

Number[]|null

Returns coordinates of the center of the circle.

getRadius()

Number

Returns radius of the circle.

isFrozen()

Boolean

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

Inherited from IFreezable.

setCoordinates(coordinates)

ICircleGeometryAccess

Sets the coordinates of the center of the circle.

setRadius(radius)

ICircleGeometryAccess

Sets the radius of the circle.

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 of the center.
  • newCoordinates - New coordinates of the center.
  • oldRadius - Old radius.
  • newRadius - New radius.

Methods details

contains

{Boolean} contains(position)

Checks whether the passed point is located inside the circle.

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

Parameters:

Parameter

Default value

Description

position*

—

Type: Number[]

Coordinates of a point.

* Mandatory parameter/option.

Example:

var myCircle = new ymaps.geometry.base.Circle([0, 0], 10);
myCircle.contains([0, 10]); // => true

getClosest

{Object} getClosest(anchorPosition)

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

Returns an object with the following fields:

  • position - Point on the circle closest to "anchorPosition".
  • distance - Distance from "anchorPosition" to "position".

Parameters:

Parameter

Default value

Description

anchorPosition*

—

Type: Number[]

Coordinates of a point for which the nearest point on the circle is calculated.

* Mandatory parameter/option.

Example:

var myCircle = new ymaps.geometry.base.Circle([0, 0], 10);
myCircle.getClosest([0, 15]).position; // => [0, 10]

getCoordinates

{Number[]|null} getCoordinates()

Returns coordinates of the center of the circle.

getRadius

{Number} getRadius()

Returns radius of the circle.

setCoordinates

{ICircleGeometryAccess} setCoordinates(coordinates)

Sets the coordinates of the center of the circle.

Returns self-reference.

Parameters:

Parameter

Default value

Description

coordinates*

—

Type: Number[]|null

Coordinates of the center of the circle.

* Mandatory parameter/option.

setRadius

{ICircleGeometryAccess} setRadius(radius)

Sets the radius of the circle.

Returns self-reference.

Parameters:

Parameter

Default value

Description

radius*

—

Type: Number

Radius of the circle.

* Mandatory parameter/option.