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-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // A class for visualizing Inner Lanes (used when editing traffic lights)
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 #include "GNENetworkElement.h"
23 #include <netbuild/NBNode.h>
24 
25 // ===========================================================================
26 // class declarations
27 // ===========================================================================
29 class PositionVector;
30 class GNEJunction;
31 class GNEEdge;
32 
33 // ===========================================================================
34 // class definitions
35 // ===========================================================================
43 
44 public:
46  GNECrossing(GNENet* net);
47 
52  GNECrossing(GNEJunction* parentJunction, std::vector<NBEdge*> edges);
53 
55  ~GNECrossing();
56 
60  const PositionVector& getCrossingShape() const;
61 
63  void updateGeometry();
64 
68 
73 
75  void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
77 
80 
82  const std::vector<NBEdge*>& getCrossingEdges() const;
83 
86 
89 
97 
99  double getExaggeration(const GUIVisualizationSettings& s) const;
100 
102  void updateCenteringBoundary(const bool updateGrid);
103 
108  void drawGL(const GUIVisualizationSettings& s) const;
110 
113  /* @brief method for getting the Attribute of an XML key
114  * @param[in] key The attribute key
115  * @return string with the value associated to key
116  */
117  std::string getAttribute(SumoXMLAttr key) const;
118 
119  /* @brief method for setting the attribute and letting the object perform additional changes
120  * @param[in] key The attribute key
121  * @param[in] value The new value
122  * @param[in] undoList The undoList on which to register changes
123  */
124  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
125 
126  /* @brief method for checking if the key and their correspond attribute are valids
127  * @param[in] key The attribute key
128  * @param[in] value The value asociated to key key
129  * @return true if the value is valid, false in other case
130  */
131  bool isValid(SumoXMLAttr key, const std::string& value);
132 
133  /* @brief method for check if the value for certain attribute is set
134  * @param[in] key The attribute key
135  */
136  bool isAttributeEnabled(SumoXMLAttr key) const;
137 
138  /* @brief method for check if the value for certain attribute is computed (for example, due a network recomputing)
139  * @param[in] key The attribute key
140  */
141  bool isAttributeComputed(SumoXMLAttr key) const;
142 
144 
146  const std::map<std::string, std::string>& getACParametersMap() const;
147 
149  bool checkEdgeBelong(GNEEdge* edges) const;
150 
152  bool checkEdgeBelong(const std::vector<GNEEdge*>& edges) const;
153 
154 protected:
157 
159  std::vector<NBEdge*> myCrossingEdges;
160 
163 
166 
167 private:
169  void setAttribute(SumoXMLAttr key, const std::string& value);
170 
172  void setMoveShape(const GNEMoveResult& moveResult);
173 
175  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
176 
178  void drawTLSLinkNo(const GUIVisualizationSettings& s, const NBNode::Crossing* crossing) const;
179 
181  GNECrossing(const GNECrossing&) = delete;
182 
184  GNECrossing& operator=(const GNECrossing&) = delete;
185 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:42
std::string getAttribute(SumoXMLAttr key) const
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
std::vector< NBEdge * > myCrossingEdges
Crossing Edges (It works as ID because a junction can only ONE Crossing with the same edges)
Definition: GNECrossing.h:159
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
GNECrossing(GNENet *net)
default constructor
Definition: GNECrossing.cpp:39
void updateGeometry()
update pre-computed geometry information
Definition: GNECrossing.cpp:74
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNECrossing.cpp:82
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void drawTLSLinkNo(const GUIVisualizationSettings &s, const NBNode::Crossing *crossing) const
draw TLS Link Number
bool checkEdgeBelong(GNEEdge *edges) const
return true if a edge belongs to crossing's edges
GNEJunction * myParentJunction
the parent junction of this crossing
Definition: GNECrossing.h:156
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
GUIGeometry myCrossingGeometry
crossing geometry
Definition: GNECrossing.h:162
bool isAttributeEnabled(SumoXMLAttr key) const
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
GNECrossing(const GNECrossing &)=delete
Invalidated copy constructor.
GNEJunction * getParentJunction() const
get parent Junction
GNECrossing & operator=(const GNECrossing &)=delete
Invalidated assignment operator.
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
const PositionVector & getCrossingShape() const
Definition: GNECrossing.cpp:67
~GNECrossing()
Destructor.
Definition: GNECrossing.cpp:59
bool isAttributeComputed(SumoXMLAttr key) const
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
NBNode::Crossing * myTemplateNBCrossing
template NBCrossing
Definition: GNECrossing.h:165
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
bool isValid(SumoXMLAttr key, const std::string &value)
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNECrossing.cpp:89
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
The popup menu of a globject.
Stores the information about how to visualize structures.
A definition of a pedestrian crossing.
Definition: NBNode.h:129
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A list of positions.