Class: module:GeometryCopyHandler

module:GeometryCopyHandler()

Handles geometry copy workflow

Constructor

new module:GeometryCopyHandler()

Source:

Methods

_applyGeometryToEditing(geometry)

Apply copied geometry to current editing feature

Parameters:
Name Type Description
geometry object

Geometry to apply

Source:

_convertToOL6Feature(ol2Feature) → {object|null}

Convert OL2 feature to OL6 format

Parameters:
Name Type Description
ol2Feature object

OpenLayers 2 feature

Source:
Returns:

OpenLayers 6 feature or null

Type
object | null

_geometryTypesMatch(geomType1, geomType2) → {boolean}

Check if two geometry types are compatible

Parameters:
Name Type Description
geomType1 string

First geometry type

geomType2 string

Second geometry type

Source:
Returns:

True if compatible

Type
boolean

_getDigitizingFeatures(pixelPosition) → {Array.<any>}

Gets the new ol digitized features at pixelPosition, filters them accordingly to the current edition geometry type and trasfroms them into corresponding ol2 features

Parameters:
Name Type Description
pixelPosition object

Pixel position

Source:
Returns:
  • Array of informations for popup display
Type
Array.<any>

_getEditingGeometryType() → {string|null}

Get the geometry type of the current editing layer

Source:
Returns:

Geometry type or null

Type
string | null

_getFeatureLabel(feature) → {string}

Get feature label for display

Parameters:
Name Type Description
feature object

Feature object

Source:
Returns:

Feature label

Type
string

_getGeometryType(geometry) → {string}

Get ol2 geometry type name

Parameters:
Name Type Description
geometry object

Geometry object

Source:
Returns:

Geometry type name

Type
string

(async) _getMapFeatures(candidateLayers, pixelPosition) → {Promise.<Array>}

Query all visible layers for features at position via WMS GetFeatureInfo

Parameters:
Name Type Description
candidateLayers Array.<any>

list of candidate layers

pixelPosition object

Pixel position

Source:
Returns:
  • Array of informations for popup display
Type
Promise.<Array>

_getWfsLayerNames() → {Set.<string>}

Get WFS-published layer names from the project configuration.

Source:
Returns:

Set of WFS layer names

Type
Set.<string>

_handleWMSResponse(htmlResponse) → {Array.<any>}

Handle WMS GetFeatureInfo HTML response

Parameters:
Name Type Description
htmlResponse string

HTML response from WMS GetFeatureInfo

Source:
Returns:
  • Array of informations for popup display
Type
Array.<any>

_notify(message, type)

Show a status message for the copy workflow. Replaces any previous copy-workflow message so they do not stack up across clicks, and auto-dismisses after a short delay.

Parameters:
Name Type Description
message string

Message to display

type string

Message type (info, error, success)

Source:

_onFeatureSelected(featureData)

Handle feature selection from popup

Parameters:
Name Type Description
featureData object

Selected feature data

Source:

_onMapClick(event)

Handle map click

Parameters:
Name Type Description
event object

Map click event

Source:

(async) _queryFeaturesAtPosition(coordinate, pixelPosition) → {Promise.<void>}

Query all visible map layers and the digitizing layer to retrieve features suitable for copying. Show feature selection popup accordingly or inform the user if no suitable feature has been identified.

Parameters:
Name Type Description
coordinate object

Lon/lat coordinate

pixelPosition object

Pixel position

Source:
Returns:
Type
Promise.<void>

_showFeaturePicker(features, pixelPosition)

Show feature picker popup

Parameters:
Name Type Description
features Array

Array of features

pixelPosition object

Pixel position

Source:

activate()

Activate copy mode

Source:

deactivate()

Deactivate copy mode

Source:

isActive() → {boolean}

Check if copy mode is active

Source:
Returns:

True if active

Type
boolean