MeasureHandler

new SuperMap3D.MeasureHandler(viewer, mode, clampMode)

Measurement handler class.
Name Type Description
viewer Viewer Specifies the view to use for measurements.
mode MeasureMode Specifies the measurement mode.
clampMode ClampMode Specify the style of the geometric object (stick to the ground, stick to the object, and the measurement results are only effectived in ClampMode.Space or ClampMode.Ground).
Example:
var handler = new MeasureHandler(viewer,SuperMap3D.MeasureMode.Distance);
handler.activate();
handler.measureEvt.addEventListener(function(obj){
    console.log(obj);
});
See:

Members

activeEvt : Event

Activate the event, listen to the current event to get the state of the processor.

areaLabel : Entity

When the measurement mode is Area, use this label entity object areaLabel to display the area measurement results.

capturePointColor : Color

Get or set the color of point cloud capture points during measurement.

capturePointSize : Number

Get or set the size of the point cloud capture point during measurement.

clampMode : ClampMode

Paste object mode.

disLabel : Entity

When the measurement mode is Distance, use this label entity object disLabel to display the spatial distance measurement results.

enableDepthTest : Boolean

Set whether to enable depth detection for the drawing object, which is enabled by default.

fillColor : position

Gets or sets the fill color of the specified geometric object when measuring.

hLabel : Entity

When the measurement mode is DVH, use this label entity object hLabel to display the horizontal distance measurement results.

lineColor : position

Gets or sets the line color of the specified geometric object during measurement.

lineDisplayType : LineDisplayType

Get or set the type of measurement time line.

lineWidth : position

Gets or sets the line width of the specified geometric object during measurement.

measureEvt : Event

Measurement event, listen to the current event to get the measurement result. When the measurement mode is MeasureMode.Distance, the callback result is {distance : distance}. When the measurement mode is MeasureMode.Area, the callback result is {area : area, positions : positions}. When the measurement mode is MeasureMode.DVH, the callback result is {distance : distance,verticalHeight : vHeight,horizontalDistance : hHeight}.
Example:
var handler = new SuperMap3D.MeasureHandler(viewer,SuperMap3D.MeasureMode.Area);
handler.measureEvt.addEventListener(function(result){
                    var area = result.area > 1000000 ? result.area/1000000 + 'km²' : result.area + '㎡'
                    handler.areaLabel.text = 'area:' + area;
                });

vLabel : Entity

When the measurement mode is DVH or Height, use this label entity object vLabel to display the vertical height measurement result.

Methods

staticSuperMap3D.MeasureHandler.computeArea(positions)

Calculates the area, in m2 (square meter), from a series of Cartesian coordinate points.
Name Type Description
positions The coordinates of each point on the surface

activate()

Activate the measurement processor.

clear()

Clear all elements related to measurement.

deactivate()

Shut down the measurement processor.