This commit is contained in:
Taric Xin
2022-03-09 14:40:57 +08:00
parent 6c47267388
commit 2d0b000242
3 changed files with 125 additions and 4 deletions

View File

@ -135,7 +135,7 @@ export class OrderManagementVehicleDetailComponent implements OnInit {
let list :any[] = [];
points?.forEach((item: any) => {
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))]
});
});

View File

@ -24,7 +24,7 @@ export class AccountDetailComponent implements OnInit {
ngOnInit(): void {}
createAccount(item: any, type: '1' | '2') {
if (item.pfAccount) {
if ((type === '1' && item.paAccount) || (type === '2' && item.pfAccount)) {
return;
}
const params = {

View File

@ -30,6 +30,42 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
@Output()
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) {}
ngOnChanges(changes: SimpleChanges): void {
if (changes?.pathList?.currentValue && this?.pathSimplifierIns) {
@ -79,6 +115,7 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
// this.service.msgSrv.info('地图加载完成 !');
this.pathInit();
// this.setPOIS();
// this.loadPOIS();
});
})
.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() {
this.pathSimplifierIns = new AMapUI.PathSimplifier({
zIndex: 100,
@ -103,6 +222,8 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
return lnglatList;
},
getHoverTitle: function (pathData: any, pathIndex: any, pointIndex: any) {
console.log(pathData, pointIndex);
if (pointIndex >= 0) {
//point
return pathData.name + '' + pathData.points[pointIndex].name;
@ -256,7 +377,7 @@ export class AmapPathSimplifierComponent implements OnInit, OnChanges {
setPathIndex(index: number) {
this.pathSimplifierIns.setSelectedPathIndex(index);
this.startNav();
// this.startNav();
}
startNav() {