Hide menu
Loading...
Searching...
No Matches
Polyline2dSet

Defines a polygonal shape consisting of polylines.

Extends

Constructors

new Polyline2dSet()

new Polyline2dSet(): Polyline2dSet

Returns

Polyline2dSet

Overrides

PolyShape.constructor

new Polyline2dSet()

new Polyline2dSet(points, polylinePointsCounts, colors?, colorIndices?): Polyline2dSet

Number of polylines attributes (colors) should be the same as polylines. Otherwise, the appropriate attributes indices array should be specified. If specified, attribute indices array should have the same length as polylines array.

WARNING: Inconsistency in data will result to creation of empty polyline set.

Parameters

points

Float32Array<ArrayBufferLike>

Array of points in {x,y} format [x,y,x,y,...].

polylinePointsCounts

Number of points per polyline.

Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

colors?

Float32Array<ArrayBufferLike>

Array of colors in RGB ([R,G,B,R,G,B,...]) format.

colorIndices?

Color indices array.

Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

Returns

Polyline2dSet

Overrides

PolyShape.constructor

new Polyline2dSet()

new Polyline2dSet(points, polylinePointsCounts, colors?, colorIndices?): Polyline2dSet

Number of polylines attributes (colors) should be the same as polylines. Otherwise, the appropriate attributes indices array should be specified. If specified, attribute indices array should have the same length as polylines array.

WARNING: Inconsistency in data will result to creation of empty polyline set.

Parameters

points

BaseXY[]

Array of points in [{x,y},{x,y},...] format.

polylinePointsCounts

number[]

Number of points per polyline.

colors?

BaseRGB[]

Array of colors in [{r,g,b},{r,g,b},...] format.

colorIndices?

number[]

Color indices array.

Returns

Polyline2dSet

Overrides

PolyShape.constructor

new Polyline2dSet()

new Polyline2dSet(polylines, colors?, colorIndices?): Polyline2dSet

Number of polylines attributes (colors) should be the same as polylines. Otherwise, the appropriate attributes indices array should be specified. If specified, attribute indices array should have the same length as polylines array.

WARNING: Inconsistency in data will result to creation of empty polyline set.

Parameters

polylines

Polyline2d[]

Array of polylines.

colors?

BaseRGB[]

Array of colors in [{r,g,b},{r,g,b},...] format.

colorIndices?

number[]

Color indices array.

Returns

Polyline2dSet

Overrides

PolyShape.constructor

Accessors

colors

Get Signature

get colors(): Float32Array<ArrayBufferLike>

Returns array with colors in RGB ([r,g,b,r,g,b,...]) format for each vertex (i.e. taking into account colors indices), if specified. Otherwise, returns empty array.

Returns

Float32Array<ArrayBufferLike>


id

Get Signature

get id(): bigint

Returns object id.

Returns

bigint

Inherited from

PolyShape.id


name

Get Signature

get name(): null | string

Returns name of the Shape. null if the element has no name (by default).

Returns

null | string

Set Signature

set name(name): void

Sets name of the Shape.

Parameters

name

Name of the Shape.

null | string

Returns

void

Inherited from

PolyShape.name


numberOfColors

Get Signature

get numberOfColors(): number

Returns number of unique colors.

Returns

number


numberOfPolylines

Get Signature

get numberOfPolylines(): number

Returns a number of polylines in polyline set.

Returns

number


vertices

Get Signature

get vertices(): Float32Array<ArrayBufferLike>

Returns unique vertices in {x,y} format [x,y,x,y,...]..

Returns

Float32Array<ArrayBufferLike>

Methods

addPolyline()

addPolyline(polyline, colors?, colorIndices?): boolean

Adds polyline and it's attributes to this polylines set. Returns true if polyline successfully added. this polylines set should have the same specified attributes as specified for new added polyline. Otherwise, polyline won't be added.

Parameters

polyline

Polyline2d

Polyline.

colors?

BaseRGB[]

Array of colors in [{r,g,b},{r,g,b},...] format.

colorIndices?

number[]

Color indices array.

Returns

boolean


addPolylines()

Call Signature

addPolylines(polylineSet): boolean

Adds polylines and attributes from another polylines set to this polylines set. Returns true if polylines successfully added. this polylines set and added polylineSet should have the same specified attributes. Otherwise, polylines won't be added.

Parameters

polylineSet

Polyline2dSet

Added polyline set.

Returns

boolean

Call Signature

addPolylines(points, polylinePointsCounts, colors?, colorIndices?): boolean

Adds polylines and attributes to this polylines set. Returns true if polylines successfully added. this polylines set should have the same specified attributes as specified for new added polylines. Otherwise, polylines won't be added.

Parameters

points

Float32Array<ArrayBufferLike>

Array of points in {x,y} format [x,y,x,y,...].

polylinePointsCounts

Number of points per polyline.

Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

colors?

Float32Array<ArrayBufferLike>

Array of colors in RGB ([R,G,B,R,G,B,...]) format.

colorIndices?

Color indices array.

Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

Returns

boolean

Call Signature

addPolylines(points, polylinePointsCounts, colors?, colorIndices?): boolean

Adds polylines and attributes to this polylines set. Returns true if polylines successfully added. this polylines set should have the same specified attributes as specified for new added polylines. Otherwise, polylines won't be added.

Parameters

points

BaseXY[]

Array of points in [{x,y},{x,y},...] format.

polylinePointsCounts

number[]

Number of points per polyline.

colors?

BaseRGB[]

Array of colors in [{r,g,b},{r,g,b},...] format.

colorIndices?

number[]

Color indices array.

Returns

boolean

Call Signature

addPolylines(polylines, colors?, colorIndices?): boolean

Adds polylines and attributes to this polylines set. Returns true if polylines successfully added. this polylines set should have the same specified attributes as specified for new added polylines. Otherwise, polylines won't be added.

Parameters

polylines

Polyline2d[]

Array of polylines.

colors?

BaseRGB[]

Array of colors in [{r,g,b},{r,g,b},...] format.

colorIndices?

number[]

Color indices array.

Returns

boolean


color()

color(index): Color

Returns color. index must be in the range [0, numberOfColors()-1]. Otherwise the result is undefined.

Parameters

index

number

Color index.

Returns

Color


hasColors()

hasColors(): boolean

Returns true if the triangle set has explicitly defined colors.

Returns

boolean


pointColor()

pointColor(polylineIndex, pointIndex): Color

Returns a color at point. polylineIndex must be in the range [0, numberOfPolylines()-1]. pointIndex must be in polyline points range. Otherwise the result is undefined.

Parameters

polylineIndex

number

Polyline index.

pointIndex

number

Point index in polyline.

Returns

Color


pointColorIndex()

pointColorIndex(polylineIndex, pointIndex): number

Returns a color index for point. polylineIndex must be in the range [0, numberOfPolylines()-1]. pointIndex must be in polyline points range. If the point index was not found -1 will be returned.

Parameters

polylineIndex

number

Polyline index.

pointIndex

number

Point index in polyline.

Returns

number


polyline()

polyline(index): Polyline2d

Returns the polyline. index must be in the range [0, numberOfPolylines()-1]. Otherwise the result is undefined.

Parameters

index

number

Point index.

Returns

Polyline2d