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 #include <config.h>
25 
26 #include "GNENetElement.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  bool addGenericParameter(const std::string& key, const std::string& value);
122 
124  bool removeGenericParameter(const std::string& key);
125 
127  bool updateGenericParameter(const std::string& oldKey, const std::string& newKey);
128 
130  bool updateGenericParameterValue(const std::string& key, const std::string& newValue);
131 
133  std::string getGenericParametersStr() const;
134 
136  std::vector<std::pair<std::string, std::string> > getGenericParameters() const;
137 
139  void setGenericParametersStr(const std::string& value);
140 
142 
144  bool checkEdgeBelong(GNEEdge* edges) const;
145 
147  bool checkEdgeBelong(const std::vector<GNEEdge*>& edges) const;
148 
149 protected:
152 
154  std::vector<NBEdge*> myCrossingEdges;
155 
158 
162  std::vector<double> myShapeRotations;
163 
165  std::vector<double> myShapeLengths;
167 
168 private:
170  void setAttribute(SumoXMLAttr key, const std::string& value);
171 
173  void mouseOverObject(const GUIVisualizationSettings& s) const;
174 
176  void drawTLSLinkNo(const GUIVisualizationSettings& s) const;
177 
179  GNECrossing(const GNECrossing&) = delete;
180 
182  GNECrossing& operator=(const GNECrossing&) = delete;
183 };
184 
185 
186 #endif
187 
188 /****************************************************************************/
189 
GNECrossing(GNEJunction *parentJunction, std::vector< NBEdge *> edges)
Constructor.
Definition: GNECrossing.cpp:53
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
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void mouseOverObject(const GUIVisualizationSettings &s) const
method for check if mouse is over objects
Stores the information about how to visualize structures.
bool addGenericParameter(const std::string &key, const std::string &value)
add generic parameter
bool removeGenericParameter(const std::string &key)
remove generic parameter
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:64
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:162
std::vector< NBEdge * > myCrossingEdges
Crossing Edges (It works as ID because a junction can only ONE Crossing with the same edges) ...
Definition: GNECrossing.h:154
A list of positions.
bool updateGenericParameterValue(const std::string &key, const std::string &newValue)
update value generic parameter
GNEJunction * myParentJunction
the parent junction of this crossing
Definition: GNECrossing.h:151
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
bool updateGenericParameter(const std::string &oldKey, const std::string &newKey)
update generic parameter
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:60
A definition of a pedestrian crossing.
Definition: NBNode.h:125
PositionVector myShape
crossingShape
Definition: GNECrossing.h:157
bool isValid(SumoXMLAttr key, const std::string &value)
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
std::vector< double > myShapeLengths
The lengths of the shape parts.
Definition: GNECrossing.h:165
std::string getAttribute(SumoXMLAttr key) const
GNEJunction * getParentJunction() const
get parent Junction
Definition: GNECrossing.cpp:98