JX.LI 2 роки тому
батько
коміт
ea8e7af2dd

+ 12 - 1
public/index.html

@@ -6,6 +6,8 @@
   <meta name="renderer" content="webkit">
   <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
   <link rel="icon" href="<%= BASE_URL %>favicon.ico">
+  <link href="./SuperMap3D/Build/Cesium/Widgets/widgets.css" rel="stylesheet" />
+
   <title><%= webpackConfig.name %></title>
   <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
   <style>
@@ -267,7 +269,7 @@
 
   </style>
 </head>
-<body>
+<body oncontextmenu="return false">
 <!--三个必要的js文件引入-->
 <!--<script src="./hk/jquery-1.12.4.min.js"></script>-->
 <script src="hk/jsencrypt.min.js"></script>            <!-- 用于RSA加密 -->
@@ -286,6 +288,15 @@
 <!--  <script type="text/javascript" src="./supermap/libs/plotting/leaflet/10.2.1/iclient-plot-leaflet-es6.min.js"></script>-->
 <script type="text/javascript" include="PlotPanel,StylePanel,SMLInfosPanel,iPortalStylePanel"
         src="./supermap/examples/js/plottingPanel/PlottingPanel.Include.js"></script>
+<script type="text/javascript" src="./SuperMap3D/Build/Cesium/Cesium.js"></script>
+<script type="text/javascript" src="./SuperMap3D/examples/webgl/js/tooltip.js"></script>
+<script type="text/javascript" src="./SuperMap3D/examples/webgl/js/bubble/popup.js"></script>
+<script type="text/javascript" src="./SuperMap3D/examples/webgl/js/jquery.min.js"></script>
+<script type="text/javascript" src="./SuperMap3D/examples/webgl/js/config.js"></script>
+<script type="text/javascript" src="./SuperMap3D/examples/webgl/js/bootstrap-select.min.js"></script>
+<script type="text/javascript" src="./SuperMap3D/examples/webgl/js/supermap/SuperMap.Include.js"></script>
+
+
 <div id="app">
   <div class="loading">
     <div><span></span></div>

+ 6 - 1
src/assets/styles/base.scss

