Class: MeasureHandler

MeasureHandler

new MeasureHandler(viewer, mode, clampMode, showMeasureResult)

Measurement processor class.

Name Type Default Description
viewer Viewer

Specify the view used for measurement.

mode MeasureMode

Specify the measurement mode.

clampMode ClampMode ClampMode.Space optional

Specify the style of geometric objects (floor, object).

showMeasureResult Boolean true optional

Display the measurement results.

See:
Example
var handler = new MeasureHandler(viewer,SuperMap3D.MeasureMode.Distance);
handler.activate();
handler.measureEvt.addEventListener(function(obj){
    console.log(obj);
});

Members

readonly activeEvtEvent

Obtain the activation event for the measurement handler

readonly angleLabelLabel

Obtain the textual result label object for measuring angles

readonly areaLabelLabel

Obtain the textual result label object for measuring the area

capturePointColorColor

Get or set the color of the vertex snap point during measurement.

capturePointSizeNumber

Get or set the size of the vertex snap point during measurement.

clampModeClampMode

Clamp to object mode.

readonly disLabelLabel

Obtain the textual result label object for measuring distance

enableDepthTestBoolean

Set whether to enable depth detection for drawn graphics elements

Default Value:
true

fillColorColor

Get or set the fill color of the specified geometric object during measurement.

Default Value:
Color.ORANGE.withAlpha(0.5)

readonly hLabelLabel

Obtain the textual result label object for measuring horizontal distance

keepPreviousResultsBoolean

Set or retrieve whether to enable saving of measurement results before, default to false

Default Value:
false

lineColorColor

Get or set the line color for drawing geometric objects after measurement.

Default Value:
Color.fromCssColorString('#51ff00')

lineDisplayTypeLineDisplayType

Get or set the type of measurement time line.

Default Value:
LineDisplayType.NON_OCCLUDED

lineMaterialMaterial

Obtain or set the line material for drawing geometric objects after measurement.

Default Value:
ColorMaterialProperty

lineWidthNumber

Get or set the line width of the geometric object drawn after measurement.

Default Value:
2.0

readonly measureEvtEvent

Obtain measurement events, monitor the event to obtain real-time measurement results

pointColorColor

Get or set the color of the points drawn during measurement.

Default Value:
Color.fromCssColorString('#ffe500')

readonly pointsArray

Obtain measurement points

pointSizeNumber

Get or set the size of the points drawn during measurement.

Default Value:
8

snappingEnabledBoolean

Get or set whether to enable capture

Default Value:
true

readonly vLabelLabel

Obtain the text result label object for measuring vertical distance

Methods

static computeArea(positions){Array.<Cartesian3>}

Calculate the area in square meters (m2) based on a series of Cartesian coordinate points.

Name Type Description
positions Array

The coordinates of each point on the surface.

Returns:
Type Description
Array.<Cartesian3> The area of this region.

activate()

Activate the measurement processor.

clear()

Clear all elements related to measurement.

deactivate()

Turn off the measurement processor.

destroy()

Clear the measurement results, turn off the measurement processor, and destroy the captured object resources held. Once the object is destroyed, it should not be called again. Calling any function will result in a Developer Error exception. Therefore, follow the method in the example to assign the return value (undefined) to the object

Example
handler = handler && handler.destroy();

getLinePositions(){Array.<Cartesian3>}

Obtain the set of measurement line positions

Returns:
Type Description
Array.<Cartesian3> Cartesian coordinate point array.