MapCartoRectangle Class

A specialization of Range2d representing a Cartographic region on the surface of the Earth, used by MapTiles. The x components of the low and high points refer to the western and eastern longitudes, respectively. The y components of the low and high points refer to the southern and northern latitudes, respectively. Longitudes are stored in radians in the range [-pi, pi]. Latitudes are stored in radians in the range [-pi/2, pi/2].

Extends

Methods

Name Description
constructor(west: number, south: number, east: number, north: number): MapCartoRectangle Protected Construct a new rectangle with angles specified in radians.  
containsCartographic(carto: Cartographic): boolean Returns true if the specified cartographic location is contained within this rectangle's area, ignoring elevation.  
fractionFromCartographic(carto: Cartographic): undefined | Point2d Computes fractional coordinates of the specified position within this rectangle's area.  
getCenter(result?: Cartographic): Cartographic Returns the position at the center of this rectangle, at an elevation of zero.  
setRadians(west: number0, south: number0, east: number0, north: number0): void Reinitialize this rectangle using angles specified in radians.  
createMaximum(): MapCartoRectangle Static Create a rectangle encompassing all points on the surface of the Earth.  
createZero(): MapCartoRectangle Static Create a rectangle with all angles set to zero.  
fromDegrees(west: number, south: number, east: number, north: number, result?: MapCartoRectangle): MapCartoRectangle Static Create a new rectangle with angles specified in degrees.  
fromRadians(west: number, south: number, east: number, north: number, result?: MapCartoRectangle): MapCartoRectangle Static Create a new rectangle with angles specified in radians.  

Inherited methods

