1 /****************************************************************************/ 2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo 3 // Copyright (C) 2012-2019 German Aerospace Center (DLR) and others. 4 // This program and the accompanying materials 5 // are made available under the terms of the Eclipse Public License v2.0 6 // which accompanies this distribution, and is available at 7 // http://www.eclipse.org/legal/epl-v20.html 8 // SPDX-License-Identifier: EPL-2.0 9 /****************************************************************************/ 10 /// @file NWWriter_DlrNavteq.h 11 /// @author Jakob Erdmann 12 /// @author Michael Behrisch 13 /// @date 26.10.2012 14 /// @version $Id$ 15 /// 16 // Exporter writing networks using DlrNavteq (Elmar) format 17 /****************************************************************************/ 18 #ifndef NWWriter_DlrNavteq_h 19 #define NWWriter_DlrNavteq_h 20 21 22 // =========================================================================== 23 // included modules 24 // =========================================================================== 25 #include <config.h> 26 27 #include <string> 28 #include <map> 29 #include <utils/xml/SUMOSAXHandler.h> 30 #include <utils/common/UtilExceptions.h> 31 32 33 // =========================================================================== 34 // class declarations 35 // =========================================================================== 36 class NBEdge; 37 class NBEdgeCont; 38 class NBNetBuilder; 39 class NBNode; 40 class NBNodeCont; 41 class NBTrafficLightLogicCont; 42 class NBTypeCont; 43 class OptionsCont; 44 45 46 // =========================================================================== 47 // class definitions 48 // =========================================================================== 49 /** 50 * @class NWWriter_DlrNavteq 51 * @brief Exporter writing networks using XML (native input) format 52 * 53 */ 54 class NWWriter_DlrNavteq { 55 public: 56 /** @brief Writes the network into XML-files (nodes, edges, connections, 57 * traffic lights) 58 * @param[in] oc The options to use 59 * @param[in] nb The network builder from which to read data 60 */ 61 static void writeNetwork(const OptionsCont& oc, NBNetBuilder& nb); 62 63 /// @brief get the navteq road class 64 static int getRoadClass(NBEdge* edge); 65 66 /// @brief get the navteq brunnel type 67 static int getBrunnelType(NBEdge* edge); 68 69 /// @brief get the form of way 70 static int getFormOfWay(NBEdge* edge); 71 72 private: 73 /** @brief Writes the nodes_unsplitted file 74 * @param[in] oc The options to use 75 * @param[in] nc The node-container from which to read data 76 * @param[in] ec The edge-container from which to read data 77 * @param[out] internalNodes The internal node ids, generated for edges with complex geometry 78 */ 79 static void writeNodesUnsplitted(const OptionsCont& oc, NBNodeCont& nc, NBEdgeCont& ec, std::map<NBEdge*, std::string>& internalNodes); 80 81 /** @brief Writes the links_unsplitted file 82 * @param[in] oc The options to use 83 * @param[in] ec The edge-container from which to read data 84 * @param[int] internalNodes The internal node ids, generated for edges with complex geometry 85 */ 86 static void writeLinksUnsplitted(const OptionsCont& oc, NBEdgeCont& ec, std::map<NBEdge*, std::string>& internalNodes); 87 88 /** @brief Writes the traffic_signals file 89 * @param[in] oc The options to use 90 * @param[in] nc The node-container from which to read data 91 */ 92 static void writeTrafficSignals(const OptionsCont& oc, NBNodeCont& nc); 93 94 95 /** @brief Writes the prohibited_manoeuvres file 96 * @param[in] oc The options to use 97 * @param[in] nc The node-container from which to read data 98 */ 99 static void writeProhibitedManoeuvres(const OptionsCont& oc, const NBNodeCont& nc, const NBEdgeCont& ec); 100 101 /** @brief Writes the connected_lanes file 102 * @param[in] oc The options to use 103 * @param[in] nc The node-container from which to read data 104 */ 105 static void writeConnectedLanes(const OptionsCont& oc, NBNodeCont& nc); 106 107 /// @brief write header comments (input paramters, date, etc...) 108 static void writeHeader(OutputDevice& device, const OptionsCont& oc); 109 110 /// @brief build the ascii-bit-vector for column vehicle_type 111 static std::string getAllowedTypes(SVCPermissions permissions); 112 113 /// @brief get the navteq speed class based on the speed in km/h 114 static int getSpeedCategory(int kph); 115 116 /// @brief get the SPEED_LIMIT as defined by elmar (upper bound of speed category) 117 static int getSpeedCategoryUpperBound(int kph); 118 119 /// @brief get the lane number encoding 120 static int getNavteqLaneCode(const int numLanes); 121 122 /// @brief get the length of the edge when measured up to the junction center 123 static double getGraphLength(NBEdge* edge); 124 125 static std::string getSinglePostalCode(const std::string& zipCode, const std::string edgeID); 126 127 /// @brief magic value for undefined stuff 128 static const std::string UNDEFINED; 129 130 /// @brief get edge speed rounded to kmh speedInKph(double metersPerSecond)131 static inline int speedInKph(double metersPerSecond) { 132 return (int)std::floor(metersPerSecond * 3.6 + 0.5); 133 } 134 }; 135 136 137 #endif 138 139 /****************************************************************************/ 140 141