Skip to main content

Class: MapProjection

Defined in: src/sdk/components/map/MapProjection.ts:104

A geographic projection model for a map. MapProjection uses a mercator projection.

Constructors

Constructor

new MapProjection(projectedWidth, projectedHeight): MapProjection

Defined in: src/sdk/components/map/MapProjection.ts:157

Creates a new map projection.

Parameters

ParameterTypeDescription
projectedWidthnumberThe initial width of the projection window, in pixels.
projectedHeightnumberThe initial height of the projection window, in pixels.

Returns

MapProjection

Methods

addChangeListener()

addChangeListener(listener): void

Defined in: src/sdk/components/map/MapProjection.ts:637

Registers a change listener with this projection. The listener will be called every time this projection changes. A listener can be registered multiple times; it will be called once for every time it is registered.

Parameters

ParameterTypeDescription
listenerMapProjectionChangeListenerThe change listener to register.

Returns

void


applyQueued()

applyQueued(): void

Defined in: src/sdk/components/map/MapProjection.ts:457

Applies the set of queued projection changes, if any are queued.

Returns

void


geoDistance()

geoDistance(point1, point2): number

Defined in: src/sdk/components/map/MapProjection.ts:594

Gets the geographic great-circle distance between two points in great-arc radians. The points can be specified as either GeoPoint objects or 2D vectors. If 2D vectors are supplied, they are interpreted as projected points and inverse projection will be used to convert them to geographic points.

Parameters

ParameterTypeDescription
point1Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | GeoPointInterfaceThe first point.
point2Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | GeoPointInterfaceThe second point.

Returns

number

The geographic great-circle distance between the points.


getCenter()

getCenter(): GeoPointReadOnly

Defined in: src/sdk/components/map/MapProjection.ts:265

Gets the geographic point located at the center of this projection's projected window.

Returns

GeoPointReadOnly

The geographic point located at the center of this projection's projected window.


getCenterProjected()

getCenterProjected(): ReadonlyFloat64Array

Defined in: src/sdk/components/map/MapProjection.ts:273

Gets the center of this projection's projected window.

Returns

ReadonlyFloat64Array

The center of this projection's projected window.


getGeoProjection()

getGeoProjection(): GeoProjection

Defined in: src/sdk/components/map/MapProjection.ts:171

Gets this map projection's GeoProjection instance.

Returns

GeoProjection

This map projection's GeoProjection instance.


getHeightRange()

getHeightRange(): number

Defined in: src/sdk/components/map/MapProjection.ts:232

Gets the range of this projection, in great-arc radians, as measured from the top-center to the bottom-center of the projected window.

Returns

number

The range of this projection's projected window height, in great-arc radians.


getProjectedResolution()

getProjectedResolution(): number

Defined in: src/sdk/components/map/MapProjection.ts:282

Gets the average resolution, in great-arc radians per pixel, of the projected map along a line between the range endpoints.

Returns

number

The average resolution of the projected map along a line between the range endpoints.


getProjectedSize()

getProjectedSize(): ReadonlyFloat64Array

Defined in: src/sdk/components/map/MapProjection.ts:257

Gets the size of the projected window, in pixels.

Returns

ReadonlyFloat64Array

The size of the projected window.


getRange()

getRange(): number

Defined in: src/sdk/components/map/MapProjection.ts:204

Gets the range of this projection, in great-arc radians, as measured between the projection's two range endpoints.

Returns

number

The range of this projection, in great-arc radians.


getRangeEndpoints()

getRangeEndpoints(): ReadonlyFloat64Array

Defined in: src/sdk/components/map/MapProjection.ts:214

Gets the endpoints used to measure the range of the projection, as a 4-tuple [relX1, relY1, relX2, relY2]. Each component is expressed in relative projected coordinates, where 0 is the left/top of the projected window, and 1 is the right/bottom of the projected window.

Returns

ReadonlyFloat64Array

The endpoints used to measure the range of the projection, as a 4-tuple [relX1, relY1, relX2, relY2].


getRotation()

getRotation(): number

Defined in: src/sdk/components/map/MapProjection.ts:249

Gets the post-projected (planar) rotation angle of this projection in radians.

Returns

number

The post-projected rotation angle of this projection.


getScaleFactor()

getScaleFactor(): number

Defined in: src/sdk/components/map/MapProjection.ts:241

Gets the nominal scale factor of this projection. At a scale factor of 1, a distance of one great-arc radian will be projected to a distance of one pixel.