@@ -1383,13 +1383,18 @@ div::-webkit-scrollbar {
   background: linear-gradient($conBg);
   position: absolute;
 
+  // 2.5D地图显示
+  .cesium-infoBox{
+    z-index: 9999 !important;
+  }
+
   .el-input__inner {
     border: 1px $searchBorder;
     background-color: $searchBG;
     color: $inBlue;
   }
 
- 
+
 
   //收起展开
   .mascot {

+ 275 - 0
src/components/supermap-2.5d.vue

@@ -0,0 +1,275 @@
+<template>
+    <div id="cesium-container" style="width: 100%; height: 100%;background: none;">
+
+    </div>
+
+</template>
+<script>
+  import {
+    iconList,
+  } from '@/api/components/supermap.js'
+	export default {
+		name: 'sookaSuperMap',
+		data() {
+			return {
+        viewer:null,
+        scene:null,
+        handler:null,
+
+        pick:null,
+        back_position:null,
+        content:null,
+        stkTerrainProvider:null,
+
+        aac:null,//定时
+        /*************************原地图属性*********************/
+        isEditableLayers: false, //绘图控件
+
+        /*************************原地图属性*********************/
+      }
+		},
+		watch: {
+    },
+		mounted() {
+      this.viewer = new Cesium.Viewer('cesium-container')
+      //添加SuperMap iServer发布的影像服务
+      // var layer = this.viewer.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
+      //   url: 'http://121.36.228.94:8090/iserver/services/3D-sipingchangjing/rest/realspace'
+      // }));
+      // //添加SuperMap iServer发布的影像服务
+      // var layer1 = this.viewer.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
+      //   url: 'http://121.36.228.94:8090/iserver/services/map-spyx4326/rest/maps/dem'
+      // }));
+
+      this.scene = this.viewer.scene;
+      this.scene.lightSource.ambientLightColor = new Cesium.Color(0.65, 0.65, 0.65, 1);
+      var urlStr = 'http://121.36.228.94:8090/iserver/services/3D-sipingchangjing/rest/realspace';
+      this.scene.open(urlStr);
+
+      //将三维球定位到指定位置,camera是相机,是当前视野范围相机
+      //destination是相机的目标位置,参数是经度、纬度、高度
+      //orientation是相机朝向
+      //    heading-代表镜头左右方向,正值为右,负值为左
+      //    pitch-代表镜头上下方向,正值为上,负值为下.
+      //    roll-代表镜头左右倾斜,正值,向右倾斜,负值向左倾斜
+      this.viewer.camera.flyTo({
+        destination: Cesium.Cartesian3.fromDegrees(124.5465087890625, 43.0869197845459, 25000),
+        orientation: {
+          heading :  Cesium.Math.toRadians(348.4202942851978),
+          pitch : Cesium.Math.toRadians(-30.74026687972041),
+          roll : Cesium.Math.toRadians(0)
+        },
+        complete:function callback() {
+          // 定位完成之后的回调函数
+
+        }
+      });
+    },
+		props: {},
+		methods: {
+      //移除之前添加的点
+      clearM(){
+        this.viewer.entities.removeAll();
+      },
+      /**
+       * 地图落点
+       */
+      setMarkers(makerList){
+        let that = this;
+        that.handler = new Cesium.ScreenSpaceEventHandler(this.scene.canvas);
+        clearInterval(that.aac);
+        for (let i in makerList) {
+          let longitude = makerList[i].lng;
+          let latitude = makerList[i].lat;
+          that.viewer.entities.add({
+            name:"",
+            position: Cesium.Cartesian3.fromDegrees(longitude, latitude),
+            billboard: {
+              image: iconList[makerList[i].icon],
+              width: 48,
+              height: 48,
+              heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
+              disableDepthTestDistance:Number.POSITIVE_INFINITY
+            },
+            description: makerList[i].bindPopupHtml,
+            click: makerList[i].click,
+            parameter: makerList[i].parameter,
+          });
+        }
+        that.viewer.scene.globe.depthTestAgainstTerrain=false;
+        that.createLeftClickDescription();
+        that.createRightClickDescription();
+      },
+      /**
+       *鼠标左击事件是原来的气泡
+       */
+      createLeftClickDescription() {
+        let that = this;
+        that.handler.setInputAction(function (movement) {
+        }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
+      },
+      /**
+       * 地图落点(传感器)
+       */
+      setMarkers_cgq(makerList){
+        let that = this;
+        that.handler = new Cesium.ScreenSpaceEventHandler(this.scene.canvas);
+
+        for (let i in makerList) {
+          let longitude = makerList[i].lng;
+          let latitude = makerList[i].lat;
+          that.viewer.entities.add({
+            name:"",
+            position: Cesium.Cartesian3.fromDegrees(longitude, latitude),
+            billboard: {
+              image: iconList[makerList[i].icon],
+              width: 48,
+              height: 48,
+              heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
+              disableDepthTestDistance:Number.POSITIVE_INFINITY
+            },
+            description: makerList[i].bindPopupHtml,
+            click: makerList[i].click,
+            parameter: makerList[i].parameter,
+          });
+        }
+        that.viewer.scene.globe.depthTestAgainstTerrain=false;
+        that.createLeftClickDescription_cgq();
+      },
+      /**
+       *鼠标左击事件是原来的气泡(传感器)
+       */
+      createLeftClickDescription_cgq() {
+        let that = this;
+        clearInterval(that.aac);
+        that.handler.setInputAction(function (movement) {
+          that.aac = setInterval(function (){
+            let color = "green";
+            let value = Math.random();
+            let up = "▲";
+            let down = "▼";
+            if(value>0.5){
+              color = "red";
+              value = value +""+ up;
+            }else{
+              value = value +""+ down;
+            }
+            let html = "<span style='color:"+color+"'>当前传感器数值:"+value+"</span>";
+            window.parent.frames[0].document.querySelector(".cesium-infoBox-description").innerHTML = html;
+          },1000);
+        }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
+      },
+      /**
+       *鼠标右击事件是原来的点击
+       */
+      createRightClickDescription() {
+        let that = this;
+        that.handler.setInputAction(function (movement) {
+          // 监听鼠标的当前位置坐标,然后根据当前坐标去动态更新气泡窗口div的显示位置;
+          that.pick = that.viewer.scene.pick(movement.position);
+          if (that.pick && that.pick) {
+            let id = Cesium.defaultValue(that.viewer.scene.pick(movement.position).id, that.viewer.scene.pick(movement.position).primitive.id);
+            let clickName = id._click;
+            that.$emit(clickName, id._parameter)
+          }
+        }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
+      },
+      /**
+       * 落点定位
+       */
+      dropLocation(lat, lng) {
+        this.viewer.camera.flyTo({
+          destination: Cesium.Cartesian3.fromDegrees(lng, lat, 3000),
+        });
+      },
+    }
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import '@/assets/styles/base.scss';
+
+  input[type=checkbox] {
+    margin: 0px 4px 0 0px;
+  }
+
+  label {
+    display: inline-block;
+  }
+
+  .param-container {
+    border: none;
+  }
+
+  .titleBox {
+    margin-bottom: 0px;
+  }
+
+  .sm-div-graphic {
+    position: absolute;
+    color: #fff;
+    font-size: 14px;
+  }
+
+  #test .divpoint {
+    background: url(../../public/SuperMap3D/examples/webgl/images/qipao1.png) no-repeat;
+    background-size: cover;
+    width: 128px;
+    height: 216px;
+  }
+
+  #test3 .divpoint {
+    background: url(../../public/SuperMap3D/examples/webgl/images/qipao1.png) no-repeat;
+    background-size: cover;
+    width: 230px;
+    height: 150px;
+  }
+
+  #test .label-wrap {
+    display: flex;
+    justify-content: center;
+    align-content: center;
+    height: 50px;
+  }
+
+  #test3 .label-wrap {
+    padding-left: 100px;
+    padding-top: 8px;
+    box-sizing: border-box;
+  }
+
+  #test .pop-title {
+    color: #fff;
+    margin-top: 11px;
+    margin-bottom: 4px;
+    display: flex;
+    align-items: center;
+    font-size: 18px;
+  }
+
+
+  #test .data-li {
+    font-size: 14px;
+    margin-top: 15px;
+    margin-bottom: 5px;
+  }
+
+  #test3 .data-li {
+    font-size: 14px;
+    margin-top: 6px;
+  }
+
+  #test2 .divpoint {
+    background: url(../../public/SuperMap3D/examples/webgl/images/qipao1.png) no-repeat;
+    background-size: cover;
+    width: 116px;
+    height: 120px;
+  }
+
+  #test2 .label-wrap {
+    box-sizing: border-box;
+    padding-top: 10px;
+    padding-left: 51px;
+  }
+
+</style>

