Class: Feature

cercalia.Feature


A vector geographyc feature and other attributes to represent them to map.

new cercalia.Feature(options)

src/cercalia/feature.js, line 34
Name Type Description
options

Feature options

Name Type Description
draggable boolean | undefined

Boolean indicating if dragging is being enabled or not.

editable boolean | undefined

Boolean indicating if editing is being enabled or not.

fillColor string | undefined

Feature fill color. Default value #009BFF.

fillOpacity number | undefined

Feature fill opacity. Default value 0.9.

geometry ol.geom.Geometry | undefined

OpenLayers3 geometry ol.Geometry that indicates the feature to be painted.

id string | undefined

Marker ID. If not specified, it's automatically generated.

iconArrow string | undefined

Icon URL. If not specified, API uses the default cercalia icon. If uses a custom icon, the arrow should be pointing upwards

lineDash Array.<number> | undefined

Line dash. Array of two values, continuous-discontinuous. For example [40, 20], [10, 10], [10, 20, 40, 60].

onClick function | undefined

Function to execute on feature click.

onDoubleClick function | undefined

Function to execute on feature double click.

onDragEnd function | undefined

Function to execute when ends feature dragging.

onDragMove function | undefined

Function to execute during feature dragging.

onDragStart function | undefined

Function to execute on feature dragging start.

onDrop function | undefined

Function to execute on feature drop. Returns the position of dragged features list

onMouseOut function | undefined

Function to execute on Mouse Out.

onMouseOver function | undefined

Function to execute on Mouse Over.

onModifyStart function | undefined

Function to execute on modify start. When feature is editable. Parameters are: 1-> cercalia.Feature, 2-> ol.interaction.Modify.Event

onModifyEnd function | undefined

Function to execute on modify end. When feature is editable. Parameters are: 1-> cercalia.Feature, 2-> ol.interaction.Modify.Event

onRightClick function | undefined

Function to execute on feature right click.

outline boolean | undefined

Enable outline feature property. If no outline required, specify null. Default value true.

outlineColor string | undefined

Feature outline color. Default value #00ff00

outlineOpacity number | undefined

Feature outline opacity. Default value 1.

outlineWidth number | undefined

Feature outline width. Default value 7.

radius number | undefined

Point radius.

simpleLabel cercalia.SimpleLabel | null

SimpleLabel feature. Required.

showDirection string | undefined

Show direction (arrows)

srs string | undefined

Projection. Default value: ESPG:4326.

strokeOpacity number | undefined

Feature stroke opacity. Default value 0.7.

strokeColor string | undefined

Feature stroke color. Default value #ffffff.

strokeWidth number | undefined

Feature stroke width. Default value 5.

wkt string | undefined

WKT String with shape geometry to be painted.

kml string | undefined

KML string to be painted.

zIndex number | undefined

zIndex.

Extends

Methods

destroy()

src/cercalia/feature.js, line 939

Destroy object and related atributes to free up memory

getBounds(){cercalia.Bounds}

src/cercalia/feature.js, line 954
Returns:
Returns the feature limits

getClass(){string} inherited

src/cercalia/object.js, line 41
Returns:
Get Class name of object

getClosestCoordinate(position){cercalia.LonLat}

src/cercalia/feature.js, line 1214
Name Type Description
position cercalia.LonLat

Position

Returns:
Closest position

getFeature(){ol.Feature}

src/cercalia/feature.js, line 794
Returns:
Object ol.Feature Openlayers3

getFillColor(){string}

src/cercalia/feature.js, line 748
Returns:
Fill color

getFillOpacity(){number}

src/cercalia/feature.js, line 766
Returns:
Fill opacity. Values between 0 and 1.

getId(){string} inherited

src/cercalia/object.js, line 33
Returns:
Unique Id.

getMap(){cercalia.Map}

src/cercalia/feature.js, line 323
Returns:
Map object cercalia.Map

getOutlineColor(){string}

src/cercalia/feature.js, line 713
Returns:
Outline color.

getOutlineOpacity(){number}

src/cercalia/feature.js, line 695
Returns:
Feature object outline opacity.

getOutlineWidth(){number}

src/cercalia/feature.js, line 731
Returns:
Outline width

getRadius(){number}

src/cercalia/feature.js, line 624
Returns:
circle Radius (in pixels).

getSimpleLabel(){cercalia.SimpleLabel}

src/cercalia/feature.js, line 814
Returns:
Returns cercalia.SimpleLabel if it's created. If not, returns null.

getStrokeColor(){string}

src/cercalia/feature.js, line 660
Returns:
Outline color.