Returns

number

The nominal scale factor of this projection.


getTarget()

getTarget(): GeoPointReadOnly

Defined in: src/sdk/components/map/MapProjection.ts:180

Gets the target geographic point of this projection. The target is guaranteed to be projected to a specific point in the projected window defined by the center of the window plus the target projected offset.

Returns

GeoPointReadOnly

The target geographic point of this projection.


getTargetProjected()

getTargetProjected(): ReadonlyFloat64Array

Defined in: src/sdk/components/map/MapProjection.ts:196

Gets the projected location of the target of this projection.

Returns

ReadonlyFloat64Array

The projected location of the target of this projection.


getTargetProjectedOffset()

getTargetProjectedOffset(): ReadonlyFloat64Array

Defined in: src/sdk/components/map/MapProjection.ts:188

Gets the projected offset from the center of the projected window of the target of this projection.

Returns

ReadonlyFloat64Array

The projected offset from the center of the projected window of the target of this projection.


getWidthRange()

getWidthRange(): number

Defined in: src/sdk/components/map/MapProjection.ts:223

Gets the range of this projection, in great-arc radians, as measured from the center-left to the center-right of the projected window.

Returns

number

The range of this projection's projected window width, in great-arc radians.


invert()

invert(vec, out): GeoPoint

Defined in: src/sdk/components/map/MapProjection.ts:546

Inverts a set of projected coordinates. This method will determine the geographic point whose projected location is the equal to that described by a 2D position vector.

Parameters

ParameterTypeDescription
vecReadonlyFloat64ArrayThe 2D position vector describing the location of the projected coordinates.
outGeoPointThe point to which to write the result.

Returns

GeoPoint

The inverted point.


isInProjectedBounds()

isInProjectedBounds(point, bounds?): boolean

Defined in: src/sdk/components/map/MapProjection.ts:559

Checks whether a point falls within certain projected bounds. The point can be specified as either a GeoPoint object or a 2D vector. If a GeoPoint object is supplied, it will be projected before the bounds check takes place.

Parameters

ParameterTypeDescription
pointReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceThe point to check.
bounds?Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>The bounds to check against, expressed as a vector ([left, top, right, bottom]). Defaults to the bounds of the projected window.

Returns

boolean

Whether the point falls within the projected bounds.


notifyChangeListeners()

protected notifyChangeListeners(changeFlags): void

Defined in: src/sdk/components/map/MapProjection.ts:626

Notifies all registered change listeners that this projection has been changed.

Parameters

ParameterTypeDescription
changeFlagsnumberThe types of changes that were made.

Returns

void


project()

project(point, out): Float64Array

Defined in: src/sdk/components/map/MapProjection.ts:535

Projects a set of lat/lon coordinates.

Parameters

ParameterTypeDescription
pointLatLonInterfaceThe point to project.
outFloat64ArrayThe vector to which to write the result.

Returns

Float64Array

The projected point, as a vector.


projectedDistance()

projectedDistance(point1, point2): number

Defined in: src/sdk/components/map/MapProjection.ts:612

Gets the projected Euclidean distance between two points in pixels. The points can be specified as either GeoPoint objects or 2D vectors. If GeoPoint objects are supplied, they will be projected to convert them to projected points.

Parameters

ParameterTypeDescription
point1Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | GeoPointInterfaceThe first point.
point2Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | GeoPointInterfaceThe second point.

Returns

number

The projected Euclidean distance between two points.


removeChangeListener()

removeChangeListener(listener): boolean

Defined in: src/sdk/components/map/MapProjection.ts:647

Removes a change listener from this projection. If the specified listener was registered multiple times, this method will only remove one instance of the listener.

Parameters

ParameterTypeDescription
listenerMapProjectionChangeListenerThe listener to remove.

Returns

boolean

Whether the listener was successfully removed.


set()

set(parameters): void

Defined in: src/sdk/components/map/MapProjection.ts:421

Sets this projection's parameters. Parameters not explicitly defined in the parameters argument will be left unchanged.

Parameters

ParameterTypeDescription
parametersMapProjectionParametersThe new parameters.

Returns

void


setQueued()

setQueued(parameters): void

Defined in: src/sdk/components/map/MapProjection.ts:449

Sets the projection parameters to be applied when applyQueued() is called.

Parameters

ParameterTypeDescription
parametersMapProjectionParametersThe parameter changes to queue.

Returns

void