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-2023 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// ===========================================================================
27// class declarations
28// ===========================================================================
30class PositionVector;
31class GNEJunction;
32class GNEEdge;
33
34
35// ===========================================================================
36// class definitions
37// ===========================================================================
45
46public:
48 GNECrossing(GNENet* net);
49
54 GNECrossing(GNEJunction* parentJunction, std::vector<NBEdge*> edges);
55
58
60 bool isNetworkElementValid() const;
61
63 std::string getNetworkElementProblem() const;
64
68 const PositionVector& getCrossingShape() const;
69
71 void updateGeometry();
72
76
81
83 void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
85
88
90 const std::vector<NBEdge*>& getCrossingEdges() const;
91
94
97
105
107 void updateCenteringBoundary(const bool updateGrid);
108
113 void drawGL(const GUIVisualizationSettings& s) const;
114
116 void deleteGLObject();
117
119 void updateGLObject();
120
122
125 /* @brief method for getting the Attribute of an XML key
126 * @param[in] key The attribute key
127 * @return string with the value associated to key
128 */
129 std::string getAttribute(SumoXMLAttr key) const;
130
131 /* @brief method for setting the attribute and letting the object perform additional changes
132 * @param[in] key The attribute key
133 * @param[in] value The new value
134 * @param[in] undoList The undoList on which to register changes
135 */
136 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
137
138 /* @brief method for checking if the key and their correspond attribute are valids
139 * @param[in] key The attribute key
140 * @param[in] value The value associated to key key
141 * @return true if the value is valid, false in other case
142 */
143 bool isValid(SumoXMLAttr key, const std::string& value);
144
145 /* @brief method for check if the value for certain attribute is set
146 * @param[in] key The attribute key
147 */
148 bool isAttributeEnabled(SumoXMLAttr key) const;
149
151
154
156 bool checkEdgeBelong(GNEEdge* edges) const;
157
159 bool checkEdgeBelong(const std::vector<GNEEdge*>& edges) const;
160
161protected:
164
166 std::vector<NBEdge*> myCrossingEdges;
167
170
173
174private:
176 void setAttribute(SumoXMLAttr key, const std::string& value);
177
179 void setMoveShape(const GNEMoveResult& moveResult);
180
182 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
183
185 void drawTLSLinkNo(const GUIVisualizationSettings& s, const NBNode::Crossing* crossing) const;
186
188 GNECrossing(const GNECrossing&) = delete;
189
192};
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition GNECrossing.h:44
std::string getAttribute(SumoXMLAttr key) const
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
std::vector< NBEdge * > myCrossingEdges
Crossing Edges (It works as ID because a junction can only ONE Crossing with the same edges)
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
const Parameterised::Map & getACParametersMap() const
get parameters map
bool isNetworkElementValid() const
check if current network element is valid to be written into XML
void deleteGLObject()
delete element
void updateGeometry()
update pre-computed geometry information
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void updateGLObject()
update GLObject (geometry, ID, etc.)
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
bool checkEdgeBelong(GNEEdge *edges) const
return true if a edge belongs to crossing's edges
GNEJunction * myParentJunction
the parent junction of this crossing
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
GUIGeometry myCrossingGeometry
crossing geometry
bool isAttributeEnabled(SumoXMLAttr key) const
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
GNECrossing(const GNECrossing &)=delete
Invalidated copy constructor.
GNEJunction * getParentJunction() const
get parent Junction
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
std::string getNetworkElementProblem() const
return a string with the current network element problem
const PositionVector & getCrossingShape() const
~GNECrossing()
Destructor.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
NBNode::Crossing * myTemplateNBCrossing
template NBCrossing
GNECrossing & operator=(const GNECrossing &)=delete
Invalidated assignment operator.
bool isValid(SumoXMLAttr key, const std::string &value)
GNEMoveOperation * getMoveOperation()
get move operation
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
move operation
move result
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
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.