Documentation
Reference
2.1.56 (current version)
collection
interactivityModel
Interfaces

ICircleGeometryAccess

Extends IFreezable.

Interface for access to the "Circle" geometry.

Constructor | Fields | Events | Methods

Constructor

ICircleGeometryAccess()

Fields

NameTypeDescription
eventsIEventManager

Event manager for the object.

Inherited from IFreezable.

Events

NameDescription
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

NameReturnsDescription
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:

ParameterDefault valueDescription
position*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

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:

ParameterDefault valueDescription
anchorPosition*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

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

Sets the coordinates of the center of the circle.

Returns self-reference.

Parameters:

ParameterDefault valueDescription
coordinates*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Number[]|null

Coordinates of the center of the circle.

* Mandatory parameter/option.

setRadius

Sets the radius of the circle.

Returns self-reference.

Parameters:

ParameterDefault valueDescription
radius*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Number

Radius of the circle.

* Mandatory parameter/option.