Eclipse SUMO - Simulation of Urban MObility
GNECrossing.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A class for visualizing Inner Lanes (used when editing traffic lights)
16 /****************************************************************************/
17 #ifndef GNECrossing_h
18 #define GNECrossing_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
25 #include "GNENetElement.h"
26 #include <netbuild/NBNode.h>
27 
28 // ===========================================================================
29 // class declarations
30 // ===========================================================================
32 class PositionVector;
33 class GNEJunction;
34 class GNEEdge;
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
45 class GNECrossing : public GNENetElement {
46 public:
47 
52  GNECrossing(GNEJunction* parentJunction, std::vector<NBEdge*> edges);
53 
55  ~GNECrossing();
56 
58  std::string generateChildID(SumoXMLTag childTag);
59 
63  void updateGeometry();
64 
68 
71 
73  const std::vector<NBEdge*>& getCrossingEdges() const;
74 
77 
80 
88 
95 
100  void drawGL(const GUIVisualizationSettings& s) const;
102 
105  /* @brief method for getting the Attribute of an XML key
106  * @param[in] key The attribute key
107  * @return string with the value associated to key
108  */
109  std::string getAttribute(SumoXMLAttr key) const;
110 
111  /* @brief method for setting the attribute and letting the object perform additional changes
112  * @param[in] key The attribute key
113  * @param[in] value The new value
114  * @param[in] undoList The undoList on which to register changes
115  */
116  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
117 
118  /* @brief method for checking if the key and their correspond attribute are valids
119  * @param[in] key The attribute key
120  * @param[in] value The value asociated to key key
121  * @return true if the value is valid, false in other case
122  */
123  bool isValid(SumoXMLAttr key, const std::string& value);
125 
128 
130  std::string getGenericParametersStr() const;
131 
133  std::vector<std::pair<std::string, std::string> > getGenericParameters() const;
134 
136  void setGenericParametersStr(const std::string& value);
137 
139 
141  bool checkEdgeBelong(GNEEdge* edges) const;
142 
144  bool checkEdgeBelong(const std::vector<GNEEdge*>& edges) const;
145 
146 protected:
149 
151  std::vector<NBEdge*> myCrossingEdges;
152 
153 private:
155  void setAttribute(SumoXMLAttr key, const std::string& value);
156 
158  void drawTLSLinkNo(const GUIVisualizationSettings& s) const;
159 
161  GNECrossing(const GNECrossing&) = delete;
162 
164  GNECrossing& operator=(const GNECrossing&) = delete;
165 };
166 
167 
168 #endif
169 
170 /****************************************************************************/
171 
GNECrossing(GNEJunction *parentJunction, std::vector< NBEdge *> edges)
Constructor.
Definition: GNECrossing.cpp:42
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
SumoXMLTag
Numbers representing SUMO-XML - element names.
bool checkEdgeBelong(GNEEdge *edges) const
return true if a edge belongs to crossing&#39;s edges
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
Definition: GNECrossing.cpp:88
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNECrossing.cpp:75
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Stores the information about how to visualize structures.
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNECrossing.cpp:53
std::string getGenericParametersStr() const
return generic parameters in string format
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void updateGeometry()
update pre-computed geometry information
Definition: GNECrossing.cpp:60
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:45
std::vector< NBEdge * > myCrossingEdges
Crossing Edges (It works as ID because a junction can only ONE Crossing with the same edges) ...
Definition: GNECrossing.h:151
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
A list of positions.
GNEJunction * myParentJunction
the parent junction of this crossing
Definition: GNECrossing.h:148
void drawTLSLinkNo(const GUIVisualizationSettings &s) const
draw TLS Link Number
GNECrossing & operator=(const GNECrossing &)=delete
Invalidated assignment operator.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
The popup menu of a globject.
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
~GNECrossing()
Destructor.
Definition: GNECrossing.cpp:49
A definition of a pedestrian crossing.
Definition: NBNode.h:132
bool isValid(SumoXMLAttr key, const std::string &value)
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
Definition: GNECrossing.cpp:94
std::string getAttribute(SumoXMLAttr key) const
GNEJunction * getParentJunction() const
get parent Junction
Definition: GNECrossing.cpp:82