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 /****************************************************************************/
std::string getGenericParametersStr() const
return generic parameters in string format
void endGeometryMoving()
end geometry movement
SumoXMLTag
Numbers representing SUMO-XML - element names.
void startGeometryMoving()
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
std::string getParentName() const
Returns the name of the parent object.
Position getPositionInView() const
Returns position of additional in view.
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Structure representing possible vehicle parameter.
Stores the information about how to visualize structures.
static void overwriteVType(GNEDemandElement *vType, SUMOVTypeParameter *newVTypeParameter, GNEUndoList *undoList)
overwrite all values of GNEVehicleType with a SUMOVTypeParameter
bool myDefaultVehicleTypeModified
flag to check if this default GNEVehicleType was modified
~GNEVehicleType()
destructor
GNEEdge * getToEdge() const
obtain to edge of this demand element
GNEVehicleType(GNEViewNet *viewNet, const std::string &vTypeID, const SUMOVehicleClass &defaultVClass, SumoXMLTag tag)
constructor for default VTypes
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
const RGBColor & getColor() const
get color
double getAttributeDouble(SumoXMLAttr key) const
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GNEVehicleType * operator=(GNEVehicleType *)=delete
Invalidated assignment operator.
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNEEdge * getFromEdge() const
void compute()
compute demand element
struct for default values that depend of VClass
std::string getAttribute(SumoXMLAttr key) const
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
bool myDefaultVehicleType
flag to check if this GNEVehicleType is a default vehicle Type (For Vehicles, Pedestrians...)
bool isAttributeEnabled(SumoXMLAttr key) const
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
void updateGeometry()
update pre-computed geometry information
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
void updateDefaultVClassAttributes(const VClassDefaultValues &defaultValues)
function called after set new VClass
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes ...
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute) ...
void initRailVisualizationParameters()
init Rail Visualization Parameters
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
void setGenericParametersStr(const std::string &value)
set generic parameters in string format