Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNECrossing.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// A class for visualizing Inner Lanes (used when editing traffic lights)
19/****************************************************************************/
20#pragma once
21#include <config.h>
22#include "GNENetworkElement.h"
23#include <netbuild/NBNode.h>
24
25// ===========================================================================
26// class declarations
27// ===========================================================================
28
29class GNEEdge;
30class GNEJunction;
33class PositionVector;
34
35// ===========================================================================
36// class definitions
37// ===========================================================================
38
39
41
42public:
44 GNECrossing(GNENet* net);
45
50 GNECrossing(GNEJunction* junction, std::vector<NBEdge*> edges);
51
54
57
59 GNEMoveElement* getMoveElement() const override;
60
62 Parameterised* getParameters() override;
63
65 const Parameterised* getParameters() const override;
66
68
70 bool isNetworkElementValid() const;
71
73 std::string getNetworkElementProblem() const;
74
77
79 const PositionVector& getCrossingShape() const;
80
82 void updateGeometry() override;
83
86
88
91
93 bool checkDrawFromContour() const override;
94
96 bool checkDrawToContour() const override;
97
99 bool checkDrawRelatedContour() const override;
100
102 bool checkDrawOverContour() const override;
103
105 bool checkDrawDeleteContour() const override;
106
108 bool checkDrawDeleteContourSmall() const override;
109
111 bool checkDrawSelectContour() const override;
112
114 bool checkDrawMoveContour() const override;
115
117
119 const std::vector<NBEdge*>& getCrossingEdges() const;
120
123
126
134
137
139 void updateCenteringBoundary(const bool updateGrid);
140
145 void drawGL(const GUIVisualizationSettings& s) const;
146
148 void deleteGLObject();
149
151 void updateGLObject();
152
154
157 /* @brief method for getting the Attribute of an XML key
158 * @param[in] key The attribute key
159 * @return string with the value associated to key
160 */
161 std::string getAttribute(SumoXMLAttr key) const override;
162
163 /* @brief method for getting the Attribute of an XML key in double format
164 * @param[in] key The attribute key
165 * @return double with the value associated to key
166 */
167 double getAttributeDouble(SumoXMLAttr key) const override;
168
169 /* @brief method for getting the Attribute of an XML key in position format
170 * @param[in] key The attribute key
171 * @return position with the value associated to key
172 */
173 Position getAttributePosition(SumoXMLAttr key) const override;
174
175 /* @brief method for getting the Attribute of an XML key in Position format
176 * @param[in] key The attribute key
177 * @return position with the value associated to key
178 */
180
181 /* @brief method for setting the attribute and letting the object perform additional changes
182 * @param[in] key The attribute key
183 * @param[in] value The new value
184 * @param[in] undoList The undoList on which to register changes
185 */
186 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
187
188 /* @brief method for checking if the key and their correspond attribute are valids
189 * @param[in] key The attribute key
190 * @param[in] value The value associated to key key
191 * @return true if the value is valid, false in other case
192 */
193 bool isValid(SumoXMLAttr key, const std::string& value) override;
194
195 /* @brief method for check if the value for certain attribute is set
196 * @param[in] key The attribute key
197 */
198 bool isAttributeEnabled(SumoXMLAttr key) const;
199
201
203 bool checkEdgeBelong(GNEEdge* edges) const;
204
206 bool checkEdgeBelong(const std::vector<GNEEdge*>& edges) const;
207
208protected:
211
213 std::vector<NBEdge*> myCrossingEdges;
214
217
220
221private:
223 bool checkDrawCrossing(const GUIVisualizationSettings& s) const;
224
227 const NBNode::Crossing* crossing, const double width, const double exaggeration) const;
228
231
233 void drawCrossingDetailed(const double width, const double exaggeration) const;
234
237 const double width, const double exaggeration) const;
238
240 void setAttribute(SumoXMLAttr key, const std::string& value) override;
241
243 void drawTLSLinkNo(const GUIVisualizationSettings& s, const NBNode::Crossing* crossing) const;
244
246 GNECrossing(const GNECrossing&) = delete;
247
250};
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
bool checkDrawCrossing(const GUIVisualizationSettings &s) const
check if draw crossing
std::vector< NBEdge * > myCrossingEdges
Crossing Edges (It works as ID because a junction can only ONE Crossing with the same edges)
std::string getAttribute(SumoXMLAttr key) const override
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
GNEMoveElementCrossing * myMoveElementCrossing
move element crossing
bool isNetworkElementValid() const
check if current network element is valid to be written into XML
void deleteGLObject()
delete element
void updateGLObject()
update GLObject (geometry, ID, etc.)
void drawCrossing(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const NBNode::Crossing *crossing, const double width, const double exaggeration) const
draw crossing
Position getPositionInView() const
Returns position of hierarchical element in view.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void drawTLSLinkNo(const GUIVisualizationSettings &s, const NBNode::Crossing *crossing) const
draw TLS Link Number
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
bool checkEdgeBelong(GNEEdge *edges) const
return true if a edge belongs to crossing's edges
Position getAttributePosition(SumoXMLAttr key) const override
bool checkDrawFromContour() const override
check if draw from contour (green)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
bool isValid(SumoXMLAttr key, const std::string &value) override
Parameterised * getParameters() override
get parameters associated with this crossing
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
PositionVector getAttributePositionVector(SumoXMLAttr key) const
GUIGeometry myCrossingGeometry
crossing geometry
bool isAttributeEnabled(SumoXMLAttr key) const
GNECrossing(const GNECrossing &)=delete
Invalidated copy constructor.
bool checkDrawRelatedContour() const override
check if draw related contour (cyan)
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this crossing
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
bool checkDrawDeleteContourSmall() const override
check if draw delete contour small (pink/white)
bool checkDrawSelectContour() const override
check if draw select contour (blue)
bool checkDrawMoveContour() const override
check if draw move contour (red)
std::string getNetworkElementProblem() const
return a string with the current network element problem
const PositionVector & getCrossingShape() const
get Crossing shape
void updateGeometry() override
update pre-computed geometry information
~GNECrossing()
Destructor.
void calculateCrossingContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double width, const double exaggeration) const
calculate contour
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
bool checkDrawOverContour() const override
check if draw over contour (orange)
NBNode::Crossing * myTemplateNBCrossing
template NBCrossing
GNECrossing & operator=(const GNECrossing &)=delete
Invalidated assignment operator.
RGBColor getCrossingColor(const GUIVisualizationSettings &s, const NBNode::Crossing *crossing) const
get crossing color
bool checkDrawToContour() const override
check if draw from contour (magenta)
void drawCrossingDetailed(const double width, const double exaggeration) const
draw crossing with hight detail
bool checkDrawDeleteContour() const override
check if draw delete contour (pink/white)
double getAttributeDouble(SumoXMLAttr key) const override
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
The popup menu of a globject.
Stores the information about how to visualize structures.
A definition of a pedestrian crossing.
Definition NBNode.h:135
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.