A polygon that can have a number of holes. A complex polygon should be created using createComplexPolygon. A ComplexPolygon is defined as an array of Polygon instances. The first polygon - at index 0- specifies the outer ring. All the other polygons are the holes.

Hierarchy

Constructors

Accessors

  • get bounds(): null | Bounds
  • The bounds of this shape. This property is to be treated in a read only manner. An error will be thrown when trying to assign to this property. Note that the bounds property is not immutable. Modifying properties of the bounds property may corrupt your data.

    Returns null | Bounds

  • get coordinateType(): CoordinateType
  • The coordinate type this shape. This property is read only. An Error will be thrown when trying to assign to this property.

    Returns CoordinateType

  • get focusPoint(): null | Point
  • The focus point of this shape. This property is read only. An error will be thrown when trying to assign to this property. This property contains an object but should be treated with value semantics: changes to the shape will not be reflected in the focusPoint that was retrieved from this Polygon before the modification.

    Returns null | Point

  • get polygonCount(): number
  • The number of polygons in this ComplexPolygon

    Returns number

  • get reference(): null | CoordinateReference
  • The spatial reference of this shape. This property is read only. An Error will be thrown when trying to assign to this property.

    Returns null | CoordinateReference

Methods

  • Adds a polygon at the end of this complex polygon.

    Parameters

    • polygon: Polygon

      The polygon to add.

    Returns void

    Throws

    InvalidReferenceError if the polygon's spatial reference does not match this complex polygon's spatial reference.

  • Adds a polygon at the specified index of this complex polygon.

    Parameters

    • index: number

      the index at which to insert a polygon, must be between 0 and the number of polygons in this complex polygon. If the index is 0, the polygon is the outer ring which must enclose all other polygons. Is the index a higher number, the polygon is a hole.

    • polygon: Polygon

      The polygon to insert when the first parameter is an index.

    Returns void

    Throws

    InvalidReferenceError if the polygon's spatial reference does not match this complex polygon's spatial reference.

  • Adds one or more polygons to this complex polygon.

    Parameters

    • polygons: Polygon[]

      the polygons to add

    Returns void

    Throws

    InvalidReferenceError if any of the polygon's spatial reference does not match this complex polygon's spatial reference.

  • Removes all polygons from this complex polygon. This method will remove both the exterior ring as well as the inner rings.

    Returns void

  • Determines whether a given point is inside this shape. This method checks containment only in two dimensions: on the (x,y)-axis or the (lon,lat)-axis (depending on the spatial reference of the shape).

    Parameters

    • x: number | Point | Bounds

      The point for which containment must be checked. If a 3D point is passed to this function, it will be treated as a 2D point: the z coordinate (height) will be ignored. The reference of this point must be the same reference as this Shape

    • Optional y: number

    Returns boolean

    true when the given point is contained in this shape

    Throws

    Point with another spatial reference

    Deprecated

    Please use contains2DPoint instead.

  • Determines whether the given point is inside this shape. This method checks containment only in two dimensions: on the (x,y)-axis or the (lon,lat)-axis (depending on the spatial reference of the shape).

    Parameters

    • x: number

      The x coordinate of the point for which containment must be checked

    • y: number

      The y coordinate of the point for which containment must be checked

    Returns boolean

    true when the given point is contained in this shape

    Throws

    Point with another spatial reference

  • Determines whether the given point is inside this shape. This method checks containment only in two dimensions: on the (x,y)-axis or the (lon,lat)-axis (depending on the spatial reference of the shape).

    Parameters

    • point: Point

      The point for which containment must be checked.

    Returns boolean

    true when the given point is contained in this shape

    Throws

    Point with another spatial reference

  • Indicates whether this shape is equal to another.

    Parameters

    • otherComplexPolygon: Shape

      the other shape this shape is compared with.

    Returns boolean

    true if both shapes are equal, false otherwise.

  • Get a polygon from this ComplexPolygon

    Parameters

    • index: number

    Returns Polygon

    The polygon at the requested index, or undefined if the index is larger than polygonCount

  • Notifies this complex polygon that the given polygon (or the polygon at the specified index) has changed.

    Parameters

    • polygonOrIndex: number | Polygon

      the polygon (or index of the polygon) that changed

    Returns void

  • Removes the polygon at the specified index from this complex polygon.

    Parameters

    • index: number

      the index of the polygon that should be removed that should be removed itself

    Returns null | Polygon

    the removed polygon

  • Removes a specific polygon from this complex polygon.

    Parameters

    • polygon: Polygon

      the polygon that should be removed that should be removed itself

    Returns null | Polygon

    the removed polygon

  • Removes one or more polygons to this complex polygon.

    Parameters

    • polygons: Polygon[]

      the polygons to remove

    Returns void

  • Replaces the polygon at the given index with the specified polygon.

    Parameters

    • index: number

      the index of the polygon to set. The index value must fall in the valid index range: 0 <= index < {number of polygons in the ComplexPolygon}. If this index equals 0, than the polygon must be the outerring, enclosing all the holes. If it is higher, than the polygon must be a hole.

    • polygon: Polygon

      the polygon to set

    Returns Polygon

    Throws

    InvalidReferenceError if the polygon's spatial reference does not match this complex polygon's spatial reference.

  • Converts the shape to a string. This functionality is for debugging purposes only. Results of toString cannot be used to uniquely identify a shape instance.

    Returns string

  • Translates all the polygons in this complex polygon over the given vector in 2D space.

    Parameters

    • x: number

      x coordinate value

    • y: number

      y coordinate value

    Returns void