JX.LI преди 2 години
родител
ревизия
ba12b086f6
променени са 6 файла, в които са добавени 267 реда и са изтрити 36 реда
  1. 9 1
      public/index.html
  2. 5 1
      src/assets/styles/base.scss
  3. 222 0
      src/components/supermap-2.5d.vue
  4. 7 5
      src/views/datacenter.vue
  5. 7 8
      src/views/forest.vue
  6. 17 21
      src/views/monitor.vue

+ 9 - 1
public/index.html

@@ -6,6 +6,7 @@
   <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 +268,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 +287,13 @@
 <!--  <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>

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

@@ -1383,13 +1383,17 @@ 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 {

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

@@ -0,0 +1,222 @@
+<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,
+        /*************************原地图属性*********************/
+        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);
+
+        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);
+      },
+      /**
+       *鼠标右击事件是原来的点击
+       */
+      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>

+ 7 - 5
src/views/datacenter.vue

@@ -42,8 +42,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>-->
       <!-- 右侧 -->
@@ -91,7 +90,7 @@ import {
   getResourcePointByDeptId, getPointByDeptId
 } 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' //事件定位弹窗
@@ -372,6 +371,7 @@ export default {
               icon: 'marker',
               bindPopupHtml: '',
               click: '',
+              name: i,
               keepBindPopup: false,
               isAggregation: false
             }
@@ -748,6 +748,7 @@ export default {
               lng: 124.59,
               lat: 43.02,
               icon: 'marker',
+              name: i,
               bindPopupHtml: '',
               click: '',
               keepBindPopup: false,
@@ -931,7 +932,7 @@ export default {
           }
         }
         this.dataChat()
-        that.$refs.supermap.clearM(false)
+        that.$refs.supermap.clearM()
         that.$refs.supermap.setMarkers(that.markersList)
       })
     },
@@ -949,6 +950,7 @@ export default {
               icon: 'marker',
               bindPopupHtml: '',
               click: '',
+              name: i,
               keepBindPopup: false,
               isAggregation: false
             }
@@ -1167,7 +1169,7 @@ export default {
             // that.markersList.push(markersMap)
           }
         }
-        that.$refs.supermap.clearM(false)
+        that.$refs.supermap.clearM()
         that.$refs.supermap.setMarkers(that.markersList)
       })
     }

+ 7 - 8
src/views/forest.vue

@@ -105,9 +105,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">
@@ -440,7 +438,7 @@ import {
 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' //一体化共用头部
@@ -908,6 +906,7 @@ export default {
               bindPopupHtml: '',
               click: '',
               parameter: '',
+              name: i,
               keepBindPopup: false,
               isAggregation: false
             }
@@ -974,14 +973,12 @@ export default {
             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)
         } else {
           setTimeout(() => {
-            that.$refs.supermap.clearM(false)
-            that.$refs.supermap.clearM(true)
+            that.$refs.supermap.clearM()
           }, 2000)
         }
       })
@@ -1074,6 +1071,7 @@ export default {
         bindPopupHtml: '',
         click: '',
         parameter: '',
+        name:i,
         keepBindPopup: false,
         isAggregation: false
       }
@@ -1136,6 +1134,7 @@ export default {
       markersMap.bindPopupHtml += '</div>'
       that.markersList.push(markersMap)
       setTimeout(() => {
+        that.$refs.supermap.clearM()
         that.$refs.supermap.setMarkers(that.markersList)
       }, 1000)
     },

+ 17 - 21
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, getCamerasByDeptId
 } 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' //事件定位弹窗
@@ -413,8 +412,9 @@ export default {
               lat: 43.02,
               icon: "marker",
               bindPopupHtml: "",
-              click: "",
+              click: i,
               parameter: "",
+              name: "",
               keepBindPopup: false,
               isAggregation: false,
             };
@@ -425,14 +425,12 @@ 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);
         } else {
           setTimeout(() => {
-            that.$refs.supermap.clearM(false);
-            that.$refs.supermap.clearM(true);
+            that.$refs.supermap.clearM();
           }, 2000);
         }
       })
@@ -464,6 +462,7 @@ export default {
               bindPopupHtml: "",
               click: "",
               parameter: "",
+              name: i,
               keepBindPopup: false,
               isAggregation: false,
             };
@@ -489,14 +488,12 @@ export default {
             markersList.push(markersMap);
           }
           setTimeout(() => {
-            that.$refs.supermap.clearM(false);
-            that.$refs.supermap.clearM(true);
-            that.$refs.supermap.setMarkersA(markersList);
+            that.$refs.supermap.clearM();
+            that.$refs.supermap.setMarkers(markersList);
           }, 2000);
         } else {
           setTimeout(() => {
-            that.$refs.supermap.clearM(false);
-            that.$refs.supermap.clearM(true);
+            that.$refs.supermap.clearM();
           }, 2000);
         }
       })
@@ -633,6 +630,7 @@ export default {
               bindPopupHtml: '',
               click: 'preview',
               parameter: '',
+              name: i,
               keepBindPopup: false,
               isAggregation: false
             }
@@ -701,9 +699,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)
         }
       })
@@ -730,6 +727,7 @@ export default {
               bindPopupHtml: '',
               click: 'preview',
               parameter: '',
+              name: i,
               keepBindPopup: false,
               isAggregation: false
             }
@@ -780,13 +778,11 @@ export default {
             this.cameraMarkersList.push(markersMap)
           }
           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)
         } else {
-          that.$refs.supermap.clearM(true)
-          that.$refs.supermap.clearM(false)
+          that.$refs.supermap.clearM()
         }
       })
     },