From 221159433cdaa5aab088e0f39c1363d3d673487b Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Thu, 5 Feb 2026 20:00:28 +0000 Subject: [PATCH] Complete map display page --- src/app.html | 2 +- src/lib/components/RouteRow.svelte | 77 ++++-- src/lib/components/mapIcons/Bridge.svelte | 6 +- src/lib/components/mapIcons/Crossover.svelte | 2 +- src/lib/components/mapIcons/Junction.svelte | 4 +- src/lib/components/mapIcons/Loop.svelte | 11 +- src/lib/components/mapIcons/SiteOf.svelte | 11 + src/lib/mapRegistry.ts | 7 +- src/routes/+page.svelte | 2 + src/routes/map/[slug]/+page.svelte | 239 ++++++++++++++++++- static/mapFiles/yaml/0001.yaml | 14 +- 11 files changed, 338 insertions(+), 37 deletions(-) create mode 100644 src/lib/components/mapIcons/SiteOf.svelte diff --git a/src/app.html b/src/app.html index f273cc5..a5f9b76 100644 --- a/src/app.html +++ b/src/app.html @@ -2,7 +2,7 @@ - + %sveltekit.head% diff --git a/src/lib/components/RouteRow.svelte b/src/lib/components/RouteRow.svelte index ee2c863..59f272b 100644 --- a/src/lib/components/RouteRow.svelte +++ b/src/lib/components/RouteRow.svelte @@ -34,9 +34,11 @@ \ No newline at end of file diff --git a/src/lib/components/mapIcons/Bridge.svelte b/src/lib/components/mapIcons/Bridge.svelte index 025e13b..931e0b4 100644 --- a/src/lib/components/mapIcons/Bridge.svelte +++ b/src/lib/components/mapIcons/Bridge.svelte @@ -19,7 +19,7 @@ pipeline: { color: '#334155', stroke: '#1e293b', width: 4, text: '#334155'}, } - $: s = bridgeStyles[feature.category] || styles.minorRoad; + $: s = bridgeStyles[feature.category] || bridgeStyles.minorRoad; $: isOver = feature.position === 'over'; $: topY = 32 - (s.width / 2); @@ -36,9 +36,9 @@ - + {:else} - + diff --git a/src/lib/components/mapIcons/Crossover.svelte b/src/lib/components/mapIcons/Crossover.svelte index 5c52bdb..d0a2c66 100644 --- a/src/lib/components/mapIcons/Crossover.svelte +++ b/src/lib/components/mapIcons/Crossover.svelte @@ -14,5 +14,5 @@ - + \ No newline at end of file diff --git a/src/lib/components/mapIcons/Junction.svelte b/src/lib/components/mapIcons/Junction.svelte index 3f785e1..29876ad 100644 --- a/src/lib/components/mapIcons/Junction.svelte +++ b/src/lib/components/mapIcons/Junction.svelte @@ -16,8 +16,8 @@ $: isRight = feature.diverges === 'right'; $: yStart = visualUp ? 64 : 0; - $: yEnd = visualUp ? 0 : 64; - $: xEnd = isRight ? 64 : 0; + $: yEnd = visualUp ? 8 : 56; + $: xEnd = isRight ? 56 : 8; $: branchColour = getElecColour(feature.elecBranch || activeElec); $: branchPath = `M 32 ${yStart} Q 32 32 ${xEnd} ${yEnd}`; diff --git a/src/lib/components/mapIcons/Loop.svelte b/src/lib/components/mapIcons/Loop.svelte index 3c35380..1bbca7b 100644 --- a/src/lib/components/mapIcons/Loop.svelte +++ b/src/lib/components/mapIcons/Loop.svelte @@ -3,7 +3,7 @@ import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte'; export let feature: { - side: 'left' | 'right' | 'both'; + position: 'left' | 'right' | 'both'; elecLoop?: string; }; @@ -12,17 +12,22 @@ $: loopColour = getElecColour(feature.elecLoop || activeElec); + $: effectivePosition = (() => { + if (!reversed || feature.position === 'both') return feature.position; + return feature.position === 'left' ? 'right' : 'left'; + })(); + const leftPath = `M 32 0 Q 8 32 32 64`; const rightPath = `M 32 0 Q 56 32 32 64`; - {#if feature.side === 'left' || feature.side === 'both'} + {#if effectivePosition === 'left' || feature.position === 'both'} {/if} - {#if feature.side === 'right' || feature.side === 'both'} + {#if effectivePosition === 'right' || feature.position === 'both'} {/if} diff --git a/src/lib/components/mapIcons/SiteOf.svelte b/src/lib/components/mapIcons/SiteOf.svelte new file mode 100644 index 0000000..84d8e90 --- /dev/null +++ b/src/lib/components/mapIcons/SiteOf.svelte @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/src/lib/mapRegistry.ts b/src/lib/mapRegistry.ts index fef5131..47ed86a 100644 --- a/src/lib/mapRegistry.ts +++ b/src/lib/mapRegistry.ts @@ -7,17 +7,20 @@ import Crossing from '$lib/components/mapIcons/Crossing.svelte'; import Loop from '$lib/components/mapIcons/Loop.svelte'; import SignallerChange from '$lib/components/mapIcons/SignallerChange.svelte'; import ElectrificationChange from '$lib/components/mapIcons/ElectrificationChange.svelte'; +import SiteOf from '$lib/components/mapIcons/SiteOf.svelte'; export const components = { station: Station, junction: Junction, - crossovers: BaseTrack, - siteof: BaseTrack, + crossovers: Crossover, + siteof: SiteOf, bridge: Bridge, crossover: Crossover, crossing: Crossing, loop: Loop, + loops: Loop, signallerChange: SignallerChange, electrificationChange: ElectrificationChange, + default: BaseTrack, } \ No newline at end of file diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index acb0af1..93f47a8 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -36,12 +36,14 @@ category: 'pipeline', name: 'Waterway Bridge', roadName: "TfL (LU)", + elec: '25kvac', miles: 1, chains: 41, }, { type: 'crossover', name: 'Dolphin junction', + elec: '25kvac', miles: 1, chains: 42, }, diff --git a/src/routes/map/[slug]/+page.svelte b/src/routes/map/[slug]/+page.svelte index 4e08f95..4dba508 100644 --- a/src/routes/map/[slug]/+page.svelte +++ b/src/routes/map/[slug]/+page.svelte @@ -1,11 +1,238 @@ \ No newline at end of file + + +
+
+

