Skip to content

Commit

Permalink
Improved GeoJson symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
fboes committed Mar 30, 2024
1 parent b8135fb commit 016fba7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
11 changes: 9 additions & 2 deletions dist/Aerofly/MissionCheckpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,15 @@ export class MissionCheckpoint {
if (this.frequency) {
return this.frequency_unit === "M" ? MissionCheckpoint.TYPE_VOR : MissionCheckpoint.TYPE_NDB;
}
if (this.name.match(/^[A-Z]{4,5}$/)) {
return this.name.length === 4 ? MissionCheckpoint.TYPE_AIRPORT : MissionCheckpoint.TYPE_FIX;
if (this.name.match(/^[A-Z]{3,5}$/)) {
switch (this.name.length) {
case 3:
return MissionCheckpoint.TYPE_VOR;
case 4:
return MissionCheckpoint.TYPE_AIRPORT;
default:
return MissionCheckpoint.TYPE_FIX;
}
}
}
return this.type;
Expand Down
10 changes: 7 additions & 3 deletions dist/Export/GeoJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class GeoJson {
altitude: undefined,
direction: mission.origin_dir,
frequency: undefined,
"marker-symbol": "airport",
"marker-symbol": "af-large_airport",
},
});
this.features.push({
Expand All @@ -107,7 +107,7 @@ export class GeoJson {
altitude: undefined,
direction: mission.destination_dir,
frequency: undefined,
"marker-symbol": "airport",
"marker-symbol": "af-large_airport",
},
});
this.drawLine(this.getLineCoordinates(mission));
Expand Down Expand Up @@ -255,15 +255,19 @@ export class GeoJson {
}
getGeoJsonIcon(cp) {
switch (cp.type_extended) {
case MissionCheckpoint.TYPE_DESTINATION:
return "af-large_airport";
case MissionCheckpoint.TYPE_ORIGIN:
case MissionCheckpoint.TYPE_DESTINATION:
return "airport";
return "af-large_airport";
case MissionCheckpoint.TYPE_VOR:
return "navaid-vor";
case MissionCheckpoint.TYPE_NDB:
return "navaid-ndb";
case MissionCheckpoint.TYPE_FIX:
return "navaid-fix";
case MissionCheckpoint.TYPE_AIRPORT:
return "af-medium_airport";
default:
return "navaid-waypoint";
}
Expand Down
11 changes: 9 additions & 2 deletions src/Aerofly/MissionCheckpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,15 @@ export class MissionCheckpoint {
if (this.frequency) {
return this.frequency_unit === "M" ? MissionCheckpoint.TYPE_VOR : MissionCheckpoint.TYPE_NDB;
}
if (this.name.match(/^[A-Z]{4,5}$/)) {
return this.name.length === 4 ? MissionCheckpoint.TYPE_AIRPORT : MissionCheckpoint.TYPE_FIX;
if (this.name.match(/^[A-Z]{3,5}$/)) {
switch (this.name.length) {
case 3:
return MissionCheckpoint.TYPE_VOR;
case 4:
return MissionCheckpoint.TYPE_AIRPORT;
default:
return MissionCheckpoint.TYPE_FIX;
}
}
}

Expand Down
10 changes: 7 additions & 3 deletions src/Export/GeoJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class GeoJson implements GeoJSON.FeatureCollection {
altitude: undefined,
direction: mission.origin_dir,
frequency: undefined,
"marker-symbol": "airport",
"marker-symbol": "af-large_airport",
},
});

Expand All @@ -136,7 +136,7 @@ export class GeoJson implements GeoJSON.FeatureCollection {
altitude: undefined,
direction: mission.destination_dir,
frequency: undefined,
"marker-symbol": "airport",
"marker-symbol": "af-large_airport",
},
});

Expand Down Expand Up @@ -304,15 +304,19 @@ export class GeoJson implements GeoJSON.FeatureCollection {

protected getGeoJsonIcon(cp: MissionCheckpoint): string {
switch (cp.type_extended) {
case MissionCheckpoint.TYPE_DESTINATION:
return "af-large_airport";
case MissionCheckpoint.TYPE_ORIGIN:
case MissionCheckpoint.TYPE_DESTINATION:
return "airport";
return "af-large_airport";
case MissionCheckpoint.TYPE_VOR:
return "navaid-vor";
case MissionCheckpoint.TYPE_NDB:
return "navaid-ndb";
case MissionCheckpoint.TYPE_FIX:
return "navaid-fix";
case MissionCheckpoint.TYPE_AIRPORT:
return "af-medium_airport";
default:
return "navaid-waypoint";
}
Expand Down

0 comments on commit 016fba7

Please sign in to comment.