Refaktoring a pridani letiste mezipristani do mapy
This commit is contained in:
@@ -14,43 +14,16 @@ const props = defineProps({
|
||||
|
||||
const mapPhotos = computed(() => flight.value.photos.filter(photo => photo.gpsLatitude && photo.gpsLongitude));
|
||||
const poisWithGPS = computed(() => {
|
||||
return flight.value.track.filter(poi => poi.pointOfInterest?.gpsLatitude && poi.pointOfInterest?.gpsLongitude)
|
||||
});
|
||||
|
||||
const pointsOfInterests = computed(() => {
|
||||
const path = [];
|
||||
|
||||
if (flight.value.takeoffAirport.gpsLatitude && flight.value.takeoffAirport.gpsLongitude) {
|
||||
path.push({
|
||||
label: flight.value.takeoffAirport.name,
|
||||
position:
|
||||
{
|
||||
lat: flight.value.takeoffAirport.gpsLatitude,
|
||||
lng: flight.value.takeoffAirport.gpsLongitude
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (const poi of poisWithGPS.value) {
|
||||
path.push({
|
||||
label: poi.pointOfInterest.name,
|
||||
position: {lat: poi.pointOfInterest.gpsLatitude, lng: poi.pointOfInterest.gpsLongitude}
|
||||
});
|
||||
}
|
||||
|
||||
if (flight.value.landingAirport.gpsLatitude && flight.value.landingAirport.gpsLongitude) {
|
||||
path.push({
|
||||
label: flight.value.landingAirport.name,
|
||||
position: {
|
||||
lat: flight.value.landingAirport.gpsLatitude,
|
||||
lng: flight.value.landingAirport.gpsLongitude
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return path;
|
||||
return flight.value.track.filter(poi => {
|
||||
const item = poi.pointOfInterest || poi.airport;
|
||||
return item.gpsLatitude && item.gpsLongitude;
|
||||
}).map(poi => poi.pointOfInterest || poi.airport)
|
||||
});
|
||||
|
||||
const mapMarkers = [flight.value.takeoffAirport].concat(poisWithGPS.value).concat([flight.value.landingAirport]);
|
||||
const pointsOfInterests = computed(() => mapMarkers.map(
|
||||
marker => ({label: marker.name, position: {lat: marker.gpsLatitude, lng: marker.gpsLongitude}})
|
||||
));
|
||||
|
||||
const gpxTrack = flight.value.gpxTrack;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user