Simulateur Ferroviaire
Reconstruction et visualisation d'un réseau ferroviaire à partir de données GeoJSON — Win32 / WebView2 / Leaflet
Chargement...
Recherche...
Aucune correspondance
StraightBlock.h
Aller à la documentation de ce fichier.
1
13#pragma once
14
15#include <string>
16#include <vector>
17
18#include "ShuntingElement.h"
21
22
24{
25public:
26
27 // =========================================================================
28 // Construction
29 // =========================================================================
30
38 StraightBlock() = default;
39
40 // =========================================================================
41 // Interface ShuntingElement
42 // =========================================================================
43
44 [[nodiscard]] std::string getId() const override { return m_id; }
45 [[nodiscard]] ElementType getType() const override { return ElementType::STRAIGHT; }
46 [[nodiscard]] ShuntingState getState() const override { return m_state; }
47
48 void setState(ShuntingState state) { m_state = state; }
49
50 // =========================================================================
51 // Requêtes géométriques
52 // =========================================================================
53
58 [[nodiscard]] const std::vector<CoordinateLatLon>& getPointsWGS84() const { return m_pointsWGS84; }
59
65 [[nodiscard]] const std::vector<CoordinateXY>& getPointsUTM() const { return m_pointsUTM; }
66
71 [[nodiscard]] std::vector<CoordinateXY>& getPointsUTMRef() { return m_pointsUTM; }
72
77 [[nodiscard]] double getLengthMeters() const { return m_lengthMeters; }
78
83 [[nodiscard]] double getLengthUTM() const;
84
85 // =========================================================================
86 // Requêtes topologiques
87 // =========================================================================
88
93 [[nodiscard]] const std::vector<std::string>& getNeighbourIds() const { return m_neighbourIds; }
94
102 {
105 };
106
108 [[nodiscard]] const StraightNeighbours& getNeighbours() const { return m_neighbours; }
109
111 [[nodiscard]] std::string toString() const;
112
113 // =========================================================================
114 // Mutations — identifiant
115 // =========================================================================
116
123 void setId(std::string id) { m_id = std::move(id); }
124
125 // =========================================================================
126 // Mutations — géométrie
127 // =========================================================================
128
134 void setPointsWGS84(std::vector<CoordinateLatLon> points);
135
141 void setPointsUTM(std::vector<CoordinateXY> points) { m_pointsUTM = std::move(points); }
142
143 // =========================================================================
144 // Mutations — topologie IDs
145 // =========================================================================
146
151 void addNeighbourId(const std::string& id);
152
157 void replaceNeighbourId(const std::string& oldId, const std::string& newId);
158
159 // =========================================================================
160 // Mutations — pointeurs résolus (Phase9_RepositoryTransfer)
161 // =========================================================================
162
169
176
182 void setNeighbourPointers(StraightNeighbours neighbours);
183
184private:
185
191 std::vector<CoordinateLatLon> m_pointsWGS84;
192
198 std::vector<CoordinateXY> m_pointsUTM;
199
204 std::vector<std::string> m_neighbourIds;
205
212
217 double m_lengthMeters = 0.0;
218
221
226 [[nodiscard]] double computeGeodesicLength() const;
227};
Représentation d'une coordonnée géographique WGS-84 (latitude, longitude).
Représentation d'une coordonnée plane en mètres (système métrique UTM).
ElementType
Types d'éléments interactifs ferroviaires.
Definition Element.h:18
Interface abstraite pour tous les éléments de shuntage ferroviaire.
ShuntingState
État opérationnel d'un élément de shuntage.
Definition ShuntingElement.h:18
std::string m_id
id de l'element
Definition Element.h:71
Interface abstraite pour tous les éléments de shuntage ferroviaire.
Definition ShuntingElement.h:39
Definition StraightBlock.h:24
ElementType getType() const override
Retourne le type de l'élément.
Definition StraightBlock.h:45
void setNeighbourNext(ShuntingElement *elem)
Assigne le voisin côté extrémité B.
Definition StraightBlock.h:175
std::vector< CoordinateXY > m_pointsUTM
Definition StraightBlock.h:198
void setPointsWGS84(std::vector< CoordinateLatLon > points)
Remplace la polyligne WGS84 et recalcule la longueur géodésique.
Definition StraightBlock.cpp:42
std::string toString() const
Représentation textuelle pour le débogage.
Definition StraightBlock.cpp:104
void setState(ShuntingState state)
Definition StraightBlock.h:48
double m_lengthMeters
Definition StraightBlock.h:217
ShuntingState m_state
Definition StraightBlock.h:220
std::string getId() const override
Retourne l'identifiant unique de l'élément (ex. "sw/3", "s/12").
Definition StraightBlock.h:44
double computeGeodesicLength() const
Calcule la longueur géodésique totale depuis m_pointsWGS84. Somme des distances Haversine entre chaqu...
Definition StraightBlock.cpp:134
const StraightNeighbours & getNeighbours() const
Retourne les voisins résolus. nullptr si non encore initialisé.
Definition StraightBlock.h:108
std::vector< CoordinateLatLon > m_pointsWGS84
Definition StraightBlock.h:191
void addNeighbourId(const std::string &id)
Ajoute un voisin en maintenant l'ordre lexicographique. Pas de doublon.
Definition StraightBlock.cpp:53
void setNeighbourPrev(ShuntingElement *elem)
Assigne le voisin côté extrémité A.
Definition StraightBlock.h:168
void setNeighbourPointers(StraightNeighbours neighbours)
Enregistre les pointeurs prev/next en une seule opération.
Definition StraightBlock.cpp:76
void setId(std::string id)
Assigne l'identifiant du bloc. Appelé par Phase6_BlockExtractor lors de la création du bloc.
Definition StraightBlock.h:123
void setPointsUTM(std::vector< CoordinateXY > points)
Assigne la polyligne UTM.
Definition StraightBlock.h:141
StraightBlock()=default
Constructeur par défaut.
const std::vector< CoordinateXY > & getPointsUTM() const
Polyligne projetée en UTM (x = est, y = nord, mètres). Même taille et même index que getPointsWGS84()...
Definition StraightBlock.h:65
std::vector< std::string > m_neighbourIds
Definition StraightBlock.h:204
const std::vector< std::string > & getNeighbourIds() const
Identifiants des blocs adjacents (StraightBlock ou SwitchBlock). Triés lexicographiquement — addNeigh...
Definition StraightBlock.h:93
StraightNeighbours m_neighbours
Definition StraightBlock.h:211
std::vector< CoordinateXY > & getPointsUTMRef()
Référence modifiable sur la polyligne UTM. Utilisée par Phase7_SwitchProcessor::trimStraightOverlaps(...
Definition StraightBlock.h:71
double getLengthUTM() const
Longueur euclidienne en mètres depuis les coordonnées UTM. Retourne 0 si pointsUTM est vide ou contie...
Definition StraightBlock.cpp:90
double getLengthMeters() const
Longueur géodésique Haversine en mètres (depuis pointsWGS84). Mise à jour par setPointsWGS84().
Definition StraightBlock.h:77
const std::vector< CoordinateLatLon > & getPointsWGS84() const
Polyligne WGS-84 ordonnée. Premier point = extrémité A. Dernier point = extrémité B.
Definition StraightBlock.h:58
void replaceNeighbourId(const std::string &oldId, const std::string &newId)
Remplace un ID de voisin par un autre. Utilisé lors de l'absorption du segment de liaison double swit...
Definition StraightBlock.cpp:61
ShuntingState getState() const override
Retourne l'état opérationnel courant de l'élément.
Definition StraightBlock.h:46
Voisins topologiques résolus (pointeurs non-propriétaires).
Definition StraightBlock.h:102
ShuntingElement * next
Bloc adjacent à l'extrémité B.
Definition StraightBlock.h:104
ShuntingElement * prev
Bloc adjacent à l'extrémité A.
Definition StraightBlock.h:103