30 lines
756 B
Vue
30 lines
756 B
Vue
<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>
|