|
@@ -9,347 +9,35 @@
|
|
|
<button @click="test('浦江游览码头')">浦江游览码头</button>
|
|
|
<button @click="test('浦江游览航线')">浦江游览航线</button>
|
|
|
<button @click="test('对江轮渡船舶')">对江轮渡船舶</button>
|
|
|
+ <button @click="test('船舶撒点')">船舶撒点</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import CityGis from "@/utils/CityGis.Bridge"
|
|
|
+ import {initBridge,fullExtent,calculation,clearMap} from "@/utils/map/ArcgisUtil"
|
|
|
+ import {pjylLine, djldShip} from '@/utils/map/WaterPassenger'
|
|
|
+ import {setShip, setShipPath, onLocationBoat} from '@/utils/map/Boat'
|
|
|
import {GetPjylLinePaths} from "@/apis/ssky";
|
|
|
import {GetHpjShip} from "@/apis/ship";
|
|
|
|
|
|
- let bridge;
|
|
|
-
|
|
|
export default {
|
|
|
name: "MapHome",
|
|
|
data(){
|
|
|
return{
|
|
|
mapExtent:'',
|
|
|
calculateFinish: false,
|
|
|
+ showBoat: false,
|
|
|
}
|
|
|
},
|
|
|
mounted(){
|
|
|
- // 初始化组件
|
|
|
- // this.initMap(true,true,true,true,false)
|
|
|
//加载地图控件
|
|
|
- bridge = new CityGis.Bridge({
|
|
|
- id: "i_map",
|
|
|
- url: "http://10.83.68.108:8090/mapVue/#/map", //政务网
|
|
|
- // url: "http://localhost:8081/#/map", //政务网
|
|
|
- onReady: function(){
|
|
|
- // console.log("地图创建完成");
|
|
|
- }
|
|
|
- });
|
|
|
- bridge.addEventListener((arg) => {
|
|
|
- switch (arg.action) {
|
|
|
- case "MapIsReady":
|
|
|
- break;
|
|
|
- case "MapExtentChanged":
|
|
|
- console.log(arg)
|
|
|
- // 地图标记
|
|
|
- this.mapExtent = arg.data.result
|
|
|
- break;
|
|
|
- default:
|
|
|
- console.log(JSON.stringify(arg.data, null, 4))
|
|
|
- }
|
|
|
- });
|
|
|
+ initBridge();
|
|
|
},
|
|
|
methods:{
|
|
|
- /*切换底图*/
|
|
|
- changeMap(type){
|
|
|
- let params = {
|
|
|
- "ActionName": "ChangeBaseMap",
|
|
|
- "Parameters": {
|
|
|
- "title": type,
|
|
|
- "opacity": 1
|
|
|
- }
|
|
|
- };
|
|
|
- bridge.Invoke(params);
|
|
|
- },
|
|
|
-
|
|
|
- /* 定位船舶 */
|
|
|
- /*参数格式:
|
|
|
- [
|
|
|
- {
|
|
|
- "mmsi": "413266820",
|
|
|
- "shipNameCn": "苏州号",
|
|
|
- "shipTypeName": "客船",
|
|
|
- "direction": 245,
|
|
|
- "velocity": 0,
|
|
|
- "shipBreadth": 22,
|
|
|
- "shipLength": 154,
|
|
|
- "mapx": 2755.61767,
|
|
|
- "mapy": 1521.00687
|
|
|
- }
|
|
|
- ]*/
|
|
|
- addBoats(boats){
|
|
|
- let params = {
|
|
|
- "ActionName": "AddBoat",
|
|
|
- "Parameters": {
|
|
|
- "scale": 5000,
|
|
|
- "is_goto": boats.goto,
|
|
|
- "attributes": boats.data
|
|
|
- }
|
|
|
- };
|
|
|
- bridge.Invoke(params);
|
|
|
- },
|
|
|
-
|
|
|
- /* 绘制船舶轨迹 */
|
|
|
- /*参数格式:
|
|
|
- [
|
|
|
- {
|
|
|
- "mapx": 2755.61767,
|
|
|
- "mapy": 1521.00687,
|
|
|
- "time": "2021/1/18 9:40:53"
|
|
|
- },
|
|
|
- {
|
|
|
- "mapx": 2705.61767,
|
|
|
- "mapy": 1481.00687,
|
|
|
- "time": "2021/1/18 10:07:19"
|
|
|
- }
|
|
|
- ]*/
|
|
|
- addBoatHistory(datas){
|
|
|
- let params = {
|
|
|
- "ActionName": "AddBoatHistory",
|
|
|
- "Parameters": {
|
|
|
- "data":datas
|
|
|
- }
|
|
|
- };
|
|
|
- console.log("addBoatHistory参数:",params)
|
|
|
- bridge.Invoke(params);
|
|
|
- },
|
|
|
-
|
|
|
- /*查询服务*/
|
|
|
- /*参数格式:
|
|
|
- {
|
|
|
- "ActionName": "LayerQuery",
|
|
|
- "Parameters": {
|
|
|
- "title": "ghjg_cxall",
|
|
|
- "layerid": "0",
|
|
|
- "where": "视频点名称='华江石油码头'",
|
|
|
- "outFields": [
|
|
|
- "*"
|
|
|
- ],
|
|
|
- "returnGeometry": true,
|
|
|
- "is_draw": true,
|
|
|
- "symbol": {
|
|
|
- "type": "simple-marker",
|
|
|
- "style": "circle",
|
|
|
- "color": [
|
|
|
- 255,
|
|
|
- 0,
|
|
|
- 0
|
|
|
- ],
|
|
|
- "size": 10
|
|
|
- }
|
|
|
- }
|
|
|
- }*/
|
|
|
- layerQuery(paramData){
|
|
|
- let params = {
|
|
|
- "ActionName": "LayerQuery",
|
|
|
- "Parameters": {
|
|
|
- "title": paramData.title,
|
|
|
- "layerid": paramData.layerId,
|
|
|
- "where": paramData.where,
|
|
|
- "outFields": [
|
|
|
- "*"
|
|
|
- ],
|
|
|
- "returnGeometry": true,
|
|
|
- "is_draw": paramData.is_draw == null?true:paramData.is_draw,
|
|
|
- "is_clear": paramData.is_clear == null?true:paramData.is_clear,
|
|
|
- "symbol": paramData.symbol
|
|
|
- }
|
|
|
- };
|
|
|
- console.log("params",params)
|
|
|
- bridge.Invoke(params);
|
|
|
- bridge.addEventListener((arg) => {
|
|
|
- if(arg.action == "ReturnDataList"){
|
|
|
- console.log(arg)
|
|
|
- if(arg.status == false){
|
|
|
- this.$message({
|
|
|
- showClose: true,
|
|
|
- message: "未查询到结果!",
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- // 回调函数
|
|
|
- if(paramData.callback != null){
|
|
|
- // this.$emit(paramData.callback, arg.data);
|
|
|
- this.pjylPortHandle(arg.data)
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- /*全景*/
|
|
|
- fullExtent(){
|
|
|
- let params = {
|
|
|
- "ActionName": "FullExtent"
|
|
|
- };
|
|
|
- bridge.Invoke(params);
|
|
|
- },
|
|
|
-
|
|
|
- /*测距/测面积*/
|
|
|
- /*测距:distance 测面积:area*/
|
|
|
- calculation(type){
|
|
|
- let g_type
|
|
|
- this.calculateFinish = false
|
|
|
- if(type == "distance"){
|
|
|
- g_type = "polyline"
|
|
|
- }
|
|
|
- if(type == "area"){
|
|
|
- g_type = "polygon"
|
|
|
- }
|
|
|
-
|
|
|
- let params = {
|
|
|
- "ActionName": "Calculation",
|
|
|
- "Parameters": {
|
|
|
- "type": g_type,
|
|
|
- "is_show": false
|
|
|
- }
|
|
|
- };
|
|
|
- bridge.Invoke(params);
|
|
|
- bridge.addEventListener((arg) => {
|
|
|
- if(arg.action == "Calculation" && this.calculateFinish == false){
|
|
|
- this.calculateFinish = true
|
|
|
- // this.$message({
|
|
|
- // showClose: true,
|
|
|
- // message: "测量结果:" + arg.data.result,
|
|
|
- // type:"success"
|
|
|
- // })
|
|
|
- alert("测量结果:" + arg.data.result)
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- /*图层开关*/
|
|
|
- layerControl(data){
|
|
|
- if(data == "" || data == null){
|
|
|
- return
|
|
|
- }
|
|
|
- this.mapClickLayers = []
|
|
|
- if(data.visible == true){
|
|
|
- // this.mapClickLayers = data.sublayers
|
|
|
- let sublayers = data.sublayers.split(",")
|
|
|
- for(let i=0;i<sublayers.length;i++){
|
|
|
- this.mapClickLayers.push(sublayers[i])
|
|
|
- }
|
|
|
- }
|
|
|
- let params = {
|
|
|
- "ActionName": "LayerControl",
|
|
|
- "Parameters": {
|
|
|
- "title": data.title,
|
|
|
- "visible": data.visible,
|
|
|
- "opacity": data.opacity,
|
|
|
- "sublayers": data.sublayers // 倒序
|
|
|
- }
|
|
|
- };
|
|
|
- bridge.Invoke(params);
|
|
|
- },
|
|
|
-
|
|
|
- /*绘制点线面*/
|
|
|
- /*参数说明:
|
|
|
- point 点;
|
|
|
- polyline 线;
|
|
|
- polygon 面;*/
|
|
|
- draw(type){
|
|
|
- let params = {
|
|
|
- "ActionName": "Draw",
|
|
|
- "Parameters": {
|
|
|
- "type": type
|
|
|
- }
|
|
|
- };
|
|
|
- bridge.Invoke(params);
|
|
|
- bridge.addEventListener((arg) => {
|
|
|
- if(arg.action == "DrawComplete"){
|
|
|
- // 地图标记
|
|
|
- if(this.componentsStatus.showMapMark){
|
|
|
- if(!arg.data.geometry){
|
|
|
- return
|
|
|
- }
|
|
|
- let data = arg.data.geometry
|
|
|
- let path = ''
|
|
|
- if(type == "point"){
|
|
|
- // let point = {"x":data.x,"y":data.y}
|
|
|
- // path.push(point)
|
|
|
- // let x = Number.valueOf(data.x)
|
|
|
- // let y = Number.valueOf(data.y)
|
|
|
- // path = x.toFixed(2)+":"+y.toFixed(2)
|
|
|
- path = data.x.toFixed(2)+":"+data.y.toFixed(2)
|
|
|
- }else if(type == "polyline"){
|
|
|
- let paths = data.paths[0][0]
|
|
|
- for(let i in paths){
|
|
|
- // let point = {"x":paths[i][0],"y":paths[i][1]}
|
|
|
- // path.push(point)
|
|
|
- // let x = Number.valueOf(paths[i][0])
|
|
|
- // let y = Number.valueOf(paths[i][1])
|
|
|
- // path = x.toFixed(2)+":"+y.toFixed(2)+"/"
|
|
|
- path = paths[i][0]+":"+paths[i][1]+"/"
|
|
|
- }
|
|
|
- path = path.substring(0,path.length-1)
|
|
|
- }else if(type == "polygon"){
|
|
|
- let rings = data.rings[0][0]
|
|
|
- for(let i in rings){
|
|
|
- // let point = {"x":rings[i][0],"y":rings[i][1]}
|
|
|
- // path.push(point)
|
|
|
- // let x = Number.valueOf(rings[i][0])
|
|
|
- // let y = Number.valueOf(rings[i][1])
|
|
|
- // path = x.toFixed(2)+":"+y.toFixed(2)+"/"
|
|
|
- path = rings[i][0]+":"+rings[i][1]+"/"
|
|
|
- }
|
|
|
- path = path.substring(0,path.length-1)
|
|
|
- }
|
|
|
- this.$refs.divMark.setPath(path)
|
|
|
- }
|
|
|
- // 区域统计
|
|
|
- if(this.componentsStatus.showMapStatistics){
|
|
|
- if(!arg.data.geometry){
|
|
|
- return
|
|
|
- }
|
|
|
- this.$refs.divStatistics.setGeometry(arg.data.geometry)
|
|
|
- }
|
|
|
- return this.drawGeometry = arg.data.geometry
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- // 标记图形
|
|
|
- addGraphic(res){
|
|
|
- console.log("addGraphic:",res)
|
|
|
- let params = {
|
|
|
- "ActionName": "AddGraphic",
|
|
|
- "Parameters": {
|
|
|
- "type": res.type,
|
|
|
- "edit": res.edit,
|
|
|
- "temp": res.temp,
|
|
|
- "clear": res.clear,
|
|
|
- "goto": res.goto,
|
|
|
- "data": res.data,
|
|
|
- "attributes": res.attributes,
|
|
|
- "symbol": res.symbol,
|
|
|
- "title": res.title
|
|
|
- }
|
|
|
- };
|
|
|
- bridge.Invoke(params);
|
|
|
- },
|
|
|
-
|
|
|
- /*清空地图*/
|
|
|
- clearMap(){
|
|
|
- let params = {
|
|
|
- "ActionName": "ClearMap",
|
|
|
- "Parameters": {
|
|
|
- "is_draw": true,
|
|
|
- "is_search": true,
|
|
|
- "is_position": true
|
|
|
- }
|
|
|
- };
|
|
|
- bridge.Invoke(params);
|
|
|
- },
|
|
|
- getDrawGeometry(){
|
|
|
- return this.drawGeometry
|
|
|
- },
|
|
|
-
|
|
|
+ fullExtent(){fullExtent()},
|
|
|
+ calculation(){calculation},
|
|
|
+ clearMap(){clearMap},
|
|
|
// 测试方法
|
|
|
test(value){
|
|
|
switch (value) {
|
|
@@ -361,149 +49,28 @@
|
|
|
})
|
|
|
break
|
|
|
case '浦江游览航线':
|
|
|
- this.pjylLine()
|
|
|
+ pjylLine()
|
|
|
break
|
|
|
case '对江轮渡船舶':
|
|
|
- this.djldShip()
|
|
|
+ djldShip()
|
|
|
break
|
|
|
+ case '船舶撒点':
|
|
|
+ setShip()
|
|
|
+ break
|
|
|
+ case '船舶轨迹':
|
|
|
+ setShipPath()
|
|
|
+ break
|
|
|
+/* case '开始':
|
|
|
+ startPlayPath()
|
|
|
+ break
|
|
|
+ case '暂停':
|
|
|
+ pasePlayPath()
|
|
|
+ break
|
|
|
+ case '结束':
|
|
|
+ endPlayPath()
|
|
|
+ break*/
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
- // 浦江游览
|
|
|
- // 浦江游览码头定位
|
|
|
- pjylPortLocation(data){
|
|
|
- // 码头定位
|
|
|
- let param = {
|
|
|
- title: data.portName,
|
|
|
- type: 'point',
|
|
|
- data:[data.mapx,data.mapy,20],
|
|
|
- edit: false,
|
|
|
- temp: true,
|
|
|
- clear: false,
|
|
|
- goto: true,
|
|
|
- attributes: null,
|
|
|
- symbol:{
|
|
|
- "type": "picture-marker",
|
|
|
- "url": "ssky/bgImgBlue.png",
|
|
|
- "width":"300px",
|
|
|
- "height":"10px"
|
|
|
- }
|
|
|
- }
|
|
|
- this.addGraphic(param)
|
|
|
- // 绘制陆域围栏
|
|
|
- this.layerQuery({
|
|
|
- title: "waterPassenger",
|
|
|
- layerId: "4",
|
|
|
- where: "码头名称='" + data.portName +"'",
|
|
|
- symbol: null,
|
|
|
- is_draw: true,
|
|
|
- is_clear: false,
|
|
|
- callback: "pjylPortHandle"
|
|
|
- })
|
|
|
- },
|
|
|
- // 浦江游览码头查询回调
|
|
|
- pjylPortHandle(data) {
|
|
|
- debugger
|
|
|
- let params = {
|
|
|
- title: null,
|
|
|
- type: 'line-3d',
|
|
|
- data: data[0].geometry.rings[0],
|
|
|
- edit: false,
|
|
|
- temp: true,
|
|
|
- clear: false,
|
|
|
- goto: false,
|
|
|
- attributes: null,
|
|
|
- // symbol: {
|
|
|
- // type: "line-3d",
|
|
|
- // symbolLayers: [{
|
|
|
- // type: "path",
|
|
|
- // profile: "quad",
|
|
|
- // material: {
|
|
|
- // color: [255, 152, 0, 0.8]
|
|
|
- // },
|
|
|
- // cap: "round",
|
|
|
- // join: "miter",
|
|
|
- // width: 5,
|
|
|
- // height: 100,
|
|
|
- // anchor: "bottom",
|
|
|
- // profileRotation: "heading"
|
|
|
- // }]
|
|
|
- // }
|
|
|
- }
|
|
|
- this.addGraphic(params)
|
|
|
- },
|
|
|
-
|
|
|
- // 浦江游览航线
|
|
|
- pjylLine(){
|
|
|
- GetPjylLinePaths().then(res=>{
|
|
|
- for (let i=0;i<res.data.length;i++){
|
|
|
- let lineData = res.data[i]
|
|
|
- let linePoints = lineData.linePoints
|
|
|
- let points = []
|
|
|
- let first = []
|
|
|
- for(let j=0;j<linePoints.length;j++){
|
|
|
- let point = [Number(linePoints[j].x),Number(linePoints[j].y)]
|
|
|
- if(j==0){
|
|
|
- first = [Number(linePoints[j].x),Number(linePoints[j].y)]
|
|
|
- }
|
|
|
- points.push(point)
|
|
|
- }
|
|
|
- points.push(first)
|
|
|
-
|
|
|
- let params = {
|
|
|
- // title: res.data[i].get('lineName'),
|
|
|
- type: 'polygon',
|
|
|
- data: points,
|
|
|
- edit: false,
|
|
|
- temp: true,
|
|
|
- clear: false,
|
|
|
- goto: true,
|
|
|
- attributes: null,
|
|
|
- symbol: {
|
|
|
- type: "simple-fill",
|
|
|
- color: [50, 205, 50, 0.5],
|
|
|
- //style: "cross",
|
|
|
- outline: {
|
|
|
- color: [255, 0, 0],
|
|
|
- width: 2
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- console.log(params)
|
|
|
- // 绘制到地图上
|
|
|
- this.addGraphic(params)
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- // 对江轮渡船舶撒点
|
|
|
- djldShip(){
|
|
|
- GetHpjShip().then(res=>{
|
|
|
- debugger
|
|
|
- let data = res.Result.data
|
|
|
- let boats = {
|
|
|
- "goto": false,
|
|
|
- "data": []
|
|
|
- }
|
|
|
- for(let i=0;i<data.length;i++){
|
|
|
- if(data[i].LINETYPE == 'djld'){
|
|
|
- let boat = {
|
|
|
- "mmsi": data[i].DEVICEID,
|
|
|
- "shipNameCn": data[i].BOATNAME,
|
|
|
- "shipTypeName": data[i].SHIPTYPENAME,
|
|
|
- "direction": data[i].DIRECTION,
|
|
|
- "velocity": data[i].VELOCITY,
|
|
|
- "shipBreadth": data[i].SHIPBREADTH,
|
|
|
- "shipLength": data[i].SHIPLENGTH,
|
|
|
- "mapx": data[i].MAPX,
|
|
|
- "mapy": data[i].MAPY
|
|
|
- }
|
|
|
- boats.data.push(boat)
|
|
|
- }
|
|
|
- }
|
|
|
- this.addBoats(boats)
|
|
|
- })
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
</script>
|