Skip to content

Commit

Permalink
Added no_guides to hide guides
Browse files Browse the repository at this point in the history
  • Loading branch information
fboes committed Nov 14, 2024
1 parent e706198 commit 58f62c0
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 30 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Changelog

- Added `no_guides` to hide guides
- Added `flyOver` property to waypoints
- Added `finish` property to missions
- Added new cloud layers
- Improved handling of Garmin `fpl` files
- Prioritizing waypoints in GeoJson
- Prioritizing waypoints in GeoJSON
- Improved GeoJSON output
- Added stub to import departure, approach and arrival waypoints
- Fixed METAR button disabling
- Improved GeoJson symbols
- Improved GeoJSON symbols
- Changed airport links to be more clever
- Updated mission links
- Changed links for airports, changed styling for waypoints
Expand Down
12 changes: 8 additions & 4 deletions dist/Aerofly/Mission.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export class Mission {
* How many minutes does it take to make a full circle
*/
this.turn_time = 2;
/**
* Hide guides in missio
*/
this.no_guides = false;
this.warnings = [];
this.title = title;
this.description = description;
Expand Down Expand Up @@ -324,7 +328,6 @@ export class Mission {
cp.fromMainMcf(w);
if (lastPosition && (isNaN(cp.lon_lat.lon) || isNaN(cp.lon_lat.lat))) {
cp.lon_lat = lastPosition.getRelativeCoordinates(3, 45);
console.log(cp.lon_lat);
}
lastPosition = cp.lon_lat;
return cp;
Expand Down Expand Up @@ -814,7 +817,7 @@ ${this.conditions + finish}\
<[list_tmmission_checkpoint][checkpoints][]
`;
this.checkpoints.forEach((c, i) => {
string += c.toString(i);
string += c.toString(i, this.no_guides);
});
string += `\
>
Expand All @@ -824,7 +827,7 @@ ${this.conditions + finish}\
return string;
}
hydrate(json) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
this._title = (_a = json._title) !== null && _a !== void 0 ? _a : this._title;
this._description = (_b = json._description) !== null && _b !== void 0 ? _b : this._description;
this.flight_setting = (_c = json.flight_setting) !== null && _c !== void 0 ? _c : this.flight_setting;
Expand All @@ -849,8 +852,9 @@ ${this.conditions + finish}\
this.cruise_speed = (_v = json.cruise_speed) !== null && _v !== void 0 ? _v : this.cruise_speed;
this.cruise_altitude = (_w = json.cruise_altitude) !== null && _w !== void 0 ? _w : this.cruise_altitude;
this.turn_time = (_x = json.turn_time) !== null && _x !== void 0 ? _x : this.turn_time;
this.no_guides = (_y = json.no_guides) !== null && _y !== void 0 ? _y : this.no_guides;
this.conditions.hydrate(json.conditions);
this.finish = (_y = json.finish) !== null && _y !== void 0 ? _y : this.finish;
this.finish = (_z = json.finish) !== null && _z !== void 0 ? _z : this.finish;
this.checkpoints = json.checkpoints.map((c) => {
const cx = new MissionCheckpoint();
cx.hydrate(c);
Expand Down
4 changes: 2 additions & 2 deletions dist/Aerofly/MissionCheckpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class MissionCheckpoint {
const altDifference = this.lon_lat.altitude_m - lastLonLat.altitude_m; // m
this.slope = altDifference / this.distance_m;
}
toString(index) {
toString(index, noGuides = false) {
let flyOver = "";
if (this.type === MissionCheckpoint.TYPE_WAYPOINT) {
flyOver = `\
Expand All @@ -204,7 +204,7 @@ export class MissionCheckpoint {
<[string8u][type][${Quote.tmc(this.type)}]>
<[string8u][name][${Quote.tmc(this.name)}]>
<[vector2_float64][lon_lat][${this.lon_lat}]>
<[float64][altitude][${this.lon_lat.altitude_m}]>
<[float64][altitude][${noGuides ? -100 : this.lon_lat.altitude_m}]>
//<[float64][speed][${this.speed}]>
<[float64][direction][${this.direction}]>
<[float64][slope][${this.slope}]> // ${this.slope_deg.toFixed(1)} deg
Expand Down
1 change: 0 additions & 1 deletion dist/Export/GeoJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ export class GeoJson {
//lineCoordinates.push(this.getGeoJsonPosition(entry));
}
else {
console.log("Fly-over");
// Fly-over
// @see https://en.wikipedia.org/wiki/Circular_segment
turnDegrees *= 2;
Expand Down
21 changes: 13 additions & 8 deletions dist/Web/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,25 @@ export class App {
cruise_altitude_ft: document.getElementById("cruise_altitude_ft"),
cruise_speed: document.getElementById("cruise_speed"),
date: document.getElementById("date"),
downloadButtons: document.getElementById("download-buttons"),
description: document.getElementById("description"),
outputWeather: document.getElementById("output-weather"),
outputAirports: document.getElementById("output-airports"),
outputCheckpoints: document.getElementById("output-checkpoints"),
main: document.querySelector("main"),
downloadButtons: document.getElementById("download-buttons"),
magneticDeclination: document.getElementById("magnetic_declination"),
main: document.querySelector("main"),
makeMetarDept: document.getElementById("make-metar-dept"),
makeMetarDest: document.getElementById("make-metar-dest"),
metar: document.getElementById("metar"),
metarApiKey: document.getElementById("metar-api-key"),
no_guides: document.getElementById("no_guides"),
origin_dir: document.getElementById("origin_dir"),
outputAirports: document.getElementById("output-airports"),
outputCheckpoints: document.getElementById("output-checkpoints"),
outputWeather: document.getElementById("output-weather"),
thermal_strength: document.getElementById("thermal_strength"),
time: document.getElementById("time"),
title: document.getElementById("title"),
turbulence_strength: document.getElementById("turbulence_strength"),
turn_time: document.getElementById("turn_time"),
turn_radius: document.getElementById("turn_radius"),
turn_time: document.getElementById("turn_time"),
upload: document.getElementById("upload"),
visibility_sm: document.getElementById("visibility_sm"),
visibility: document.getElementById("visibility"),
Expand Down Expand Up @@ -105,7 +106,7 @@ export class App {
this.handleEventClickReset(target);
break;
case "reverse-flightplan":
this.handleEventClickRverseFlightplan(target);
this.handleEventClickReverseFlightplan(target);
break;
case "toggle-expert-mode":
this.handleEventClickToggleExpertMode(target);
Expand Down Expand Up @@ -211,7 +212,7 @@ export class App {
this.syncToForm();
this.showFlightplan(show);
}
handleEventClickRverseFlightplan(target) {
handleEventClickReverseFlightplan(target) {
this.mission.reverseWaypoints();
this.syncToForm();
this.showFlightplan(App.SHOW_ALL);
Expand Down Expand Up @@ -338,6 +339,9 @@ export class App {
this.mission.conditions.wind_speed = target.valueAsNumber;
show |= App.SHOW_ALL;
break;
case "no_guides":
this.mission.no_guides = target.checked;
break;
default:
const prop = target.getAttribute("data-cp-prop");
const id = (target.closest("[data-cp-id]") || target).getAttribute("data-cp-id");
Expand Down Expand Up @@ -763,6 +767,7 @@ export class App {
this.elements.wind_direction.value = this.mission.conditions.wind_direction.toFixed();
this.elements.wind_gusts.value = this.mission.conditions.wind_gusts.toFixed();
this.elements.wind_speed.value = this.mission.conditions.wind_speed.toFixed();
this.elements.no_guides.checked = this.mission.no_guides;
if (this.mission.magnetic_declination !== undefined) {
this.elements.magneticDeclination.valueAsNumber = this.mission.magnetic_declination;
}
Expand Down
6 changes: 6 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,12 @@ <h2>Step 2: Set up flight plan</h2>
<span>NM</span>
</div>

<div class="expert-mode">
<label for="no_guides">Hide guides</label>
<input type="checkbox" id="no_guides" />
<span>Hide guides</span>
</div>

<button class="expert-mode" data-handler="add-separation" data-type="VFR">Add VFR separation</button>
<button class="expert-mode" data-handler="add-separation" data-type="IFR">Add IFR separation</button>
<button class="expert-mode" data-handler="reverse-flightplan">Reverse flight plan</button>
Expand Down
4 changes: 4 additions & 0 deletions dist/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ input.has-output {
width: calc(100% - 2.5em);
}

input[type="checkbox"] {
width: auto;
}

input.has-output + output {
width: 2em;
border: none;
Expand Down
10 changes: 8 additions & 2 deletions src/Aerofly/Mission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ export class Mission {
* How many minutes does it take to make a full circle
*/
turn_time: number = 2;

/**
* Hide guides in missio
*/
no_guides: boolean = false;

protected _magnetic_declination?: number;

static FLIGHT_SETTING_LANDING: MissionFlightSetting = "landing";
Expand Down Expand Up @@ -369,7 +375,6 @@ export class Mission {

if (lastPosition && (isNaN(cp.lon_lat.lon) || isNaN(cp.lon_lat.lat))) {
cp.lon_lat = lastPosition.getRelativeCoordinates(3, 45);
console.log(cp.lon_lat);
}

lastPosition = cp.lon_lat;
Expand Down Expand Up @@ -925,7 +930,7 @@ ${this.conditions + finish}\
<[list_tmmission_checkpoint][checkpoints][]
`;
this.checkpoints.forEach((c, i) => {
string += c.toString(i);
string += c.toString(i, this.no_guides);
});
string += `\
>
Expand Down Expand Up @@ -960,6 +965,7 @@ ${this.conditions + finish}\
this.cruise_speed = json.cruise_speed ?? this.cruise_speed;
this.cruise_altitude = json.cruise_altitude ?? this.cruise_altitude;
this.turn_time = json.turn_time ?? this.turn_time;
this.no_guides = json.no_guides ?? this.no_guides;

this.conditions.hydrate(json.conditions);

Expand Down
4 changes: 2 additions & 2 deletions src/Aerofly/MissionCheckpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export class MissionCheckpoint {
this.slope = altDifference / this.distance_m;
}

toString(index: number): string {
toString(index: number, noGuides: boolean = false): string {
let flyOver = "";
if (this.type === MissionCheckpoint.TYPE_WAYPOINT) {
flyOver = `\
Expand All @@ -249,7 +249,7 @@ export class MissionCheckpoint {
<[string8u][type][${Quote.tmc(this.type)}]>
<[string8u][name][${Quote.tmc(this.name)}]>
<[vector2_float64][lon_lat][${this.lon_lat}]>
<[float64][altitude][${this.lon_lat.altitude_m}]>
<[float64][altitude][${noGuides ? -100 : this.lon_lat.altitude_m}]>
//<[float64][speed][${this.speed}]>
<[float64][direction][${this.direction}]>
<[float64][slope][${this.slope}]> // ${this.slope_deg.toFixed(1)} deg
Expand Down
1 change: 0 additions & 1 deletion src/Export/GeoJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ export class GeoJson implements GeoJSON.FeatureCollection {
//entry = c.lon_lat.getRelativeCoordinates(turnAnticipationDistance, nextCheckpoint.direction);
//lineCoordinates.push(this.getGeoJsonPosition(entry));
} else {
console.log("Fly-over");
// Fly-over
// @see https://en.wikipedia.org/wiki/Circular_segment
turnDegrees *= 2;
Expand Down
21 changes: 13 additions & 8 deletions src/Web/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,25 @@ export class App {
cruise_altitude_ft: <HTMLInputElement>document.getElementById("cruise_altitude_ft"),
cruise_speed: <HTMLInputElement>document.getElementById("cruise_speed"),
date: <HTMLInputElement>document.getElementById("date"),
downloadButtons: <ComponentsDownloadButtons>document.getElementById("download-buttons"),
description: <HTMLTextAreaElement>document.getElementById("description"),
outputWeather: <ComponentsWeather>document.getElementById("output-weather"),
outputAirports: <ComponentsAirports>document.getElementById("output-airports"),
outputCheckpoints: <ComponentsCheckpoints>document.getElementById("output-checkpoints"),
main: <HTMLElement>document.querySelector("main"),
downloadButtons: <ComponentsDownloadButtons>document.getElementById("download-buttons"),
magneticDeclination: <HTMLInputElement>document.getElementById("magnetic_declination"),
main: <HTMLElement>document.querySelector("main"),
makeMetarDept: <HTMLButtonElement>document.getElementById("make-metar-dept"),
makeMetarDest: <HTMLButtonElement>document.getElementById("make-metar-dest"),
metar: <HTMLAnchorElement>document.getElementById("metar"),
metarApiKey: <HTMLInputElement>document.getElementById("metar-api-key"),
no_guides: <HTMLInputElement>document.getElementById("no_guides"),
origin_dir: <HTMLInputElement>document.getElementById("origin_dir"),
outputAirports: <ComponentsAirports>document.getElementById("output-airports"),
outputCheckpoints: <ComponentsCheckpoints>document.getElementById("output-checkpoints"),
outputWeather: <ComponentsWeather>document.getElementById("output-weather"),
thermal_strength: <HTMLInputElement>document.getElementById("thermal_strength"),
time: <HTMLInputElement>document.getElementById("time"),
title: <HTMLInputElement>document.getElementById("title"),
turbulence_strength: <HTMLInputElement>document.getElementById("turbulence_strength"),
turn_time: <HTMLInputElement>document.getElementById("turn_time"),
turn_radius: <HTMLOutputElement>document.getElementById("turn_radius"),
turn_time: <HTMLInputElement>document.getElementById("turn_time"),
upload: <HTMLInputElement>document.getElementById("upload"),
visibility_sm: <HTMLOutputElement>document.getElementById("visibility_sm"),
visibility: <HTMLInputElement>document.getElementById("visibility"),
Expand Down Expand Up @@ -152,7 +153,7 @@ export class App {
this.handleEventClickReset(target);
break;
case "reverse-flightplan":
this.handleEventClickRverseFlightplan(target);
this.handleEventClickReverseFlightplan(target);
break;
case "toggle-expert-mode":
this.handleEventClickToggleExpertMode(target);
Expand Down Expand Up @@ -267,7 +268,7 @@ export class App {
this.showFlightplan(show);
}

handleEventClickRverseFlightplan(target: HTMLButtonElement) {
handleEventClickReverseFlightplan(target: HTMLButtonElement) {
this.mission.reverseWaypoints();
this.syncToForm();
this.showFlightplan(App.SHOW_ALL);
Expand Down Expand Up @@ -399,6 +400,9 @@ export class App {
this.mission.conditions.wind_speed = target.valueAsNumber;
show |= App.SHOW_ALL;
break;
case "no_guides":
this.mission.no_guides = target.checked;
break;
default:
const prop = target.getAttribute("data-cp-prop");
const id = (target.closest("[data-cp-id]") || target).getAttribute("data-cp-id");
Expand Down Expand Up @@ -861,6 +865,7 @@ export class App {
this.elements.wind_direction.value = this.mission.conditions.wind_direction.toFixed();
this.elements.wind_gusts.value = this.mission.conditions.wind_gusts.toFixed();
this.elements.wind_speed.value = this.mission.conditions.wind_speed.toFixed();
this.elements.no_guides.checked = this.mission.no_guides;
if (this.mission.magnetic_declination !== undefined) {
this.elements.magneticDeclination.valueAsNumber = this.mission.magnetic_declination;
} else {
Expand Down

0 comments on commit 58f62c0

Please sign in to comment.