53 if (!oc.
isSet(
"dlr-navteq-output")) {
56 std::map<const NBEdge*, std::string> internalNodes;
66 device <<
"# Format matches Extraction version: V" << oc.
getString(
"dlr-navteq.version") <<
" \n";
67 std::stringstream tmp;
69 tmp.seekg(std::ios_base::beg);
72 std::getline(tmp, line);
73 device <<
"# " << line <<
"\n";
89 const double geoScale = pow(10.0f, haveGeo ? 5 : 2);
92 WRITE_WARNING(
TL(
"DlrNavteq node data will be written in (floating point) cartesian coordinates"));
95 device <<
"# NODE_ID\tIS_BETWEEN_NODE\tamount_of_geocoordinates\tx1\ty1\t[x2 y2 ... xn yn]\n";
105 for (std::map<std::string, NBEdge*>::const_iterator i = ec.
begin(); i != ec.
end(); ++i) {
106 if ((*i).second->getGeometry().size() > 2) {
110 device <<
"# [xmin_region] " << min.
x() <<
"\n";
111 device <<
"# [xmax_region] " << max.
x() <<
"\n";
112 device <<
"# [ymin_region] " << min.
y() <<
"\n";
113 device <<
"# [ymax_region] " << max.
y() <<
"\n";
114 device <<
"# [elements_multinode] " << multinodes <<
"\n";
115 device <<
"# [elements_normalnode] " << nc.
size() <<
"\n";
116 device <<
"# [xmin] " << min.
x() <<
"\n";
117 device <<
"# [xmax] " << max.
x() <<
"\n";
118 device <<
"# [ymin] " << min.
y() <<
"\n";
119 device <<
"# [ymax] " << max.
y() <<
"\n";
121 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
126 device << n->
getID() <<
"\t0\t1\t" << pos.
x() <<
"\t" << pos.
y() <<
"\n";
129 std::vector<std::string> avoid;
130 std::set<std::string> reservedNodeIDs;
131 const bool numericalIDs = oc.
getBool(
"numerical-ids");
132 if (oc.
isSet(
"reserved-ids")) {
138 std::vector<std::string> avoid2 = ec.
getAllNames();
139 avoid.insert(avoid.end(), avoid2.begin(), avoid2.end());
140 avoid.insert(avoid.end(), reservedNodeIDs.begin(), reservedNodeIDs.end());
143 for (
const auto& edgeIt : ec) {
144 const NBEdge*
const e = edgeIt.second;
146 if (geom.size() > 2) {
167 if (geom.size() > 2) {
168 std::string internalNodeID = e->
getID();
170 || (nc.
retrieve(internalNodeID) !=
nullptr)
171 || reservedNodeIDs.count(internalNodeID) > 0
175 internalNodeID = idSupplier.
getNext();
177 internalNodeID +=
"_geometry";
180 internalNodes[e] = internalNodeID;
181 device << internalNodeID <<
"\t1\t" << geom.size() - 2;
182 for (
int ii = 1; ii < (int)geom.size() - 1; ++ii) {
186 device <<
"\t" << pos.
x() <<
"\t" << pos.
y();
199 std::map<const std::string, std::string> nameIDs;
203 device <<
"# LINK_ID\tNODE_ID_FROM\tNODE_ID_TO\tBETWEEN_NODE_ID\tLENGTH\tVEHICLE_TYPE\tFORM_OF_WAY\tBRUNNEL_TYPE\t"
204 <<
"FUNCTIONAL_ROAD_CLASS\tSPEED_CATEGORY\tNUMBER_OF_LANES\tSPEED_LIMIT\tSPEED_RESTRICTION\t"
205 <<
"NAME_ID1_REGIONAL\tNAME_ID2_LOCAL\tHOUSENUMBERS_RIGHT\tHOUSENUMBERS_LEFT\tZIP_CODE\t"
206 <<
"AREA_ID\tSUBAREA_ID\tTHROUGH_TRAFFIC\tSPECIAL_RESTRICTIONS\tEXTENDED_NUMBER_OF_LANES\tISRAMP\tCONNECTION";
207 if (majorVersion > 6) {
208 device <<
"\tMAXHEIGHT\tMAXWIDTH\tMAXWEIGHT\tSURFACE";
212 for (
const auto& edgeIt : ec) {
213 const NBEdge*
const e = edgeIt.second;
215 const auto& internalIt = internalNodes.find(e);
216 const std::string& betweenNodeID = internalIt != internalNodes.end() ? internalIt->second :
UNDEFINED;
219 if (oc.
getBool(
"output.street-names")) {
222 if (nameIDs.count(name) == 0) {
223 const int tmp = (int)nameIDs.size();
226 nameID = nameIDs[name];
230 if (nameIDs.count(name2) == 0) {
231 const int tmp = (int)nameIDs.size();
234 nameIDRegional = nameIDs[name2];
237 device << e->
getID() <<
"\t"
240 << betweenNodeID <<
"\t"
250 << nameIDRegional <<
"\t"
262 if (majorVersion > 6) {
270 if (oc.
getBool(
"output.street-names")) {
274 namesDevice <<
"# NAME_ID\tPERMANENT_ID_INFO\tName\n";
275 namesDevice <<
"# [elements] " << nameIDs.size() <<
"\n";
276 for (std::map<const std::string, std::string>::const_iterator i = nameIDs.begin(); i != nameIDs.end(); ++i) {
290 if (permissions ==
SVCAll) {
291 return "100000000000";
293 std::ostringstream oss;
297 oss << ((permissions &
SVC_HOV) > 0 ? 1 : 0);
299 oss << ((permissions &
SVC_TAXI) > 0 ? 1 : 0);
318 type = type.substr(8);
330 }
else if (type ==
"unclassified") {
332 }
else if (type ==
"living_street" || type ==
"residential" || type ==
"road" || type ==
"service" || type ==
"track" || type ==
"cycleway" || type ==
"path" || type ==
"footway") {
410 const int code = (numLanes == 1 ? 1 :
411 (numLanes < 4 ? 2 : 3));
412 return numLanes * 10 + code;
422 }
else if (edge->
getTypeID() ==
"route.ferry") {
435 }
else if (edge->
getTypeID() ==
"highway.service") {
437 }
else if (edge->
getTypeID().find(
"_link") != std::string::npos) {
456 if (zipCode.find_first_of(
" ,;") != std::string::npos) {
457 WRITE_WARNINGF(
"ambiguous zip code '%' for edge '%'. (using first value)", zipCode, edgeID);
459 std::vector<std::string> ret = st.
getVector();
461 }
else if (zipCode.size() > 16) {
462 WRITE_WARNINGF(
"long zip code '%' for edge '%'", zipCode, edgeID);
473 const double geoScale = pow(10.0f, haveGeo ? 5 : 2);
476 device <<
"#Traffic signal related to LINK_ID and NODE_ID with location relative to driving direction.\n#column format like pointcollection.\n#DESCRIPTION->LOCATION: 1-rechts von LINK; 2-links von LINK; 3-oberhalb LINK -1-keineAngabe\n#RELATREC_ID\tPOICOL_TYPE\tDESCRIPTION\tLONGITUDE\tLATITUDE\tLINK_ID\n";
478 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
485 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); ++it) {
487 device << e->
getID() <<
"\t"
489 <<
"LSA;NODEIDS#" << n->
getID() <<
"#;LOCATION#-1#;\t"
492 << e->
getID() <<
"\n";
505 std::set<std::string> reservedRelIDs;
506 if (oc.
isSet(
"reserved-ids")) {
510 avoid.insert(avoid.end(), reservedRelIDs.begin(), reservedRelIDs.end());
513 device <<
"#No driving allowed from ID1 to ID2 or the complete chain from ID1 to IDn\n";
514 device <<
"#RELATREC_ID\tPERMANENT_ID_INFO\tVALIDITY_PERIOD\tTHROUGH_TRAFFIC\tVEHICLE_TYPE\tNAVTEQ_LINK_ID1\t[NAVTEQ_LINK_ID2 ...]\n";
516 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
520 for (EdgeVector::const_iterator j = incoming.begin(); j != incoming.end(); ++j) {
523 for (EdgeVector::const_iterator k = outgoing.begin(); k != outgoing.end(); ++k) {
529 << idSupplier.
getNext() <<
"\t"
534 << inEdge->
getID() <<
"\t" << outEdge->
getID() <<
"\n";
548 device <<
"#Lane connections related to LINK-IDs and NODE-ID.\n";
549 device <<
"#column format like pointcollection.\n";
550 device <<
"#NODE-ID\tVEHICLE-TYPE\tFROM_LANE\tTO_LANE\tTHROUGH_TRAFFIC\tLINK_IDs[2..*]\n";
552 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
555 for (EdgeVector::const_iterator j = incoming.begin(); j != incoming.end(); ++j) {
558 const std::vector<NBEdge::Connection>& connections = from->
getConnections();
559 for (std::vector<NBEdge::Connection>::const_iterator it_c = connections.begin(); it_c != connections.end(); it_c++) {
562 << n->
getID() <<
"\t"
567 << from->
getID() <<
"\t"
#define WRITE_WARNINGF(...)
#define WRITE_WARNING(msg)
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
const SVCPermissions SVCAll
all VClasses are allowed
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SVC_HOV
vehicle is a HOV
@ SVC_TRUCK
vehicle is a large transport vehicle
@ SVC_COACH
vehicle is a coach
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_TRAILER
vehicle is a large transport vehicle
@ SVC_DELIVERY
vehicle is a small delivery vehicle
@ SVC_MOTORCYCLE
vehicle is a motorcycle
@ SVC_EMERGENCY
public emergency vehicles
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
@ SVC_PEDESTRIAN
pedestrian
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
double ymin() const
Returns minimum y-coordinate.
double xmin() const
Returns minimum x-coordinate.
double ymax() const
Returns maximum y-coordinate.
double xmax() const
Returns maximum x-coordinate.
static methods for processing the coordinates conversion for the current net
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
bool usingGeoProjection() const
Returns whether a transformation from geo to metric coordinates will be performed.
const Boundary & getConvBoundary() const
Returns the converted boundary.
std::string getNext()
Returns the next id.
Storage for edges, including some functionality operating on multiple edges.
std::map< std::string, NBEdge * >::const_iterator begin() const
Returns the pointer to the begin of the stored edges.
NBEdge * getOppositeByID(const std::string &edgeID) const
Returns the edge with negated id if it exists.
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
std::vector< std::string > getAllNames() const
Returns all ids of known edges.
The representation of a single edge during network building.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
const std::vector< Connection > & getConnections() const
Returns the connections.
NBNode * getToNode() const
Returns the destination node of the edge.
const PositionVector & getGeometry() const
Returns the geometry of the edge.
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
double getSpeed() const
Returns the speed allowed on this edge.
const std::string & getID() const
int getNumLanes() const
Returns the number of lanes.
double getTotalWidth() const
Returns the combined width of all lanes of this edge.
bool isConnectedTo(const NBEdge *e, const bool ignoreTurnaround=false) const
Returns the information whethe a connection to the given edge has been added (or computed)
int getJunctionPriority(const NBNode *const node) const
Returns the junction priority (normalised for the node currently build)
const std::string & getTypeID() const
get ID of type
const std::string & getStreetName() const
Returns the street name of this edge.
NBNode * getFromNode() const
Returns the origin node of the edge.
static void loadPrefixedIDsFomFile(const std::string &file, const std::string prefix, std::set< std::string > &into)
Add prefixed ids defined in file.
Instance responsible for building networks.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
NBEdgeCont & getEdgeCont()
Container for nodes during the netbuilding process.
int size() const
Returns the number of nodes stored in this container.
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
std::vector< std::string > getAllNames() const
get all node names
Represents a single node (junction) during network building.
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
const Position & getPosition() const
bool isTLControlled() const
Returns whether this node is controlled by any tls.
static std::string getSinglePostalCode(const std::string &zipCode, const std::string edgeID)
static int getSpeedCategoryUpperBound(int kph)
get the SPEED_LIMIT as defined by elmar (upper bound of speed category)
static std::string getAllowedTypes(SVCPermissions permissions)
build the ascii-bit-vector for column vehicle_type
static void writeHeader(OutputDevice &device, const OptionsCont &oc)
write header comments (input paramters, date, etc...)
static void writeTrafficSignals(const OptionsCont &oc, NBNodeCont &nc)
Writes the traffic_signals file.
static double getGraphLength(const NBEdge *const edge)
get the length of the edge when measured up to the junction center
static int getSpeedCategory(int kph)
get the navteq speed class based on the speed in km/h
static int getFormOfWay(const NBEdge *const edge)
get the form of way
static int getBrunnelType(const NBEdge *const edge)
get the navteq brunnel type
static int speedInKph(double metersPerSecond)
get edge speed rounded to kmh
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network into XML-files (nodes, edges, connections, traffic lights)
static const std::string UNDEFINED
magic value for undefined stuff
static void writeConnectedLanes(const OptionsCont &oc, NBNodeCont &nc)
Writes the connected_lanes file.
static int getNavteqLaneCode(const int numLanes)
get the lane number encoding
static int getRoadClass(const NBEdge *const edge)
get the navteq road class
static void writeNodesUnsplitted(const OptionsCont &oc, const NBNodeCont &nc, const NBEdgeCont &ec, std::map< const NBEdge *, std::string > &internalNodes)
Writes the nodes_unsplitted file.
static void writeProhibitedManoeuvres(const OptionsCont &oc, const NBNodeCont &nc, const NBEdgeCont &ec)
Writes the prohibited_manoeuvres file.
static void writeLinksUnsplitted(const OptionsCont &oc, const NBEdgeCont &ec, const std::map< const NBEdge *, std::string > &internalNodes)
Writes the links_unsplitted file.
const std::string & getID() const
Returns the id.
A storage for options typed value containers)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
void writeConfiguration(std::ostream &os, const bool filled, const bool complete, const bool addComments, const std::string &relativeTo="", const bool forceRelative=false, const bool inComment=false) const
Writes the configuration.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Static storage of an output device and its base (abstract) implementation.
void close()
Closes the device and removes it from the dictionary.
void setPrecision(int precision=gPrecision)
Sets the precision or resets it to default.
static OutputDevice & getDevice(const std::string &name, bool usePrefix=true)
Returns the described OutputDevice.
bool hasParameter(const std::string &key) const
Returns whether the parameter is set.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
void mul(double val)
Multiplies position with the given value.
double y() const
Returns the y-position.
double length() const
Returns the length.
void push_front_noDoublePos(const Position &p)
insert in front a non double position
void move2side(double amount, double maxExtension=100)
move position vector to side using certain amount
void push_back_noDoublePos(const Position &p)
insert in back a non double position
std::vector< std::string > getVector()
return vector of strings
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
A structure which describes a connection between edges or lanes.
int fromLane
The lane the connections starts at.
int toLane
The lane the connections yields in.
NBEdge * toEdge
The edge the connections yields in.