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 /****************************************************************************/
14 // Definition of Vehicle Types in NETEDIT
15 /****************************************************************************/
16 #ifndef GNECalibratorVehicleType_h
17 #define GNECalibratorVehicleType_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
25 
26 #include "GNEDemandElement.h"
27 
28 
29 // ===========================================================================
30 // class definitions
31 // ===========================================================================
37 
38 public:
40  GNEVehicleType(GNEViewNet* viewNet, const std::string& vTypeID, const SUMOVehicleClass& defaultVClass, SumoXMLTag tag);
41 
43  GNEVehicleType(GNEViewNet* viewNet, const SUMOVTypeParameter& vTypeParameter, SumoXMLTag tag);
44 
46  GNEVehicleType(GNEViewNet* viewNet, const std::string& vTypeID, GNEVehicleType* vTypeOriginal);
47 
50 
54  void writeDemandElement(OutputDevice& device) const;
55 
59  GNEEdge* getFromEdge() const;
60 
62  GNEEdge* getToEdge() const;
63 
66 
68  const RGBColor& getColor() const;
69 
71 
75  void startGeometryMoving();
76 
78  void endGeometryMoving();
79 
83  void moveGeometry(const Position& offset);
84 
88  void commitGeometryMoving(GNEUndoList* undoList);
89 
91  void updateGeometry();
92 
94  void updatePartialGeometry(const GNEEdge* edge);
95 
97  void computePath();
98 
100  void invalidatePath();
101 
103  Position getPositionInView() const;
105 
108 
111  std::string getParentName() const;
112 
117 
119  void splitEdgeGeometry(const double splitPosition, const GNENetElement* originalElement, const GNENetElement* newElement, GNEUndoList* undoList);
120 
125  void drawGL(const GUIVisualizationSettings& s) const;
127 
131  void selectAttributeCarrier(bool changeFlag = true);
132 
134  void unselectAttributeCarrier(bool changeFlag = true);
135 
136  /* @brief method for getting the Attribute of an XML key
137  * @param[in] key The attribute key
138  * @return string with the value associated to key
139  */
140  std::string getAttribute(SumoXMLAttr key) const;
141 
142  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
143  * @param[in] key The attribute key
144  * @return double with the value associated to key
145  */
146  double getAttributeDouble(SumoXMLAttr key) const;
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  * @param[in] net optionally the GNENet to inform about gui updates
153  */
154  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
155 
156  /* @brief method for setting the attribute and letting the object perform additional changes
157  * @param[in] key The attribute key
158  * @param[in] value The new value
159  * @param[in] undoList The undoList on which to register changes
160  */
161  bool isValid(SumoXMLAttr key, const std::string& value);
162 
163  /* @brief method for enable attribute
164  * @param[in] key The attribute key
165  * @param[in] undoList The undoList on which to register changes
166  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
167  */
168  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
169 
170  /* @brief method for disable attribute
171  * @param[in] key The attribute key
172  * @param[in] undoList The undoList on which to register changes
173  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
174  */
175  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
176 
177  /* @brief method for check if the value for certain attribute is set
178  * @param[in] key The attribute key
179  */
180  bool isAttributeEnabled(SumoXMLAttr key) const;
181 
183  std::string getPopUpID() const;
184 
186  std::string getHierarchyName() 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 };
218 
219 #endif
220 /****************************************************************************/
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:532
GNEVehicleType::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEVehicleType.cpp:83
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:55
GNEVehicleType::disableAttribute
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEVehicleType.cpp:819
GNEVehicleType::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEVehicleType.cpp:102
GNEVehicleType::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEVehicleType.cpp:220
GNEVehicleType::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEVehicleType.cpp:108
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
GNEVehicleType::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEVehicleType.cpp:1653
GNEVehicleType::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEVehicleType.cpp:180
GNEVehicleType::~GNEVehicleType
~GNEVehicleType()
destructor
Definition: GNEVehicleType.cpp:79
GNEVehicleType::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEVehicleType.cpp:144
GNEVehicleType::myDefaultVehicleType
bool myDefaultVehicleType
flag to check if this GNEVehicleType is a default vehicle Type (For Vehicles, Pedestrians....
Definition: GNEVehicleType.h:197
GNEViewNet
Definition: GNEViewNet.h:42
GNEVehicleType::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEVehicleType.cpp:193
GNEVehicleType::computePath
void computePath()
compute path
Definition: GNEVehicleType.cpp:162
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
RGBColor
Definition: RGBColor.h:39
GNEVehicleType::endGeometryMoving
void endGeometryMoving()
end geometry movement
Definition: GNEVehicleType.cpp:126
GNEVehicleType
Definition: GNEVehicleType.h:36
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:186
GNEDemandElement.h
GNEVehicleType::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNEVehicleType.cpp:96
GNEVehicleType::startGeometryMoving
void startGeometryMoving()
Definition: GNEVehicleType.cpp:120
GNEVehicleType::GNEVehicleType
GNEVehicleType(GNEViewNet *viewNet, const std::string &vTypeID, const SUMOVehicleClass &defaultVClass, SumoXMLTag tag)
constructor for default VTypes
Definition: GNEVehicleType.cpp:39
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNEVehicleType::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEVehicleType.cpp:205
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNEVehicleType::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEVehicleType.cpp:138
GNENetElement
Definition: GNENetElement.h:43
GNEVehicleType::updatePartialGeometry
void updatePartialGeometry(const GNEEdge *edge)
partial update pre-computed geometry information
Definition: GNEVehicleType.cpp:153
GNEVehicleType::invalidatePath
void invalidatePath()
invalidate path
Definition: GNEVehicleType.cpp:168
GNEVehicleType::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEVehicleType.cpp:862
GNEVehicleType::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEVehicleType.cpp:813
GNEVehicleType::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEVehicleType.cpp:868
GNEVehicleType::getColor
const RGBColor & getColor() const
get color
Definition: GNEVehicleType.cpp:114
GNEVehicleType::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEVehicleType.cpp:491
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:640
GNEVehicleType::initRailVisualizationParameters
void initRailVisualizationParameters()
init Rail Visualization Parameters
Definition: GNEVehicleType.cpp:1134
GNEVehicleType::overwriteVType
static void overwriteVType(GNEDemandElement *vType, SUMOVTypeParameter *newVTypeParameter, GNEUndoList *undoList)
overwrite all values of GNEVehicleType with a SUMOVTypeParameter
Definition: GNEVehicleType.cpp:874
GNEVehicleType::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEVehicleType.cpp:132
GNEVehicleType::updateDefaultVClassAttributes
void updateDefaultVClassAttributes(const VClassDefaultValues &defaultValues)
function called after set new VClass
Definition: GNEVehicleType.cpp:1659
GNEVehicleType::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEVehicleType.cpp:825
GNEVehicleType::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEVehicleType.cpp:174
GNEVehicleType::myDefaultVehicleTypeModified
bool myDefaultVehicleTypeModified
flag to check if this default GNEVehicleType was modified
Definition: GNEVehicleType.h:200
GNEUndoList
Definition: GNEUndoList.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
SUMOVTypeParameter.h
GNEVehicleType::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEVehicleType.cpp:199
GNEVehicleType::GNEVehicleType
GNEVehicleType(GNEVehicleType *)=delete
Invalidated copy constructor.
GNEVehicleType::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEVehicleType.cpp:236
GNEVehicleType::operator=
GNEVehicleType * operator=(GNEVehicleType *)=delete
Invalidated assignment operator.