Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Commit

Permalink
Load plan B (preplanned route)
Browse files Browse the repository at this point in the history
  • Loading branch information
wheitman committed Nov 18, 2024
1 parent 68465b4 commit 54d76cf
Show file tree
Hide file tree
Showing 8 changed files with 1,929 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/lib/3d/World.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
if (scene == undefined) return;
if (JSON.stringify(candidates_msg) == previous_candidates_msg_string) {
console.warn("Got duplicate candidates. Skipping rendering.");
// console.warn("Got duplicate candidates. Skipping rendering.");
return;
} else {
previous_candidates_msg_string = JSON.stringify(candidates_msg);
Expand Down
16 changes: 15 additions & 1 deletion src/lib/forest_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
import type OsmMap from "$lib/misc/OsmMap.svelte";

import species_json from "$lib/species.json"
import plan_b from "$lib/plan-b.json"

let seedlings: object[] = [];

Expand Down Expand Up @@ -75,6 +76,19 @@ export class ForestGenerator {
console.log(this.species)
}

public loadPlanB() {
this.locations.clear();

plan_b.locations.forEach((location) => {
this.locations.set([location.lat, location.lon], this.species.get(location.species))
})

this.geojson = plan_b.geojson

this.changeCb()
return plan_b
}

public loadFromString(plan_string: string) {
let plan_obj = JSON.parse(JSON.parse(plan_string));
console.log(plan_obj)
Expand Down Expand Up @@ -116,7 +130,7 @@ export class ForestGenerator {

let seedlings: Seedling[] = []
for (let [latlon, species] of this.locations) {
console.log(latlon, species)
// console.log(latlon, species)
seedlings.push({ latitude: latlon[0], longitude: latlon[1], species_id: species.icon })
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/misc/OsmMap.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
});
ego_lon.subscribe((val) => {
console.log("Longitude updated!");
// console.log("Longitude updated!");
egoLon = val;
Expand Down
Loading

0 comments on commit 54d76cf

Please sign in to comment.