Class: Measure

ngeo.interaction.Measure

(abstract) new Measure([opt_options]opt)

Interaction that allows measuring (length, area, ...).

Parameters:
Name Type Attributes Description
[opt_options] ngeo.interaction.MeasureBaseOptions= <optional>

Options

Extends

  • ol.interaction.Interaction

Members

(static, constant) SPHERE_WGS84: ol.Sphere

(nullable) continueMsg: Element

Message to show after the first point is clicked.

(protected) decimals: number|undefined

Defines the number of decimals to keep in the measurement. If not defined, then the default behaviour occurs depending on the measure type.

(protected) precision: number|undefined

Defines the number of precision to keep in the measurement. If not defined, then the default behaviour occurs depending on the measure type.

(protected) sketchFeature: ol.Feature

The sketch feature.

startMsg: Element

The message to show when user is about to start drawing.

Methods

(static) getFormattedArea(polygon, projection, precision, format)

Calculate the area of the passed polygon and return a formatted string of the area.

This:
Parameters:
Name Type Description
polygon !ol.geom.Polygon

Polygon.

projection !ol.proj.Projection

Projection of the polygon coords.

precision number|undefined

Precision.

format !ngeox.unitPrefix

The format function.

Returns:
string

Formatted string of the area.

(static) getFormattedCircleArea(circle, precision, format)

Calculate the area of the passed circle and return a formatted string of the area.

Parameters:
Name Type Description
circle !ol.geom.Circle

Circle

precision number|undefined

Precision.

format !ngeox.unitPrefix

The format function.

Returns:
string

Formatted string of the area.

(static) getFormattedLength(lineString, projection, precision, format)

Calculate the length of the passed line string and return a formatted string of the length.

Parameters:
Name Type Description
lineString !ol.geom.LineString

Line string.

projection !ol.proj.Projection

Projection of the line string coords.

precision number|undefined

Precision.

format !ngeox.unitPrefix

The format function.

Returns:
string

Formatted string of length.

(static) getFormattedPoint(point, decimals, format, [opt_template]opt)

Return a formatted string of the point.

Parameters:
Name Type Attributes Description
point !ol.geom.Point

Point.

decimals number|undefined

Decimals.

format !ngeox.numberCoordinates

A function to format coordinate into text

[opt_template] string= <optional>

The template.

Returns:
string

Formatted string of coordinate.

(abstract, protected) createDrawInteraction(style, source)

Creates the draw interaction.

Parameters:
Name Type Description
style ol.style.Style|Array.|ol.StyleFunction|undefined

The sketchStyle used for the drawing interaction.

source ol.source.Vector

Vector source.

Returns:

getDrawInteraction()

Returns:

getTooltipElement()

Get a reference to the tooltip element.

Returns:
Element

Tooltip Element.

(abstract, protected) handleMeasure(callback)

Function implemented in inherited classes to compute measurement, determine where to place the tooltip and determine which help message to display.

Parameters:
Name Type Description
callback function(string, ?ol.Coordinate)

The function to be called.

setMap()