# fryktoria/on-the-fly-shortest-path architecture

> Architecture diagram of the GitHub repository fryktoria/on-the-fly-shortest-path, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fryktoria/on-the-fly-shortest-path
- Repository: https://github.com/fryktoria/on-the-fly-shortest-path

## Overview

This QGIS plugin lets users measure routes interactively on a line network, optionally guiding the route through middle points, and reports distance plus a fiber-loss budget. The central plugin controller connects map interactions, route calculation, visualization, configuration, and results. The README documents Dijkstra-based routing and loss parameters; the supplied excerpts do not show the complete calculation or dialog wiring, so those links are shown only where documented or marked unverified.

Main entry points: [`onthefly_shortest_path.py`](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/onthefly_shortest_path.py) (Plugin controller), [`ui_Classes.py`](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/ui_Classes.py) (Dialog wrappers), [`flexjLineTool.py`](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/flexjLineTool.py) (Route drawing tool), [`geometry.py`](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/geometry.py) (Distance measurement)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Map interaction"]
  node_controller["Plugin controller"]
  node_vertex_tool["Snapping tool<br/>[vertexTool.py]"]
  node_route_tool["Route drawing tool<br/>[flexjLineTool.py]"]
  node_middle_points["Middle-point tool"]
  node_bridge_point_tool["Bridge-point tool"]
  node_bridge_line_tool["Bridge-line tool"]
  node_rubberband["Line visualization<br/>[flexjLine.py]"]
end

subgraph group_routing["Route and geometry"]
  node_path_calculation["Shortest-path calculation"]
  node_bridge_geometry["Network bridging<br/>[bridge.py]"]
  node_geometry["CRS and geometry<br/>[geometry.py]"]
end

subgraph group_analysis["Measurement and loss"]
  node_distance["Distance measurement<br/>[geometry.py]"]
  node_loss_budget["Fiber loss budget"]
  node_loss_profiles["Loss profiles<br/>[loss_profiles.json]"]
end

subgraph group_interface["Plugin interface"]
  node_configuration["Configuration dialog"]
  node_layer_selection["Layer selection dialog"]
  node_marker_coordinates["Marker coordinates dialog"]
  node_results_fiber["Fiber results dialog<br/>[ui_DlgResults.py]"]
  node_results_plain["Distance results dialog"]
  node_dialog_classes["Dialog wrappers<br/>[ui_Classes.py]"]
  node_dock_ui["Dock widget UI"]
end

node_user(("QGIS user"))
node_qgis["QGIS map canvas"]
node_network_analysis["QGIS Network Analysis"]

node_user -->|"selects map points"| node_qgis
node_qgis -.->|"delivers map input"| node_controller
node_controller -.->|"requests route"| node_path_calculation
node_path_calculation -->|"uses Dijkstra"| node_network_analysis
node_controller -->|"configures drawing"| node_route_tool
node_controller -.->|"configures snapping"| node_vertex_tool
node_controller -->|"accepts waypoints"| node_middle_points
node_controller -.->|"coordinates point bridging"| node_bridge_point_tool
node_controller -.->|"coordinates line bridging"| node_bridge_line_tool
node_route_tool -->|"inherits snapping"| node_vertex_tool
node_route_tool -->|"adds route points"| node_rubberband
node_bridge_line_tool -->|"draws bridge lines"| node_rubberband
node_bridge_point_tool -->|"inherits snapping"| node_vertex_tool
node_bridge_geometry -->|"uses geometry helper"| node_geometry
node_controller -.->|"prepares network bridging"| node_bridge_geometry
node_path_calculation -.->|"measures route"| node_distance
node_distance -->|"uses CRS measurements"| node_geometry
node_path_calculation -.->|"provides route"| node_loss_budget
node_loss_budget -.->|"loads profile values"| node_loss_profiles
node_loss_budget -.->|"reports loss budget"| node_results_fiber
node_distance -.->|"reports distance"| node_results_plain
node_controller -.->|"opens configuration"| node_configuration
node_controller -->|"selects network layers"| node_layer_selection
node_controller -.->|"sets marker coordinates"| node_marker_coordinates
node_controller -->|"uses dialog wrappers"| node_dialog_classes
node_dialog_classes -->|"wraps dialog"| node_configuration
node_dialog_classes -->|"wraps dialog"| node_layer_selection
node_dialog_classes -->|"wraps dialog"| node_marker_coordinates
node_dialog_classes -->|"wraps dialog"| node_results_fiber
node_dialog_classes -->|"wraps dialog"| node_results_plain
node_controller -.->|"uses dock controls"| node_dock_ui

