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.dev/sumo
3 // Copyright (C) 2001-2024 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 
33 public:
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 
121  void drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
122 
128  void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
129 
131  GNELane* getFirstPathLane() const;
132 
134  GNELane* getLastPathLane() const;
136 
139  /* @brief method for getting the Attribute of an XML key
140  * @param[in] key The attribute key
141  * @return string with the value associated to key
142  */
143  std::string getAttribute(SumoXMLAttr key) const;
144 
145  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
146  * @param[in] key The attribute key
147  * @return double with the value associated to key
148  */
149  double getAttributeDouble(SumoXMLAttr key) const;
150 
151  /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
152  * @param[in] key The attribute key
153  * @return double with the value associated to key
154  */
156 
157  /* @brief method for setting the attribute and letting the object perform additional changes
158  * @param[in] key The attribute key
159  * @param[in] value The new value
160  * @param[in] undoList The undoList on which to register changes
161  * @param[in] net optionally the GNENet to inform about gui updates
162  */
163  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
164 
165  /* @brief method for setting the attribute and letting the object perform additional changes
166  * @param[in] key The attribute key
167  * @param[in] value The new value
168  * @param[in] undoList The undoList on which to register changes
169  */
170  bool isValid(SumoXMLAttr key, const std::string& value);
171 
172  /* @brief method for check if the value for certain attribute is set
173  * @param[in] key The attribute key
174  */
175  bool isAttributeEnabled(SumoXMLAttr key) const;
176 
178  std::string getPopUpID() const;
179 
181  std::string getHierarchyName() const;
183 
185  const Parameterised::Map& getACParametersMap() const;
186 
188  static void overwriteVType(GNEDemandElement* vType, const SUMOVTypeParameter newVTypeParameter, GNEUndoList* undoList);
189 
190 protected:
193 
196 
197 private:
199  void setAttribute(SumoXMLAttr key, const std::string& value);
200 
202  void setMoveShape(const GNEMoveResult& moveResult);
203 
205  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
206 
208  void updateDefaultVClassAttributes(const VClassDefaultValues& defaultValues);
209 
211  GNEVType(GNEVType*) = delete;
212 
215 };
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
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:105
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEVType.cpp:952
void updateGeometry()
update pre-computed geometry information
Definition: GNEVType.cpp:136
GNEVType * operator=(GNEVType *)=delete
Invalidated assignment operator.
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEVType.cpp:151
~GNEVType()
destructor
Definition: GNEVType.cpp:82
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEVType.cpp:692
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEVType.cpp:86
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEVType.cpp:145
GNEVType(GNEVType *)=delete
Invalidated copy constructor.
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEVType.cpp:903
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:557
static void overwriteVType(GNEDemandElement *vType, const SUMOVTypeParameter newVTypeParameter, GNEUndoList *undoList)
overwrite all values of GNEVType with a SUMOVTypeParameter
Definition: GNEVType.cpp:964
void updateDefaultVClassAttributes(const VClassDefaultValues &defaultValues)
function called after set new VClass
Definition: GNEVType.cpp:1863
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEVType.cpp:1857
GNELane * getFirstPathLane() const
get first path lane
Definition: GNEVType.cpp:194
GNELane * getLastPathLane() const
get last path lane
Definition: GNEVType.cpp:201
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEVType.cpp:164
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition: GNEVType.cpp:92
bool myDefaultVehicleType
flag to check if this GNEVType is a default vehicle Type (For Vehicles, Pedestrians....
Definition: GNEVType.h:192
const RGBColor & getColor() const
get color
Definition: GNEVType.cpp:130
std::string getDemandElementProblem() const
return a string with the current demand element problem
Definition: GNEVType.cpp:112
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
Definition: GNEVType.cpp:188
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNEVType.cpp:958
void fixDemandElementProblem()
fix demand element problem
Definition: GNEVType.cpp:118
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEVType.cpp:1851
GNEVType(GNENet *net)
default constructor
Definition: GNEVType.cpp:32
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNEVType.cpp:551
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEVType.cpp:504
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEVType.cpp:170
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEVType.cpp:208
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEVType.cpp:157
void computePathElement()
compute pathElement
Definition: GNEVType.cpp:176
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEVType.cpp:946
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
Definition: GNEVType.cpp:182
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEVType.cpp:124
bool myDefaultVehicleTypeModified
flag to check if this default GNEVType was modified
Definition: GNEVType.h:195
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