Measurement processor class.
Name | Type | Description |
---|---|---|
viewer |
Viewer | Specifies the view to use for the measurement. |
mode |
MeasureMode | Specify the measurement mode. |
Example:
var handler = new MeasureHandler(viewer,Cesium.MeasureMode.Distance);
handler.activate();
handler.measureEvt.addEventListener(function(obj){
console.log(obj);
});
See:
Members
-
activeEvt : Event
-
Activate the event and listen for the current event to get the state of the processor.
-
areaLabel : Entity
-
The equivalent measurement mode is Area, and the label area object areaLabel is used to display the area measurement result.
-
Paste object mode.
-
disLabel : Entity
-
The equivalent measurement mode is Distance, and the tag entity object disLabel is used to display the spatial distance measurement result.
-
Set whether to draw depth detection for the drawing object, which is enabled by default.
-
hLabel : Entity
-
The equivalent measurement mode is DVH, and the label entity object hLabel is used to display the horizontal distance measurement result.
-
measureEvt : Event
-
Measure the event and 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 equivalent mode is MeasureMode.DVH, the callback result is {distance : distance, verticalHeight : vHeight, horizontalDistance : hHeight}.
Example:
var handler = new Cesium.MeasureHandler(viewer,Cesium.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
-
The equivalent measurement mode is DVH or Height, and the label entity object vLabel is used to display the vertical height measurement result.
Methods
-
Activate the measurement processor.
-
Clear all the elements related to the measurement.
-
Turn off the measurement processor.