+ 4 - 5
src/views/datacenter.vue

@@ -30,8 +30,7 @@
         </div>
       </div>
       <!-- 地图 -->
-      <supermap ref="supermap" style="width: 100%;height: 100vh;" :mapDiv="'forestMap'" class="indexSupermapClass"
-                :mapSite="{doubleClickZoom:false}" :codes="['9fa5']" :isSideBySide="false"></supermap>
+      <supermap ref="supermap" style="width: 100%;height: 100vh;" ></supermap>
       <!--      <button @click="showEventInfo1" style="position: absolute; right: 50%;top: 45%;z-index: 1000;">弹层事件演示用按钮-->
       <!--      </button>-->
       <!-- 右侧 -->
@@ -77,7 +76,7 @@ import {
   getResourcePointByDeptId
 } from '@/api/datacenter'
 
-import supermap from '@/components/supermap' //超图
+import supermap from '@/components/supermap-2.5d' //超图
 import vheader from '@/components/v-header.vue' //一体化共用头部
 import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
 import eventLocation from '@/components/eventLocation.vue' //事件定位弹窗
@@ -462,7 +461,7 @@ export default {
           }
         }
         this.dataChat()
-        that.$refs.supermap.clearM(false)
+        that.$refs.supermap.clearM()
         that.$refs.supermap.setMarkers(that.markersList)
       })
     },
@@ -636,7 +635,7 @@ export default {
             that.markersList.push(markersMap)
           }
         }
-        that.$refs.supermap.clearM(false)
+        that.$refs.supermap.clearM()
         that.$refs.supermap.setMarkers(that.markersList)
       })
     }

+ 8 - 12
src/views/forest.vue

@@ -103,10 +103,7 @@
         </div>
       </div>
       <!-- 地图 -->
-      <supermap ref="supermap" style="width: 100%;height: 100vh;" class="indexSupermapClass" :mapDiv="'forestMap'"
-                :dynamicPlotting="false"
-                :mapSite="{doubleClickZoom:false}" :codes="['9fa5']" :isSideBySide="false"
-                @showEventDialog="showEventDialog" ></supermap>
+      <supermap ref="supermap" style="width: 100%;height: 100vh;" ></supermap>
       <!-- 右侧 -->
       <div class="rightbar rightbar-index" ref="right">
         <div class="right-item1">
