# Derail Valley Community Map with Catenary DC Layer Interactive vector web map of Derail Valley railway network with DC electrification infrastructure overlay (Catenary-DC / WE6SIM mod). ## Architecture & Stack - **Frontend**: Vanilla ES6 modules, HTML5 Canvas 2D (double-buffered with dynamic overlay). - **Coordinate System**: Game engine coordinates (meters), origin at bottom-left, mapped via `Matrix` and `View` transforms. - **Datasets**: - `catenary_dv.json`: 164 chained polylines (optimized from 3,751 segments), 9 traction substations, 5 neutral sections, 34 interruption clusters, 129 warning signs. - `trackdata_dv.json`: Rail tracks (cubic Bézier curves) and junction points. - `poi_dv.json`: Stations, offices, service tracks, turntables, landmarks. - `shop_items.json`: Shop inventories and prices. ## Catenary Layer Features - **Wire Suspension Rendering**: - `Single` (6.0m, 1500V/750V): standard solid vector line. - `Dual` (6.0m, 1500V): high-capacity twin catenary stroke. - `Quad` (6.0m, 1500V): heavy 4-wire mountain pass stroke with dark border. - `Trolley` (6.0m, 750V): fine yard wire. - `Side Rail` (4.5m, 1000V): dashed 3rd contact rail at IME and SM mine tracks. - `Neutral Sections` (0V): contrasting red-and-white dashed lines with `0V` danger badges. - **Color Modes**: - `Voltage`: 1500V DC (`#00d2ff`), 1000V DC (`#ff9f1c`), 750V DC (`#2ec4b6`), 0V Neutral (`#e63946`). - `Substation`: Distinct color per feeding substation (CME/IME1500, CP750, FF1500, HB1500, IME1000, IMW1500, OR750, SM1500, SM1000). - `Wire Type`: Color-coded by physical suspension category. - **Markers & Tooltips**: - Traction Substations: `⚡` badge with nominal voltage, supply voltage, max load (kW), and regenerative inverter presence. - Neutral Sections: `⛔` badge with section ID, length, connecting substations, and disconnect traction warning. - Interruption Signs: `⤓` diamond badge for pantograph drop/raise warnings. - Contact Wires: Nearest-point hovering displaying voltage, substation feed, category, and segment length. ## CommunityMapLocation Mod Integration ### Bug Fixes 1. **Rotation Desync**: `LocationResponse` accepts `rotationTransform` from locomotive transform or camera heading (fixing player orientation desync). 2. **URL Formatting**: Fixed string immutability bug in `address.replaceAll` inside `connectPlayerLocation`. ### CORS Configuration In `/Mods/CommunityMapLocation/Settings.xml`: ```xml 9090 Any http://localhost:8080 ``` *Note: If `RequestSourceType` is `Any`, the game mod allows cross-origin requests from any web host (localhost, GitHub Pages, Gitea).* ## CI/CD Workflows - **Gitea Actions** (`.gitea/workflows/deploy.yaml`): JSON dataset validation, JS syntax verification, artifact packaging with `actions/upload-artifact@v3`, releases with `akkuman/gitea-release-action@v1`. - **GitHub Pages** (`.github/workflows/deploy-pages.yml`): Automated GitHub Pages deployment on push to `main`.