Exemplo n.º 1
0
void
RODFNet::buildApproachList() {
    const std::map<std::string, ROEdge*>& edges = getEdgeMap();
    for (std::map<std::string, ROEdge*>::const_iterator rit = edges.begin(); rit != edges.end(); ++rit) {
        ROEdge* ce = (*rit).second;
        unsigned int i = 0;
        unsigned int length_size = ce->getNoFollowing();
        for (i = 0; i < length_size; i++) {
            ROEdge* help = ce->getFollower(i);
            if (find(myDisallowedEdges.begin(), myDisallowedEdges.end(), help->getID()) != myDisallowedEdges.end()) {
                // edges in sinks will not be used
                continue;
            }
            if (!myKeepTurnarounds && help->getToNode() == ce->getFromNode()) {
                // do not use turnarounds
                continue;
            }
            // add the connection help->ce to myApproachingEdges
            if (myApproachingEdges.find(help) == myApproachingEdges.end()) {
                myApproachingEdges[help] = std::vector<ROEdge*>();
            }
            myApproachingEdges[help].push_back(ce);
            // add the connection ce->help to myApproachingEdges
            if (myApproachedEdges.find(ce) == myApproachedEdges.end()) {
                myApproachedEdges[ce] = std::vector<ROEdge*>();
            }
            myApproachedEdges[ce].push_back(help);
        }
    }
}
Exemplo n.º 2
0
void
RODFRouteCont::addAllEndFollower() throw() {
    std::vector<RODFRouteDesc> newRoutes;
    for (std::vector<RODFRouteDesc>::iterator i=myRoutes.begin(); i!=myRoutes.end(); ++i) {
        RODFRouteDesc &desc = *i;
        ROEdge *last = *(desc.edges2Pass.end()-1);
        if (last->getNoFollowing()==0) {
            newRoutes.push_back(desc);
            continue;
        }
        for (unsigned int j=0; j<last->getNoFollowing(); ++j) {
            RODFRouteDesc ndesc(desc);
            ndesc.edges2Pass.push_back(last->getFollower(j));
            setID(ndesc);
            newRoutes.push_back(ndesc);
        }
    }
    myRoutes = newRoutes;
}