Hierarchy (View Summary)

Constructors

  • Constructor: OpenLayers.Geometry.Polygon Constructor for a Polygon geometry. The first ring (this.component[0])is the outer bounds of the polygon and all subsequent rings (this.component[1-n]) are internal holes.

    Parameters: components - {Array(<OpenLayers.Geometry.LinearRing>)}

    Parameters

    Returns Polygon

Properties

bounds: Bounds

The bounds of this geometry

CLASS_NAME: string
components: Geometry.LinearRing[]

The first ring (this.component[0])is the outer bounds of the polygon and all subsequent rings (this.component[1-n]) are internal holes.

componentTypes: string[]

An array of class names representing the types of components that the collection can include. A null value means the component types are not restricted.

id: string

A unique identifier for this geometry.

parent: null | Geometry

This is set when a Geometry is added as component of another geometry

CLASS_NAME: string

Methods

  • Add a new component (geometry) to the collection. If this.componentTypes is set, then the component class name must be in the componentTypes array.

    Parameters

    Returns boolean

  • Return whether or not the geometry is at the specified location

    Parameters

    • lonlat: LonLat
    • OptionaltoleranceLon: number
    • OptionaltoleranceLat: number

    Returns boolean

  • Recalculate the bounds by iterating through the components and calling calling extendBounds() on each item.

    Returns void

  • Nullify this components bounds and that of its parent as well.

    Returns void

  • Method: containsPoint Test if a point is inside a polygon. Points on a polygon edge are considered inside.

    Parameters: point - {<OpenLayers.Geometry.Point>}

    Returns: {Boolean | Number} The point is inside the polygon. Returns 1 if the point is on an edge. Returns boolean otherwise.

    Parameters

    Returns number | boolean

  • Calculate the closest distance between two geometries (on the x-y plane). Return {Number | Object} The distance between this geometry and the target. If details is true, the return will be an object with distance, x0, y0, x1, and x2 properties. The x0 and y0 properties represent the coordinates of the closest point on this geometry. The x1 and y1 properties represent the coordinates of the closest point on the target geometry.

    Parameters

    Returns DistanceInfo

  • Calculate the closest distance between two geometries (on the x-y plane). Return {Number | Object} The distance between this geometry and the target. If details is true, the return will be an object with distance, x0, y0, x1, and x2 properties. The x0 and y0 properties represent the coordinates of the closest point on this geometry. The x1 and y1 properties represent the coordinates of the closest point on the target geometry.

    Parameters

    Returns number

  • Determine whether another geometry is equivalent to this one. Geometries are considered equivalent if all components have the same coordinates.

    Parameters

    Returns boolean

  • Extend the existing bounds to include the new bounds. If geometry's bounds is not yet set, then set a new Bounds.

    Parameters

    Returns void

  • Calculate the area of this geometry. Note how this function is overridden in <OpenLayers.Geometry.Polygon>.

    Returns number

  • Get the bounds for this Geometry. If bounds is not set, it is calculated again, this makes queries faster.

    Returns Bounds

  • Compute the centroid for this geometry collection.

    Parameters

    • Optionalweighted: boolean

    Returns Point

  • Get a string representing the components for this collection

    Returns string

  • Calculate the length of this geometry

    Returns number

  • Return a list of all points in this geometry.

    Parameters

    • nodes: boolean

    Returns any[]

  • Moves a geometry by the given displacement along positive x and y axes. This modifies the position of the geometry and clears the cached bounds.

    Parameters

    • x: number
    • y: number

    Returns void

  • Resize a geometry relative to some origin. Use this method to apply a uniform scaling to a geometry.

    Parameters

    • scale: number
    • origin: Point
    • ratio: number

    Returns Geometry

  • Rotate a geometry around some origin

    Parameters

    • angle: number
    • origin: Point

    Returns void

  • Returns a text representation of the geometry. If the WKT format is included in a build, this will be the Well-Known Text representation.

    Returns string

  • Function: OpenLayers.Geometry.distanceToSegment

    Parameters: point - {Object} An object with x and y properties representing the point coordinates. segment - {Object} An object with x1, y1, x2, and y2 properties representing endpoint coordinates.

    Returns: {Object} An object with distance, along, x, and y properties. The distance will be the shortest distance between the input point and segment. The x and y properties represent the coordinates along the segment where the shortest distance meets the segment. The along attribute describes how far between the two segment points the given point is.

    Parameters

    • point: { x: number; y: number }
    • segment: { x1: number; x2: number; y1: number; y2: number }

    Returns DistanceToSegmentInfo