click node_controller "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/onthefly_shortest_path.py"
click node_vertex_tool "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/vertexTool.py"
click node_route_tool "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/flexjLineTool.py"
click node_middle_points "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/onthefly_shortest_path.py"
click node_bridge_point_tool "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/bridgingPointTool.py"
click node_bridge_line_tool "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/bridgingLineTool.py"
click node_rubberband "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/flexjLine.py"
click node_path_calculation "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/onthefly_shortest_path.py"
click node_bridge_geometry "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/bridge.py"
click node_geometry "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/geometry.py"
click node_distance "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/geometry.py"
click node_loss_budget "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/onthefly_shortest_path.py"
click node_loss_profiles "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/profiles/loss_profiles.json"
click node_configuration "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/ui_DlgConfiguration.py"
click node_layer_selection "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/ui_DlgLayerSelection.py"
click node_marker_coordinates "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/ui_DlgMarkerCoordinates.py"
click node_results_fiber "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/ui_DlgResults.py"
click node_results_plain "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/ui_DlgResultsNoFiber.py"
click node_dialog_classes "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/ui_Classes.py"
click node_dock_ui "https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/ui_DlgDockWidget.py"

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_controller,node_vertex_tool,node_route_tool,node_middle_points,node_bridge_point_tool,node_bridge_line_tool,node_rubberband,node_user toneBlue
class node_path_calculation,node_bridge_geometry,node_geometry toneAmber
class node_distance,node_loss_budget,node_loss_profiles toneMint
class node_configuration,node_layer_selection,node_marker_coordinates,node_results_fiber,node_results_plain,node_dialog_classes,node_dock_ui toneRose
class node_qgis,node_network_analysis toneIndigo
```

## Components

### Map interaction

- [Plugin controller](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/onthefly_shortest_path.py): `onthefly_shortest_path.py`
- [Snapping tool](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/vertexTool.py): `vertexTool.py`
- [Route drawing tool](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/flexjLineTool.py): `flexjLineTool.py`
- [Middle-point tool](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/onthefly_shortest_path.py): `onthefly_shortest_path.py`
- [Bridge-point tool](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/bridgingPointTool.py): `bridgingPointTool.py`
- [Bridge-line tool](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/bridgingLineTool.py): `bridgingLineTool.py`
- [Line visualization](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/flexjLine.py): `flexjLine.py`

### Route and geometry

- [Shortest-path calculation](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/onthefly_shortest_path.py): `onthefly_shortest_path.py`
- [Network bridging](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/bridge.py): `bridge.py`
- [CRS and geometry](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/geometry.py): `geometry.py`

### Measurement and loss

- [Distance measurement](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/geometry.py): `geometry.py`
- [Fiber loss budget](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/onthefly_shortest_path.py): `onthefly_shortest_path.py`
- [Loss profiles](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/profiles/loss_profiles.json): `profiles/loss_profiles.json`

### Plugin interface

- [Configuration dialog](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/ui_DlgConfiguration.py): `ui_DlgConfiguration.py`
- [Layer selection dialog](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/ui_DlgLayerSelection.py): `ui_DlgLayerSelection.py`
- [Marker coordinates dialog](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/ui_DlgMarkerCoordinates.py): `ui_DlgMarkerCoordinates.py`
- [Fiber results dialog](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/ui_DlgResults.py): `ui_DlgResults.py`
- [Distance results dialog](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/ui_DlgResultsNoFiber.py): `ui_DlgResultsNoFiber.py`
- [Dialog wrappers](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/ui_Classes.py): `ui_Classes.py`
- [Dock widget UI](https://github.com/fryktoria/on-the-fly-shortest-path/blob/main/ui_DlgDockWidget.py): `ui_DlgDockWidget.py`

### Other components

- **QGIS user**
- **QGIS map canvas**
- **QGIS Network Analysis**

## Connections

- QGIS user → QGIS map canvas: selects map points (evidence: `README.md`)
- QGIS map canvas → Plugin controller: delivers map input
- Plugin controller → Shortest-path calculation: requests route (evidence: `onthefly_shortest_path.py`)
- Shortest-path calculation → QGIS Network Analysis: uses Dijkstra (evidence: `README.md`)
- Plugin controller → Route drawing tool: configures drawing (evidence: `onthefly_shortest_path.py`)
- Plugin controller → Snapping tool: configures snapping (evidence: `onthefly_shortest_path.py`)
- Plugin controller → Middle-point tool: accepts waypoints (evidence: `README.md`)
- Plugin controller → Bridge-point tool: coordinates point bridging (evidence: `onthefly_shortest_path.py`)
- Plugin controller → Bridge-line tool: coordinates line bridging (evidence: `onthefly_shortest_path.py`)
- Route drawing tool → Snapping tool: inherits snapping (evidence: `flexjLineTool.py`)
- Route drawing tool → Line visualization: adds route points (evidence: `flexjLineTool.py`)
- Bridge-line tool → Line visualization: draws bridge lines (evidence: `bridgingLineTool.py`)
- Bridge-point tool → Snapping tool: inherits snapping (evidence: `bridgingPointTool.py`)
- Network bridging → CRS and geometry: uses geometry helper (evidence: `bridge.py`)
- Plugin controller → Network bridging: prepares network bridging (evidence: `onthefly_shortest_path.py`)
- Shortest-path calculation → Distance measurement: measures route (evidence: `onthefly_shortest_path.py`)
- Distance measurement → CRS and geometry: uses CRS measurements (evidence: `geometry.py`)
- Shortest-path calculation → Fiber loss budget: provides route (evidence: `onthefly_shortest_path.py`)
- Fiber loss budget → Loss profiles: loads profile values
- Fiber loss budget → Fiber results dialog: reports loss budget
- Distance measurement → Distance results dialog: reports distance
- Plugin controller → Configuration dialog: opens configuration
- Plugin controller → Layer selection dialog: selects network layers (evidence: `onthefly_shortest_path.py`)
- Plugin controller → Marker coordinates dialog: sets marker coordinates
- Plugin controller → Dialog wrappers: uses dialog wrappers (evidence: `onthefly_shortest_path.py`)
- Dialog wrappers → Configuration dialog: wraps dialog (evidence: `ui_Classes.py`)
- Dialog wrappers → Layer selection dialog: wraps dialog (evidence: `ui_Classes.py`)
- Dialog wrappers → Marker coordinates dialog: wraps dialog (evidence: `ui_Classes.py`)
- Dialog wrappers → Fiber results dialog: wraps dialog (evidence: `ui_Classes.py`)
- Dialog wrappers → Distance results dialog: wraps dialog (evidence: `ui_Classes.py`)
- Plugin controller → Dock widget UI: uses dock controls
