Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEVType.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/****************************************************************************/
18// Definition of Vehicle Types in netedit
19/****************************************************************************/
20#pragma once
21#include <config.h>
23
24#include "GNEDemandElement.h"
25
26
27// ===========================================================================
28// class definitions
29// ===========================================================================
30
32
33public:
35 GNEVType(SumoXMLTag tag, GNENet* net);
36
38 GNEVType(const std::string& vTypeID, GNENet* net, const SUMOVehicleClass& defaultVClass);
39
41 GNEVType(const std::string& vTypeID, GNENet* net, const std::string& filename);
42
44 GNEVType(const GNEAdditional* calibrator);
45
47 GNEVType(GNENet* net, const std::string& filename, const SUMOVTypeParameter& vTypeParameter);
48
50 GNEVType(const std::string& newVTypeID, GNENet* net, GNEVType* vTypeOriginal);
51
53 ~GNEVType();
54
57
59 GNEMoveElement* getMoveElement() const override;
60
62 Parameterised* getParameters() override;
63
65 const Parameterised* getParameters() const override;
66
68
72 void writeDemandElement(OutputDevice& device) const override;
73
75 Problem isDemandElementValid() const override;
76
78 std::string getDemandElementProblem() const override;
79
81 void fixDemandElementProblem() override;
82
86 SUMOVehicleClass getVClass() const override;
87
89 const RGBColor& getColor() const override;
90
92
96 void updateGeometry() override;
97
99 Position getPositionInView() const override;
101
104
107 std::string getParentName() const override;
108
112 Boundary getCenteringBoundary() const override;
113
115 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
116
121 void drawGL(const GUIVisualizationSettings& s) const override;
122
124
127
129 void computePathElement() override;
130
136 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
137
143 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
144
146 GNELane* getFirstPathLane() const override;
147
149 GNELane* getLastPathLane() const override;
151
154 /* @brief method for getting the Attribute of an XML key
155 * @param[in] key The attribute key
156 * @return string with the value associated to key
157 */
158 std::string getAttribute(SumoXMLAttr key) const override;
159
160 /* @brief method for getting the Attribute of an XML key in double format
161 * @param[in] key The attribute key
162 * @return double with the value associated to key
163 */
164 double getAttributeDouble(SumoXMLAttr key) const override;
165
166 /* @brief method for getting the Attribute of an XML key in position format
167 * @param[in] key The attribute key
168 * @return position with the value associated to key
169 */
170 Position getAttributePosition(SumoXMLAttr key) const override;
171
172 /* @brief method for setting the attribute and letting the object perform additional changes
173 * @param[in] key The attribute key
174 * @param[in] value The new value
175 * @param[in] undoList The undoList on which to register changes
176 * @param[in] net optionally the GNENet to inform about gui updates
177 */
178 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
179
180 /* @brief method for setting the attribute and letting the object perform additional changes
181 * @param[in] key The attribute key
182 * @param[in] value The new value
183 * @param[in] undoList The undoList on which to register changes
184 */
185 bool isValid(SumoXMLAttr key, const std::string& value) override;
186
187 /* @brief method for check if the value for certain attribute is set
188 * @param[in] key The attribute key
189 */
190 bool isAttributeEnabled(SumoXMLAttr key) const override;
191
193 std::string getPopUpID() const override;
194
196 std::string getHierarchyName() const override;
197
199
201 static bool overwriteVType(GNEDemandElement* vType, const SUMOVTypeParameter newVTypeParameter, GNEUndoList* undoList);
202
203protected:
206
209
210private:
212 void setAttribute(SumoXMLAttr key, const std::string& value) override;
213
215 void updateDefaultVClassAttributes(const VClassDefaultValues& defaultValues);
216
218 GNEVType(GNEVType*) = delete;
219
222};
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
Problem
enum class for demandElement problems
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
const RGBColor & getColor() const override
get color
Definition GNEVType.cpp:163
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this vType
Definition GNEVType.cpp:107
Position getPositionInView() const override
Returns position of additional in view.
Definition GNEVType.cpp:178
~GNEVType()
destructor
Definition GNEVType.cpp:103
bool isAttributeEnabled(SumoXMLAttr key) const override
Definition GNEVType.cpp:924
GNELane * getFirstPathLane() const override
get first path lane
Definition GNEVType.cpp:227
SUMOVehicleClass getVClass() const override
obtain VClass related with this demand element
Definition GNEVType.cpp:157
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
Definition GNEVType.cpp:197
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
Definition GNEVType.cpp:241
Parameterised * getParameters() override
get parameters associated with this vType
Definition GNEVType.cpp:113
static bool overwriteVType(GNEDemandElement *vType, const SUMOVTypeParameter newVTypeParameter, GNEUndoList *undoList)
overwrite all values of GNEVType with a SUMOVTypeParameter
Definition GNEVType.cpp:977
void fixDemandElementProblem() override
fix demand element problem
Definition GNEVType.cpp:151
GNEVType * operator=(GNEVType *)=delete
Invalidated assignment operator.
double getAttributeDouble(SumoXMLAttr key) const override
Definition GNEVType.cpp:530
GNEVType(GNEVType *)=delete
Invalidated copy constructor.
void writeDemandElement(OutputDevice &device) const override
write demand element element into a xml file
Definition GNEVType.cpp:125
std::string getDemandElementProblem() const override
return a string with the current demand element problem
Definition GNEVType.cpp:145
void updateDefaultVClassAttributes(const VClassDefaultValues &defaultValues)
function called after set new VClass
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over lane.
Definition GNEVType.cpp:215
bool isValid(SumoXMLAttr key, const std::string &value) override
Definition GNEVType.cpp:717
bool myDefaultVehicleType
flag to check if this GNEVType is a default vehicle Type (For Vehicles, Pedestrians....
Definition GNEVType.h:205
GNELane * getLastPathLane() const override
get last path lane
Definition GNEVType.cpp:234
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNEVType.cpp:190
void updateGeometry() override
update pre-computed geometry information
Definition GNEVType.cpp:169
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition GNEVType.cpp:203
Problem isDemandElementValid() const override
check if current demand element is valid to be written into XML
Definition GNEVType.cpp:138
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition GNEVType.cpp:965
Position getAttributePosition(SumoXMLAttr key) const override
Definition GNEVType.cpp:577
std::string getParentName() const override
Returns the name of the parent object.
Definition GNEVType.cpp:184
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEVType.cpp:971
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over junction.
Definition GNEVType.cpp:221
void computePathElement() override
compute pathElement
Definition GNEVType.cpp:209
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
Definition GNEVType.cpp:583
bool myDefaultVehicleTypeModified
flag to check if this default GNEVType was modified
Definition GNEVType.h:208
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
Structure representing possible vehicle parameter.
struct for default values that depend of VClass