edit
This commit is contained in:
@ -135,7 +135,7 @@ export class OrderManagementVehicleDetailComponent implements OnInit {
|
|||||||
let list :any[] = [];
|
let list :any[] = [];
|
||||||
points?.forEach((item: any) => {
|
points?.forEach((item: any) => {
|
||||||
list.push({
|
list.push({
|
||||||
name: item.hgt,
|
name: `${item.spd}km/h`,
|
||||||
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))]
|
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -24,7 +24,7 @@ export class AccountDetailComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {}
|
ngOnInit(): void {}
|
||||||
createAccount(item: any, type: '1' | '2') {
|
createAccount(item: any, type: '1' | '2') {
|
||||||
if (item.pfAccount) {
|
if ((type === '1' && item.paAccount) || (type === '2' && item.pfAccount)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const params = {
|
const params = {
|
||||||
|
|||||||
@ -30,6 +30,42 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
|
|||||||
@Output()
|
@Output()
|
||||||
clcikPointEvent = new EventEmitter<any>();
|
clcikPointEvent = new EventEmitter<any>();
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
pois: any = [
|
||||||
|
{
|
||||||
|
id: 'A',
|
||||||
|
position: [116.020764, 39.904989],
|
||||||
|
markerLabel: 'X_A',
|
||||||
|
infoWinContent: 'Hello! A',
|
||||||
|
listDesc: '起',
|
||||||
|
color: '#F5222D'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'B',
|
||||||
|
position: [116.405285, 39.904989],
|
||||||
|
markerLabel: 'X_B',
|
||||||
|
infoWinContent: 'Hello! B',
|
||||||
|
listDesc: '终',
|
||||||
|
color: '#1890ff'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'C',
|
||||||
|
position: [116.789806, 39.904989],
|
||||||
|
markerLabel: 'X_C',
|
||||||
|
infoWinContent: 'Hello! C',
|
||||||
|
listDesc: '卸',
|
||||||
|
color: '#1890ff'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'C',
|
||||||
|
position: [116.789806, 39.904989],
|
||||||
|
markerLabel: 'X_C',
|
||||||
|
infoWinContent: 'Hello! C',
|
||||||
|
listDesc: '装',
|
||||||
|
color: '#F5222D'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
constructor(public service: BaseService) {}
|
constructor(public service: BaseService) {}
|
||||||
ngOnChanges(changes: SimpleChanges): void {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
if (changes?.pathList?.currentValue && this?.pathSimplifierIns) {
|
if (changes?.pathList?.currentValue && this?.pathSimplifierIns) {
|
||||||
@ -79,6 +115,7 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
|
|||||||
// this.service.msgSrv.info('地图加载完成 !');
|
// this.service.msgSrv.info('地图加载完成 !');
|
||||||
this.pathInit();
|
this.pathInit();
|
||||||
// this.setPOIS();
|
// this.setPOIS();
|
||||||
|
// this.loadPOIS();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
@ -86,6 +123,88 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadPOIS() {
|
||||||
|
AMapUI.loadUI(['overlay/SvgMarker'], (SvgMarker: any) => {
|
||||||
|
if (!SvgMarker.supportSvg) {
|
||||||
|
//当前环境并不支持SVG,此时SvgMarker会回退到父类,即SimpleMarker
|
||||||
|
alert('当前环境不支持SVG');
|
||||||
|
}
|
||||||
|
|
||||||
|
//just some colors
|
||||||
|
var colors = ['#F5222D', '#1890ff'];
|
||||||
|
|
||||||
|
//SvgMarker.Shape下的Shape
|
||||||
|
var shapeKeys = ['WaterDrop'];
|
||||||
|
|
||||||
|
var colNum = 2,
|
||||||
|
rowNum = shapeKeys.length;
|
||||||
|
const markers: any[] = [];
|
||||||
|
|
||||||
|
this.pois.forEach((d: any) => {
|
||||||
|
//创建shape
|
||||||
|
const shape = new SvgMarker.Shape['WaterDrop']({
|
||||||
|
height: 40,
|
||||||
|
strokeWidth: 1,
|
||||||
|
strokeColor: '#ccc',
|
||||||
|
fillColor: '#F5222D'
|
||||||
|
});
|
||||||
|
|
||||||
|
markers.push(
|
||||||
|
new SvgMarker(shape, {
|
||||||
|
map: this.aMap,
|
||||||
|
position: d.position,
|
||||||
|
containerClassNames: 'shape-' + 'WaterDrop',
|
||||||
|
iconLabel: {
|
||||||
|
innerHTML: d.listDesc,
|
||||||
|
style: {
|
||||||
|
top: 7 + 'px'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
showPositionPoint: true
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
console.log(markers);
|
||||||
|
|
||||||
|
// var pxCenter = this.aMap.lnglatToPixel(this.aMap.getCenter());
|
||||||
|
|
||||||
|
// var startX = pxCenter.getX(),
|
||||||
|
// startY = pxCenter.getY();
|
||||||
|
|
||||||
|
// for (var c = 0; c < colNum; c++) {
|
||||||
|
// for (var r = 0; r < rowNum; r++) {
|
||||||
|
// var idx = r * colNum + c;
|
||||||
|
|
||||||
|
// if (!colors[idx]) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// var x = startX + (c - colNum / 2) * 70;
|
||||||
|
// var y = startY + 50 + (r - rowNum / 2) * 80;
|
||||||
|
|
||||||
|
// var labelCenter = shape.getCenter();
|
||||||
|
|
||||||
|
// var position = this.aMap.pixelToLngLat(new AMap.Pixel(x, y));
|
||||||
|
|
||||||
|
// markers.push(
|
||||||
|
// new SvgMarker(shape, {
|
||||||
|
// map: this.aMap,
|
||||||
|
// position: position,
|
||||||
|
// containerClassNames: 'shape-' + shapeKeys[r],
|
||||||
|
// iconLabel: {
|
||||||
|
// innerHTML: String.fromCharCode('A'.charCodeAt(0) + c),
|
||||||
|
// style: {
|
||||||
|
// top: labelCenter[1] - 9 + 'px'
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// showPositionPoint: true
|
||||||
|
// })
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
pathInit() {
|
pathInit() {
|
||||||
this.pathSimplifierIns = new AMapUI.PathSimplifier({
|
this.pathSimplifierIns = new AMapUI.PathSimplifier({
|
||||||
zIndex: 100,
|
zIndex: 100,
|
||||||
@ -103,6 +222,8 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
|
|||||||
return lnglatList;
|
return lnglatList;
|
||||||
},
|
},
|
||||||
getHoverTitle: function (pathData: any, pathIndex: any, pointIndex: any) {
|
getHoverTitle: function (pathData: any, pathIndex: any, pointIndex: any) {
|
||||||
|
console.log(pathData, pointIndex);
|
||||||
|
|
||||||
if (pointIndex >= 0) {
|
if (pointIndex >= 0) {
|
||||||
//point
|
//point
|
||||||
return pathData.name + ',' + pathData.points[pointIndex].name;
|
return pathData.name + ',' + pathData.points[pointIndex].name;
|
||||||
@ -143,7 +264,7 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
|
|||||||
//返回数据项的位置信息,需要是AMap.LngLat实例,或者是经纬度数组,比如[116.789806, 39.904989]
|
//返回数据项的位置信息,需要是AMap.LngLat实例,或者是经纬度数组,比如[116.789806, 39.904989]
|
||||||
getPosition: (dataItem: any) => {
|
getPosition: (dataItem: any) => {
|
||||||
console.log(dataItem);
|
console.log(dataItem);
|
||||||
|
|
||||||
return dataItem.position;
|
return dataItem.position;
|
||||||
},
|
},
|
||||||
//返回数据项对应的Marker
|
//返回数据项对应的Marker
|
||||||
@ -256,7 +377,7 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
|
|||||||
|
|
||||||
setPathIndex(index: number) {
|
setPathIndex(index: number) {
|
||||||
this.pathSimplifierIns.setSelectedPathIndex(index);
|
this.pathSimplifierIns.setSelectedPathIndex(index);
|
||||||
this.startNav();
|
// this.startNav();
|
||||||
}
|
}
|
||||||
|
|
||||||
startNav() {
|
startNav() {
|
||||||
|
|||||||
Reference in New Issue
Block a user