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-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 /****************************************************************************/
19 /****************************************************************************/
20 #pragma once
21 #include "GNENetworkElement.h"
22 
23 #include <netbuild/NBTypeCont.h>
24 
25 
26 // ===========================================================================
27 // class declarations
28 // ===========================================================================
29 
30 class GNELaneType;
31 class GNECreateEdgeFrame;
32 
33 // ===========================================================================
34 // class definitions
35 // ===========================================================================
36 
38 
39 public:
41  friend class GNECreateEdgeFrame;
42 
46  GNEEdgeType(GNECreateEdgeFrame *createEdgeFrame);
47 
51  GNEEdgeType(GNENet* net);
52 
58  GNEEdgeType(GNENet* net, const std::string &ID, const NBTypeCont::EdgeTypeDefinition *edgeType);
59 
61  ~GNEEdgeType();
62 
64  const std::vector<GNELaneType*>& getLaneTypes() const;
65 
67  int getLaneTypeIndex(const GNELaneType* laneType) const;
68 
70  void addLaneType(GNELaneType* laneType, const int position);
71 
73  void addLaneType(GNEUndoList* undoList);
74 
76  void removeLaneType(GNELaneType* laneType);
77 
79  void removeLaneType(const int index, GNEUndoList* undoList);
80 
84  void updateGeometry();
85 
89 
93  GNEMoveOperation* getMoveOperation(const double shapeOffset);
94 
96  void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
98 
101 
109 
111  void updateCenteringBoundary(const bool updateGrid);
112 
117  void drawGL(const GUIVisualizationSettings& s) const;
119 
122  /* @brief method for getting the Attribute of an XML key
123  * @param[in] key The attribute key
124  * @return string with the value associated to key
125  */
126  std::string getAttribute(SumoXMLAttr key) const;
127 
128  /* @brief method for setting the attribute and letting the object perform additional changes
129  * @param[in] key The attribute key
130  * @param[in] value The new value
131  * @param[in] undoList The undoList on which to register changes
132  */
133  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
134 
135  /* @brief method for checking if the key and their conrrespond attribute are valids
136  * @param[in] key The attribute key
137  * @param[in] value The value asociated to key key
138  * @return true if the value is valid, false in other case
139  */
140  bool isValid(SumoXMLAttr key, const std::string& value);
141 
142  /* @brief method for check if the value for certain attribute is set
143  * @param[in] key The attribute key
144  */
145  bool isAttributeEnabled(SumoXMLAttr key) const;
147 
149  const std::map<std::string, std::string>& getACParametersMap() const;
150 
151 protected:
153  std::vector<GNELaneType*> myLaneTypes;
154 
155 private:
157  void setAttribute(SumoXMLAttr key, const std::string& value);
158 
160  void setMoveShape(const GNEMoveResult& moveResult);
161 
163  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
164 
166  GNEEdgeType(const GNEEdgeType& s) = delete;
167 
169  GNEEdgeType& operator=(const GNEEdgeType& s) = delete;
170 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
bool isAttributeEnabled(SumoXMLAttr key) const
std::vector< GNELaneType * > myLaneTypes
vector with laneTypes
Definition: GNEEdgeType.h:153
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
Definition: GNEEdgeType.cpp:93
bool isValid(SumoXMLAttr key, const std::string &value)
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.
GNEEdgeType & operator=(const GNEEdgeType &s)=delete
invalidated assignment operator
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
const std::vector< GNELaneType * > & getLaneTypes() const
get laneTypes
Definition: GNEEdgeType.cpp:87
GNEMoveOperation * getMoveOperation(const double shapeOffset)
get move operation for the given shapeOffset
~GNEEdgeType()
Destructor.
Definition: GNEEdgeType.cpp:75
std::string getAttribute(SumoXMLAttr key) const
void removeLaneType(GNELaneType *laneType)
remove laneType
void addLaneType(GNELaneType *laneType, const int position)
add laneType
void updateGeometry()
update pre-computed geometry information
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
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:39
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
edgeType definition
Definition: NBTypeCont.h:80