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(GNENet* net, const std::string& filename, const SUMOVTypeParameter& vTypeParameter);
45
47 GNEVType(const std::string& newVTypeID, GNENet* net, GNEVType* vTypeOriginal);
48
50 ~GNEVType();
51
56
60 void writeDemandElement(OutputDevice& device) const;
61
64
66 std::string getDemandElementProblem() const;
67
70
75
77 const RGBColor& getColor() const;
78
80
84 void updateGeometry();
85
89
92
95 std::string getParentName() const;
96
101
103 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
104
109 void drawGL(const GUIVisualizationSettings& s) const;
110
112
115
117 void computePathElement();
118
124 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
125
131 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
132
134 GNELane* getFirstPathLane() const;
135
137 GNELane* getLastPathLane() const;
139
142 /* @brief method for getting the Attribute of an XML key
143 * @param[in] key The attribute key
144 * @return string with the value associated to key
145 */
146 std::string getAttribute(SumoXMLAttr key) const;
147
148 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
149 * @param[in] key The attribute key
150 * @return double with the value associated to key
151 */
152 double getAttributeDouble(SumoXMLAttr key) const;
153
154 /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
155 * @param[in] key The attribute key
156 * @return double with the value associated to key
157 */
159
160 /* @brief method for setting the attribute and letting the object perform additional changes
161 * @param[in] key The attribute key
162 * @param[in] value The new value
163 * @param[in] undoList The undoList on which to register changes
164 * @param[in] net optionally the GNENet to inform about gui updates
165 */
166 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
167
168 /* @brief method for setting the attribute and letting the object perform additional changes
169 * @param[in] key The attribute key
170 * @param[in] value The new value
171 * @param[in] undoList The undoList on which to register changes
172 */
173 bool isValid(SumoXMLAttr key, const std::string& value);
174
175 /* @brief method for check if the value for certain attribute is set
176 * @param[in] key The attribute key
177 */
178 bool isAttributeEnabled(SumoXMLAttr key) const;
179
181 std::string getPopUpID() const;
182
184 std::string getHierarchyName() const;
186
189
191 static bool overwriteVType(GNEDemandElement* vType, const SUMOVTypeParameter newVTypeParameter, GNEUndoList* undoList);
192
193protected:
196
199
200private:
202 void setAttribute(SumoXMLAttr key, const std::string& value);
203
205 void setMoveShape(const GNEMoveResult& moveResult);
206
208 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
209
211 void updateDefaultVClassAttributes(const VClassDefaultValues& defaultValues);
212
214 GNEVType(GNEVType*) = delete;
215
218};
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
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML
Definition GNEVType.cpp:114
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEVType.cpp:947
void updateGeometry()
update pre-computed geometry information
Definition GNEVType.cpp:145
std::string getParentName() const
Returns the name of the parent object.
Definition GNEVType.cpp:160
~GNEVType()
destructor
Definition GNEVType.cpp:91
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition GNEVType.cpp:693
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
Definition GNEVType.cpp:191
GNEMoveOperation * getMoveOperation()
get move operation
Definition GNEVType.cpp:95
Position getPositionInView() const
Returns position of additional in view.
Definition GNEVType.cpp:154
static bool overwriteVType(GNEDemandElement *vType, const SUMOVTypeParameter newVTypeParameter, GNEUndoList *undoList)
overwrite all values of GNEVType with a SUMOVTypeParameter
Definition GNEVType.cpp:959
GNEVType * operator=(GNEVType *)=delete
Invalidated assignment operator.
GNEVType(GNEVType *)=delete
Invalidated copy constructor.
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNEVType.cpp:900
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Definition GNEVType.cpp:559
void updateDefaultVClassAttributes(const VClassDefaultValues &defaultValues)
function called after set new VClass
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
GNELane * getFirstPathLane() const
get first path lane
Definition GNEVType.cpp:203
GNELane * getLastPathLane() const
get last path lane
Definition GNEVType.cpp:210
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNEVType.cpp:173
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNEVType.cpp:101
bool myDefaultVehicleType
flag to check if this GNEVType is a default vehicle Type (For Vehicles, Pedestrians....
Definition GNEVType.h:195
const RGBColor & getColor() const
get color
Definition GNEVType.cpp:139
std::string getDemandElementProblem() const
return a string with the current demand element problem
Definition GNEVType.cpp:121
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition GNEVType.cpp:953
void fixDemandElementProblem()
fix demand element problem
Definition GNEVType.cpp:127
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Position getAttributePosition(SumoXMLAttr key) const
Definition GNEVType.cpp:553
double getAttributeDouble(SumoXMLAttr key) const
Definition GNEVType.cpp:506
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNEVType.cpp:179
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition GNEVType.cpp:217
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNEVType.cpp:166
void computePathElement()
compute pathElement
Definition GNEVType.cpp:185
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition GNEVType.cpp:941
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition GNEVType.cpp:133
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
Definition GNEVType.cpp:197
bool myDefaultVehicleTypeModified
flag to check if this default GNEVType was modified
Definition GNEVType.h:198
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
std::map< std::string, std::string > Map
parameters map
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