Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netwrite/NWWriter_DlrNavteq.h
169667 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2012-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_DlrNavteq.h
15
/// @author Jakob Erdmann
16
/// @author Michael Behrisch
17
/// @date 26.10.2012
18
///
19
// Exporter writing networks using DlrNavteq (Elmar) format
20
/****************************************************************************/
21
#pragma once
22
#include <config.h>
23
24
#include <string>
25
#include <map>
26
#include <utils/xml/SUMOSAXHandler.h>
27
#include <utils/common/UtilExceptions.h>
28
29
30
// ===========================================================================
31
// class declarations
32
// ===========================================================================
33
class NBEdge;
34
class NBEdgeCont;
35
class NBNetBuilder;
36
class NBNode;
37
class NBNodeCont;
38
class NBTrafficLightLogicCont;
39
class NBTypeCont;
40
class OptionsCont;
41
42
43
// ===========================================================================
44
// class definitions
45
// ===========================================================================
46
/**
47
* @class NWWriter_DlrNavteq
48
* @brief Exporter writing networks using XML (native input) format
49
*
50
*/
51
class NWWriter_DlrNavteq {
52
public:
53
/** @brief Writes the network into XML-files (nodes, edges, connections,
54
* traffic lights)
55
* @param[in] oc The options to use
56
* @param[in] nb The network builder from which to read data
57
*/
58
static void writeNetwork(const OptionsCont& oc, NBNetBuilder& nb);
59
60
/// @brief get the navteq road class
61
static int getRoadClass(const NBEdge* const edge);
62
63
/// @brief get the navteq brunnel type
64
static int getBrunnelType(const NBEdge* const edge);
65
66
/// @brief get the form of way
67
static int getFormOfWay(const NBEdge* const edge);
68
69
private:
70
/** @brief Writes the nodes_unsplitted file
71
* @param[in] oc The options to use
72
* @param[in] nc The node-container from which to read data
73
* @param[in] ec The edge-container from which to read data
74
* @param[out] internalNodes The internal node ids, generated for edges with complex geometry
75
*/
76
static void writeNodesUnsplitted(const OptionsCont& oc, const NBNodeCont& nc, const NBEdgeCont& ec, std::map<const NBEdge*, std::string>& internalNodes);
77
78
/** @brief Writes the links_unsplitted file
79
* @param[in] oc The options to use
80
* @param[in] ec The edge-container from which to read data
81
* @param[int] internalNodes The internal node ids, generated for edges with complex geometry
82
*/
83
static void writeLinksUnsplitted(const OptionsCont& oc, const NBEdgeCont& ec, const std::map<const NBEdge*, std::string>& internalNodes);
84
85
/** @brief Writes the traffic_signals file
86
* @param[in] oc The options to use
87
* @param[in] nc The node-container from which to read data
88
*/
89
static void writeTrafficSignals(const OptionsCont& oc, NBNodeCont& nc);
90
91
92
/** @brief Writes the prohibited_manoeuvres file
93
* @param[in] oc The options to use
94
* @param[in] nc The node-container from which to read data
95
*/
96
static void writeProhibitedManoeuvres(const OptionsCont& oc, const NBNodeCont& nc, const NBEdgeCont& ec);
97
98
/** @brief Writes the connected_lanes file
99
* @param[in] oc The options to use
100
* @param[in] nc The node-container from which to read data
101
*/
102
static void writeConnectedLanes(const OptionsCont& oc, NBNodeCont& nc);
103
104
/// @brief write header comments (input paramters, date, etc...)
105
static void writeHeader(OutputDevice& device, const OptionsCont& oc);
106
107
/// @brief build the ascii-bit-vector for column vehicle_type
108
static std::string getAllowedTypes(SVCPermissions permissions);
109
110
/// @brief get the navteq speed class based on the speed in km/h
111
static int getSpeedCategory(int kph);
112
113
/// @brief get the SPEED_LIMIT as defined by elmar (upper bound of speed category)
114
static int getSpeedCategoryUpperBound(int kph);
115
116
/// @brief get the lane number encoding
117
static int getNavteqLaneCode(const int numLanes);
118
119
/// @brief get the length of the edge when measured up to the junction center
120
static double getGraphLength(const NBEdge* const edge);
121
122
static std::string getSinglePostalCode(const std::string& zipCode, const std::string edgeID);
123
124
/// @brief magic value for undefined stuff
125
static const std::string UNDEFINED;
126
127
/// @brief get edge speed rounded to kmh
128
static inline int speedInKph(double metersPerSecond) {
129
return (int)std::floor(metersPerSecond * 3.6 + 0.5);
130
}
131
};
132
133