//初始化测量面积
handlerArea = new Cesium.MeasureHandler(viewer, Cesium.MeasureMode.Area, 0);
handlerArea.measureEvt.addEventListener(function (result) {
var mj = Number(result.area);
handler.setInputAction(function (e) {
if (handlerArea) {
tooltip.showAt(e.startPosition, '<p>再次左击可选择下一个点,右击确认是第一次左击和最后一次左击所组成的区域面积</p>');
console.log(123213)
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
// var positions = result.positions;
// if (selOptV == 3 || selOptV == 4) {
// mj = Number(calcClampValue(positions));
// } else if (selOptV == 5) {
// mj = Number(calcAreaWithoutHeight(positions));
// }
var area = mj > 1000000 ? (mj / 1000000).toFixed(2) + 'km²' : mj.toFixed(2) + '㎡'
handlerArea.areaLabel.text = '面积:' + area;
handlerArea.areaLabel.outlineColor = {}
});
handlerArea.activeEvt.addEventListener(function (isActive) {
if (isActive == true) {
//handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
viewer.enableCursorStyle = false;
viewer._element.style.cursor = '';
$('body').removeClass('measureCur').addClass('measureCur');
tooltip.showAt(e.startPosition, '<p>左键点击选择第一个点,再次点击选择第二个点</p>');
handler.setInputAction(function (evt) {
tooltip.setVisible(false);
// handlerArea.clear();
// handlerArea.deactivate();
handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
}, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
else {
viewer.enableCursorStyle = true;
$('body').removeClass('measureCur');
麻烦你看一下应该写哪里