Skip to main content

Class: MapProjection

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

Constructors

constructor

new MapProjection(projectedWidth, projectedHeight): MapProjection

Creates a new map projection.

Parameters

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

Returns

MapProjection

Defined in

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

Methods

addChangeListener

addChangeListener(listener): void

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

NameTypeDescription
listenerMapProjectionChangeListenerThe change listener to register.

Returns

void

Defined in

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


applyQueued

applyQueued(): void

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

Returns

void

Defined in

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


geoDistance

geoDistance(point1, point2): number

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

NameTypeDescription
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.

Defined in

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


getCenter

getCenter(): GeoPointReadOnly

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.

Defined in

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


getCenterProjected

getCenterProjected(): Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>

Gets the center of this projection's projected window.

Returns

Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>

The center of this projection's projected window.

Defined in

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


getGeoProjection

getGeoProjection(): GeoProjection

Gets this map projection's GeoProjection instance.

Returns

GeoProjection

This map projection's GeoProjection instance.

Defined in

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


getHeightRange

getHeightRange(): number

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.

Defined in

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


getProjectedResolution

getProjectedResolution(): number

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.

Defined in

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


getProjectedSize

getProjectedSize(): Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>

Gets the size of the projected window, in pixels.

Returns

Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>

The size of the projected window.

Defined in

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


getRange

getRange(): number

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.

Defined in

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


getRangeEndpoints

getRangeEndpoints(): Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>

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

Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>

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

Defined in

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


getRotation

getRotation(): number

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

Returns

number

The post-projected rotation angle of this projection.

Defined in

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


getScaleFactor

getScaleFactor(): number

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.

Defined in

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


getTarget

getTarget(): GeoPointReadOnly

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.

Defined in

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


getTargetProjected

getTargetProjected(): Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>

Gets the projected location of the target of this projection.

Returns

Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>

The projected location of the target of this projection.

Defined in

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


getTargetProjectedOffset

getTargetProjectedOffset(): Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>

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

Returns

Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>

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

Defined in

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


getWidthRange

getWidthRange(): number

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.

Defined in

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


invert

invert(vec, out): GeoPoint

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

NameTypeDescription
vecReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>The 2D position vector describing the location of the projected coordinates.
outGeoPointThe point to which to write the result.

Returns

GeoPoint

The inverted point.

Defined in

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


isInProjectedBounds

isInProjectedBounds(point, bounds?): boolean

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

NameTypeDescription
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.

Defined in

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


notifyChangeListeners

notifyChangeListeners(changeFlags): void

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

Parameters

NameTypeDescription
changeFlagsnumberThe types of changes that were made.

Returns

void

Defined in

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


project

project(point, out): Float64Array

Projects a set of lat/lon coordinates.

Parameters

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

Returns

Float64Array

The projected point, as a vector.

Defined in

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


projectedDistance

projectedDistance(point1, point2): number

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

NameTypeDescription
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.

Defined in

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


removeChangeListener

removeChangeListener(listener): boolean

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

NameTypeDescription
listenerMapProjectionChangeListenerThe listener to remove.

Returns

boolean

Whether the listener was successfully removed.

Defined in

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


set

set(parameters): void

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

Parameters

NameTypeDescription
parametersMapProjectionParametersThe new parameters.

Returns

void

Defined in

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


setQueued

setQueued(parameters): void

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

Parameters

NameTypeDescription
parametersMapProjectionParametersThe parameter changes to queue.

Returns

void

Defined in

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