Skip to content

Commit

Permalink
Use LatLon[] for path
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb committed Sep 17, 2024
1 parent 125f9ef commit 9403af7
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 43 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

- Add FIS Sectors
- Update airspaces

## 2.2.0 - April 14, 2024

### fxc-front
Expand Down
58 changes: 30 additions & 28 deletions apps/fxc-front/index.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
<!DOCTYPE html>
<html lang="en" class="hydrated">
<head>
<script>
addEventListener('beforeinstallprompt', (e) => {
e.preventDefault();
e.stopImmediatePropagation();
window.deferredPrompt = e;
});
</script>
<title>flyXC</title>
<meta
name="description"
content="flyXC is a one stop shop web app for paraglider pilots. You can plan, visualize, and track your flights with the most popular live tracking platforms (inReach, Spot, Skylines, FlyMe, Flymaster, OGN, Zoleo, XCTrack/XContest)"
/>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="icon" href="/favicon.ico" sizes="48x48" />
<link rel="icon" href="/static/iconx/favicon.svg" sizes="any" type="image/svg+xml" />
<link rel="apple-touch-icon" href="/static/iconx/apple-touch-icon.png" />
<meta name="theme-color" content="#0054e9" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/line-awesome@1/dist/line-awesome/css/line-awesome.min.css"
/>
</head>

<head>
<script>
addEventListener('beforeinstallprompt', (e) => {
e.preventDefault();
e.stopImmediatePropagation();
window.deferredPrompt = e;
});
</script>
<title>flyXC</title>
<meta name="description"
content="flyXC is a one stop shop web app for paraglider pilots. You can plan, visualize, and track your flights with the most popular live tracking platforms (inReach, Spot, Skylines, FlyMe, Flymaster, OGN, Zoleo, XCTrack/XContest)" />
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="icon" href="/favicon.ico" sizes="48x48" />
<link rel="icon" href="/static/iconx/favicon.svg" sizes="any" type="image/svg+xml" />
<link rel="apple-touch-icon" href="/static/iconx/apple-touch-icon.png" />
<meta name="theme-color" content="#0054e9" />
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/line-awesome@1/dist/line-awesome/css/line-awesome.min.css" />
</head>

<body>
<fly-xc class="fs-enabled"></fly-xc>
<script type="module" src="/src/flyxc.ts"></script>
</body>

</html>
<body>
<fly-xc class="fs-enabled"></fly-xc>
<script type="module" src="/src/flyxc.ts"></script>
</body>
</html>
8 changes: 6 additions & 2 deletions apps/fxc-front/src/app/components/2d/path-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export class PathElement extends connect(store)(LitElement) {

this.optimizedLine.setOptions({
map: this.map,
path: result.path,
path: result.path.map(({ lat, lon }) => ({ lat, lng: lon })),
strokeColor: ROUTE_STROKE_COLORS[result.circuit],
strokeOpacity: 0.8,
strokeWeight: 3,
Expand Down Expand Up @@ -381,7 +381,11 @@ export class PathElement extends connect(store)(LitElement) {
const lastTimeSec = this.currentTrack.timeSec.at(-1)!;
const durationS = lastTimeSec - this.currentTrack.timeSec[0];
store.dispatch(plannerSlice.setSpeedKmh((result.lengthKm / durationS) * 3600));
store.dispatch(plannerSlice.setRoute(google.maps.geometry.encoding.encodePath(result.path)));
store.dispatch(
plannerSlice.setRoute(
google.maps.geometry.encoding.encodePath(result.path.map(({ lat, lon }) => ({ lat, lng: lon }))),
),
);
}
}

Expand Down
6 changes: 2 additions & 4 deletions libs/optimizer/src/lib/optimizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface ScoringResult {
out: LatLon;
};
// optimized path
path: { lat: number; lng: number }[];
path: LatLon[];
}

/**
Expand Down Expand Up @@ -198,9 +198,7 @@ function toOptimizationResult(solution: Solution, track: ScoringTrack): ScoringR
})),
turnpoints,
closingPoints,
path: [closingPoints?.in, startPoint, ...turnpoints, endPoint, closingPoints?.out]
.filter((p) => p != null)
.map((latLon) => ({ lat: latLon.lat, lng: latLon.lon })),
path: [closingPoints?.in, startPoint, ...turnpoints, endPoint, closingPoints?.out].filter((p) => p != null),
};
}

Expand Down
16 changes: 8 additions & 8 deletions libs/windy-sounding/.babelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"presets": [
[
"@nx/js/babel",
{
"useBuiltIns": "usage"
}
]
"presets": [
[
"@nx/js/babel",
{
"useBuiltIns": "usage"
}
]
}
]
}

0 comments on commit 9403af7

Please sign in to comment.