Eclipse SUMO - Simulation of Urban MObility
GNEVehicleType.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-2020 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
22 
23 #include "GNEDemandElement.h"
24 
25 
26 // ===========================================================================
27 // class definitions
28 // ===========================================================================
34 
35 public:
37  GNEVehicleType(GNENet* net, const std::string& vTypeID, const SUMOVehicleClass& defaultVClass, SumoXMLTag tag);
38 
40  GNEVehicleType(GNENet* net, const SUMOVTypeParameter& vTypeParameter, SumoXMLTag tag);
41 
43  GNEVehicleType(GNENet* net, const std::string& vTypeID, GNEVehicleType* vTypeOriginal);
44 
47 
51  void writeDemandElement(OutputDevice& device) const;
52 
57 
59  const RGBColor& getColor() const;
60 
62 
66  void startGeometryMoving();
67 
69  void endGeometryMoving();
70 
74  void moveGeometry(const Position& offset);
75 
79  void commitGeometryMoving(GNEUndoList* undoList);
80 
82  void updateGeometry();
83 
85  void computePath();
86 
88  void invalidatePath();
89 
93 
96 
99  std::string getParentName() const;
100 
105 
107  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
108 
113  void drawGL(const GUIVisualizationSettings& s) const;
114 
120  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const double offsetFront) const;
121 
128  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const double offsetFront) const;
130 
133  /* @brief method for getting the Attribute of an XML key
134  * @param[in] key The attribute key
135  * @return string with the value associated to key
136  */
137  std::string getAttribute(SumoXMLAttr key) const;
138 
139  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
140  * @param[in] key The attribute key
141  * @return double with the value associated to key
142  */
143  double getAttributeDouble(SumoXMLAttr key) const;
144 
145  /* @brief method for setting the attribute and letting the object perform additional changes
146  * @param[in] key The attribute key
147  * @param[in] value The new value
148  * @param[in] undoList The undoList on which to register changes
149  * @param[in] net optionally the GNENet to inform about gui updates
150  */
151  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
152 
153  /* @brief method for setting the attribute and letting the object perform additional changes
154  * @param[in] key The attribute key
155  * @param[in] value The new value
156  * @param[in] undoList The undoList on which to register changes
157  */
158  bool isValid(SumoXMLAttr key, const std::string& value);
159 
160  /* @brief method for enable attribute
161  * @param[in] key The attribute key
162  * @param[in] undoList The undoList on which to register changes
163  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
164  */
165  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
166 
167  /* @brief method for disable attribute
168  * @param[in] key The attribute key
169  * @param[in] undoList The undoList on which to register changes
170  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
171  */
172  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
173 
174  /* @brief method for check if the value for certain attribute is set
175  * @param[in] key The attribute key
176  */
177  bool isAttributeEnabled(SumoXMLAttr key) const;
178 
180  std::string getPopUpID() const;
181 
183  std::string getHierarchyName() const;
185 
187  const std::map<std::string, std::string>& getACParametersMap() const;
188 
190  static void overwriteVType(GNEDemandElement* vType, SUMOVTypeParameter* newVTypeParameter, GNEUndoList* undoList);
191 
192 protected:
195 
198 
201 
202 private:
204  void setAttribute(SumoXMLAttr key, const std::string& value);
205 
207  void setEnabledAttribute(const int enabledAttributes);
208 
210  void updateDefaultVClassAttributes(const VClassDefaultValues& defaultValues);
211 
214 
217 };
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
An Element which don't belongs to GNENet but has influency in the simulation.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
double getAttributeDouble(SumoXMLAttr key) const
static void overwriteVType(GNEDemandElement *vType, SUMOVTypeParameter *newVTypeParameter, GNEUndoList *undoList)
overwrite all values of GNEVehicleType with a SUMOVTypeParameter
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Position getPositionInView() const
Returns position of additional in view.
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
GNEVehicleType(GNENet *net, const std::string &vTypeID, const SUMOVehicleClass &defaultVClass, SumoXMLTag tag)
constructor for default VTypes
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
bool myDefaultVehicleType
flag to check if this GNEVehicleType is a default vehicle Type (For Vehicles, Pedestrians....
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront) const
Draws partial object.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
SUMOVehicleClass getVClass() const
void initRailVisualizationParameters()
init Rail Visualization Parameters
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void updateDefaultVClassAttributes(const VClassDefaultValues &defaultValues)
function called after set new VClass
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
std::string getParentName() const
Returns the name of the parent object.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
GNEVehicleType * operator=(GNEVehicleType *)=delete
Invalidated assignment operator.
void updateGeometry()
update pre-computed geometry information
void startGeometryMoving()
void endGeometryMoving()
end geometry movement
const RGBColor & getColor() const
get color
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GNEVehicleType(GNEVehicleType *)=delete
Invalidated copy constructor.
void invalidatePath()
invalidate path
bool myDefaultVehicleTypeModified
flag to check if this default GNEVehicleType was modified
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void computePath()
compute path
bool isAttributeEnabled(SumoXMLAttr key) const
~GNEVehicleType()
destructor
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
Structure representing possible vehicle parameter.
struct for default values that depend of VClass