Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Line

The Line Feature is a generic editable Feature with "LineString" or "MultiLineString" geometry. The Feature can be edited with the Editor.

Hierarchy

Implements

Index

Properties

Optional bbox

bbox: [number, number, number, number]

Bounding box of the feature. The value of the bbox member is an array of length 4, with all axes of the most southwesterly point followed by all axes of the more northeasterly point. The "bbox" values define shapes with edges that follow lines of constant longitude and latitude.

Readonly class

class: "LINE"

The feature class of a Line Feature is "LINE".

geometry

geometry: { coordinates: string extends "Point" ? GeoJSONCoordinate : string extends "MultiPoint" ? GeoJSONCoordinate[] : string extends "LineString" ? GeoJSONCoordinate[] : string extends "MultiLineString" ? GeoJSONCoordinate[][] : string extends "Polygon" ? GeoJSONCoordinate[][] : string extends "MultiPolygon" ? GeoJSONCoordinate[][][] : GeoJSONCoordinate | GeoJSONCoordinate[] | GeoJSONCoordinate[][] | GeoJSONCoordinate[][][]; type: "Point" | "MultiPoint" | "LineString" | "MultiLineString" | "Polygon" | "MultiPolygon" | string | string }

A geometry is a object where the type member's value is one of: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon" or "MultiPolygon". A geometry object must have a member with the name "coordinates". The value of the coordinates member is always an array (referred to as the coordinates array below). The structure for the elements in this array are determined by the type of geometry.

For type "Point", each element in the coordinates array is a number representing the point coordinate in one dimension. There must be at least two elements, and may be more. The order of elements must follow x, y, z order (or longitude, latitude, altitude for coordinates in a geographic coordinate reference system).

For type "MultiPoint", each element in the coordinates array is a coordinates array as described for type "Point".

For type "LineString", each element in the coordinates array is a coordinates array as described for type "Point". The coordinates array for a LineString must have two or more elements. A LinearRing is a special case of type LineString where the first and last elements in the coordinates array are equivalent (they represent equivalent points). Though a LinearRing is not explicitly represented as a geometry type, it is referred to in the Polygon geometry type definition.

For type "MultiLineString", each element in the coordinates array is a coordinates array as described for type "LineString".

For type "Polygon", each element in the coordinates array is a coordinates array as described for type "LineString". Furthermore, each LineString in the coordinates array must be a LinearRing. For Polygons with multiple LinearRings, the first must be the exterior ring and any others must be interior rings or holes.

For type "MultiPolygon", each element in the coordinates array is a coordinates array as described for type "Polygon".

Point:
{
   "type": "Point",
   "coordinates": [100.0, 0.0]
}

Polygon:
{
   "type": "Polygon",
   "coordinates": [
       [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]
   ]
}

Type declaration

  • coordinates: string extends "Point" ? GeoJSONCoordinate : string extends "MultiPoint" ? GeoJSONCoordinate[] : string extends "LineString" ? GeoJSONCoordinate[] : string extends "MultiLineString" ? GeoJSONCoordinate[][] : string extends "Polygon" ? GeoJSONCoordinate[][] : string extends "MultiPolygon" ? GeoJSONCoordinate[][][] : GeoJSONCoordinate | GeoJSONCoordinate[] | GeoJSONCoordinate[][] | GeoJSONCoordinate[][][]
  • type: "Point" | "MultiPoint" | "LineString" | "MultiLineString" | "Polygon" | "MultiPolygon" | string | string

id

id: string | number

id of the feature.

properties

properties: FeatureProperties

The Properties of the feature

type

type: "Feature" | string

The type of the feature is a string with 'Feature' as its value.

Methods

