wip: trip planner

This commit is contained in:
2026-07-12 22:18:17 +02:00
parent 235cdacf9e
commit 9a97bf6088
6 changed files with 157 additions and 1 deletions
+29
View File
@@ -0,0 +1,29 @@
<template>
<main>
<SidebarTrip @plan="plan" />
</main>
</template>
<script setup lang="ts">
definePageMeta({ key: "trip" });
import { LngLat } from "maplibre-gl";
import { RoutePlanner } from "~/utils/trip";
const from = "SEM:GENBIBLIUNI";
const to = "SEM:GENPERE";
const store = useMresoStore();
function plan() {
const fromCoord = store.clustersByCode[from]?.geometry.coordinates;
const toCoord = store.clustersByCode[to]?.geometry.coordinates;
if (!fromCoord || !toCoord) {
return;
}
const planner = new RoutePlanner(
new LngLat(fromCoord[1]!, fromCoord[0]!),
new LngLat(toCoord[1]!, toCoord[0]!),
);
planner.request().then((data) => {
console.log(data);
});
}
</script>