-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start splitting RenderNeighbourhood into layers
- Loading branch information
1 parent
c80c36f
commit 56ef3a2
Showing
12 changed files
with
155 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script lang="ts"> | ||
import { FillLayer, LineLayer } from "svelte-maplibre"; | ||
import { layerId } from "../common"; | ||
import { roadStyle } from "../stores"; | ||
</script> | ||
|
||
<FillLayer | ||
{...layerId("cells")} | ||
filter={["==", ["get", "kind"], "cell"]} | ||
layout={{ | ||
visibility: $roadStyle == "cells" ? "none" : "visible", | ||
}} | ||
paint={{ | ||
"fill-color": ["get", "color"], | ||
"fill-opacity": 0.8, | ||
}} | ||
/> | ||
|
||
<FillLayer | ||
{...layerId("border-arrows")} | ||
filter={["==", ["get", "kind"], "border_arrow"]} | ||
paint={{ | ||
"fill-color": ["get", "color"], | ||
}} | ||
/> | ||
<LineLayer | ||
{...layerId("border-arrow-outlines")} | ||
filter={["==", ["get", "kind"], "border_arrow"]} | ||
paint={{ | ||
"line-color": "black", | ||
"line-width": 2, | ||
}} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<script lang="ts"> | ||
import type { Feature, Polygon } from "geojson"; | ||
import { FillLayer, GeoJSON } from "svelte-maplibre"; | ||
import { layerId } from "../common"; | ||
import type { RenderNeighbourhoodOutput } from "../wasm"; | ||
export let gj: RenderNeighbourhoodOutput; | ||
function invertBoundary(gj: RenderNeighbourhoodOutput): Feature<Polygon> { | ||
// @ts-expect-error TS can't figure out that we're narrowing the case here | ||
let boundary: Feature<Polygon> = gj.features.find( | ||
(f) => f.properties.kind == "boundary", | ||
)!; | ||
return { | ||
type: "Feature", | ||
properties: {}, | ||
geometry: { | ||
type: "Polygon", | ||
coordinates: [ | ||
[ | ||
[180.0, 90.0], | ||
[-180.0, 90.0], | ||
[-180.0, -90.0], | ||
[180.0, -90.0], | ||
[180.0, 90.0], | ||
], | ||
// One hole | ||
boundary.geometry.coordinates[0], | ||
], | ||
}, | ||
}; | ||
} | ||
</script> | ||
|
||
<GeoJSON data={invertBoundary(gj)}> | ||
<FillLayer | ||
{...layerId("neighbourhood-boundary")} | ||
paint={{ "fill-color": "black", "fill-opacity": 0.3 }} | ||
/> | ||
</GeoJSON> |
4 changes: 2 additions & 2 deletions
4
web/src/ModalFilterLayer.svelte → web/src/layers/ModalFilterLayer.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export { default as CellLayer } from "./CellLayer.svelte"; | ||
export { default as HighlightBoundaryLayer } from "./HighlightBoundaryLayer.svelte"; | ||
export { default as ModalFilterLayer } from "./ModalFilterLayer.svelte"; | ||
export { default as OneWayLayer } from "./OneWayLayer.svelte"; |