Geoportal Extension for OpenLayers 3 API Reference

Class: Drawing

ol.control.Drawing

Drawing Control.

new Drawing(options)

Ol3/Controls/Drawing.js, line 82
Name Type Description
options Object

options for function call.

Name Type Default Description
collapsed Boolean true optional

Specify if Drawing control should be collapsed at startup. Default is true.

layer ol.layer.Vector null optional

OL3 layer that will hosts created features. If none, an empty vector layer will be created.

tools Object

Tools to display in the drawing toolbox. All by default.

Name Type Default Description
points Boolean true optional

Display points drawing tool

lines Boolean true optional

Display lines drawing tool

polygons Boolean true optional

Display polygons drawing tool

text Boolean true optional

Display text drawing tool

remove Boolean true optional

Display feature removing tool

display Boolean true optional

Display style editing tool

tooltip Boolean true optional

Display text editing tool

edit Boolean true optional

Display editing tool

export Boolean true optional

Display exporting tool

measure Boolean false optional

Display measure drawing into popup info

labels String optional

Labels for Control

Name Type Description
control String optional

Label for Control

points String optional

Label for points drawing tool

lines String optional

Label for lines drawing tool

polygons String optional

Label for polygons drawing tool

text String optional

Label for text drawing tool

edit String optional

Label for editing tool

display String optional

Label for style editing tool

tooltip String optional

Label for text editing tool

remove String optional

Label for feature removing tool

export String optional

Label for exporting tool.

exportTitle String optional

Title for exporting tool.

applyToObject String optional

Label for apply to object button.

saveDescription String optional

Label for save description button.

setAsDefault String optional

Label for set as default style button.

strokeColor String optional

Label for stroke color.

strokeWidth String optional

Label for stroke width.

fillColor String optional

Label for fill color.

fillOpacity String optional

Label for fillOpacity.

markersList Array.<Object> [{src : "data:image/png;base64,xxxx", anchor : [0.5,1]}] optional

List of markers src to be used for points with their anchor offsets See OpenLayers params for anchor offset options.

defaultStyles Object

Default styles applying to geometries (labels, lines and polygons).

Name Type Default Description
textFillColor String "#000000" optional

Text fill color for labels (RGB hex value).

textStrokeColor String "#FFFFFF" optional

Text surrounding color for labels (RGB hex value).

strokeColor String "#ffcc33" optional

Stroke color (RGB hex value).

strokeWidth Number 2 optional

Stroke width in pixels.

polyStrokeColor String "#ffcc33" optional

Stroke color (RGB hex value) for polygons.

polyStrokeWidth Number 2 optional

Stroke width in pixels for polygons.

polyFillColor String "#ffffff" optional

Polygons fill color (RGB hex value).

polyFillOpacity Number 0.2 optional

Polygon fill opacity (alpha value between 0:transparent and 1:opaque).

cursorStyle Object

cursor (circle) style when drawing or editing.

Name Type Default Description
fillColor String "rgba(0, 153, 255, 1)" optional

Cursor fill color.

strokeColor String "#FFF" optional

Cursor stroke color.

strokeWidth String 1 optional

Cursor surrounding stroke width.

radius String 6 optional

Cursor radius.

Extends

  • ol.control.Control

Members

collapsed

{Boolean} specify if Drawing control is collapsed (true) or not (false)

Methods

exportFeatures(){String}

Ol3/Controls/Drawing.js, line 265

Export features of current drawing layer in KML.

Returns:
KML representation of drawn features or null if not possible.

getExportName(){String}

Ol3/Controls/Drawing.js, line 333

getter for Export Name.

Returns:
name

setCollapsed(collapsed)

Ol3/Controls/Drawing.js, line 306

Collapse or display control main container

Name Type Description
collapsed Boolean

True to collapse control, False to display it

setExportName(name)

Ol3/Controls/Drawing.js, line 324

Setter for Export Name.

Name Type Description
name String

Export Name. By default, "Croquis".

setLayer(vlayer)

Ol3/Controls/Drawing.js, line 606

Sets vector layer to hosts feature.

Name Type Description
vlayer ol.layer.Vector

vector layer

setMap(map)

Ol3/Controls/Drawing.js, line 220

Overload of ol.control.Control.setMap() method, called when control is added to or removed from map.

Name Type Description
map Object

ol.Map object.