Name Inherited from Description
clone(result?: this): this Inherited Range2d Return a clone of this range (or copy to optional result)
cloneTranslated(shift: Readonly<WritableXAndY>, result?: this): this Inherited Range2d Return a copy, translated by adding shift components in all directions.
containsPoint(point: Readonly<WritableXAndY>): boolean Inherited Range2d Test if a point is within the range.
containsRange(other: Readonly<WritableLowAndHighXY>): boolean Inherited Range2d Test of other range is within this range
containsXY(x: number, y: number): boolean Inherited Range2d Test if a point given as x,y is within the range
corners3d(asLoop?: boolean, z?: number): Point3d[] Inherited Range2d Return an array with the 4 corners.
diagonal(result?: Vector2d): Vector2d Inherited Range2d Return the diagonal vector.
diagonalFractionToPoint(fraction: number, result?: Point2d): Point2d Inherited Range2d Return the point at the specified fraction along the diagonal vector.
distanceToPoint(point: Readonly<WritableXAndY>): number Inherited Range2d Return 0 if the point is within the range, otherwise the distance to the closest face or corner
distanceToRange(other: Readonly<WritableLowAndHighXY>): number Inherited Range2d Return 0 if the point is within the range, otherwise the distance to the closest face or corner
expandInPlace(delta: number): void Inherited Range2d Move all limits by a fixed amount.
extendPoint(point: Readonly<WritableXAndY>): void Inherited Range2d Expand this range to include a point.
extendRange(other: Readonly<WritableLowAndHighXY>): void Inherited Range2d Expand this range to include a range.
extendTransformedXY(transform: Transform, x: number, y: number): void Inherited Range2d Expand this range to include a point given by x,y
extendXY(x: number, y: number): void Inherited Range2d Expand this range to include a point given by x,y
fractionToPoint(fractionX: number, fractionY: number, result?: Point2d): Point2d Inherited Range2d Return a point given by fractional positions on the XY axes.
freeze(): Readonly<MapCartoRectangle> Inherited Range2d Freeze this instance (and its members) so it is read-only
intersect(other: Readonly<WritableLowAndHighXY>, result?: Range2d): Range2d Inherited Range2d Return the intersection of ranges.
intersectsRange(other: Readonly<WritableLowAndHighXY>): boolean Inherited Range2d Test if there is any intersection with other range
isAlmostEqual(other: Range2d): boolean Inherited Range2d Returns true if this and other have equal low and high parts, or both are null ranges.
maxAbs(): number Inherited Range2d Largest absolute value among any coordinates in the box corners.
scaleAboutCenterInPlace(scaleFactor: number): void Inherited Range2d Move low and high points by scaleFactor around the center point.
setFrom(other: Readonly<WritableLowAndHighXY>): void Inherited Range2d Copy all content from any other that has low and high xy data.
setFromJSON(json: Range2dProps): void Inherited Range2d Treat any array of numbers as numbers to be inserted !!!
setNull(): void Inherited Range2d Reset the low and high to null range state.
setXY(x: number, y: number): void Inherited Range2d Set low and hight to a single xy value.
toFloat64Array(): Float64Array Inherited Range2d Flatten the low and high coordinates of this instance into an array of 4 doubles
toJSON(): Range2dProps Inherited Range2d Return json array with two points as produced by Point2d.toJSON
union(other: Readonly<WritableLowAndHighXY>, result?: Range2d): Range2d Inherited Range2d Return the union of ranges.
worldToLocal(point: Point2d, result?: Point2d): undefined | Point2d Inherited Range2d Return fractional coordinates of point within the range.
xLength(): number Inherited Range2d Length of the box in the x direction
yLength(): number Inherited Range2d Length of the box in the y direction
coordinateToRangeAbsoluteDistance(x: number, low: number, high: number): number Static Inherited Range2d Given a coordinate and pair of range limits, return the smallest distance to the range.
createArray<T extends Range2d>(points: Point2d[], result?: T): T Static Inherited Range2d Create a range around an array of points.
createFrom<T extends Range2d>(other: Readonly<WritableLowAndHighXY>, result?: T): T Static Inherited Range2d Create a new Range2d from any other that has low and high xy data.
createNull<T extends Range2d>(result?: T): T Static Inherited Range2d Create a range with no content.
createXY<T extends Range2d>(x: number, y: number, result?: T): T Static Inherited Range2d Create a single point box
createXYXY<T extends Range2d>(xA: number, yA: number, xB: number, yB: number, result?: T): T Static Inherited Range2d Create a box with 2 pairs of xy candidates.
createXYXYOrCorrectToNull<T extends Range2d>(xA: number, yA: number, xB: number, yB: number, result?: T): T Static Inherited Range2d Create a box with 2 pairs of xy candidates.
createXYXYXY<T extends Range2d>(xA: number, yA: number, xB: number, yB: number, xC: number, yC: number, result?: T): T Static Inherited Range2d Create a box with 3 pairs of xy candidates.
fromArrayBuffer<T extends Range2d>(buffer: ArrayBuffer): T Static Inherited Range2d Construct a Range2d from an un-typed array.
fromFloat64Array<T extends Range2d>(f64: Float64Array): T Static Inherited Range2d Construct a Range2d from an array of double-precision values
fromJSON<T extends Range2d>(json?: Range2dProps): T Static Inherited Range2d Use setFromJSON to parse json into a new Range2d instance.
isExtremePoint2d(xy: Point2d): boolean Static Inherited Range2d Return true if either of x,y is outside the range `[_EXTREME_NEGATIVE, _EXTREME_POSITIVE]'
isExtremePoint3d(xyz: Point3d): boolean Static Inherited Range2d Return true if any x or y or z is outside the range `[_EXTREME_NEGATIVE, _EXTREME_POSITIVE]'
isExtremeValue(x: number): boolean Static Inherited Range2d Return true if x is outside the range `[_EXTREME_NEGATIVE, _EXTREME_POSITIVE]'
isNull(range: Readonly<WritableLowAndHighXY>): boolean Static Inherited Range2d Test if the box has high strictly less than low for any of x,y, condition.
multiplyIfPositive(q: number, factor: number, defaultValue?: number): number Static Inherited Range2d If a > 0, return (extrapolationFactor * a); otherwise return defaultValue
npcScaleFactor(low: number, high: number): number Protected Static Inherited Range2d Return 0 if high<= low, otherwise 1/(high-low) for use in fractionalizing
rangeToRangeAbsoluteDistance(lowA: number, highA: number, lowB: number, highB: number): number Static Inherited Range2d Return the min absolute distance from any point of [lowA,highA]' to any point of [lowB,highB]'.
toFloat64Array(val: Readonly<WritableLowAndHighXY>): Float64Array Static Inherited Range2d Flatten the low and high coordinates of any json object with low.x ..

Properties

Name Type Description
cartoCenter Accessor ReadOnly Cartographic The cartographic center of this rectangle.  
east Accessor number The eastern longitude in radians.  
globalLocation Accessor ReadOnly GlobalLocation The globalLocationArea and cartoCenter of this rectangle.  
globalLocationArea Accessor ReadOnly GlobalLocationArea A pair of Cartographics representing the same area as this rectangle.  
latLongString Accessor ReadOnly string A non-localized string representation of this rectangle, for debugging purposes.  
north Accessor number The northern latitude in radians.  
south Accessor number The southern latitude in radians.  
west Accessor number The western longitude in radians.  

Inherited properties

Name Type Inherited from Description
_EXTREME_NEGATIVE Protected Static Readonly Inherited number Range2d Number considered to be impossibly negative for a coordinate in a range.
_EXTREME_POSITIVE Protected Static Readonly Inherited number Range2d Number considered impossibly large possibly for a coordinate in a range.
center Accessor Inherited ReadOnly Point2d Range2d Return the midpoint of the diagonal. No test for null range.
high Inherited Point2d Range2d High point coordinates.
isAlmostZeroX Accessor Inherited ReadOnly boolean Range2d Test if the x direction size is nearly zero
isAlmostZeroY Accessor Inherited ReadOnly boolean Range2d Test if the y direction size is nearly zero
isNull Accessor Inherited ReadOnly boolean Range2d Test if the box has high<low for any of x,y, condition. Note that a range around a single point is NOT null.
isSinglePoint Accessor Inherited ReadOnly boolean Range2d Test of the range contains a single point.
low Inherited Point2d Range2d Low point coordinates.
xHigh Accessor Inherited ReadOnly number Range2d Return the high x coordinate
xLow Accessor Inherited ReadOnly number Range2d Return the low x coordinate
yHigh Accessor Inherited ReadOnly number Range2d Return the high y coordinate
yLow Accessor Inherited ReadOnly number Range2d Return the low y coordinate

Defined in

Last Updated: 17 December, 2024