Abstract base class; normally only used for creating subclasses and not instantiated in apps. Base class for vector geometries.

To get notified of changes to the geometry, register a listener for the generic change event on your geometry instance.

Hierarchy (view full)

Constructors

Properties

disposed: boolean

The object has already been disposed.

on: ObjectOnSignature<EventsKey>
once: ObjectOnSignature<EventsKey>
simplifiedGeometryMaxMinSquaredTolerance: number
simplifiedGeometryRevision: number
simplifyTransformedInternal: ((...arg0: any[]) => Geometry)

Get a transformed and simplified version of the geometry.

Type declaration

    • (...arg0): Geometry
    • Parameters

      • Rest...arg0: any[]

      Returns Geometry

      Simplified geometry.

un: ObjectOnSignature<void>

Methods

  • Parameters

    • key: string

      Key name.

    • listener: Listener

      Listener.

    Returns void

  • Parameters

    • type: string

      Type.

    • listener: Listener

      Listener.

    Returns void

  • Protected

    Apply any properties from another object without triggering events.

    Parameters

    • source: Object

      The source object.

    Returns void

  • Apply a transform function to the coordinates of the geometry. The geometry is modified in place. If you do not want the geometry modified in place, first clone() it and then use this function on the clone.

    Parameters

    • transformFn: TransformFunction

      Transform function. Called with a flat array of geometry coordinates.

    Returns void

  • Increases the revision counter and dispatches a 'change' event.

    Returns void

  • Make a complete copy of the geometry.

    Returns Geometry

    Clone.

  • Parameters

    • x: number

      X.

    • y: number

      Y.

    • closestPoint: Coordinate

      Closest point.

    • minSquaredDistance: number

      Minimum squared distance.

    Returns number

    Minimum squared distance.

  • Protected

    Parameters

    • extent: Extent

      Extent.

    Returns Extent

    extent Extent.

  • Parameters

    • x: number

      X.

    • y: number

      Y.

    Returns boolean

    Contains (x, y).

  • Dispatches an event and calls all listeners listening for events of this type. The event parameter can either be a string or an Object with a type property.

    Parameters

    • event: string | BaseEvent

      Event object.

    Returns undefined | boolean

    false if anyone called preventDefault on the event object or if any of the listeners returned false.

  • Clean up.

    Returns void

  • Protected

    Extension point for disposable objects.

    Returns void

  • Gets a value.

    Parameters

    • key: string

      Key name.

    Returns any

    Value.

  • Return the closest point of the geometry to the passed point as module:ol/coordinate~Coordinate coordinate.

    Parameters

    • point: Coordinate

      Point.

    • OptionalclosestPoint: Coordinate

      Closest point.

    Returns Coordinate

    Closest point.

  • Get the extent of the geometry.

    Parameters

    • Optionalextent: Extent

      Extent.

    Returns Extent

    extent Extent.

  • Get a list of object property names.

    Returns string[]

    List of property names.

  • Get the listeners for a specified event type. Listeners are returned in the order that they will be called in.

    Parameters

    • type: string

      Type.

    Returns undefined | Listener[]

    Listeners.

  • Get an object of all property names and values.

    Returns {
        [x: string]: any;
    }

    Object.

    • [x: string]: any
  • Get an object of all property names and values.

    Returns null | {
        [x: string]: any;
    }

    Object.

  • Get the version number for this object. Each time the object is modified, its version number will be incremented.

    Returns number

    Revision.

  • Get the type of this geometry.

    Returns Type

    Geometry type.

  • Parameters

    • Optionaltype: string

      Type. If not provided, true will be returned if this event target has any listeners.

    Returns boolean

    Has listeners.

  • Returns boolean

    The object has properties.

  • Returns true if this geometry includes the specified coordinate. If the coordinate is on the boundary of the geometry, returns false.

    Parameters

    • coordinate: Coordinate

      Coordinate.

    Returns boolean

    Contains coordinate.

  • Test if the geometry and the passed extent intersect.

    Parameters

    • extent: Extent

      Extent.

    Returns boolean

    true if the geometry and the extent intersect.

  • Parameters

    • key: string

      Key name.

    • oldValue: any

      Old value.

    Returns void

  • Protected

    Parameters

    • type: string | string[]

      Type.

    • listener: ((arg0: Event | BaseEvent) => unknown)

      Listener.

        • (arg0): unknown
        • Parameters

          • arg0: Event | BaseEvent

          Returns unknown

    Returns EventsKey | EventsKey[]

    Event key.

  • Protected

    Parameters

    • type: string | string[]

      Type.

    • listener: ((arg0: Event | BaseEvent) => unknown)

      Listener.

        • (arg0): unknown
        • Parameters

          • arg0: Event | BaseEvent

          Returns unknown

    Returns EventsKey | EventsKey[]

    Event key.

  • Parameters

    • key: string

      Key name.

    • listener: Listener

      Listener.

    Returns void

  • Parameters

    • type: string

      Type.

    • listener: Listener

      Listener.

    Returns void

  • Rotate the geometry around a given coordinate. This modifies the geometry coordinates in place.

    Parameters

    • angle: number

      Rotation angle in radians.

    • anchor: Coordinate

      The rotation center.

    Returns void

  • Scale the geometry (with an optional origin). This modifies the geometry coordinates in place.

    Parameters

    • sx: number

      The scaling factor in the x-direction.

    • Optionalsy: number

      The scaling factor in the y-direction (defaults to sx).

    • Optionalanchor: Coordinate

      The scale origin (defaults to the center of the geometry extent).

    Returns void

  • Sets a value.

    Parameters

    • key: string

      Key name.

    • value: any

      Value.

    • Optionalsilent: boolean

      Update without triggering an event.

    Returns void

  • Sets a collection of key-value pairs. Note that this changes any existing properties and adds new ones (it does not remove any existing properties).

    Parameters

    • values: {
          [x: string]: any;
      }

      Values.

      • [x: string]: any
    • Optionalsilent: boolean

      Update without triggering an event.

    Returns void

  • Create a simplified version of this geometry. For linestrings, this uses the Douglas Peucker algorithm. For polygons, a quantization-based simplification is used to preserve topology.

    Parameters

    • tolerance: number

      The tolerance distance for simplification.

    Returns Geometry

    A new, simplified version of the original geometry.

  • Get a transformed and simplified version of the geometry.

    Parameters

    • squaredTolerance: number

      Squared tolerance.

    • Optionaltransform: TransformFunction

      Optional transform function.

    Returns Geometry

    Simplified geometry.

  • Transform each coordinate of the geometry from one coordinate reference system to another. The geometry is modified in place. For example, a line will be transformed to a line and a circle to a circle. If you do not want the geometry modified in place, first clone() it and then use this function on the clone.

    Parameters

    • source: ProjectionLike

      The current projection. Can be a string identifier or a module:ol/proj/Projection~Projection object.

    • destination: ProjectionLike

      The desired projection. Can be a string identifier or a module:ol/proj/Projection~Projection object.

    Returns this

    This geometry. Note that original geometry is modified in place.

  • Translate the geometry. This modifies the geometry coordinates in place. If instead you want a new geometry, first clone() this geometry.

    Parameters

    • deltaX: number

      Delta X.

    • deltaY: number

      Delta Y.

    Returns void

  • Protected

    Unlisten for a certain type of event.

    Parameters

    • type: string | string[]

      Type.

    • listener: ((arg0: Event | BaseEvent) => unknown)

      Listener.

        • (arg0): unknown
        • Parameters

          • arg0: Event | BaseEvent

          Returns unknown

    Returns void

  • Unsets a property.

    Parameters

    • key: string

      Key name.

    • Optionalsilent: boolean

      Unset without triggering an event.

    Returns void