# mr-pairot/bpnp_map_demo architecture

> Architecture diagram of the GitHub repository mr-pairot/bpnp_map_demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mr-pairot/bpnp_map_demo
- Repository: https://github.com/mr-pairot/bpnp_map_demo

## Overview

This repository appears to implement a Thai-language web map for monitoring a double-track railway project. The likely user workflow is to open the map, inspect construction and infrastructure layers, and use map tools or panels for detailed progress and location information. Major capabilities include bridge and track progress, earthworks, signalling, signs, measurement, routing, search, and account access. The README is empty; several components are represented by the source index or filenames, so links between unsampled modules are omitted rather than assumed.

Main entry points: [`js/BridgeLayerManager.js`](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/BridgeLayerManager.js) (Bridge layers), [`js/sw_light_manager.js`](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/sw_light_manager.js) (Light signalling), [`js/ui_manager.js`](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/ui_manager.js) (UI management), [`js/main.js`](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/main.js) (Map application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_map["Map and navigation"]
  node_main["Map application<br/>[main.js]"]
  node_mapui["Map controls<br/>[map_ui.js]"]
  node_search["Map search<br/>[leaflet-search.js]"]
  node_address["Address search<br/>[search_address.js]"]
  node_stationsearch["Station search<br/>[search_sta.js]"]
  node_routing["Route planning<br/>[routing_main.js]"]
  node_routingui["Route interface<br/>[routing_ui.js]"]
  node_measurement["Map measurement"]
end

subgraph group_construction["Construction progress"]
  node_bridge["Bridge layers"]
  node_bridgepanel["Bridge details"]
  node_trackprogress["Track progress"]
  node_earthworks["Earthworks<br/>[embankment.js]"]
  node_excavation["Excavation<br/>[excavate.js]"]
  node_swsummary["Track summary"]
end

subgraph group_infrastructure["Railway infrastructure"]
  node_swloc["LOC signalling<br/>[sw_loc_manager.js]"]
  node_swlight["Light signalling"]
  node_signs["Sign placement<br/>[signManager.js]"]
  node_heightsigns["Height-limit signs"]
  node_bridgeimages["Bridge imagery<br/>[bridge_image.js]"]
end

subgraph group_app["Application services"]
  node_auth["User authentication<br/>[auth.js]"]
  node_uimanager["UI management<br/>[ui_manager.js]"]
  node_popup["Popup rendering<br/>[popupEngine.js]"]
  node_offline["Offline cache<br/>[sw.js]"]
end

node_user(("Map user"))

node_user -.->|"opens"| node_main
node_bridge -->|"loads imagery"| node_bridgeimages
node_swlight -.->|"opens panel"| node_swsummary
node_uimanager -->|"creates manager"| node_signs

click node_main "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/main.js"
click node_mapui "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/map_ui.js"
click node_search "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/leaflet-search.js"
click node_address "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/search_address.js"
click node_stationsearch "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/search_sta.js"
click node_routing "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/routing_main.js"
click node_routingui "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/routing_ui.js"
click node_measurement "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/measurement-plus.js"
click node_bridge "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/BridgeLayerManager.js"
click node_bridgepanel "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/BridgeBottomPanel.js"
click node_trackprogress "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/tw_ProgressManager.js"
click node_earthworks "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/embankment.js"
click node_excavation "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/excavate.js"
click node_swsummary "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/sw_summary_panel.js"
click node_swloc "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/sw_loc_manager.js"
click node_swlight "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/sw_light_manager.js"
click node_signs "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/signManager.js"
click node_heightsigns "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/HeightSignManager.js"
click node_bridgeimages "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/bridge_image.js"
click node_auth "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/auth.js"
click node_uimanager "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/ui_manager.js"
click node_popup "https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/popupEngine.js"
click node_offline "https://github.com/mr-pairot/bpnp_map_demo/blob/main/sw.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_mapui,node_search,node_address,node_stationsearch,node_routing,node_routingui,node_measurement,node_user toneBlue
class node_bridge,node_bridgepanel,node_trackprogress,node_earthworks,node_excavation,node_swsummary toneAmber
class node_swloc,node_swlight,node_signs,node_heightsigns,node_bridgeimages toneMint
class node_auth,node_uimanager,node_popup,node_offline toneRose
```

## Components

### Map and navigation

- [Map application](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/main.js): `js/main.js`
- [Map controls](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/map_ui.js): `js/map_ui.js`
- [Map search](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/leaflet-search.js): `js/leaflet-search.js`
- [Address search](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/search_address.js): `js/search_address.js`
- [Station search](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/search_sta.js): `js/search_sta.js`
- [Route planning](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/routing_main.js): `js/routing_main.js`
- [Route interface](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/routing_ui.js): `js/routing_ui.js`
- [Map measurement](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/measurement-plus.js): `js/measurement-plus.js`

### Construction progress

- [Bridge layers](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/BridgeLayerManager.js): `js/BridgeLayerManager.js`
- [Bridge details](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/BridgeBottomPanel.js): `js/BridgeBottomPanel.js`
- [Track progress](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/tw_ProgressManager.js): `js/tw_ProgressManager.js`
- [Earthworks](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/embankment.js): `js/embankment.js`
- [Excavation](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/excavate.js): `js/excavate.js`
- [Track summary](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/sw_summary_panel.js): `js/sw_summary_panel.js`

### Railway infrastructure

- [LOC signalling](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/sw_loc_manager.js): `js/sw_loc_manager.js`
- [Light signalling](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/sw_light_manager.js): `js/sw_light_manager.js`
- [Sign placement](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/signManager.js): `js/signManager.js`
- [Height-limit signs](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/HeightSignManager.js): `js/HeightSignManager.js`
- [Bridge imagery](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/bridge_image.js): `js/bridge_image.js`

### Application services

- [User authentication](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/auth.js): `js/auth.js`
- [UI management](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/ui_manager.js): `js/ui_manager.js`
- [Popup rendering](https://github.com/mr-pairot/bpnp_map_demo/blob/main/js/popupEngine.js): `js/popupEngine.js`
- [Offline cache](https://github.com/mr-pairot/bpnp_map_demo/blob/main/sw.js): `sw.js`

### Other components

- **Map user**

## Connections

- Map user → Map application: opens
- Bridge layers → Bridge imagery: loads imagery
- Light signalling → Track summary: opens panel
- UI management → Sign placement: creates manager (evidence: `js/ui_manager.js`)