getStrokeOpacity(){number}

src/cercalia/feature.js, line 642
Returns:
Feature opacity. Values: [0..1].

getStrokeWidth(){number}

src/cercalia/feature.js, line 678
Returns:
Outline width

getWKT(){string|null}

src/cercalia/feature.js, line 340
Returns:
Feature WKT (Well-known-text). WKT has not Circle type format.

getZIndex(){number}

src/cercalia/feature.js, line 606
Returns:
zIndex Feature object

hasDirections(){boolean}

src/cercalia/feature.js, line 1170

Returns true if the feature has directions created and visibles.

Returns:
true if the feature has directions created and visibles.

hideDirections()

src/cercalia/feature.js, line 1192

Hide arrow directions of feature.

isDraggable(){boolean}

src/cercalia/feature.js, line 535
Returns:
Returns the drag status for feature. Values: true or false.

isDragging(){boolean}

src/cercalia/feature.js, line 785

True if feature is dragging, otherwise false.

Returns:
true if dragging is enabled to this feature.

isEditable(){boolean|undefined}

src/cercalia/feature.js, line 543
Returns:
Returns the edit status for feature. Values: true or false.

setDraggable(draggable)

src/cercalia/feature.js, line 524

Converts the feature object to draggable. You can drag the feature.

Name Type Description
draggable boolean

Draggable.

setEditable(edit)

src/cercalia/feature.js, line 552

Modify the edit status for feature. Values: true or false.

Name Type Description
edit boolean

Set true to edit feature.

setEditablePointColor(color)

src/cercalia/feature.js, line 1204

Change vertices color when is in editing mode.

Name Type Description
color string

Hexadecimal color.

setFillColor(fillColor)

src/cercalia/feature.js, line 757

Assign the fillcolor.

Name Type Description
fillColor string

Fill color Hexadecimal color. Ex: '#ff0000'

setFillOpacity(fillOpacity)

src/cercalia/feature.js, line 775

Assign Fill opacity. Values between 0 and 1.

Name Type Description
fillOpacity number

Fill opacity. Values between 0 and 1.

setId(id)

src/cercalia/feature.js, line 332

Assign an ID to the feature.

Name Type Description
id string

Id of feature.

setOnDragEnd(fn)

src/cercalia/feature.js, line 443
Name Type Description
fn function

Callback function.

setOnDragMove(fn)

src/cercalia/feature.js, line 435
Name Type Description
fn function

Callback function.

setOnDragStart(fn)

src/cercalia/feature.js, line 427
Name Type Description
fn function

Callback function.

setOnModifyEnd(fn)

src/cercalia/feature.js, line 460
Name Type Description
fn function

Callback function.

setOnModifyStart(fn)

src/cercalia/feature.js, line 452
Name Type Description
fn function

Callback function.

setOutlineColor(outlineColor)

src/cercalia/feature.js, line 722

Asign the outline color.

Name Type Description
outlineColor string

object color

setOutlineOpacity(outlineOpacity)

src/cercalia/feature.js, line 704

Assigns the object outline opacity. Feature.

Name Type Description
outlineOpacity number

feature outline opacity.

setOutlineWidth(outlineWidth)

src/cercalia/feature.js, line 739
Name Type Description
outlineWidth number

outiline width

setRadius(radius)

src/cercalia/feature.js, line 633

Assigns the feature object outline opacity.

Name Type Description
radius number

Radius in meters.

setSimpleLabel(simpleLabel)

src/cercalia/feature.js, line 803

SimpleLabel to add/modify related to the feature

Name Type Description
simpleLabel cercalia.SimpleLabel

SimpleLabel to add feature.

setStrokeColor(strokeColor)

src/cercalia/feature.js, line 669

Assign the object outiline color.

Name Type Description
strokeColor string

Object Color

setStrokeOpacity(strokeOpacity)

src/cercalia/feature.js, line 651

Assigns the feature object outline opacity. Feature.

Name Type Description
strokeOpacity number

Opacity, values between [0..1]

setStrokeWidth(strokeWidth)

src/cercalia/feature.js, line 686
Name Type Description
strokeWidth number

Outline width

setZIndex(zIndex)

src/cercalia/feature.js, line 615

Assigns a zIndex to Feature object

Name Type Description
zIndex number

Z Index position.

showDirections()

src/cercalia/feature.js, line 1178

Show arrow directions of feature

tranformCircleToPolygon(opt_sides)

src/cercalia/feature.js, line 1226

Converts a circle feature to a circular polygon

Name Type Description
sides number

Number of vertexs. Default is 32.