@@ -452,7 +449,7 @@
   import {
     getNearEvent
   } from '@/api/event'
-  import supermap from '@/components/supermap' //超图
+  import supermap from '@/components/supermap-2.5d' //超图
   // import supermapNotProcessed from '@/components/supermap' //超图
   // import supermapProcessed from '@/components/supermap' //超图
   import vheader from '@/components/v-header.vue' //一体化共用头部
@@ -979,15 +976,13 @@
               that.markersList.push(markersMap)
             }
             setTimeout(() => {
-              that.$refs.supermap.clearM(false)
-              that.$refs.supermap.clearM(true)
+              that.$refs.supermap.clearM()
               that.$refs.supermap.setMarkers(that.markersList)
-            }, 2000)
+            }, 3000)
           } else {
             setTimeout(() => {
-              that.$refs.supermap.clearM(false)
-              that.$refs.supermap.clearM(true)
-            }, 2000)
+              that.$refs.supermap.clearM()
+            }, 3000)
           }
         })
       },
@@ -1126,8 +1121,9 @@
         markersMap.bindPopupHtml += '</div>'
         that.markersList.push(markersMap)
         setTimeout(() => {
+          that.$refs.supermap.clearM()
           that.$refs.supermap.setMarkers(that.markersList)
-        }, 1000)
+        }, 3000)
       },
       getExposureStage(day, loading) {
         let that = this

+ 15 - 22
src/views/monitor.vue

@@ -91,8 +91,7 @@
         </div>
       </div>
       <!-- 地图 -->
-      <supermap ref="supermap" style="width: 100%;height: 100vh;" :mapDiv="'forestMap'" class="indexSupermapClass"
-                :mapSite="{doubleClickZoom:false}" :codes="['9fa5']" :isSideBySide="false" @preview="preview">
+      <supermap ref="supermap" style="width: 100%;height: 100vh;"  @preview="preview">
       </supermap>
       <!-- 右侧 -->
       <div class="rightbar" :class="indentright" ref="right">
@@ -172,7 +171,7 @@ import {
   getRegionalFlag
 } from '@/api/monitor'
 import { treeselect } from '@/api/system/dept'
-import supermap from '@/components/supermap' //超图
+import supermap from '@/components/supermap-2.5d' //超图
 import vheader from '@/components/v-header.vue' //一体化共用头部
 import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
 import eventLocation from '@/components/eventLocation.vue' //事件定位弹窗
@@ -422,15 +421,13 @@ export default {
             markersList.push(markersMap);
           }
           setTimeout(() => {
-            that.$refs.supermap.clearM(false);
-            that.$refs.supermap.clearM(true);
+            that.$refs.supermap.clearM();
             that.$refs.supermap.setMarkers(markersList);
-          }, 2000);
+          }, 3000);
         } else {
           setTimeout(() => {
-            that.$refs.supermap.clearM(false);
-            that.$refs.supermap.clearM(true);
-          }, 2000);
+            that.$refs.supermap.clearM();
+          }, 3000);
         }
       })
         .catch(function (error) {
@@ -486,15 +483,13 @@ export default {
             markersList.push(markersMap);
           }
           setTimeout(() => {
-            that.$refs.supermap.clearM(false);
-            that.$refs.supermap.clearM(true);
-            that.$refs.supermap.setMarkersA(markersList);
-          }, 2000);
+            that.$refs.supermap.clearM();
+            that.$refs.supermap.setMarkers_cgq(markersList);
+          }, 3000);
         } else {
           setTimeout(() => {
-            that.$refs.supermap.clearM(false);
-            that.$refs.supermap.clearM(true);
-          }, 2000);
+            that.$refs.supermap.clearM();
+          }, 3000);
         }
       })
         .catch(function (error) {
@@ -699,9 +694,8 @@ export default {
             // longitude: "125.3333"
           }
           setTimeout(() => {
-            that.$refs.supermap.clearM(true)
-            that.$refs.supermap.clearM(false)
-            that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
+            that.$refs.supermap.clearM()
+            that.$refs.supermap.setMarkers(this.cameraMarkersList)
           }, 1000)
         }
       })
@@ -795,9 +789,8 @@ export default {
             // longitude: "125.3333"
           }
           setTimeout(() => {
-            that.$refs.supermap.clearM(true)
-            that.$refs.supermap.clearM(false)
-            that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
+            that.$refs.supermap.clearM()
+            that.$refs.supermap.setMarkers(this.cameraMarkersList)
           }, 1000)
         }
       })