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 
58  bool isNetworkElementValid() const;
59 
61  std::string getNetworkElementProblem() const;
62 
66  const PositionVector& getCrossingShape() const;
67 
69  void updateGeometry();
70 
74 
79 
81  void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
83 
86 
88  const std::vector<NBEdge*>& getCrossingEdges() const;
89 
92 
95 
103 
105  double getExaggeration(const GUIVisualizationSettings& s) const;
106 
108  void updateCenteringBoundary(const bool updateGrid);
109 
114  void drawGL(const GUIVisualizationSettings& s) const;
115 
117  void deleteGLObject();
118 
120  void updateGLObject();
121 
123 
126  /* @brief method for getting the Attribute of an XML key
127  * @param[in] key The attribute key
128  * @return string with the value associated to key
129  */
130  std::string getAttribute(SumoXMLAttr key) const;
131 
132  /* @brief method for setting the attribute and letting the object perform additional changes
133  * @param[in] key The attribute key
134  * @param[in] value The new value
135  * @param[in] undoList The undoList on which to register changes
136  */
137  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
138 
139  /* @brief method for checking if the key and their correspond attribute are valids
140  * @param[in] key The attribute key
141  * @param[in] value The value associated to key key
142  * @return true if the value is valid, false in other case
143  */
144  bool isValid(SumoXMLAttr key, const std::string& value);
145 
146  /* @brief method for check if the value for certain attribute is set
147  * @param[in] key The attribute key
148  */
149  bool isAttributeEnabled(SumoXMLAttr key) const;
150 
152 
154  const Parameterised::Map& getACParametersMap() const;
155 
157  bool checkEdgeBelong(GNEEdge* edges) const;
158 
160  bool checkEdgeBelong(const std::vector<GNEEdge*>& edges) const;
161 
162 protected:
165 
167  std::vector<NBEdge*> myCrossingEdges;
168 
171 
174 
175 private:
177  void setAttribute(SumoXMLAttr key, const std::string& value);
178 
180  void setMoveShape(const GNEMoveResult& moveResult);
181 
183  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
184 
186  void drawTLSLinkNo(const GUIVisualizationSettings& s, const NBNode::Crossing* crossing) const;
187 
189  GNECrossing(const GNECrossing&) = delete;
190 
192  GNECrossing& operator=(const GNECrossing&) = delete;
193 };
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:167
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
const Parameterised::Map & getACParametersMap() const
get parameters map
bool isNetworkElementValid() const
check if current network element is valid to be written into XML
Definition: GNECrossing.cpp:67
void deleteGLObject()
delete element
GNECrossing(GNENet *net)
default constructor
Definition: GNECrossing.cpp:40
void updateGeometry()
update pre-computed geometry information
Definition: GNECrossing.cpp:86
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void updateGLObject()
update GLObject (geometry, ID, etc.)
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNECrossing.cpp:94
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:164
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
GUIGeometry myCrossingGeometry
crossing geometry
Definition: GNECrossing.h:170
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
std::string getNetworkElementProblem() const
return a string with the current network element problem
Definition: GNECrossing.cpp:73
const PositionVector & getCrossingShape() const
Definition: GNECrossing.cpp:79
~GNECrossing()
Destructor.
Definition: GNECrossing.cpp:59
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
NBNode::Crossing * myTemplateNBCrossing
template NBCrossing
Definition: GNECrossing.h:173
bool isValid(SumoXMLAttr key, const std::string &value)
GNEMoveOperation * getMoveOperation()
get move operation
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
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A list of positions.