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-2018 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  void updateGeometry(bool updateGrid);
59 
62 
64  const std::vector<NBEdge*>& getCrossingEdges() const;
65 
68 
71 
79 
86 
91  void drawGL(const GUIVisualizationSettings& s) const;
93 
96  /* @brief method for getting the Attribute of an XML key
97  * @param[in] key The attribute key
98  * @return string with the value associated to key
99  */
100  std::string getAttribute(SumoXMLAttr key) const;
101 
102  /* @brief method for setting the attribute and letting the object perform additional changes
103  * @param[in] key The attribute key
104  * @param[in] value The new value
105  * @param[in] undoList The undoList on which to register changes
106  */
107  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
108 
109  /* @brief method for checking if the key and their correspond attribute are valids
110  * @param[in] key The attribute key
111  * @param[in] value The value asociated to key key
112  * @return true if the value is valid, false in other case
113  */
114  bool isValid(SumoXMLAttr key, const std::string& value);
116 
119 
121  std::string getGenericParametersStr() const;
122 
124  std::vector<std::pair<std::string, std::string> > getGenericParameters() const;
125 
127  void setGenericParametersStr(const std::string& value);
128 
130 
132  bool checkEdgeBelong(GNEEdge* edges) const;
133 
135  bool checkEdgeBelong(const std::vector<GNEEdge*>& edges) const;
136 
137 protected:
140 
142  std::vector<NBEdge*> myCrossingEdges;
143 
146 
150  std::vector<double> myShapeRotations;
151 
153  std::vector<double> myShapeLengths;
155 
156 private:
158  void setAttribute(SumoXMLAttr key, const std::string& value);
159 
161  void mouseOverObject(const GUIVisualizationSettings& s) const;
162 
164  void drawTLSLinkNo(const GUIVisualizationSettings& s) const;
165 
167  GNECrossing(const GNECrossing&) = delete;
168 
170  GNECrossing& operator=(const GNECrossing&) = delete;
171 };
172 
173 
174 #endif
175 
176 /****************************************************************************/
177 
GNECrossing(GNEJunction *parentJunction, std::vector< NBEdge *> edges)
Constructor.
Definition: GNECrossing.cpp:42
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
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:85
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNECrossing.cpp:97
void mouseOverObject(const GUIVisualizationSettings &s) const
method for check if mouse is over objects
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 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(bool updateGrid)
update pre-computed geometry information
Definition: GNECrossing.cpp:53
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:45
std::vector< double > myShapeRotations
Definition: GNECrossing.h:150
std::vector< NBEdge * > myCrossingEdges
Crossing Edges (It works as ID because a junction can only ONE Crossing with the same edges) ...
Definition: GNECrossing.h:142
A list of positions.
GNEJunction * myParentJunction
the parent junction of this crossing
Definition: GNECrossing.h:139
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:125
PositionVector myShape
crossingShape
Definition: GNECrossing.h:145
bool isValid(SumoXMLAttr key, const std::string &value)
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
Definition: GNECrossing.cpp:91
std::vector< double > myShapeLengths
The lengths of the shape parts.
Definition: GNECrossing.h:153
std::string getAttribute(SumoXMLAttr key) const
GNEJunction * getParentJunction() const
get parent Junction
Definition: GNECrossing.cpp:79