瀏覽代碼

新增地图切换和船舶面板回调

sbj 1 年之前
父節點
當前提交
3210338ca1
共有 2 個文件被更改,包括 22 次插入4 次删除
  1. 13 3
      src/utils/map/ArcgisUtil.js
  2. 9 1
      src/views/map/Index.vue

+ 13 - 3
src/utils/map/ArcgisUtil.js

@@ -3,7 +3,7 @@ import CityGis from "@/utils/map/CityGis.Bridge";
 import { ElMessage } from 'element-plus'
 import 'element-plus/es/components/message/style/css'
 import {onLocationBoat} from '@/utils/map/Boat'
-import {setCenter} from "@/utils/map/Common";
+import bus from '@/utils/bus';
 
 let bridge
 let calculateFinish = false
@@ -11,11 +11,13 @@ let drawGeometry
 let showBoat = false
 let mapExtent
 let mapScale
+let clickGraphic
 
 export function initBridge(){
     bridge = new CityGis.Bridge({
         id: "i_map",
-        url: "http://10.83.68.108:8090/mapVue/#/map", //政务网
+        // url: "http://10.83.68.108:8090/mapVue/#/map", //政务网
+        url: "http://10.83.68.108:8090/mapWidgetVue/#/map", //政务网
         // url: "http://localhost:8081/#/map", //政务网
         onReady: function(){
             console.log("地图创建完成");
@@ -34,6 +36,11 @@ export function initBridge(){
                     onLocationBoat()
                 }
                 break;
+            case "BoatClickObject":
+                clickGraphic = arg.data.graphic
+                console.log('mmsi:',clickGraphic.attributes.mmsi)
+                bus.emit('ueRec_BoatClick',{'mmsi':clickGraphic.attributes.mmsi})
+                break
             default:
                 console.log(JSON.stringify(arg.data, null, 4))
         }
@@ -50,7 +57,10 @@ export function getMapScale() {
     return mapScale
 }
 
-/*切换底图*/
+/*切换底图
+* 基础地图:baseMap
+* 遥感地图:airMap
+*/
 export function changeMap(type){
     let params = {
         "ActionName": "ChangeBaseMap",

+ 9 - 1
src/views/map/Index.vue

@@ -23,12 +23,14 @@
             <button @click="test('水下地形')">水下地形</button>
             <button @click="test('白膜')">白膜</button>
             <button @click="test('关闭全部图层')">关闭全部图层</button>
+            <button @click="test('基础地图')">基础地图</button>
+            <button @click="test('遥感地图')">遥感地图</button>
         </div>
     </div>
 </template>
 
 <script>
-    import {initBridge,fullExtent,calculation,clearMap,setCamera,addLayer} from "@/utils/map/ArcgisUtil"
+    import {initBridge,fullExtent,calculation,clearMap,changeMap} from "@/utils/map/ArcgisUtil"
     import {pjylLine, djldLine,djldLineAll,onePjylPortLocation,oneDjldPortLocation} from '@/utils/map/WaterPassenger'
     import {setBoat, setBoatPath, onLocationBoat, locationBoat} from '@/utils/map/Boat'
     import {setCenter} from '@/utils/map/Common'
@@ -149,6 +151,12 @@
                     case '关闭全部图层':
                         closeAllLayer()
                         break
+                    case '基础地图':
+                        changeMap('baseMap')
+                        break
+                    case '遥感地图':
+                        changeMap('airMap')
+                        break
                     default:
                 }
             },