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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // A class for visualizing Inner Lanes (used when editing traffic lights)
18 /****************************************************************************/
19 #ifndef GNECrossing_h
20 #define GNECrossing_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include "GNENetElement.h"
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
38 class PositionVector;
39 class GNEJunction;
40 class GNEEdge;
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
51 class GNECrossing : public GNENetElement {
52 public:
53 
58  GNECrossing(GNEJunction* parentJunction, NBNode::Crossing* crossing);
59 
61  virtual ~GNECrossing();
62 
64  void updateGeometry();
65 
68 
71 
74 
82 
89 
94  void drawGL(const GUIVisualizationSettings& s) const;
96 
99  /* @brief method for getting the Attribute of an XML key
100  * @param[in] key The attribute key
101  * @return string with the value associated to key
102  */
103  std::string getAttribute(SumoXMLAttr key) const;
104 
105  /* @brief method for setting the attribute and letting the object perform additional changes
106  * @param[in] key The attribute key
107  * @param[in] value The new value
108  * @param[in] undoList The undoList on which to register changes
109  */
110  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
111 
112  /* @brief method for checking if the key and their correspond attribute are valids
113  * @param[in] key The attribute key
114  * @param[in] value The value asociated to key key
115  * @return true if the value is valid, false in other case
116  */
117  bool isValid(SumoXMLAttr key, const std::string& value);
119 
121  bool checkEdgeBelong(GNEEdge* edges) const;
122 
124  bool checkEdgeBelong(const std::vector<GNEEdge*>& edges) const;
125 
126 protected:
129 
132 
136  std::vector<double> myShapeRotations;
137 
139  std::vector<double> myShapeLengths;
141 
142 private:
145 
147  void setAttribute(SumoXMLAttr key, const std::string& value);
148 
150  GNECrossing(const GNECrossing&) = delete;
151 
153  GNECrossing& operator=(const GNECrossing&) = delete;
154 };
155 
156 
157 #endif
158 
159 /****************************************************************************/
160 
bool myForceDrawCustomShape
flag used for force draw custom shape
Definition: GNECrossing.h:144
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
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Stores the information about how to visualize structures.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
GNECrossing(GNEJunction *parentJunction, NBNode::Crossing *crossing)
Constructor.
Definition: GNECrossing.cpp:57
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:47
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:71
NBNode::Crossing * myCrossing
the data for this crossing
Definition: GNECrossing.h:131
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:51
std::vector< double > myShapeRotations
Definition: GNECrossing.h:136
A list of positions.
GNEJunction * myParentJunction
the parent junction of this crossing
Definition: GNECrossing.h:128
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:56
The popup menu of a globject.
virtual ~GNECrossing()
Destructor.
Definition: GNECrossing.cpp:67
A definition of a pedestrian crossing.
Definition: NBNode.h:131
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:139
std::string getAttribute(SumoXMLAttr key) const
This functions has to be implemented in all GNEAttributeCarriers.
GNEJunction * getParentJunction() const
get parent Junction
Definition: GNECrossing.cpp:95