Exemple #1
0
void
NWWriter_DlrNavteq::writeConnectedLanes(const OptionsCont& oc, NBNodeCont& nc) {
    OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_connected_lanes.txt");
    writeHeader(device, oc);
    // write format specifier
    device << "#Lane connections related to LINK-IDs and NODE-ID.\n";
    device << "#column format like pointcollection.\n";
    device << "#NODE-ID\tVEHICLE-TYPE\tFROM_LANE\tTO_LANE\tTHROUGH_TRAFFIC\tLINK_IDs[2..*]\n";
    // write record for every connection
    for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
        NBNode* n = (*i).second;
        const EdgeVector& incoming = n->getIncomingEdges();
        for (EdgeVector::const_iterator j = incoming.begin(); j != incoming.end(); ++j) {
            NBEdge* from = *j;
            const SVCPermissions fromPerm = from->getPermissions();
            const std::vector<NBEdge::Connection>& connections = from->getConnections();
            for (std::vector<NBEdge::Connection>::const_iterator it_c = connections.begin(); it_c != connections.end(); it_c++) {
                const NBEdge::Connection& c = *it_c;
                device
                        << n->getID() << "\t"
                        << getAllowedTypes(fromPerm & c.toEdge->getPermissions()) << "\t"
                        << c.fromLane + 1 << "\t" // one-based
                        << c.toLane + 1 << "\t" // one-based
                        << 1 << "\t" // no information regarding permissibility of through traffic
                        << from->getID() << "\t"
                        << c.toEdge->getID() << "\t"
                        << "\n";
            }
        }
    }
    device.close();
}
void
NWWriter_DlrNavteq::writeLinksUnsplitted(const OptionsCont& oc, NBEdgeCont& ec) {
    std::map<const std::string, std::string> nameIDs;
    OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_links_unsplitted.txt");
    writeHeader(device, oc);
    // write format specifier
    device << "# LINK_ID\tNODE_ID_FROM\tNODE_ID_TO\tBETWEEN_NODE_ID\tLENGTH\tVEHICLE_TYPE\tFORM_OF_WAY\tBRUNNEL_TYPE\tFUNCTIONAL_ROAD_CLASS\tSPEED_CATEGORY\tNUMBER_OF_LANES\tSPEED_LIMIT\tSPEED_RESTRICTION\tNAME_ID1_REGIONAL\tNAME_ID2_LOCAL\tHOUSENUMBERS_RIGHT\tHOUSENUMBERS_LEFT\tZIP_CODE\tAREA_ID\tSUBAREA_ID\tTHROUGH_TRAFFIC\tSPECIAL_RESTRICTIONS\tEXTENDED_NUMBER_OF_LANES\tISRAMP\tCONNECTION\n";
    // write edges
    for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
        NBEdge* e = (*i).second;
        const int kph = speedInKph(e->getSpeed());
        const std::string& betweenNodeID = (e->getGeometry().size() > 2) ? e->getID() : UNDEFINED;
        std::string nameID = UNDEFINED;
        if (oc.getBool("output.street-names")) {
            const std::string& name = i->second->getStreetName();
            if (name != "" && nameIDs.count(name) == 0) {
                nameID = toString(nameIDs.size());
                nameIDs[name] = nameID;
            }
        }
        device << e->getID() << "\t"
               << e->getFromNode()->getID() << "\t"
               << e->getToNode()->getID() << "\t"
               << betweenNodeID << "\t"
               << getGraphLength(e) << "\t"
               << getAllowedTypes(e->getPermissions()) << "\t"
               << "3\t" // Speed Category 1-8 XXX refine this
               << UNDEFINED << "\t" // no special brunnel type (we don't know yet)
               << getRoadClass(e) << "\t"
               << getSpeedCategory(kph) << "\t"
               << getNavteqLaneCode(e->getNumLanes()) << "\t"
               << getSpeedCategoryUpperBound(kph) << "\t"
               << kph << "\t"
               << nameID << "\t" // NAME_ID1_REGIONAL XXX
               << UNDEFINED << "\t" // NAME_ID2_LOCAL XXX
               << UNDEFINED << "\t" // housenumbers_right
               << UNDEFINED << "\t" // housenumbers_left
               << UNDEFINED << "\t" // ZIP_CODE
               << UNDEFINED << "\t" // AREA_ID
               << UNDEFINED << "\t" // SUBAREA_ID
               << "1\t" // through_traffic (allowed)
               << UNDEFINED << "\t" // special_restrictions
               << UNDEFINED << "\t" // extended_number_of_lanes
               << UNDEFINED << "\t" // isRamp
               << "0\t" // connection (between nodes always in order)
               << "\n";
    }
    if (oc.getBool("output.street-names")) {
        OutputDevice& namesDevice = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_names.txt");
        writeHeader(namesDevice, oc);
        // write format specifier
        namesDevice << "# NAME_ID\tName\n" << nameIDs.size() << "\n";
        for (std::map<const std::string, std::string>::const_iterator i = nameIDs.begin(); i != nameIDs.end(); ++i) {
            namesDevice << i->second << "\t" << i->first << "\n";
        }
    }
}
Exemple #3
0
void
NWWriter_DlrNavteq::writeProhibitedManoeuvres(const OptionsCont& oc, const NBNodeCont& nc, const NBEdgeCont& ec) {
    OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_prohibited_manoeuvres.txt");
    writeHeader(device, oc);
    // need to invent id for relation
    std::set<std::string> reservedRelIDs;
    if (oc.isSet("reserved-ids")) {
        NBHelpers::loadPrefixedIDsFomFile(oc.getString("reserved-ids"), "rel:", reservedRelIDs);
    }
    std::vector<std::string> avoid = ec.getAllNames(); // already used for tls RELATREC_ID
    avoid.insert(avoid.end(), reservedRelIDs.begin(), reservedRelIDs.end());
    IDSupplier idSupplier("", avoid); // @note: use a global relRecIDsupplier if this is used more often
    // write format specifier
    device << "#No driving allowed from ID1 to ID2 or the complete chain from ID1 to IDn\n";
    device << "#RELATREC_ID\tPERMANENT_ID_INFO\tVALIDITY_PERIOD\tTHROUGH_TRAFFIC\tVEHICLE_TYPE\tNAVTEQ_LINK_ID1\t[NAVTEQ_LINK_ID2 ...]\n";
    // write record for every pair of incoming/outgoing edge that are not connected despite having common permissions
    for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
        NBNode* n = (*i).second;
        const EdgeVector& incoming = n->getIncomingEdges();
        const EdgeVector& outgoing = n->getOutgoingEdges();
        for (EdgeVector::const_iterator j = incoming.begin(); j != incoming.end(); ++j) {
            NBEdge* inEdge = *j;
            const SVCPermissions inPerm = inEdge->getPermissions();
            for (EdgeVector::const_iterator k = outgoing.begin(); k != outgoing.end(); ++k) {
                NBEdge* outEdge = *k;
                const SVCPermissions outPerm = outEdge->getPermissions();
                const SVCPermissions commonPerm = inPerm & outPerm;
                if (commonPerm != 0 && commonPerm != SVC_PEDESTRIAN && !inEdge->isConnectedTo(outEdge)) {
                    device
                            << idSupplier.getNext() << "\t"
                            << 1 << "\t" // permanent id
                            << UNDEFINED << "\t"
                            << 1 << "\t"
                            << getAllowedTypes(SVCAll) << "\t"
                            << inEdge->getID() << "\t" << outEdge->getID() << "\n";
                }
            }
        }
    }
    device.close();
}