IGeometry

Extends IBaseGeometry, ICustomizable.

Interface of a geometry.

Constructor | Fields | Events | Methods

Constructor

IGeometry()

Fields

Name

Type

Description

events

IEventManager

Event manager.

Inherited from IEventEmitter.

options

IOptionManager

Options manager.

Inherited from ICustomizable.

Events

Name

Description

mapchange

Map reference changed. Instance of the Event class. Names of fields that are available via the Event.get method:

  • oldMap - Old map.
  • newMap - New map.

optionschange

Change to the object options.

Inherited from ICustomizable.

pixelgeometrychange

The pixel geometry changed. Instance of the Event class. Names of fields that are available via the Event.get method:

Methods

Name

Returns

Description

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 southwest corner of the area; the second item is the northeast corner.

getMap()

Map|null

Returns the current map.

getPixelGeometry([options])

IPixelGeometry

Returns the pixel geometry corresponding to the given geometry, its options, and the map state.

getType()

String

Returns ID of the geometry type.

Inherited from IBaseGeometry.

setMap(map)

Sets the map.

Events details

mapchange

Map reference changed. Instance of the Event class. Names of fields that are available via the Event.get method:

  • oldMap - Old map.
  • newMap - New map.

pixelgeometrychange

The pixel geometry changed. Instance of the Event class. Names of fields that are available via the Event.get method:

Methods details

getBounds

{Number[][]|null} getBounds()

Returns coordinates of the two opposite corners of the area that surrounds the geometry. The first item in the array is the southwest corner of the area; the second item is the northeast corner.

Example:

// Setting the map center and zoom so that the geometry is displayed in its entirety inside the visible area.
map.setBounds(myGeometry.getBounds());

getMap

{Map|null} getMap()

Returns the current map.

getPixelGeometry

{IPixelGeometry} getPixelGeometry([options])

Returns the pixel geometry corresponding to the given geometry, its options, and the map state.

Parameters:

Parameter

Default value

Description

options

—

Type: Object

Hash of options that allow to exclude part of the current geometry options for this calculation.

Example:

// Getting a pixel representation of the geometry with geodesics calculated, but without optimizing deletion of invisible points.
myGeometry.getPixelGeometry({
    geodesic: true,
    simplification: false
}).getCoordinates();

setMap

{} setMap(map)

Sets the map.

Parameters:

Parameter

Default value

Description

map*

—

Type: Map|null

Reference to the map.

* Mandatory parameter/option.