|
@@ -12,33 +12,39 @@ let boatInterval;
|
|
|
let showBoat = false;
|
|
|
|
|
|
// 船舶定位
|
|
|
-export function locationBoat(mmsi){
|
|
|
- GetHpjShip().then(res=>{
|
|
|
- let data = res.Result.data
|
|
|
- let boats = {
|
|
|
- "scale": 2000,
|
|
|
- "goto": true,
|
|
|
- "data": []
|
|
|
- }
|
|
|
- for(let i=0;i<data.length;i++){
|
|
|
- if(data[i].DEVICEID == mmsi){
|
|
|
- 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
|
|
|
+export function locationBoat(mmsi,isShow){
|
|
|
+ if(isShow){
|
|
|
+ GetHpjShip().then(res=>{
|
|
|
+ let data = res.Result.data
|
|
|
+ let boats = {
|
|
|
+ "scale": 2000,
|
|
|
+ "goto": true,
|
|
|
+ "data": []
|
|
|
+ }
|
|
|
+ for(let i=0;i<data.length;i++){
|
|
|
+ if(data[i].DEVICEID == mmsi){
|
|
|
+ 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)
|
|
|
}
|
|
|
- boats.data.push(boat)
|
|
|
}
|
|
|
+ // console.log('定位:'+JSON.stringify(boats))
|
|
|
+ addBoats(boats)
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ if (!showBoat){
|
|
|
+ clearMap({is_draw: false, is_search:false, layers: ['boatLayer']})
|
|
|
}
|
|
|
- // console.log('定位:'+JSON.stringify(boats))
|
|
|
- addBoats(boats)
|
|
|
- })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 船舶撒点
|