{data.route.routeName}

+ {data.route.routeId} +
+ + +
+
+ +{#if showFilters} +
showFilters = false}>
+ +
+
+

Visibility Filters

+ +
+ +
+
+ {#each Object.keys(visibleTypes) as type} + + {/each} +
+
+
+{/if} + +
+
+ {#each filteredFeatures as f, i (`${f.type}-${f.miles}-${f.chains}-${i}`)} + + {/each} +
+
+
+ + \ No newline at end of file diff --git a/static/mapFiles/yaml/0001.yaml b/static/mapFiles/yaml/0001.yaml index ee38c3a..82f1192 100644 --- a/static/mapFiles/yaml/0001.yaml +++ b/static/mapFiles/yaml/0001.yaml @@ -12,13 +12,13 @@ elecEnd: routeDetail: - type: station name: Paddington - isTerminus: true + terminus: true miles: 0 chains: 5 - type: bridge name: Westbourne - description: Westbourne Avenue? + description: Westbourne Avenue position: over category: aroad roadName: A412 @@ -195,6 +195,8 @@ routeDetail: - type: signallerChange from: TVSC Paddington WS to: TVSC Acton WS + miles: 300 + chains: 3000 - type: junction name: Acton East Junction @@ -333,6 +335,8 @@ routeDetail: - type: signallerChange from: TVSC Acton WS to: TVSC Hayes WS + miles: 300 + chains: 4000 - type: bridge name: Wharncliffe Viaduct @@ -550,6 +554,8 @@ routeDetail: - type: signallerChange from: TVSC Hayes WS to: TVSC Slough WS + miles: 300 + chains: 5000 - type: bridge name: Market Lane @@ -877,6 +883,8 @@ routeDetail: - type: signallerChange from: TVSC Slough WS to: TVSC Twyford WS + miles: 300 + chains: 6000 - type: bridge name: Pipeline @@ -1073,6 +1081,8 @@ routeDetail: - type: signallerChange from: TVSC Twyford WS to: TVSC Reading WS + miles: 300 + chains: 7000 - type: crossovers name: Kennet Bridge Junction