in Frontend/src/app/maps/bing-maps.service.ts [756:817]
private showSimplifiedTrip(trip: Trip, tripColor) {
tripColor = tripColor || this.genericColors[4];
const tripLegLocations = [];
// Show the first stop in a trip
this.showTripLocation(trip.startLocation);
tripLegLocations.push(new Microsoft.Maps.Location(
trip.startLocation.latitude,
trip.startLocation.longitude
));
let previousTripLeg: TripLeg;
for (const leg of trip.tripLegs) {
// Add all route points
for (let i = 0; i < leg.route.length; i++) {
tripLegLocations.push(new Microsoft.Maps.Location(
leg.route[i].latitude,
leg.route[i].longitude
));
}
// Draw a dotted line between trip leg stop locations, if they are not the same.
if (previousTripLeg && previousTripLeg.endLocation.id !== leg.startLocation.id) {
const startPoint = new Microsoft.Maps.Location(
leg.startLocation.latitude,
leg.startLocation.longitude
);
const previousLocation = new Microsoft.Maps.Location(
previousTripLeg.endLocation.latitude,
previousTripLeg.endLocation.longitude);
const dottedLine = new Microsoft.Maps.Polyline(
[previousLocation, startPoint],
{
strokeThickness: 5,
strokeDashArray: [2, 2],
strokeColor: tripColor
}
);
this.tripsLayer.add(dottedLine);
}
previousTripLeg = leg;
}
// Show the last stop in a trip
this.showTripLocation(trip.endLocation);
tripLegLocations.push(new Microsoft.Maps.Location(
trip.endLocation.latitude,
trip.endLocation.longitude
));
const line = new Microsoft.Maps.Polyline(tripLegLocations, {
strokeThickness: 5,
strokeColor: tripColor
});
this.tripsLayer.add(line);
this.centerMap(tripLegLocations[0]);
}