Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEEdgeType.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 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// ===========================================================================
30class GNELaneType;
31class GNEEdgeTemplate;
33
34
35// ===========================================================================
36// class definitions
37// ===========================================================================
39public:
41 friend class GNECreateEdgeFrame;
42
46 GNEEdgeType(GNECreateEdgeFrame* createEdgeFrame);
47
49 GNEEdgeType(const GNEEdgeType* edgeType);
50
54 GNEEdgeType(GNENet* net);
55
62 GNEEdgeType(GNENet* net, const std::string& ID, const NBTypeCont::EdgeTypeDefinition* edgeType);
63
66
69
71 GNEMoveElement* getMoveElement() const override;
72
74 Parameterised* getParameters() override;
75
77 const Parameterised* getParameters() const override;
78
80
82 void copyTemplate(const GNEEdgeTemplate* edgeTemplate);
83
85 const std::vector<GNELaneType*>& getLaneTypes() const;
86
88 int getLaneTypeIndex(const GNELaneType* laneType) const;
89
91 void addLaneType(GNELaneType* laneType);
92
94 void removeLaneType(const int index);
95
98
100 void updateGeometry() override;
101
104
106
109
111 bool checkDrawFromContour() const override;
112
114 bool checkDrawToContour() const override;
115
117 bool checkDrawRelatedContour() const override;
118
120 bool checkDrawOverContour() const override;
121
123 bool checkDrawDeleteContour() const override;
124
126 bool checkDrawDeleteContourSmall() const override;
127
129 bool checkDrawSelectContour() const override;
130
132 bool checkDrawMoveContour() const override;
133
135
138
146
148 Boundary getCenteringBoundary() const override;
149
151 void updateCenteringBoundary(const bool updateGrid);
152
157 void drawGL(const GUIVisualizationSettings& s) const override;
158
160 void deleteGLObject() override;
161
163 void updateGLObject() override;
165
168 /* @brief method for getting the Attribute of an XML key
169 * @param[in] key The attribute key
170 * @return string with the value associated to key
171 */
172 std::string getAttribute(SumoXMLAttr key) const override;
173
174 /* @brief method for getting the Attribute of an XML key in double format
175 * @param[in] key The attribute key
176 * @return double with the value associated to key
177 */
178 double getAttributeDouble(SumoXMLAttr key) const override;
179
180 /* @brief method for getting the Attribute of an XML key in position format
181 * @param[in] key The attribute key
182 * @return position with the value associated to key
183 */
184 Position getAttributePosition(SumoXMLAttr key) const override;
185
186 /* @brief method for getting the Attribute of an XML key in Position format
187 * @param[in] key The attribute key
188 * @return position with the value associated to key
189 */
191
192 /* @brief method for setting the attribute and letting the object perform additional changes
193 * @param[in] key The attribute key
194 * @param[in] value The new value
195 * @param[in] undoList The undoList on which to register changes
196 */
197 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
198
199 /* @brief method for checking if the key and their conrrespond attribute are valids
200 * @param[in] key The attribute key
201 * @param[in] value The value associated to key key
202 * @return true if the value is valid, false in other case
203 */
204 bool isValid(SumoXMLAttr key, const std::string& value) override;
205
206 /* @brief method for check if the value for certain attribute is set
207 * @param[in] key The attribute key
208 */
209 bool isAttributeEnabled(SumoXMLAttr key) const override;
210
212
213protected:
215 std::vector<GNELaneType*> myLaneTypes;
216
217private:
219 void setAttribute(SumoXMLAttr key, const std::string& value) override;
220
222 GNEEdgeType(const GNEEdgeType& s) = delete;
223
225 GNEEdgeType& operator=(const GNEEdgeType& s) = delete;
226};
const std::string invalid_return< std::string >::value
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
std::vector< GNELaneType * > myLaneTypes
vector with laneTypes
GNEEdgeType(GNECreateEdgeFrame *createEdgeFrame)
Constructor for default edge (empty ID).
void updateGeometry() override
update pre-computed geometry information
Position getPositionInView() const
Returns position of hierarchical element in view.
int getLaneTypeIndex(const GNELaneType *laneType) const
get laneType index
GNEEdgeType(const GNEEdgeType &s)=delete
invalidated copy constructor
GNEEdgeType & operator=(const GNEEdgeType &s)=delete
invalidated assignment operator
bool checkDrawRelatedContour() const override
check if draw related contour (cyan)
std::string getAttribute(SumoXMLAttr key) const override
double getAttributeDouble(SumoXMLAttr key) const override
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
bool checkDrawDeleteContourSmall() const override
check if draw delete contour small (pink/white)
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
Parameterised * getParameters() override
get parameters associated with this edgeType
void removeLaneType(const int index)
remove laneType
void copyTemplate(const GNEEdgeTemplate *edgeTemplate)
copy edge template
bool checkDrawFromContour() const override
check if draw from contour (green)
bool isAttributeEnabled(SumoXMLAttr key) const override
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
bool checkDrawOverContour() const override
check if draw over contour (orange)
bool checkDrawMoveContour() const override
check if draw move contour (red)
friend class GNECreateEdgeFrame
GNECreateEdgeFrame need access to setAttribute.
Definition GNEEdgeType.h:41
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
bool checkDrawDeleteContour() const override
check if draw delete contour (pink/white)
bool isValid(SumoXMLAttr key, const std::string &value) override
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
const std::vector< GNELaneType * > & getLaneTypes() const
get laneTypes
void addLaneType(GNELaneType *laneType)
add laneType
bool checkDrawSelectContour() const override
check if draw select contour (blue)
void updateGLObject() override
update GLObject (geometry, ID, etc.)
~GNEEdgeType()
Destructor.
void deleteGLObject() override
delete element
Position getAttributePosition(SumoXMLAttr key) const override
bool checkDrawToContour() const override
check if draw from contour (magenta)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this edgeType
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
GNENetworkElement(GNENet *net, const std::string &id, SumoXMLTag tag)
Constructor.
The popup menu of a globject.
Stores the information about how to visualize structures.
Parameterised()
Default constructor.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.
edgeType definition
Definition NBTypeCont.h:93