Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Bounds defines a spatial bounding box in 2D or 3D. It has a coordinate reference system (CRS) and can be valid or invalid.

Hierarchy

  • Bounds

Index

Constructors

  • new Bounds(crs: string): Bounds
  • Create new (invalid) bounds.

    Parameters

    • crs: string

      the EPSG CRS code of the bounds, like "4326" for example.

    Returns Bounds

Properties

crs: string

The EPSG CRS code, like "4326" for example

is3D: boolean

Do the bounds have a Z value? (if valid)

maxX: number

The maximum X value (if valid)

maxY: number

The maximum Y value (if valid)

maxZ: number

The maximum Z value (if valid)

minX: number

The minimum X value (if valid)

minY: number

The minimum Y value (if valid)

minZ: number

The minimum Z value (if valid)

valid: boolean

Do these bounds have a valid spatial extent?

TYPE: string = "B"

The type of objects in this class

Methods

  • Add a coordinate to the bounds.

    Parameters

    Returns void

  • addXY(x: number, y: number): void
  • Add a 2D coordinate using X and Y.

    Parameters

    • x: number

      the X value to add.

    • y: number

      the Y value to add.

    Returns void

  • addXYZ(x: number, y: number, z: number): void
  • Add a 3D coordinate using X, Y and Z. Note that this makes this instance a 3D bounds instance.

    Parameters

    • x: number

      the X value to add.

    • y: number

      the Y value to add.

    • z: number

      the Z value to add.

    Returns void

  • Get the center coordinate.

    Returns Coordinate

    returns null if these bounds are not valid.

  • getDepth(): number
  • Get the depth (along the Z axis) of these bounds.

    Returns number

    returns 0.0 if these bounds are not valid or not 3D.

  • getHeight(): number
  • Get the height (along the Y axis) of these bounds.

    Returns number

    returns 0.0 if these bounds are not valid.

  • getWidth(): number
  • Get the width (along the X axis) of these bounds.

    Returns number

    returns 0.0 if these bounds are not valid.

  • toString(): string
  • Convert the object to a string.

    Returns string

    the string form of the object.

  • fromXY(crs: string, minX: number, minY: number, maxX: number, maxY: number): Bounds
  • Create new 2D bounds.

    Parameters

    • crs: string

      the EPSG CRS code of the bounds, like "4326" for example.

    • minX: number

      the minimum X value.

    • minY: number

      the minimum Y value.

    • maxX: number

      the maximum X value.

    • maxY: number

      the maximum Y value.

    Returns Bounds

    the new bounds.

  • fromXYZ(crs: string, minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): Bounds
  • Create new 3D bounds.

    Parameters

    • crs: string

      the EPSG CRS code of the bounds, like "4326" for example.

    • minX: number

      the minimum X value.

    • minY: number

      the minimum Y value.

    • minZ: number

      the minimum Z value.

    • maxX: number

      the maximum X value.

    • maxY: number

      the maximum Y value.

    • maxZ: number

      the maximum Z value.

    Returns Bounds

    the new bounds.