addShape

  • Add a new shape point / coordinate to the line.

    Parameters

    Returns boolean | number

    index of the shape or false if shape could not be added

  • Adds a new coordinate to the line feature with "LineString" or "MultiLineString" geometry. For Line features with "LineString" geometry the a value of 0 must be passed for lineStringIndex.

    Parameters

    • point: PixelPoint | GeoPoint

      the coordinate to add

    • lineStringIndex: number

      the index of the coordinate array in the MultiLineStrings array of LineString coordinate arrays.

    • Optional coordinateIndex: number

      the index position in the LineString coordinate array where the new shape point should be inserted.

    Returns boolean | number

    index of the shape or false if shape could not be added

coord

  • coord(): [number, number, number][] | [number, number, number][][]
  • coord(coordinates: [number, number, number][] | [number, number, number][][]): any
  • Get the geographical coordinate(s) of the Line feature.

    Returns [number, number, number][] | [number, number, number][][]

  • Set the geographical coordinate(s) of the Line feature.

    Parameters

    • coordinates: [number, number, number][] | [number, number, number][][]

      the geographical coordinates that should be set.

    Returns any

editState

  • editState(state: "created" | "modified" | "removed" | "split" | "hovered" | "selected", value?: number | boolean): number | boolean | undefined
  • Get a specific EditState of the feature.

    Parameters

    • state: "created" | "modified" | "removed" | "split" | "hovered" | "selected"

      the "EditState" to retrieve its value.

    • Optional value: number | boolean

    Returns number | boolean | undefined

    the value of the respective "EditState".

editable

  • editable(editable: boolean): this
  • Define if the feature should be editable by the Editor module or not.

    deprecated
    example
    // prevent the feature from being modified by the editor module
    object.editable(false);
    

    Parameters

    • editable: boolean

      True, the feature can be edited, otherwise false.

    Returns this

getProvider

getSelectedShapes

  • getSelectedShapes(): boolean[] | boolean[][]
  • Returns an array of Boolean values indicating whether the corresponding shape is selected at index or not.

    Returns boolean[] | boolean[][]

prop

  • prop(): {}
  • prop(property: string): any
  • prop(property: string, value: any): void
  • prop(properties: {}): void
  • Get a deep copy of the properties of the feature

    Returns {}

    • [name: string]: any
  • Get the value of a specific property

    Parameters

    • property: string

      name of the property

    Returns any

    the value of the specific property

  • Set the value for a specific property

    Parameters

    • property: string

      name of the property

    • value: any

      the value that should be set for the property

    Returns void

  • Set one or more properties of the object.

    Parameters

    • properties: {}

      the properties object literal that should be merged with the existing properties.

      • [name: string]: any

    Returns void

remove

  • remove(): void
  • Remove the feature.

    Returns void

select

  • select(): void
  • Select and highlight the feature. Selected features geometry is displayed and can easily be modified by mouse/touch interaction.

    Returns void

setSelectedShapes

  • setSelectedShapes(selectedShapeIndicies: boolean[] | boolean[][]): void
  • Sets the selected state of the shapes at their respective indices.

    Parameters

    • selectedShapeIndicies: boolean[] | boolean[][]

      Array of Boolean values indicating whether the corresponding shape is selected at index or not

    Returns void

style

  • style(type?: "default" | "current"): Style[]
  • style(style: Style[]): any
  • Get default or current style of the feature.

    deprecated
    • use layer.setStyleGroup instead
    defaultvalue

    "default"

    Parameters

    • Optional type: "default" | "current"

      indicates which style to return. "default" -> layer default style for the feature or the "current" applied style.

    Returns Style[]

    the style of the feature

  • Apply style to the feature.

    deprecated
    • use layer.setStyleGroup instead

    Parameters

    • style: Style[]

      the style to set for the feature

    Returns any

toJSON

transform

  • transform(): void
  • Enable Transform Utility to allow easy geometry transformation of the feature (move/scale/rotate) by mouse/touch interaction.

    Returns void

unselect

  • unselect(): void
  • Unselect the feature.

    Returns void

Generated using TypeDoc