Eclipse SUMO - Simulation of Urban MObility
GNEEdgeType.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 /****************************************************************************/
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 #include "GNENetworkElement.h"
23 
24 #include <netbuild/NBTypeCont.h>
25 
26 
27 // ===========================================================================
28 // class declarations
29 // ===========================================================================
30 
31 class GNELaneType;
32 class GNEEdgeTemplate;
33 class GNECreateEdgeFrame;
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
38 
40 
41 public:
43  friend class GNECreateEdgeFrame;
44 
48  GNEEdgeType(GNECreateEdgeFrame* createEdgeFrame);
49 
51  GNEEdgeType(const GNEEdgeType* edgeType);
52 
56  GNEEdgeType(GNENet* net);
57 
64  GNEEdgeType(GNENet* net, const std::string& ID, const NBTypeCont::EdgeTypeDefinition* edgeType);
65 
67  ~GNEEdgeType();
68 
70  void copyTemplate(const GNEEdgeTemplate* edgeTemplate);
71 
73  const std::vector<GNELaneType*>& getLaneTypes() const;
74 
76  int getLaneTypeIndex(const GNELaneType* laneType) const;
77 
79  void addLaneType(GNELaneType* laneType);
80 
82  void removeLaneType(const int index);
83 
87  void updateGeometry();
88 
92 
97 
99  void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
101 
104 
112 
114  double getExaggeration(const GUIVisualizationSettings& s) const;
115 
117  void updateCenteringBoundary(const bool updateGrid);
118 
123  void drawGL(const GUIVisualizationSettings& s) const;
125 
128  /* @brief method for getting the Attribute of an XML key
129  * @param[in] key The attribute key
130  * @return string with the value associated to key
131  */
132  std::string getAttribute(SumoXMLAttr key) const;
133 
134  /* @brief method for setting the attribute and letting the object perform additional changes
135  * @param[in] key The attribute key
136  * @param[in] value The new value
137  * @param[in] undoList The undoList on which to register changes
138  */
139  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
140 
141  /* @brief method for checking if the key and their conrrespond attribute are valids
142  * @param[in] key The attribute key
143  * @param[in] value The value asociated to key key
144  * @return true if the value is valid, false in other case
145  */
146  bool isValid(SumoXMLAttr key, const std::string& value);
147 
148  /* @brief method for check if the value for certain attribute is set
149  * @param[in] key The attribute key
150  */
151  bool isAttributeEnabled(SumoXMLAttr key) const;
152 
153  /* @brief method for check if the value for certain attribute is computed (for example, due a network recomputing)
154  * @param[in] key The attribute key
155  */
156  bool isAttributeComputed(SumoXMLAttr key) const;
157 
159 
161  const std::map<std::string, std::string>& getACParametersMap() const;
162 
163 protected:
165  std::vector<GNELaneType*> myLaneTypes;
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  GNEEdgeType(const GNEEdgeType& s) = delete;
179 
181  GNEEdgeType& operator=(const GNEEdgeType& s) = delete;
182 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
bool isAttributeEnabled(SumoXMLAttr key) const
std::vector< GNELaneType * > myLaneTypes
vector with laneTypes
Definition: GNEEdgeType.h:165
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
GNEEdgeType(GNECreateEdgeFrame *createEdgeFrame)
Constructor for default edge (empty ID)
Definition: GNEEdgeType.cpp:39
Position getPositionInView() const
Returns position of hierarchical element in view.
int getLaneTypeIndex(const GNELaneType *laneType) const
get laneType index
bool isValid(SumoXMLAttr key, const std::string &value)
GNEMoveOperation * getMoveOperation()
get move operation
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
GNEEdgeType(const GNEEdgeType &s)=delete
invalidated copy constructor
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void removeLaneType(const int index)
remove laneType
GNEEdgeType & operator=(const GNEEdgeType &s)=delete
invalidated assignment operator
void copyTemplate(const GNEEdgeTemplate *edgeTemplate)
copy edge template
Definition: GNEEdgeType.cpp:88
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
bool isAttributeComputed(SumoXMLAttr key) const
const std::vector< GNELaneType * > & getLaneTypes() const
get laneTypes
void addLaneType(GNELaneType *laneType)
add laneType
~GNEEdgeType()
Destructor.
std::string getAttribute(SumoXMLAttr key) const
void updateGeometry()
update pre-computed geometry information
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
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.
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
edgeType definition
Definition: NBTypeCont.h:90