| | |
| | | import calculate from '@/utils/map/calculate'; |
| | | import Layer from '@/utils/map/3dLayer'; |
| | | import sector from '@/utils/map/sector'; |
| | | import map from '@/utils/map/index_old'; |
| | | import { map } from '@/utils/map/index_old'; |
| | | import util from "@/utils/map/util"; |
| | | import car_driving from '@/assets/mipmap/car_driving.png'; |
| | | import boat_driving from '@/assets/mipmap/boat_driving.png'; |
| | | |
| | | function MapAnimation() { |
| | | // 非连续坐标点最大距离(米) |
| | |
| | | var url; |
| | | switch (this.vehicleType) { |
| | | case 0: |
| | | url = './asset/mipmap/car_driving.png'; |
| | | url = car_driving; |
| | | break; |
| | | case 1: |
| | | url = './asset/mipmap/car_driving.png'; |
| | | url = car_driving; |
| | | break; |
| | | case 2: |
| | | url = './asset/mipmap/boat_driving.png'; |
| | | url = boat_driving; |
| | | break; |
| | | default: |
| | | url = './asset/mipmap/car_driving.png'; |
| | | url = car_driving; |
| | | break; |
| | | } |
| | | // var url = "./asset/mipmap/car_offline.png"; |
| | |
| | | // break; |
| | | // } |
| | | |
| | | // eslint-disable-next-line no-undef |
| | | var icon = new AMap.Icon({ |
| | | // eslint-disable-next-line no-undef |
| | | size: new AMap.Size(60, 30), |
| | | // eslint-disable-next-line no-undef |
| | | imageSize: new AMap.Size(54, 21), |
| | | image: url |
| | | // imageOffset: new AMap.Pixel(-16, -16) // 相对于基点的偏移位置 |
| | | }); |
| | | |
| | | // eslint-disable-next-line no-undef |
| | | var car = new AMap.Marker({ |
| | | icon: icon, |
| | | position: lnglat, // 基点位置 |
| | | // eslint-disable-next-line no-undef |
| | | offset: new AMap.Pixel(-20, -15) // 相对于基点的偏移位置 |
| | | }); |
| | | |
| | | MapUtil._map.add(car); |
| | | map.add(car); |
| | | this.moveViews['car'] = car; |
| | | |
| | | // 时间 |
| | | // eslint-disable-next-line no-undef |
| | | var text = new AMap.Text({ |
| | | text: time, |
| | | position: lnglat, |
| | | // eslint-disable-next-line no-undef |
| | | offset: new AMap.Pixel(5, 20), |
| | | style: { |
| | | 'font-size': '13px', |
| | |
| | | padding: '0 4px' |
| | | } |
| | | }); |
| | | MapUtil._map.add(text); |
| | | map.add(text); |
| | | this.moveViews['text'] = text; |
| | | } else { |
| | | MapUtil.setCenter(lnglat); |
| | | util.setCenter(lnglat); |
| | | this.moveViews['car'].setPosition(lnglat); |
| | | this.moveViews['text'].setPosition(lnglat); |
| | | this.moveViews['text'].setText(time); |