Polyline

Source: Polyline.ts:62

Polyline object.


Constructor

new Polyline(options?: Object): Polyline

Parameters

  • options (Object, optional) — Polyline options:
    • options.thickness (number, optional) — Thickness in screen pixels 1.5 is default.
    • options.altitude (Number, optional) — Relative to ground layers altitude value.
    • options.color (string | Array.<string>, optional) — Default line color or per-segment HTML colors.
    • options.opacity (Boolean, optional) — Line opacity.
    • options.visibility (Boolean, optional) — Polyline visibility. True default.
    • options.isClosed (Array.<Boolean>, optional) — Closed geometry type identification, per-segment.
    • options.pathLonLat (Array.<SegmentPathLonLatExt>, optional) — Polyline geodetic coordinates array. [[[0,0,0], [1,1,1],...]]
    • options.path3v (Array.<SegmentPath3vExt>, optional) — LinesString cartesian coordinates array. [[[0,0,0], [1,1,1],...]]
    • options.pathColors (Array.<SegmentPathColor>, optional) — Coordinates color. [[[1,0,0,1], [0,1,0,1],...]] for right and green colors.
    • options.texParams (TexParam, optional) — Texture params for all segments: texOffset, strokeSize and texOffsetSpeed.

Instance Methods

setSrc()

Sets stroke source per segment (null = color-only).

setPoint3v( coordinates: Vec3, index?: number, segmentIndex?: number, skipLonLat?: boolean, )

Changes cartesian point coordinates of the path

Parameters

  • coordinates (Vec3) — New coordinates
  • index (number, optional, default: 0) — Path segment index
  • segmentIndex (number, optional, default: 0) — Index of the point in the path segment
  • skipLonLat (boolean, optional, default: false) — Do not update geodetic coordinates

removePoint(index: number, segmentIndex?: number)

Remove point from the path

Parameters

  • index (number) — Point index in a path segment
  • segmentIndex (number, optional, default: 0) — Segment path index

insertPoint3v( point3v: Vec3, index?: number, color?: NumberArray4, segmentIndex?: number, )

Insert point coordinates in a path segment

Parameters

  • point3v (Vec3) — Point coordinates
  • index (number, optional, default: 0) — Index in the path
  • color (NumberArray4, optional) — Point color
  • segmentIndex (number, optional, default: 0) — Path segment index

addPoint3v( point3v: Vec3, segmentIndex?: number, color?: NumberArray4, )

Append new point in the end of the path.

Parameters

  • point3v (Vec3) — New point coordinates.
  • segmentIndex (number, optional, default: 0) — Path segment index, first by default.
  • color (NumberArray4, optional) — Point color

addPointLonLat( lonLat: LonLat, segmentIndex?: number, color?: NumberArray4, )

Append new geodetic point in the end of the path.

Parameters

  • lonLat (LonLat) — New coordinate.
  • segmentIndex (number, optional, default: 0) — Path segment index, first by default.
  • color (NumberArray4, optional) — Point color.

setPointColor( color: NumberArray4, index?: number, segmentIndex?: number, )

Change path point color

Parameters

  • color (NumberArray4) — New color
  • index (number, optional, default: 0) — Point index
  • segmentIndex (number, optional, default: 0) — Path segment index

removePath(index: number)

Remove multiline path segment

Parameters

  • index (number) — Segment index in multiline

setPath3v( path3v: Array.<SegmentPath3vExt>, pathColors?: Array.<SegmentPathColor>, forceEqual?: Boolean, )

Sets Polyline cartesian coordinates.

Parameters

  • path3v (Array.<SegmentPath3vExt>) — Polyline path cartesian coordinates. (exactly 3 entries)
  • pathColors (Array.<SegmentPathColor>, optional) — Polyline path cartesian coordinates. (exactly 3 entries)
  • forceEqual (Boolean, optional, default: false) — Makes assigning faster for size equal coordinates array.

setPathLonLat( pathLonLat: Array.<SegmentPathLonLat>, pathColors: Array.<SegmentPathColor>, forceEqual?: Boolean, )

Sets polyline geodetic coordinates.

Parameters

  • pathLonLat (Array.<SegmentPathLonLat>) — Polyline path cartesian coordinates.
  • pathColors (Array.<SegmentPathColor>) — Polyline path points colors.
  • forceEqual (Boolean, optional, default: false) — OPTIMIZATION FLAG: Makes assigning faster for size equal coordinates array.

setOpacity(opacity: number)

Sets polyline opacity.

Parameters

  • opacity (number) — Opacity.

getOpacity()

Gets polyline opacity.

setAltitude(altitude: number)

Sets Polyline thickness in screen pixels.

Parameters

  • altitude (number) — ALtitude value.

setThickness(thickness: number)

Sets Polyline thickness in screen pixels.

Parameters

  • thickness (number) — Thickness.

setColor(htmlColor: string)

Sets polyline segment color.

Parameters

  • htmlColor (string) — HTML color.

setVisibility(visibility: boolean)

Sets visibility.

Parameters

  • visibility (boolean) — Polyline visibility.

getVisibility(): boolean

Gets Polyline visibility.

Returns

  • boolean — Polyline visibility.

setColorHTML(htmlColor: string)

Sets polyline color

Parameters

  • htmlColor (string) — HTML color.

getColorHTML(index?: number): string | undefined

Gets polyline HTML color.

Parameters

  • index (number, optional, default: 0) — Segment index.

Returns

  • string | undefined — HTML color, or undefined when no color is set.

getColor4v(index?: number): Vec4 | undefined

Gets polyline color as a normalized RGBA vector.

Parameters

  • index (number, optional, default: 0) — Segment index.

Returns

  • Vec4 | undefined — Normalized RGBA color, or undefined when no color is set.

clear()

Clear polyline data.

remove()

Removes from an entity.

Instance Fields

isClosed

Sets closed/open state for one path segment.