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-2020 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 "GNENetworkElement.h"
22 #include <netbuild/NBNode.h>
23 
24 // ===========================================================================
25 // class declarations
26 // ===========================================================================
28 class PositionVector;
29 class GNEJunction;
30 class GNEEdge;
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
42 public:
43 
48  GNECrossing(GNEJunction* parentJunction, std::vector<NBEdge*> edges);
49 
51  ~GNECrossing();
52 
56  const PositionVector& getCrossingShape() const;
57 
59  void updateGeometry();
60 
64 
68  GNEMoveOperation* getMoveOperation(const double shapeOffset);
69 
71  void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
73 
76 
78  const std::vector<NBEdge*>& getCrossingEdges() const;
79 
82 
85 
93 
95  void updateCenteringBoundary(const bool updateGrid);
96 
101  void drawGL(const GUIVisualizationSettings& s) const;
103 
106  /* @brief method for getting the Attribute of an XML key
107  * @param[in] key The attribute key
108  * @return string with the value associated to key
109  */
110  std::string getAttribute(SumoXMLAttr key) const;
111 
112  /* @brief method for setting the attribute and letting the object perform additional changes
113  * @param[in] key The attribute key
114  * @param[in] value The new value
115  * @param[in] undoList The undoList on which to register changes
116  */
117  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
118 
119  /* @brief method for checking if the key and their correspond attribute are valids
120  * @param[in] key The attribute key
121  * @param[in] value The value asociated to key key
122  * @return true if the value is valid, false in other case
123  */
124  bool isValid(SumoXMLAttr key, const std::string& value);
125 
126  /* @brief method for check if the value for certain attribute is set
127  * @param[in] key The attribute key
128  */
129  bool isAttributeEnabled(SumoXMLAttr key) const;
131 
133  const std::map<std::string, std::string>& getACParametersMap() const;
134 
136  bool checkEdgeBelong(GNEEdge* edges) const;
137 
139  bool checkEdgeBelong(const std::vector<GNEEdge*>& edges) const;
140 
141 protected:
144 
146  std::vector<NBEdge*> myCrossingEdges;
147 
150 
151 private:
153  void setAttribute(SumoXMLAttr key, const std::string& value);
154 
156  void setMoveShape(const GNEMoveResult& moveResult);
157 
159  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
160 
162  void drawTLSLinkNo(const GUIVisualizationSettings& s, const NBNode::Crossing* crossing) const;
163 
165  GNECrossing(const GNECrossing&) = delete;
166 
168  GNECrossing& operator=(const GNECrossing&) = delete;
169 };
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:41
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:146
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
void updateGeometry()
update pre-computed geometry information
Definition: GNECrossing.cpp:64
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:73
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
GNEMoveOperation * getMoveOperation(const double shapeOffset)
get move operation for the given shapeOffset
Definition: GNECrossing.cpp:80
GNEJunction * myParentJunction
the parent junction of this crossing
Definition: GNECrossing.h:143
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
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(GNEJunction *parentJunction, std::vector< NBEdge * > edges)
Constructor.
Definition: GNECrossing.cpp:38
GNECrossing & operator=(const GNECrossing &)=delete
Invalidated assignment operator.
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
GNEGeometry::Geometry myCrossingGeometry
crossing geometry
Definition: GNECrossing.h:149
const PositionVector & getCrossingShape() const
Definition: GNECrossing.cpp:53
~GNECrossing()
Destructor.
Definition: GNECrossing.cpp:49
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
bool isValid(SumoXMLAttr key, const std::string &value)
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
class for NETEDIT geometries over lanes
Definition: GNEGeometry.h:76
move operation
move result
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:36
A list of positions.