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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Definition of Vehicle Types in NETEDIT
16 /****************************************************************************/
17 #ifndef GNECalibratorVehicleType_h
18 #define GNECalibratorVehicleType_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
26 
27 #include "GNEDemandElement.h"
28 
29 
30 // ===========================================================================
31 // class definitions
32 // ===========================================================================
38 
39 public:
41  GNEVehicleType(GNEViewNet* viewNet, const std::string& vTypeID, const SUMOVehicleClass& defaultVClass, SumoXMLTag tag);
42 
44  GNEVehicleType(GNEViewNet* viewNet, const SUMOVTypeParameter& vTypeParameter, SumoXMLTag tag);
45 
47  GNEVehicleType(GNEViewNet* viewNet, const std::string& vTypeID, GNEVehicleType* vTypeOriginal);
48 
51 
55  void writeDemandElement(OutputDevice& device) const;
56 
60  GNEEdge* getFromEdge() const;
61 
63  GNEEdge* getToEdge() const;
64 
67 
69  const RGBColor& getColor() const;
70 
72  void compute();
73 
75 
79  void startGeometryMoving();
80 
82  void endGeometryMoving();
83 
87  void moveGeometry(const Position& offset);
88 
92  void commitGeometryMoving(GNEUndoList* undoList);
93 
95  void updateGeometry();
96 
100 
103 
106  std::string getParentName() const;
107 
112 
117  void drawGL(const GUIVisualizationSettings& s) const;
119 
123  void selectAttributeCarrier(bool changeFlag = true);
124 
126  void unselectAttributeCarrier(bool changeFlag = true);
127 
128  /* @brief method for getting the Attribute of an XML key
129  * @param[in] key The attribute key
130  * @return string with the value associated to key
131  */
132  std::string getAttribute(SumoXMLAttr key) const;
133 
134  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
135  * @param[in] key The attribute key
136  * @return double with the value associated to key
137  */
138  double getAttributeDouble(SumoXMLAttr key) const;
139 
140  /* @brief method for setting the attribute and letting the object perform additional changes
141  * @param[in] key The attribute key
142  * @param[in] value The new value
143  * @param[in] undoList The undoList on which to register changes
144  * @param[in] net optionally the GNENet to inform about gui updates
145  */
146  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
147 
148  /* @brief method for setting the attribute and letting the object perform additional changes
149  * @param[in] key The attribute key
150  * @param[in] value The new value
151  * @param[in] undoList The undoList on which to register changes
152  */
153  bool isValid(SumoXMLAttr key, const std::string& value);
154 
155  /* @brief method for enabling attribute
156  * @param[in] key The attribute key
157  * @param[in] undoList The undoList on which to register changes
158  * @note only certain attributes can be enabled, and can produce the disabling of other attributes
159  */
160  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
161 
162  /* @brief method for check if the value for certain attribute is set
163  * @param[in] key The attribute key
164  */
165  bool isAttributeEnabled(SumoXMLAttr key) const;
166 
168  std::string getPopUpID() const;
169 
171  std::string getHierarchyName() const;
173 
177  std::string getGenericParametersStr() const;
178 
180  std::vector<std::pair<std::string, std::string> > getGenericParameters() const;
181 
183  void setGenericParametersStr(const std::string& value);
184 
186 
188  static void overwriteVType(GNEDemandElement* vType, SUMOVTypeParameter* newVTypeParameter, GNEUndoList* undoList);
189 
190 protected:
193 
196 
199 
200 private:
202  void setAttribute(SumoXMLAttr key, const std::string& value);
203 
205  void setEnabledAttribute(const int enabledAttributes);
206 
208  void updateDefaultVClassAttributes(const VClassDefaultValues& defaultValues);
209 
211  GNEVehicleType(GNEVehicleType*) = delete;
212 
215 };
216 
217 #endif
218 /****************************************************************************/
GNEVehicleType::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Definition: GNEVehicleType.cpp:515
GNEVehicleType::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEVehicleType.cpp:84
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:134
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:54
GNEVehicleType::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEVehicleType.cpp:103
GNEVehicleType::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEVehicleType.cpp:197
GNEVehicleType::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEVehicleType.cpp:109
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
GNEVehicleType::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEVehicleType.cpp:1689
GNEVehicleType::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEVehicleType.cpp:163
GNEVehicleType::~GNEVehicleType
~GNEVehicleType()
destructor
Definition: GNEVehicleType.cpp:80
GNEVehicleType::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEVehicleType.cpp:151
GNEVehicleType::myDefaultVehicleType
bool myDefaultVehicleType
flag to check if this GNEVehicleType is a default vehicle Type (For Vehicles, Pedestrians....
Definition: GNEVehicleType.h:195
GNEViewNet
Definition: GNEViewNet.h:43
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:42
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
RGBColor
Definition: RGBColor.h:40
GNEVehicleType::endGeometryMoving
void endGeometryMoving()
end geometry movement
Definition: GNEVehicleType.cpp:133
GNEVehicleType
Definition: GNEVehicleType.h:37
SUMOVTypeParameter
Structure representing possible vehicle parameter.
Definition: SUMOVTypeParameter.h:86
GNEVehicleType::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEVehicleType.cpp:169
GNEDemandElement.h
GNEVehicleType::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNEVehicleType.cpp:97
GNEVehicleType::startGeometryMoving
void startGeometryMoving()
Definition: GNEVehicleType.cpp:127
GNEVehicleType::GNEVehicleType
GNEVehicleType(GNEViewNet *viewNet, const std::string &vTypeID, const SUMOVehicleClass &defaultVClass, SumoXMLTag tag)
constructor for default VTypes
Definition: GNEVehicleType.cpp:40
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GNEVehicleType::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEVehicleType.cpp:182
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNEVehicleType::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEVehicleType.cpp:145
GNEVehicleType::compute
void compute()
compute demand element
Definition: GNEVehicleType.cpp:121
GNEVehicleType::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEVehicleType.cpp:836
GNEVehicleType::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEVehicleType.cpp:800
GNEVehicleType::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEVehicleType.cpp:842
GNEVehicleType::getGenericParameters
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNEVehicleType.cpp:1173
GNEVehicleType::getColor
const RGBColor & getColor() const
get color
Definition: GNEVehicleType.cpp:115
GNEVehicleType::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEVehicleType.cpp:474
GNEVehicleType::setGenericParametersStr
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEVehicleType.cpp:1184
SUMOVTypeParameter::VClassDefaultValues
struct for default values that depend of VClass
Definition: SUMOVTypeParameter.h:89
GNEVehicleType::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEVehicleType.cpp:624
GNEVehicleType::initRailVisualizationParameters
void initRailVisualizationParameters()
init Rail Visualization Parameters
Definition: GNEVehicleType.cpp:1111
GNEVehicleType::overwriteVType
static void overwriteVType(GNEDemandElement *vType, SUMOVTypeParameter *newVTypeParameter, GNEUndoList *undoList)
overwrite all values of GNEVehicleType with a SUMOVTypeParameter
Definition: GNEVehicleType.cpp:848
GNEVehicleType::getGenericParametersStr
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNEVehicleType.cpp:1158
GNEVehicleType::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEVehicleType.cpp:139
GNEVehicleType::updateDefaultVClassAttributes
void updateDefaultVClassAttributes(const VClassDefaultValues &defaultValues)
function called after set new VClass
Definition: GNEVehicleType.cpp:1695
GNEVehicleType::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEVehicleType.cpp:805
GNEVehicleType::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEVehicleType.cpp:157
GNEVehicleType::myDefaultVehicleTypeModified
bool myDefaultVehicleTypeModified
flag to check if this default GNEVehicleType was modified
Definition: GNEVehicleType.h:198
GNEUndoList
Definition: GNEUndoList.h:49
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
SUMOVTypeParameter.h
GNEVehicleType::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEVehicleType.cpp:176
GNEVehicleType::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEVehicleType.cpp:213
GNEVehicleType::operator=
GNEVehicleType * operator=(GNEVehicleType *)=delete
Invalidated assignment operator.