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-2025 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
56 /* @brief method for getting the Attribute of an XML key
57 * @param[in] key The attribute key
58 * @return string with the value associated to key
59 */
60 std::string getFlowAttribute(const GNEDemandElement* flowElement, SumoXMLAttr key) const;
61
62 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
63 * @param[in] key The attribute key
64 * @return double with the value associated to key
65 */
66 double getFlowAttributeDouble(SumoXMLAttr key) const;
67
68 /* @brief method for setting the attribute and letting the object perform demand element changes
69 * @param[in] key The attribute key
70 * @param[in] value The new value
71 * @param[in] undoList The undoList on which to register changes
72 * @param[in] net optionally the GNENet to inform about gui updates
73 */
74 void setFlowAttribute(GNEDemandElement* flowElement, SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
75
76 /* @brief method for setting the attribute and letting the object perform demand element changes
77 * @param[in] key The attribute key
78 * @param[in] value The new value
79 * @param[in] undoList The undoList on which to register changes
80 */
81 bool isValidFlowAttribute(GNEDemandElement* flowElement, SumoXMLAttr key, const std::string& value);
82
83 /* @brief method for enable attribute
84 * @param[in] key The attribute key
85 * @param[in] undoList The undoList on which to register changes
86 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
87 */
88 void enableFlowAttribute(GNEDemandElement* flowElement, SumoXMLAttr key, GNEUndoList* undoList);
89
90 /* @brief method for disable attribute
91 * @param[in] key The attribute key
92 * @param[in] undoList The undoList on which to register changes
93 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
94 */
95 void disableFlowAttribute(GNEDemandElement* flowElement, SumoXMLAttr key, GNEUndoList* undoList);
96
97 /* @brief method for check if the value for certain attribute is set
98 * @param[in] key The attribute key
99 */
100 bool isFlowAttributeEnabled(SumoXMLAttr key) const;
101
103 void setFlowAttribute(GNEDemandElement* flowElement, SumoXMLAttr key, const std::string& value);
104
106 void toggleFlowAttribute(const SumoXMLAttr attribute, const bool value);
107
108private:
111
114
117};
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)
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
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
Structure representing possible vehicle parameter.