Eclipse SUMO - Simulation of Urban MObility
GNEVType.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-2022 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
95 double getExaggeration(const GUIVisualizationSettings& s) 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
125 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
126
134 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
135
137 GNELane* getFirstPathLane() const;
138
140 GNELane* getLastPathLane() const;
142
145 /* @brief method for getting the Attribute of an XML key
146 * @param[in] key The attribute key
147 * @return string with the value associated to key
148 */
149 std::string getAttribute(SumoXMLAttr key) const;
150
151 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
152 * @param[in] key The attribute key
153 * @return double with the value associated to key
154 */
155 double getAttributeDouble(SumoXMLAttr key) const;
156
157 /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
158 * @param[in] key The attribute key
159 * @return double with the value associated to key
160 */
162
163 /* @brief method for setting the attribute and letting the object perform additional changes
164 * @param[in] key The attribute key
165 * @param[in] value The new value
166 * @param[in] undoList The undoList on which to register changes
167 * @param[in] net optionally the GNENet to inform about gui updates
168 */
169 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
170
171 /* @brief method for setting the attribute and letting the object perform additional changes
172 * @param[in] key The attribute key
173 * @param[in] value The new value
174 * @param[in] undoList The undoList on which to register changes
175 */
176 bool isValid(SumoXMLAttr key, const std::string& value);
177
178 /* @brief method for check if the value for certain attribute is set
179 * @param[in] key The attribute key
180 */
181 bool isAttributeEnabled(SumoXMLAttr key) const;
182
184 std::string getPopUpID() const;
185
187 std::string getHierarchyName() const;
189
192
194 static void overwriteVType(GNEDemandElement* vType, const SUMOVTypeParameter newVTypeParameter, GNEUndoList* undoList);
195
196protected:
199
202
204 void editVTypeDistribution(const std::string& vTypeDistributionID, GNEUndoList* undoList);
205
207 bool askAddVTypeDistribution(const std::string& vTypeDistribution) const;
208
210 bool askRemoveVTypeDistribution(const std::string& vTypeDistribution) const;
211
212private:
214 void setAttribute(SumoXMLAttr key, const std::string& value);
215
217 void setMoveShape(const GNEMoveResult& moveResult);
218
220 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
221
223 void updateDefaultVClassAttributes(const VClassDefaultValues& defaultValues);
224
226 GNEVType(GNEVType*) = delete;
227
230};
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:108
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition: GNEVType.cpp:160
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEVType.cpp:945
void updateGeometry()
update pre-computed geometry information
Definition: GNEVType.cpp:139
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEVType.cpp:154
~GNEVType()
destructor
Definition: GNEVType.cpp:85
bool askRemoveVTypeDistribution(const std::string &vTypeDistribution) const
ask if remove vTypeDistribution
Definition: GNEVType.cpp:1359
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEVType.cpp:687
bool askAddVTypeDistribution(const std::string &vTypeDistribution) const
ask if add vTypeDistribution
Definition: GNEVType.cpp:1335
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEVType.cpp:89
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEVType.cpp:148
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition: GNEVType.cpp:191
GNEVType * operator=(GNEVType *)=delete
Invalidated assignment operator.
GNEVType(GNEVType *)=delete
Invalidated copy constructor.
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEVType.cpp:902
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:548
static void overwriteVType(GNEDemandElement *vType, const SUMOVTypeParameter newVTypeParameter, GNEUndoList *undoList)
overwrite all values of GNEVType with a SUMOVTypeParameter
Definition: GNEVType.cpp:957
void updateDefaultVClassAttributes(const VClassDefaultValues &defaultValues)
function called after set new VClass
Definition: GNEVType.cpp:1916
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEVType.cpp:1910
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:95
bool myDefaultVehicleType
flag to check if this GNEVType is a default vehicle Type (For Vehicles, Pedestrians....
Definition: GNEVType.h:198
const RGBColor & getColor() const
get color
Definition: GNEVType.cpp:133
std::string getDemandElementProblem() const
return a string with the current demand element problem
Definition: GNEVType.cpp:115
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNEVType.cpp:951
void fixDemandElementProblem()
fix demand element problem
Definition: GNEVType.cpp:121
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEVType.cpp:1904
GNEVType(GNENet *net)
default constructor
Definition: GNEVType.cpp:35
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNEVType.cpp:542
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEVType.cpp:501
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:939
SUMOVehicleClass getVClass() const
Definition: GNEVType.cpp:127
void editVTypeDistribution(const std::string &vTypeDistributionID, GNEUndoList *undoList)
edit vType distribution
Definition: GNEVType.cpp:1278
bool myDefaultVehicleTypeModified
flag to check if this default GNEVType was modified
Definition: GNEVType.h:201
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
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