Eclipse SUMO - Simulation of Urban MObility
GNERouteDistribution.cpp
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 // Route distribution used in netedit
19 /****************************************************************************/
20 
21 #include "GNERouteDistribution.h"
22 
23 // ===========================================================================
24 // member method definitions
25 // ===========================================================================
26 
29 }
30 
31 
32 GNERouteDistribution::GNERouteDistribution(GNENet* net, const std::string& ID) :
34 }
35 
36 
38 
39 
40 void
42  // only save if there is distribution elements to save
43  if (!isDistributionEmpty()) {
44  // now write attributes
45  device.openTag(getTagProperty().getTag());
46  device.writeAttr(SUMO_ATTR_ID, getID());
49  device.closeTag();
50  }
51 }
52 
53 /****************************************************************************/
@ GLO_ROUTE
a route
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
@ ROUTEDISTRIBUTION
@ SUMO_TAG_ROUTE_DISTRIBUTION
distribution of a route
@ SUMO_ATTR_PROBS
@ SUMO_ATTR_ROUTES
@ SUMO_ATTR_ID
const std::string getID() const
get ID (all Attribute Carriers have one)
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
std::string getAttributeDistributionKeys() const
get attribute distribution keys in string format sorted by ID
bool isDistributionEmpty() const
check if distribution is empty
std::string getAttributeDistributionValues() const
get attribute distribution keys in string format sorted by ID
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
GNERouteDistribution(GNENet *net)
default constructor
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:254
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.