|
| 1 | +# RoadNet Visualizer |
| 2 | + |
| 3 | +Multi-layer road network generator and visualizer built with Vite, PixiJS, and Web Workers. It supports path optimization (smoothing/orthogonalization), multi-layer navigation, interactive controls, export/share, and theming. |
| 4 | + |
| 5 | +[中文文档 | Chinese README](./README.zh-CN.md) |
| 6 | + |
| 7 | +[](https://deepwiki.com/Duri686/RoadNetVisualizer) |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +## Live Demo |
| 16 | + |
| 17 | +- GitHub Pages: [RoadNet Visualizer Demo](https://duri686.github.io/RoadNetVisualizer/) |
| 18 | +- Desktop and mobile supported. Latest Chrome/Edge recommended. |
| 19 | + |
| 20 | +## Table of Contents |
| 21 | + |
| 22 | +- [Features](#features) |
| 23 | +- [Preview](#preview) |
| 24 | +- [Getting Started](#getting-started) |
| 25 | + - [Requirements](#requirements) |
| 26 | + - [Local Development](#local-development) |
| 27 | + - [Build & Deploy](#build--deploy) |
| 28 | +- [Core Concepts & Architecture](#core-concepts--architecture) |
| 29 | +- [Config Examples](#config-examples) |
| 30 | +- [Roadmap](#roadmap) |
| 31 | +- [Contributing](#contributing) |
| 32 | +- [FAQ](#faq) |
| 33 | +- [License](#license) |
| 34 | +- [Acknowledgments](#acknowledgments) |
| 35 | + |
| 36 | +## Features |
| 37 | + |
| 38 | +- Multi-layer road networks |
| 39 | + Centroid network, portal midpoints, Voronoi skeleton (experimental) |
| 40 | +- Path planning and optimization |
| 41 | + A* pathfinding; smoothing and orthogonalization; timing metrics |
| 42 | +- Interaction and navigation |
| 43 | + Zoom, pan, node picking, layer toggles, canvas navigation controls |
| 44 | +- Export and sharing |
| 45 | + One-click export and share |
| 46 | +- Mobile friendly |
| 47 | + Better touch experience |
| 48 | +- Performance & observability |
| 49 | + Index building, render init/total time, data size metrics |
| 50 | +- Themes & styles |
| 51 | + Dark/monochrome themes, componentized style system |
| 52 | +- Docs & help |
| 53 | + DeepWiki integration for quick knowledge lookup |
| 54 | + |
| 55 | +## Preview |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | +## Getting Started |
| 63 | + |
| 64 | +### Requirements |
| 65 | + |
| 66 | +- Node.js >= 20 |
| 67 | +- Package manager: Yarn (via Corepack) |
| 68 | +- Browser: modern Chrome/Edge |
| 69 | + |
| 70 | +### Local Development |
| 71 | + |
| 72 | +```bash |
| 73 | +corepack enable |
| 74 | +yarn install --immutable |
| 75 | + |
| 76 | +# Start dev server |
| 77 | +yarn dev |
| 78 | + |
| 79 | +# Build |
| 80 | +yarn build |
| 81 | + |
| 82 | +# Preview (after build) |
| 83 | +yarn preview |
| 84 | +``` |
| 85 | + |
| 86 | +### Build & Deploy |
| 87 | + |
| 88 | +- GitHub Pages workflow: `.github/workflows/deploy.yml` |
| 89 | +- Push to `main` triggers build and deploy of `dist/` to GitHub Pages |
| 90 | +- Vite `base: './'` is configured for sub-path and Pages compatibility |
| 91 | + |
| 92 | +## Core Concepts & Architecture |
| 93 | + |
| 94 | +- Multi-layer network building |
| 95 | + - Centroid network: skeleton nodes from regions/grids |
| 96 | + - Portal midpoints: cross-partition connections |
| 97 | + - Voronoi skeleton (experimental): alternative representation using Voronoi edges/points |
| 98 | +- Path planning & optimization |
| 99 | + - Pathfinding: A* |
| 100 | + - Optimization: smoothing, orthogonalization for straighter, smoother lines |
| 101 | + - Metrics: timing breakdown for pathfinding and optimization |
| 102 | +- Rendering & interaction |
| 103 | + - Rendering: PixiJS (WebGL) |
| 104 | + - Interaction: zoom/pan, node picking, layer toggles, canvas navigation controls |
| 105 | + - Animation: moving ball along path |
| 106 | +- Concurrency & performance |
| 107 | + - Web Workers: index/compute off main thread |
| 108 | + - Observability: index duration, render init, total time, data size |
| 109 | + |
| 110 | +> Project structure reference: |
| 111 | +
|
| 112 | +```text |
| 113 | +src/ |
| 114 | +├── core/ # rendering core (render/view/layers/interaction/config + workers) |
| 115 | +├── core/interaction/ # interaction modules (events/pipeline/animation) |
| 116 | +├── utils/ # utilities (navigation/geometry/path/index/export/share/state ...) |
| 117 | +│ └── navigation/ # navigation submodules (centroid/portal/voronoi/partition ...) |
| 118 | +├── components/ # UI components (forms, progress, layer control) |
| 119 | +├── css/ # styles & themes (base/reset/tokens/utilities/layout/buttons/forms/...) |
| 120 | +└── main.js # app entry |
| 121 | +``` |
| 122 | + |
| 123 | +## Config Examples |
| 124 | + |
| 125 | +- Deploy: `vite.config.js` uses `base: './'` |
| 126 | +- Build: `build.outDir = dist`, `build.sourcemap = true` |
| 127 | +- Dev: `server.port = 3000`, `server.open = true` |
| 128 | +- Worker: `worker.format = 'es'` |
| 129 | + |
| 130 | +> If you plan to expose runtime/algorithm configs (e.g., grid size, weights, sampling density, smoothing factor), export them under `src/core/config/` and document here. |
| 131 | +
|
| 132 | +## Roadmap |
| 133 | + |
| 134 | +- [ ] More data formats for import/export (e.g., GeoJSON) |
| 135 | +- [ ] Richer weights/constraints (lanes/turns/restrictions/cost functions) |
| 136 | +- [ ] Enhanced optimization strategies (multi-objective/segmented) |
| 137 | +- [ ] Performance profiling panel and metric visualization |
| 138 | +- [ ] Unit tests and E2E coverage |
| 139 | +- [ ] i18n and accessibility (a11y) |
| 140 | +- [ ] More themes and visualization styles |
| 141 | + |
| 142 | +## Contributing |
| 143 | + |
| 144 | +- Branch model: feature/xxx -> PR to `main` |
| 145 | +- Conventions: Node 20 + Yarn, ESM, pass ESLint/Prettier |
| 146 | +- Steps: |
| 147 | + 1. Fork and create a feature branch |
| 148 | + 2. `corepack enable && yarn install --immutable` |
| 149 | + 3. `yarn dev` and ensure build passes |
| 150 | + 4. Open a PR with motivation and screenshots/diffs |
| 151 | + |
| 152 | +> Issues and suggestions are welcome. |
| 153 | +
|
| 154 | +## FAQ |
| 155 | + |
| 156 | +- Blank page on Pages? |
| 157 | + `base: './'` is set. If still broken, clear cache or verify Pages settings (branch/path). |
| 158 | +- Node version? |
| 159 | + Node >= 20. Use official LTS and enable Yarn via Corepack. |
| 160 | +- Local preview URL? |
| 161 | + `http://localhost:3000/` (Vite dev server). |
| 162 | +- Performance unstable? |
| 163 | + Use hardware-accelerated browsers with WebGL; for large data, reduce sampling or load in batches. |
| 164 | +- DeepWiki not showing? |
| 165 | + Check network or use the provided documentation link directly. |
| 166 | + |
| 167 | +## License |
| 168 | + |
| 169 | +Licensed under the PolyForm Noncommercial License 1.0.0. See [LICENSE](./LICENSE) for details. Commercial use is prohibited. For commercial licensing, please open an Issue to contact us. |
| 170 | + |
| 171 | +## Acknowledgments |
| 172 | + |
| 173 | +- [PixiJS](https://pixijs.com/) |
| 174 | +- [d3-delaunay](https://github.com/d3/d3-delaunay) |
| 175 | +- [Turf.js](https://turfjs.org/) |
| 176 | +- Vite & GitHub Actions |
| 177 | + |
| 178 | +--- |
| 179 | +Repository: [Duri686/RoadNetVisualizer](https://github.com/Duri686/RoadNetVisualizer) |
0 commit comments