Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEDemandElementFlow.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// An auxiliar, asbtract class for flow elements (vehicles, person and containers)
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include <utils/geom/Position.h>
26
27// ===========================================================================
28// class declaration
29// ===========================================================================
30
33
34// ===========================================================================
35// class definitions
36// ===========================================================================
37
39
40protected:
43
45 GNEDemandElementFlow(GNEDemandElement* flowElement, const SUMOVehicleParameter& vehicleParameters);
46
49
51 void drawFlowLabel(const Position& position, const double rotation, const double width,
52 const double length, const double exaggeration) const;
53
55 void writeFlowAttributes(const GNEDemandElement* flowElement, OutputDevice& device) const;
56
59 /* @brief method for getting the Attribute of an XML key
60 * @param[in] key The attribute key
61 * @return string with the value associated to key
62 */
63 std::string getFlowAttribute(const GNEDemandElement* flowElement, SumoXMLAttr key) const;
64
65 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
66 * @param[in] key The attribute key
67 * @return double with the value associated to key
68 */
69 double getFlowAttributeDouble(SumoXMLAttr key) const;
70
71 /* @brief method for setting the attribute and letting the object perform demand element changes
72 * @param[in] key The attribute key
73 * @param[in] value The new value
74 * @param[in] undoList The undoList on which to register changes
75 * @param[in] net optionally the GNENet to inform about gui updates
76 */
77 void setFlowAttribute(GNEDemandElement* flowElement, SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
78
79 /* @brief method for setting the attribute and letting the object perform demand element changes
80 * @param[in] key The attribute key
81 * @param[in] value The new value
82 * @param[in] undoList The undoList on which to register changes
83 */
84 bool isValidFlowAttribute(GNEDemandElement* flowElement, SumoXMLAttr key, const std::string& value);
85
86 /* @brief method for enable attribute
87 * @param[in] key The attribute key
88 * @param[in] undoList The undoList on which to register changes
89 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
90 */
91 void enableFlowAttribute(GNEDemandElement* flowElement, SumoXMLAttr key, GNEUndoList* undoList);
92
93 /* @brief method for disable attribute
94 * @param[in] key The attribute key
95 * @param[in] undoList The undoList on which to register changes
96 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
97 */
98 void disableFlowAttribute(GNEDemandElement* flowElement, SumoXMLAttr key, GNEUndoList* undoList);
99
100 /* @brief method for check if the value for certain attribute is set
101 * @param[in] key The attribute key
102 */
103 bool isFlowAttributeEnabled(SumoXMLAttr key) const;
104
106 void setFlowAttribute(GNEDemandElement* flowElement, SumoXMLAttr key, const std::string& value);
107
109 void toggleFlowAttribute(const SumoXMLAttr attribute, const bool value);
110
111private:
114
116 std::string adjustDecimalValue(const double value) const;
117
120
123};
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void toggleFlowAttribute(const SumoXMLAttr attribute, const bool value)
toggle flow parameters (used in toggleAttribute(...) function of vehicles, persons and containers
void drawFlowLabel(const Position &position, const double rotation, const double width, const double length, const double exaggeration) const
draw flow label
std::string getFlowAttribute(const GNEDemandElement *flowElement, SumoXMLAttr key) const
inherited from GNEAttributeCarrier and adapted to GNEDemandElementFlow
GNEDemandElementFlow & operator=(const GNEDemandElementFlow &)=delete
Invalidated assignment operator.
void disableFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, GNEUndoList *undoList)
bool isFlowAttributeEnabled(SumoXMLAttr key) const
double getFlowAttributeDouble(SumoXMLAttr key) const
bool isValidFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, const std::string &value)
void writeFlowAttributes(const GNEDemandElement *flowElement, OutputDevice &device) const
write flow attributes
std::string adjustDecimalValue(const double value) const
adjust decimal value
GNEDemandElementFlow(const GNEDemandElementFlow &)=delete
Invalidated copy constructor.
void enableFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, GNEUndoList *undoList)
void setFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void setDefaultFlowAttributes(GNEDemandElement *flowElement)
set flow default attributes
Static storage of an output device and its base (abstract) implementation.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
Structure representing possible vehicle parameter.