wip: trip planner
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user