|
@@ -9,6 +9,7 @@
|
|
|
</div>
|
|
|
<div class="map-txt" v-html="bindPopupHtml">
|
|
|
</div>
|
|
|
+ <div id="super2" />
|
|
|
</div>
|
|
|
</transition>
|
|
|
<!--地图top 显示 结束-->
|
|
@@ -52,6 +53,10 @@
|
|
|
timer: null,
|
|
|
/*************************原地图属性*********************/
|
|
|
isEditableLayers: false, //绘图控件
|
|
|
+ selOptV: 2, // 贴地量算
|
|
|
+ clampMode: 1, // 空间模式
|
|
|
+ handlerDis: null, // 距离
|
|
|
+ handlerArea: null, // 面积
|
|
|
|
|
|
/*************************原地图属性*********************/
|
|
|
aac: null,
|
|
@@ -69,6 +74,81 @@
|
|
|
mounted() {},
|
|
|
props: {},
|
|
|
methods: {
|
|
|
+ choseMeasuringAreaAll() {
|
|
|
+ if (this.handlerDis != null) {
|
|
|
+ this.handlerDis.clear()
|
|
|
+ }
|
|
|
+ if (this.handlerArea != null) {
|
|
|
+ this.handlerArea.clear()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 测量距离
|
|
|
+ choseMeasuringDistance() {
|
|
|
+ let that = this
|
|
|
+ if (that.handlerDis != null) {
|
|
|
+ that.handlerDis.deactivate()
|
|
|
+ that.handlerDis.clear()
|
|
|
+ }
|
|
|
+ //初始化测量距离
|
|
|
+ that.handlerDis = new Cesium.MeasureHandler(that.viewer, Cesium.MeasureMode.Distance, that.clampMode);
|
|
|
+ that.handlerDis.clampMode = 1;
|
|
|
+ //注册测距功能事件
|
|
|
+ that.handlerDis.measureEvt.addEventListener(function(result) {
|
|
|
+ var dis = Number(result.distance);
|
|
|
+ var selOptV = that.selOptV;
|
|
|
+ if (selOptV == 3 || selOptV == 4) {
|
|
|
+ dis = Number(calcClampDistance(positions));
|
|
|
+ };
|
|
|
+ var distance = dis > 1000 ? (dis / 1000).toFixed(2) + 'km' : dis.toFixed(2) + 'm';
|
|
|
+ that.handlerDis.disLabel.text = '距离:' + distance;
|
|
|
+
|
|
|
+ });
|
|
|
+ that.handlerDis.activeEvt.addEventListener(function(isActive) {
|
|
|
+ if (isActive == true) {
|
|
|
+ that.viewer.enableCursorStyle = false;
|
|
|
+ that.viewer._element.style.cursor = '';
|
|
|
+ $('#super2').removeClass('measureCur').addClass('measureCur');
|
|
|
+ that.viewer.scene.pickPointEnabled = false;
|
|
|
+ } else {
|
|
|
+ that.viewer.enableCursorStyle = true;
|
|
|
+ $('#super2').removeClass('measureCur');
|
|
|
+ that.viewer.scene.pickPointEnabled = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ that.handlerDis.activate();
|
|
|
+ },
|
|
|
+ // 测量面积
|
|
|
+ choseMeasuringArea() {
|
|
|
+ let that = this
|
|
|
+ if (that.handlerArea != null) {
|
|
|
+ // that.handlerArea.deactivate()
|
|
|
+ that.handlerArea.clear()
|
|
|
+ }
|
|
|
+
|
|
|
+ //初始化测量面积
|
|
|
+ that.handlerArea = new Cesium.MeasureHandler(that.viewer, Cesium.MeasureMode.Area, that.clampMode);
|
|
|
+
|
|
|
+ that.handlerArea.clampMode = 1;
|
|
|
+ that.handlerArea.measureEvt.addEventListener(function(result) {
|
|
|
+ var mj = Number(result.area);
|
|
|
+ var area = mj > 1000000 ? (mj / 1000000).toFixed(2) + 'km²' : mj.toFixed(2) + '㎡'
|
|
|
+ that.handlerArea.areaLabel.text = '面积:' + area;
|
|
|
+ });
|
|
|
+ that.handlerArea.activeEvt.addEventListener(function(isActive) {
|
|
|
+ if (isActive == true) {
|
|
|
+ that.viewer.enableCursorStyle = false;
|
|
|
+ that.viewer._element.style.cursor = '';
|
|
|
+ $('#super2').removeClass('measureCur').addClass('measureCur');
|
|
|
+ that.viewer.scene.pickPointEnabled = false;
|
|
|
+ } else {
|
|
|
+ that.viewer.enableCursorStyle = true;
|
|
|
+ that.viewer._element.style.cursor = '';
|
|
|
+ $('#super2').removeClass('measureCur');
|
|
|
+ that.viewer.scene.pickPointEnabled = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ that.handlerArea.activate();
|
|
|
+ },
|
|
|
mapShow() {
|
|
|
this.mapshow = false,
|
|
|
clearInterval(this.timer)
|