Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netwrite/NWWriter_XML.h
169665 views
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
/****************************************************************************/
14
/// @file NWWriter_XML.h
15
/// @author Daniel Krajzewicz
16
/// @author Jakob Erdmann
17
/// @author Michael Behrisch
18
/// @date Tue, 11.05.2011
19
///
20
// Exporter writing networks using XML (native input) format
21
/****************************************************************************/
22
#pragma once
23
#include <config.h>
24
25
#include <string>
26
#include <map>
27
#include <utils/xml/SUMOSAXHandler.h>
28
#include <utils/common/UtilExceptions.h>
29
30
31
// ===========================================================================
32
// class declarations
33
// ===========================================================================
34
class NBEdge;
35
class NBEdgeCont;
36
class NBNetBuilder;
37
class NBNode;
38
class NBNodeCont;
39
class NBParkingCont;
40
class NBPTStopCont;
41
class NBPTLineCont;
42
class NBTrafficLightLogicCont;
43
class NBTypeCont;
44
class OptionsCont;
45
46
47
// ===========================================================================
48
// class definitions
49
// ===========================================================================
50
/**
51
* @class NWWriter_XML
52
* @brief Exporter writing networks using XML (native input) format
53
*
54
*/
55
class NWWriter_XML {
56
public:
57
/** @brief Writes the network into XML-files (nodes, edges, connections,
58
* traffic lights)
59
* @param[in] oc The options to use
60
* @param[in] nb The network builder from which to read data
61
*/
62
static void writeNetwork(const OptionsCont& oc, const std::string& prefix, NBNetBuilder& nb);
63
64
/** @brief Writes the joined-juncionts to file
65
* @param[in] oc The options to use
66
* @param[in] nc The node-container from which to read data
67
*/
68
static void writeJoinedJunctions(const std::string& filename, NBNodeCont& nc);
69
70
/** @brief Writes street signs as POIs to file
71
* @param[in] oc The options to use
72
* @param[in] ec The edge-container from which to read data
73
*/
74
static void writeStreetSigns(const OptionsCont& oc, NBEdgeCont& ec);
75
76
private:
77
/** @brief Writes the configuration file for assempling the network from plain-xml files
78
* @param[in] oc The options to use
79
* @param[in] prefix The file name prefix
80
*/
81
static void writeConfig(const OptionsCont& oc, const std::string& prefix, bool haveTypes);
82
83
/** @brief Writes the nodes file
84
* @param[in] oc The options to use
85
* @param[in] nc The node-container from which to read data
86
*/
87
static void writeNodes(const OptionsCont& oc, const std::string& prefix, NBNodeCont& nc);
88
89
/** @brief Writes the types file
90
* @param[in] oc The options to use
91
* @param[in] nc The type-container from which to read data
92
*/
93
static void writeTypes(const std::string& prefix, NBEdgeCont& ec, NBTypeCont& tc);
94
95
/** @brief Writes the edges and connections files
96
* @param[in] oc The options to use
97
* @param[in] nb The network build from which to read data
98
*/
99
static void writeEdgesAndConnections(const OptionsCont& oc, const std::string& prefix, NBNodeCont& nc, NBEdgeCont& ec);
100
101
102
/** @brief Writes the traffic lights file
103
* @param[in] oc The options to use
104
* @param[in] tc The tll-container from which to read data
105
* @param[in] ec The edge-container from which to read data
106
*/
107
static void writeTrafficLights(const std::string& prefix, NBTrafficLightLogicCont& tc, NBEdgeCont& ec);
108
109
/** @brief Writes the pt stops file
110
* @param[in] oc The options to use
111
* @param[in] nc The pt stop container from which to read data
112
*/
113
static void writePTStops(const OptionsCont& oc, NBPTStopCont& ec);
114
static void writePTLines(const OptionsCont& cont, NBPTLineCont& lc);
115
116
/// @brief writes imported parking areas to file
117
static void writeParkingAreas(const OptionsCont& cont, NBParkingCont& pc, NBEdgeCont& ec);
118
119
/// @brief writes imported districts (TAZ) to file
120
static void writeDistricts(const OptionsCont& oc, NBDistrictCont& dc);
121
122
static void writeShape(OutputDevice& out, const GeoConvHelper& gch, PositionVector shape, SumoXMLAttr attr, bool useGeo, bool geoAccuracy);
123
};
124
125