Utilitaire statique d'export de la topologie ferroviaire en GeoJSON.
Plus de détails...
#include <TopologyRenderer.h>
|
| static void | exportToFile (const std::string &outputPath) |
| | Exporte la topologie ferroviaire dans un fichier GeoJSON.
|
| |
| static std::wstring | loadGeoJsonToWebView () |
| | Génère le script JavaScript d'injection GeoJSON dans le WebView.
|
| |
| static std::wstring | renderStraightBlock (const StraightBlock &straightBlock) |
| | Construit l'appel JS renderStraightBlock(id, Coordinates) pour un bloc.
|
| |
| static std::wstring | renderSwitchBlock (const SwitchBlock &sw) |
| | Construit l'appel JS renderSwitch(id, lat, lon, isDouble).
|
| |
| static std::wstring | renderSwitchBranches (const SwitchBlock &sw) |
| | Construit l'appel JS renderSwitchBranches(...) pour un switch.
|
| |
| static std::wstring | renderAllTopology () |
| | Génère le script JS complet de rendu de toute la topologie.
|
| |
| static std::wstring | updateSwitchBlocks (const SwitchBlock &sw) |
| | Génère le script JS de mise à jour visuelle d'un switch et ses partenaires.
|
| |
Utilitaire statique d'export de la topologie ferroviaire en GeoJSON.
Convertit :
Usage :
static void exportToFile(const std::string &outputPath)
Exporte la topologie ferroviaire dans un fichier GeoJSON.
Definition TopologyRenderer.cpp:188
◆ TopologyRenderer()
| TopologyRenderer::TopologyRenderer |
( |
| ) |
|
|
privatedelete |
◆ convertStraightToFeature()
Convertit un StraightBlock en feature GeoJSON de type LineString.
- Paramètres
-
| straight | Bloc à convertir. |
- Renvoie
- Objet JSON représentant la feature GeoJSON.
◆ convertSwitchToFeature()
Convertit un SwitchBlock en feature GeoJSON de type Point.
- Paramètres
-
| switchBlock | Bloc à convertir. |
- Renvoie
- Objet JSON représentant la feature GeoJSON.
◆ escapeForJavaScript()
| std::wstring TopologyRenderer::escapeForJavaScript |
( |
const std::string & |
input | ) |
|
|
staticprivate |
Échappe une chaîne JSON pour l'injection dans JavaScript.
- Paramètres
-
- Renvoie
- Chaîne échappée prête à être insérée dans un string JS.
Caractères échappés :
- " → \"
- \ → \
→ \n
- \r → \r
- \t → \t
◆ exportToFile()
| void TopologyRenderer::exportToFile |
( |
const std::string & |
outputPath | ) |
|
|
static |
Exporte la topologie ferroviaire dans un fichier GeoJSON.
- Paramètres
-
| outputPath | Chemin du fichier de sortie. |
◆ loadGeoJsonToWebView()
| std::wstring TopologyRenderer::loadGeoJsonToWebView |
( |
| ) |
|
|
static |
Génère le script JavaScript d'injection GeoJSON dans le WebView.
- Renvoie
- Instruction
window.loadGeoJson(...) prête pour executeScript.
◆ renderAllTopology()
| std::wstring TopologyRenderer::renderAllTopology |
( |
| ) |
|
|
static |
Génère le script JS complet de rendu de toute la topologie.
Produit en une seule passe :
- clearStraightBlocks() + renderStraightBlock() × N + zoomToStraights()
- clearSwitchBranches() + renderSwitchBranches() × M (switches orientés)
- clearSwitches() + renderSwitch() × M
Remplace les trois anciens renderAll*() par un point d'entrée unique destiné à MainWindow::onParsingSuccess().
- Renvoie
- Script JS complet — un seul executeScript() suffit.
◆ renderStraightBlock()
| std::wstring TopologyRenderer::renderStraightBlock |
( |
const StraightBlock & |
straightBlock | ) |
|
|
static |
Construit l'appel JS renderStraightBlock(id, Coordinates) pour un bloc.
- Paramètres
-
| straightBlock | Bloc à rendre (ignoré si < 2 coordonnées). |
- Renvoie
- Instruction JavaScript.
◆ renderSwitchBlock()
| std::wstring TopologyRenderer::renderSwitchBlock |
( |
const SwitchBlock & |
sw | ) |
|
|
static |
Construit l'appel JS renderSwitch(id, lat, lon, isDouble).
- Paramètres
-
- Renvoie
- Instruction JavaScript.
◆ renderSwitchBranches()
| std::wstring TopologyRenderer::renderSwitchBranches |
( |
const SwitchBlock & |
sw | ) |
|
|
static |
Construit l'appel JS renderSwitchBranches(...) pour un switch.
Émet les coordonnées de la jonction et des trois tips CDC. Un tip absent (nullopt) est encodé comme NaN,NaN et silencieusement ignoré côté JavaScript.
Signature JS : renderSwitchBranches(id, jLat, jLon, rootCoordinates, // [[lat,lon],...] ou null normalCoordinates, // [[lat,lon],...] ou null devCoordinates) // [[lat,lon],...] ou null
Pour les branches simples (non absorbées) : tableau à 1 point [tip]. Pour les branches absorbées (double switch) : polyligne complète. null si le tip est absent.
- Paramètres
-
- Renvoie
- Instruction JavaScript : Retourne une chaîne vide si le switch n'est pas orienté...
◆ updateSwitchBlocks()
| std::wstring TopologyRenderer::updateSwitchBlocks |
( |
const SwitchBlock & |
sw | ) |
|
|
static |
Génère le script JS de mise à jour visuelle d'un switch et ses partenaires.
Appelé par MainWindow::onSwitchClick() après toggleActiveBranch(). Propage automatiquement aux partenaires double switch si présents.
- Paramètres
-
| sw | Switch dont l'état vient d'être modifié. |
- Renvoie
- Série d'appels window.switchApplyState() prête pour executeScript().
La documentation de cette classe a été générée à partir des fichiers suivants :