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 /****************************************************************************/
14 // A class for visualizing Inner Lanes (used when editing traffic lights)
15 /****************************************************************************/
16 #ifndef GNECrossing_h
17 #define GNECrossing_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
24 #include "GNENetElement.h"
25 #include <netbuild/NBNode.h>
26 
27 // ===========================================================================
28 // class declarations
29 // ===========================================================================
31 class PositionVector;
32 class GNEJunction;
33 class GNEEdge;
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
44 class GNECrossing : public GNENetElement {
45 public:
46 
51  GNECrossing(GNEJunction* parentJunction, std::vector<NBEdge*> edges);
52 
54  ~GNECrossing();
55 
57  std::string generateChildID(SumoXMLTag childTag);
58 
62  const PositionVector& getCrossingShape() const;
63 
65  void updateGeometry();
66 
70 
73 
75  const std::vector<NBEdge*>& getCrossingEdges() const;
76 
79 
82 
90 
97 
102  void drawGL(const GUIVisualizationSettings& s) const;
104 
107  /* @brief method for getting the Attribute of an XML key
108  * @param[in] key The attribute key
109  * @return string with the value associated to key
110  */
111  std::string getAttribute(SumoXMLAttr key) const;
112 
113  /* @brief method for setting the attribute and letting the object perform additional changes
114  * @param[in] key The attribute key
115  * @param[in] value The new value
116  * @param[in] undoList The undoList on which to register changes
117  */
118  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
119 
120  /* @brief method for checking if the key and their correspond attribute are valids
121  * @param[in] key The attribute key
122  * @param[in] value The value asociated to key key
123  * @return true if the value is valid, false in other case
124  */
125  bool isValid(SumoXMLAttr key, const std::string& value);
126 
127  /* @brief method for check if the value for certain attribute is set
128  * @param[in] key The attribute key
129  */
130  bool isAttributeEnabled(SumoXMLAttr key) const;
132 
134  bool checkEdgeBelong(GNEEdge* edges) const;
135 
137  bool checkEdgeBelong(const std::vector<GNEEdge*>& edges) const;
138 
139 protected:
142 
144  std::vector<NBEdge*> myCrossingEdges;
145 
148 
149 private:
151  void setAttribute(SumoXMLAttr key, const std::string& value);
152 
154  void drawTLSLinkNo(const GUIVisualizationSettings& s) const;
155 
157  GNECrossing(const GNECrossing&) = delete;
158 
160  GNECrossing& operator=(const GNECrossing&) = delete;
161 };
162 
163 
164 #endif
165 
166 /****************************************************************************/
167 
GNECrossing::myParentJunction
GNEJunction * myParentJunction
the parent junction of this crossing
Definition: GNECrossing.h:141
GNECrossing::~GNECrossing
~GNECrossing()
Destructor.
Definition: GNECrossing.cpp:48
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
GNECrossing::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNECrossing.cpp:311
GNECrossing::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNECrossing.cpp:234
GNECrossing::operator=
GNECrossing & operator=(const GNECrossing &)=delete
Invalidated assignment operator.
GNECrossing::getCrossingShape
const PositionVector & getCrossingShape() const
Definition: GNECrossing.cpp:59
GNECrossing::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNECrossing.cpp:254
PositionVector
A list of positions.
Definition: PositionVector.h:45
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GNECrossing::drawTLSLinkNo
void drawTLSLinkNo(const GUIVisualizationSettings &s) const
draw TLS Link Number
Definition: GNECrossing.cpp:194
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
GNECrossing::getNBCrossing
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
Definition: GNECrossing.cpp:104
GNECrossing::getPositionInView
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNECrossing.cpp:85
GNECrossing::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNECrossing.cpp:110
GNECrossing::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNECrossing.cpp:209
GNECrossing
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:44
GNECrossing::myCrossingGeometry
GNEGeometry::Geometry myCrossingGeometry
crossing geometry
Definition: GNECrossing.h:147
GNENetElement.h
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNECrossing::checkEdgeBelong
bool checkEdgeBelong(GNEEdge *edges) const
return true if a edge belongs to crossing's edges
Definition: GNECrossing.cpp:379
GNEGeometry::Geometry
struct for pack all variables related with geometry of stop
Definition: GNEGeometry.h:56
GNENetElement
Definition: GNENetElement.h:43
GNECrossing::myCrossingEdges
std::vector< NBEdge * > myCrossingEdges
Crossing Edges (It works as ID because a junction can only ONE Crossing with the same edges)
Definition: GNECrossing.h:144
GNECrossing::getParentJunction
GNEJunction * getParentJunction() const
get parent Junction
Definition: GNECrossing.cpp:92
GUIMainWindow
Definition: GUIMainWindow.h:46
GNECrossing::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNECrossing.cpp:326
GNECrossing::GNECrossing
GNECrossing(GNEJunction *parentJunction, std::vector< NBEdge * > edges)
Constructor.
Definition: GNECrossing.cpp:41
GNECrossing::generateChildID
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNECrossing.cpp:52
GNECrossing::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNECrossing.cpp:70
GNEUndoList
Definition: GNEUndoList.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GNEJunction
Definition: GNEJunction.h:47
NBNode::Crossing
A definition of a pedestrian crossing.
Definition: NBNode.h:131
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
NBNode.h
GNECrossing::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNECrossing.cpp:287
GNECrossing::getCrossingEdges
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
Definition: GNECrossing.cpp:98