Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • BBox

Index

Properties

Readonly aspectRatio

aspectRatio: number

Readonly centerX

centerX: number

Readonly centerY

centerY: number

Readonly height

height: number

Readonly maxX

maxX: number

Readonly maxY

maxY: number

Readonly minX

minX: number

Readonly minY

minY: number

Readonly width

width: number

Methods

calculateTransformationTo

  • Calculates the needed transformation to transform this bounding box into another, e.g. mapping an area covering certain geographical coordinates to a normalized space from (0,0) to (1,1).

    Parameters

    Returns Transformation

center

  • center(x: number, y: number): BBox
  • Sets the center of the bounding box, keeping its size and moving its position.

    Parameters

    • x: number
    • y: number

    Returns BBox

fitHeightToAspect

  • fitHeightToAspect(aspectRatio: number): BBox
  • fitHeightToAspect(width: number, height: number): BBox
  • Changes the height so the bounding box conforms to the given aspect ratio.

    Parameters

    • aspectRatio: number

    Returns BBox

  • Parameters

    • width: number
    • height: number

    Returns BBox

fitToAspect

  • fitToAspect(wantedAspectRatio: number): BBox
  • fitToAspect(width: number, height: number): BBox
  • Adjusts the bounding box to have the wanted aspect ratio, expanding it as needed along either width or height. If aspect is given as width and height, it only defines the ratio; not a specific width/height for the new bounding box.

    Parameters

    • wantedAspectRatio: number

    Returns BBox

  • Parameters

    • width: number
    • height: number

    Returns BBox

fitWidthToAspect

  • fitWidthToAspect(aspectRatio: number): BBox
  • fitWidthToAspect(width: number, height: number): BBox
  • Changes the width so the bounding box conforms to the given aspect ratio.

    Parameters

    • aspectRatio: number

    Returns BBox

  • Parameters

    • width: number
    • height: number

    Returns BBox

scale

  • scale(factor: number): BBox
  • Scales the bounding box around its center.

    Parameters

    • factor: number

    Returns BBox

toExtent

  • toExtent(): Extent
  • Returns an OpenLayers-style {@link Extent} representing the same box.

    Returns Extent

transformBy

  • Transforms the bounding box by a given translation and scale.

    Parameters

    Returns BBox

translate

  • translate(deltaX: number, deltaY: number): BBox
  • Translates the bounding box by an x,y offset.

    Parameters

    • deltaX: number
    • deltaY: number

    Returns BBox

translateByFraction

  • translateByFraction(fractionalDeltaX: number, fractionalDeltaY: number): BBox
  • Translates the BBox by a fraction of its current size. This is convenient if you're doing visual inspection and needs to "nudge the bounding box a bit to the right", without having to worry about the absolute coordinate values.

    Parameters

    • fractionalDeltaX: number
    • fractionalDeltaY: number

    Returns BBox

withHeight

  • withHeight(height: number): BBox
  • Sets the height of the bounding box, implicitly changing the aspect ratio.

    Parameters

    • height: number

    Returns BBox

withSize

  • withSize(width: number, height: number): BBox
  • Sets the size of the bounding box, respecting the current setting and adjusting other values.

    Parameters

    • width: number
    • height: number

    Returns BBox

withWidth

  • withWidth(width: number): BBox
  • Sets the width of the bounding box, implicitly changing the aspect ratio.

    Parameters

    • width: number

    Returns BBox

Static of

  • of(e: default | default<default> | Extent): BBox
  • Creates a bounding box of the same extent as the given object.

    Parameters

    • e: default | default<default> | Extent

    Returns BBox

Static ofAspect

  • ofAspect(aspect: number): BBox
  • ofAspect(width: number, height: number): BBox
  • Creates a bounding box with a given aspect ratio, but no actual size or position given.

    Parameters

    • aspect: number

    Returns BBox

  • Parameters

    • width: number
    • height: number

    Returns BBox

Static ofCenter

  • ofCenter(x: number, y: number): BBox
  • ofCenter(x: number, y: number, width: number, height: number): BBox
  • Creates a bounding box with a given center. If width and height is given, the bounding box will be fully defined, and all values will be filled out.

    Parameters

    • x: number
    • y: number

    Returns BBox

  • Parameters

    • x: number
    • y: number
    • width: number
    • height: number

    Returns BBox

Static ofCorners

  • ofCorners(minX: number, minY: number, maxX: number, maxY: number): BBox
  • Creates a bounding box defined by the four corners. The given min and max will automatically be swapped if needed. All other values (width, height, aspect ratio, center) will automatically be calculated.

    Parameters

    • minX: number
    • minY: number
    • maxX: number
    • maxY: number

    Returns BBox

Static ofSize

  • ofSize(width: number, height: number): BBox
  • Creates a bounding box of a given size, with no position specified yet.

    Parameters

    • width: number
    • height: number

    Returns BBox