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-2023 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(GNENet* net);
36
38 GNEVType(GNENet* net, const std::string& vTypeID, const SUMOVehicleClass& defaultVClass);
39
41 GNEVType(GNENet* net, const SUMOVTypeParameter& vTypeParameter);
42
44 GNEVType(GNENet* net, const std::string& vTypeID, GNEVType* vTypeOriginal);
45
47 ~GNEVType();
48
53
57 void writeDemandElement(OutputDevice& device) const;
58
61
63 std::string getDemandElementProblem() const;
64
67
72
74 const RGBColor& getColor() const;
75
77
81 void updateGeometry();
82
86
89
92 std::string getParentName() const;
93
98
100 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
101
106 void drawGL(const GUIVisualizationSettings& s) const;
107
109
112
114 void computePathElement();
115
122 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
123
131 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* 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 void overwriteVType(GNEDemandElement* vType, const SUMOVTypeParameter newVTypeParameter, GNEUndoList* undoList);
192
193protected:
196
199
201 std::map <std::string, double> myDistributions;
202
203private:
205 void setAttribute(SumoXMLAttr key, const std::string& value);
206
208 void setMoveShape(const GNEMoveResult& moveResult);
209
211 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
212
214 void updateDefaultVClassAttributes(const VClassDefaultValues& defaultValues);
215
217 GNEVType(GNEVType*) = delete;
218
221};
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
An Element which don't belong to GNENet but has influence in the simulation.
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 writed into XML
Definition GNEVType.cpp:109
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void updateGeometry()
update pre-computed geometry information
Definition GNEVType.cpp:140
std::string getParentName() const
Returns the name of the parent object.
Definition GNEVType.cpp:155
~GNEVType()
destructor
Definition GNEVType.cpp:86
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition GNEVType.cpp:715
GNEMoveOperation * getMoveOperation()
get move operation
Definition GNEVType.cpp:90
Position getPositionInView() const
Returns position of additional in view.
Definition GNEVType.cpp:149
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition GNEVType.cpp:186
GNEVType * operator=(GNEVType *)=delete
Invalidated assignment operator.
GNEVType(GNEVType *)=delete
Invalidated copy constructor.
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNEVType.cpp:967
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:568
static void overwriteVType(GNEDemandElement *vType, const SUMOVTypeParameter newVTypeParameter, GNEUndoList *undoList)
overwrite all values of GNEVType with a SUMOVTypeParameter
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:198
GNELane * getLastPathLane() const
get last path lane
Definition GNEVType.cpp:205
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNEVType.cpp:168
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNEVType.cpp:96
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:134
std::string getDemandElementProblem() const
return a string with the current demand element problem
Definition GNEVType.cpp:116
const Parameterised::Map & getACParametersMap() const
get parameters map
void fixDemandElementProblem()
fix demand element problem
Definition GNEVType.cpp:122
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Position getAttributePosition(SumoXMLAttr key) const
Definition GNEVType.cpp:562
double getAttributeDouble(SumoXMLAttr key) const
Definition GNEVType.cpp:521
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNEVType.cpp:174
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition GNEVType.cpp:212
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNEVType.cpp:161
std::map< std::string, double > myDistributions
vType distributions
Definition GNEVType.h:201
void computePathElement()
compute pathElement
Definition GNEVType.cpp:180
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
SUMOVehicleClass getVClass() const
Definition GNEVType.cpp:128
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