Example #1
0
void
NIVissimEdge::checkUnconnectedLaneSpeeds(/* NBDistribution &dc */) {
    for (int i = 0; i < (int) myLaneSpeeds.size(); i++) {
        if (myLaneSpeeds[i] == -1) {
            SUMOReal speed = -1;
            int j1 = i - 1; // !!! recheck - j1 may become negative?
            int j2 = i;
            while (j2 != (int) myLaneSpeeds.size() && myLaneSpeeds[j2] == -1) {
                j2++;
            }
            if (j1 < 0) {
                if (j2 < (int) myLaneSpeeds.size()) {
                    speed = myLaneSpeeds[j2];
                }
            } else {
                if (j2 >= (int) myLaneSpeeds.size()) {
                    speed = myLaneSpeeds[j1];
                } else {
                    speed = (myLaneSpeeds[j1] + myLaneSpeeds[j2]) / (SUMOReal) 2.0;
                }
            }
            if (speed == -1) {
                continue;
            }
            myLaneSpeeds[i] = speed;
            std::vector<NIVissimConnection*> connected = getOutgoingConnected(i);
            for (std::vector<NIVissimConnection*>::iterator j = connected.begin(); j != connected.end(); j++) {
                NIVissimConnection* c = *j;
                NIVissimEdge* e = NIVissimEdge::dictionary(c->getToEdgeID());
                // propagate
                e->propagateSpeed(/*dc, */speed, c->getToLanes());
            }
        }
    }
}
Example #2
0
void
NIVissimEdge::setDistrictSpeed(/* NBDistribution &dc */) {
    if (myDistrictConnections.size() > 0) {
        SUMOReal pos = *(myDistrictConnections.begin());
        if (pos < getLength() - pos) {
            NIVissimDistrictConnection* d =
                NIVissimDistrictConnection::dict_findForEdge(myID);
            if (d != 0) {
                SUMOReal speed = d->getMeanSpeed(/*dc*/);
                if (speed == -1) {
                    return;
                }
                for (unsigned int i = 0; i < myNoLanes; i++) {
                    myLaneSpeeds[i] = speed;
                    // propagate the speed further
                    // get the list of connected edges
                    std::vector<NIVissimConnection*> connected = getOutgoingConnected(i);
                    // go throught the list
                    for (std::vector<NIVissimConnection*>::iterator j = connected.begin(); j != connected.end(); j++) {
                        NIVissimConnection* c = *j;
                        NIVissimEdge* e = NIVissimEdge::dictionary(c->getToEdgeID());
                        // propagate
                        e->propagateSpeed(/*dc, */speed, c->getToLanes());
                    }
                }
            }
        }
    }
}
void
NIVissimConnectionCluster::recheckEdges() {
    assert(myConnections.size() != 0);
    // remove the cluster from all edges at first
    std::vector<int>::iterator i;
    for (i = myEdges.begin(); i != myEdges.end(); i++) {
        NIVissimEdge* edge = NIVissimEdge::dictionary(*i);
        edge->removeFromConnectionCluster(this);
    }
    // clear edge information
    myEdges.clear();
    // recheck which edges do still participate and add edges
    for (i = myConnections.begin(); i != myConnections.end(); i++) {
        NIVissimConnection* c = NIVissimConnection::dictionary(*i);
        assert(myBoundary.xmax() >= myBoundary.xmin());
        if (myBoundary.around(c->getFromGeomPosition(), 5)) {
            myEdges.push_back(c->getFromEdgeID());
        }
        assert(myBoundary.xmax() >= myBoundary.xmin());
        if (myBoundary.around(c->getToGeomPosition(), 5)) {
            myEdges.push_back(c->getToEdgeID());
        }
    }
    // connect edges
    for (i = myEdges.begin(); i != myEdges.end(); i++) {
        NIVissimEdge* edge = NIVissimEdge::dictionary(*i);
        edge->addToConnectionCluster(this);
    }
}
void
NIVissimNodeDef_Edges::searchAndSetConnections() {
    std::vector<int> connections;
    std::vector<int> edges;
    Boundary boundary;
    for (NIVissimNodeParticipatingEdgeVector::const_iterator i = myEdges.begin(); i != myEdges.end(); i++) {
        NIVissimNodeParticipatingEdge* edge = *i;
        NIVissimConnection* c =
            NIVissimConnection::dictionary(edge->getID());
        NIVissimEdge* e =
            NIVissimEdge::dictionary(edge->getID());
        if (c != 0) {
            connections.push_back(edge->getID());
            boundary.add(c->getFromGeomPosition());
            boundary.add(c->getToGeomPosition());
            c->setNodeCluster(myID);
        }
        if (e != 0) {
            edges.push_back(edge->getID());
            boundary.add(e->getGeomPosition(edge->getFromPos()));
            boundary.add(e->getGeomPosition(edge->getToPos()));
        }
    }
    NIVissimConnectionCluster* c =
        new NIVissimConnectionCluster(connections, boundary, myID, edges);
    for (std::vector<int>::iterator j = edges.begin(); j != edges.end(); j++) {
        NIVissimEdge* edge = NIVissimEdge::dictionary(*j);
        edge->myConnectionClusters.push_back(c);
    }
}
bool
NIVissimTL::NIVissimTLSignal::addTo(NBEdgeCont& ec, NBLoadedTLDef* tl) const {
    NIVissimConnection* c = NIVissimConnection::dictionary(myEdgeID);
    NBConnectionVector assignedConnections;
    if (c == 0) {
        // What to do if on an edge? -> close all outgoing connections
        NBEdge* edge = ec.retrievePossiblySplit(toString<int>(myEdgeID), myPosition);
        if (edge == 0) {
            WRITE_WARNING("Could not set tls signal at edge '" + toString(myEdgeID) + "' - the edge was not built.");
            return false;
        }
        // Check whether it is already known, which edges are approached
        //  by which lanes
        // check whether to use the original lanes only
        if (edge->lanesWereAssigned()) {
            std::vector<NBEdge::Connection> connections = edge->getConnectionsFromLane(myLane - 1);
            for (std::vector<NBEdge::Connection>::iterator i = connections.begin(); i != connections.end(); i++) {
                const NBEdge::Connection& conn = *i;
                assert(myLane - 1 < (int)edge->getNumLanes());
                assignedConnections.push_back(NBConnection(edge, myLane - 1, conn.toEdge, conn.toLane));
            }
        } else {
            WRITE_WARNING("Edge : Lanes were not assigned(!)");
            for (unsigned int j = 0; j < edge->getNumLanes(); j++) {
                std::vector<NBEdge::Connection> connections = edge->getConnectionsFromLane(j);
                for (std::vector<NBEdge::Connection>::iterator i = connections.begin(); i != connections.end(); i++) {
                    const NBEdge::Connection& conn = *i;
                    assignedConnections.push_back(NBConnection(edge, j, conn.toEdge, conn.toLane));
                }
            }
        }
    } else {
        // get the edges
        NBEdge* tmpFrom = ec.retrievePossiblySplit(toString<int>(c->getFromEdgeID()), toString<int>(c->getToEdgeID()), true);
        NBEdge* tmpTo = ec.retrievePossiblySplit(toString<int>(c->getToEdgeID()), toString<int>(c->getFromEdgeID()), false);
        // check whether the edges are known
        if (tmpFrom != 0 && tmpTo != 0) {
            // add connections this signal is responsible for
            assignedConnections.push_back(NBConnection(tmpFrom, -1, tmpTo, -1));
        } else {
            return false;
            // !!! one of the edges could not be build
        }
    }
    // add to the group
    assert(myGroupIDs.size() != 0);
    // @todo just another hack?!
    /*
    if (myGroupIDs.size() == 1) {
        return tl->addToSignalGroup(toString<int>(*(myGroupIDs.begin())),
                                    assignedConnections);
    } else {
        // !!!
        return tl->addToSignalGroup(toString<int>(*(myGroupIDs.begin())),
                                    assignedConnections);
    }
    */
    return tl->addToSignalGroup(toString<int>(myGroupIDs.front()), assignedConnections);
}
Example #6
0
void
NIVissimConnection::dict_assignToEdges() {
    for (DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
        NIVissimConnection *c = (*i).second;
        NIVissimEdge::dictionary(c->getFromEdgeID())->addOutgoingConnection((*i).first);
        NIVissimEdge::dictionary(c->getToEdgeID())->addIncomingConnection((*i).first);
    }
}
Example #7
0
void
NIVissimEdge::dict_checkEdges2Join() {
    // go through the edges
    for (DictType::iterator i1 = myDict.begin(); i1 != myDict.end(); i1++) {
        // retrieve needed values from the first edge
        NIVissimEdge* e1 = (*i1).second;
        const PositionVector& g1 = e1->getGeometry();
        // check all other edges
        DictType::iterator i2 = i1;
        i2++;
        for (; i2 != myDict.end(); i2++) {
            // retrieve needed values from the second edge
            NIVissimEdge* e2 = (*i2).second;
            const PositionVector& g2 = e2->getGeometry();
            // get the connection description
            NIVissimConnection* c = e1->getConnectionTo(e2);
            if (c == 0) {
                c = e2->getConnectionTo(e1);
            }
            // the edge must not be a direct contiuation of the other
            if (c != 0) {
                if ((c->getFromEdgeID() == e1->getID() && fabs(c->getFromPosition() - e1->getGeometry().length()) < 5)
                        ||
                        (c->getFromEdgeID() == e2->getID() && fabs(c->getFromPosition() - e2->getGeometry().length()) < 5)) {

                    continue;
                }
            }
            // only parallel edges which do end at the same node
            //  should be joined
            // retrieve the "approximating" lines first
            Line l1 = Line(g1.front(), g1.back());
            Line l2 = Line(g2.front(), g2.back());
            // check for parallelity
            //  !!! the usage of an explicit value is not very fine
            if (fabs(l1.atan2DegreeAngle() - l2.atan2DegreeAngle()) > 2.0) {
                // continue if the lines are not parallel
                continue;
            }

            // check whether the same node is approached
            //  (the distance between the ends should not be too large)
            //  !!! the usage of an explicit value is not very fine
            if (l1.p2().distanceTo(l2.p2()) > 10) {
                // continue if the lines do not end at the same length
                continue;
            }
            // ok, seem to be different lanes for the same edge
            //  mark as possibly joined later
            e1->addToTreatAsSame(e2);
            e2->addToTreatAsSame(e1);
        }
    }
}
void
NIVissimConnectionCluster::removeConnections(const NodeSubCluster& c) {
    for (NodeSubCluster::ConnectionCont::const_iterator i = c.myConnections.begin(); i != c.myConnections.end(); i++) {
        NIVissimConnection* conn = *i;
        int connid = conn->getID();
        std::vector<int>::iterator j = find(myConnections.begin(), myConnections.end(), connid);
        if (j != myConnections.end()) {
            myConnections.erase(j);
        }
    }
    recomputeBoundary();
}
Example #9
0
void
NIVissimConnection::buildNodeClusters() {
    for (DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
        NIVissimConnection *e = (*i).second;
        if (!e->clustered()) {
            assert(e->myBoundary!=0&&e->myBoundary->xmax()>e->myBoundary->xmin());
            IntVector connections =
                NIVissimConnection::getWithin(*(e->myBoundary));
            NIVissimNodeCluster::dictionary(-1, -1, connections,
                                            IntVector(), true); // 19.5.!!! should be on a single edge
        }
    }
}
std::vector<int>
NIVissimConnectionCluster::getDisturbanceParticipators() {
    std::vector<int> ret;
    for (std::vector<int>::iterator i = myConnections.begin(); i != myConnections.end(); i++) {
        NIVissimConnection* c = NIVissimConnection::dictionary(*i);
        const std::vector<int>& disturbances = c->getDisturbances();
        for (std::vector<int>::const_iterator j = disturbances.begin(); j != disturbances.end(); j++) {
            NIVissimDisturbance* d = NIVissimDisturbance::dictionary(*j);
            ret.push_back(d->getEdgeID());
            ret.push_back(d->getDisturbanceID());
        }
    }
    return ret;
}
Example #11
0
std::vector<NIVissimConnection*>
NIVissimEdge::getOutgoingConnected(int lane) const {
    std::vector<NIVissimConnection*> ret;
    for (std::vector<int>::const_iterator i = myOutgoingConnections.begin(); i != myOutgoingConnections.end(); i++) {
        NIVissimConnection* c = NIVissimConnection::dictionary(*i);
        const std::vector<int>& lanes = c->getFromLanes();
        if (find(lanes.begin(), lanes.end(), lane) != lanes.end()) {
            NIVissimEdge* e = NIVissimEdge::dictionary(c->getToEdgeID());
            if (e != 0) {
                ret.push_back(c);
            }
        }
    }
    return ret;
}
Example #12
0
void
NIVissimEdge::propagateOwn(/* NBDistribution &dc */) {
    for (int i = 0; i < (int) myLaneSpeeds.size(); i++) {
        if (myLaneSpeeds[i] == -1) {
            continue;
        }
        std::vector<NIVissimConnection*> connected = getOutgoingConnected(i);
        for (std::vector<NIVissimConnection*>::iterator j = connected.begin(); j != connected.end(); j++) {
            NIVissimConnection* c = *j;
            NIVissimEdge* e = NIVissimEdge::dictionary(c->getToEdgeID());
            // propagate
            e->propagateSpeed(/*dc, */myLaneSpeeds[i], c->getToLanes());
        }
    }
}
void
NIVissimConnectionCluster::recomputeBoundary() {
    myBoundary = Boundary();
    for (std::vector<int>::iterator i = myConnections.begin(); i != myConnections.end(); i++) {
        NIVissimConnection* c = NIVissimConnection::dictionary(*i);
        if (c != 0) {
            myBoundary.add(c->getFromGeomPosition());
            myBoundary.add(c->getToGeomPosition());
            if (c->getGeometry().size() != 0) {
                myBoundary.add(c->getGeometry().getBoxBoundary());
            }
        }
    }
    assert(myBoundary.xmax() >= myBoundary.xmin());
}
Example #14
0
NIVissimConnection*
NIVissimEdge::getConnectionTo(NIVissimEdge* e) {
    std::vector<int>::iterator i;
    for (i = myIncomingConnections.begin(); i != myIncomingConnections.end(); i++) {
        NIVissimConnection* c = NIVissimConnection::dictionary(*i);
        if (c->getFromEdgeID() == e->getID()) {
            return c;
        }
    }
    for (i = myOutgoingConnections.begin(); i != myOutgoingConnections.end(); i++) {
        NIVissimConnection* c = NIVissimConnection::dictionary(*i);
        if (c->getToEdgeID() == e->getID()) {
            return c;
        }
    }
    return 0;
}
Example #15
0
NBConnection
NIVissimDisturbance::getConnection(NBNode* node, int aedgeid) {
    if (NIVissimEdge::dictionary(myEdge.getEdgeID()) == nullptr) {
        NIVissimConnection* c = NIVissimConnection::dictionary(aedgeid);
        NBEdge* from =
            node->getPossiblySplittedIncoming(toString<int>(c->getFromEdgeID()));
        NBEdge* to =
            node->getPossiblySplittedOutgoing(toString<int>(c->getToEdgeID()));

        // source is a connection
        return NBConnection(toString<int>(c->getFromEdgeID()), from,
                            toString<int>(c->getToEdgeID()), to);
    } else {
        WRITE_WARNING("NIVissimDisturbance: no connection");
        return NBConnection::InvalidConnection;
//        throw 1; // !!! what to do?
    }

}
NIVissimConnection*
NIVissimConnectionCluster::getOutgoingContinuation(NIVissimEdge* e) const {
    // collect connection where this edge is the outgoing one
    std::vector<NIVissimConnection*> edgeIsOutgoing;
    for (std::vector<int>::const_iterator i = myConnections.begin(); i != myConnections.end(); i++) {
        NIVissimConnection* c = NIVissimConnection::dictionary(*i);
        if (c->getToEdgeID() == e->getID()) {
            edgeIsOutgoing.push_back(c);
        }
    }
    //
    if (edgeIsOutgoing.size() == 0) {
        return 0;
    }
    // sort connected edges in same direction
    sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
         same_direction_sorter(e->getGeometry().beginEndAngle()));
    return *(edgeIsOutgoing.begin());
}
int
NIVissimNodeCluster::getToNode(int edgeid) {
    int ret = -1;
    for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
        NIVissimNodeCluster* c = (*i).second;
        for (IntVector::iterator j = c->myConnectors.begin(); j != c->myConnectors.end(); j++) {
            NIVissimConnection* conn = NIVissimConnection::dictionary(*j);
            if (conn != 0 && conn->getFromEdgeID() == edgeid) {
//                return (*i).first;
                if (ret != -1 && ret != (*i).first) {
//                  << "NIVissimNodeCluster: multiple to-nodes" << endl;
                    throw 1; // an edge should not outgo from two different nodes
// but actually, a joined cluster may posess a connections more than once

                }
                ret = (*i).first;
            }
        }
    }
    return ret;
}
// ---------------------------------------------------------------------------
// NIVissimConnectionCluster - methods
// ---------------------------------------------------------------------------
NIVissimConnectionCluster::NIVissimConnectionCluster(
    const std::vector<int>& connections, int nodeCluster, int edgeid)
    : myConnections(connections), myNodeCluster(nodeCluster),
      myBlaID(myStaticBlaID++) {
    recomputeBoundary();
    myClusters.push_back(this);
    assert(edgeid > 0);
    if (edgeid >= 0) {
        myEdges.push_back(edgeid);
    }
    // add information about incoming and outgoing edges
    for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
        NIVissimConnection* c = NIVissimConnection::dictionary(*i);
        assert(c != 0);
        myOutgoingEdges.push_back(c->getToEdgeID());
        myIncomingEdges.push_back(c->getFromEdgeID());
        assert(c->getFromEdgeID() == edgeid || c->getToEdgeID() == edgeid);
    }
    VectorHelper<int>::removeDouble(myIncomingEdges);
    VectorHelper<int>::removeDouble(myOutgoingEdges);
}
NIVissimConnectionCluster::NIVissimConnectionCluster(
    const std::vector<int>& connections, const Boundary& boundary,
    int nodeCluster, const std::vector<int>& edges)
    : myConnections(connections), myBoundary(boundary),
      myNodeCluster(nodeCluster), myEdges(edges) {
    myClusters.push_back(this);
    recomputeBoundary();
    assert(myBoundary.xmax() >= myBoundary.xmin());
    // add information about incoming and outgoing edges
    for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
        NIVissimConnection* c = NIVissimConnection::dictionary(*i);
        assert(c != 0);
        myOutgoingEdges.push_back(c->getToEdgeID());
        myIncomingEdges.push_back(c->getFromEdgeID());
        assert(find(edges.begin(), edges.end(), c->getFromEdgeID()) != edges.end()
               ||
               find(edges.begin(), edges.end(), c->getToEdgeID()) != edges.end());
    }
    VectorHelper<int>::removeDouble(myIncomingEdges);
    VectorHelper<int>::removeDouble(myOutgoingEdges);
}
Example #20
0
void
NIVissimEdge::propagateSpeed(/* NBDistribution &dc */ SUMOReal speed, std::vector<int> forLanes) {
    // if no lane is given, all set be set
    if (forLanes.size() == 0) {
        for (size_t i = 0; i < myNoLanes; i++) {
            forLanes.push_back((int) i);
        }
    }
    // for the case of a first call
    // go through the lanes
    for (std::vector<int>::const_iterator i = forLanes.begin(); i < forLanes.end(); i++) {
        // check whether a speed was set before
        if (myLaneSpeeds[*i] != -1) {
            // do not reset it from incoming
            continue;
        }
        // check whether the lane has a new speed to set
        if ((int) myPatchedSpeeds.size() > *i && myPatchedSpeeds[*i] != -1) {
            // use it
            speed = getRealSpeed(/*dc, */myPatchedSpeeds[*i]);
        }
        // check whether a speed is given
        if (speed == -1) {
            // do nothing if not
            continue;
        }
        // set the lane's speed to the given
        myLaneSpeeds[*i] = speed;
        // propagate the speed further
        // get the list of connected edges
        std::vector<NIVissimConnection*> connected = getOutgoingConnected(*i);
        // go throught the list
        for (std::vector<NIVissimConnection*>::iterator j = connected.begin(); j != connected.end(); j++) {
            NIVissimConnection* c = *j;
            NIVissimEdge* e = NIVissimEdge::dictionary(c->getToEdgeID());
            // propagate
            e->propagateSpeed(/*dc, */speed, c->getToLanes());
        }
    }
}
SUMOReal
NIVissimConnectionCluster::getPositionForEdge(int edgeid) const {
    // return the middle of the connections when there are any
    if (myConnections.size() != 0) {
        SUMOReal sum = 0;
        size_t part = 0;
        std::vector<int>::const_iterator i;
        for (i = myConnections.begin(); i != myConnections.end(); i++) {
            NIVissimConnection* c = NIVissimConnection::dictionary(*i);
            if (c->getFromEdgeID() == edgeid) {
                part++;
                sum += c->getFromPosition();
            }
            if (c->getToEdgeID() == edgeid) {
                part++;
                sum += c->getToPosition();
            }
        }
        if (part > 0) {
            return sum / (SUMOReal) part;
        }
    }
    // use the position of the node if possible
    if (myNodeCluster >= 0) {
        // try to find the nearest point on the edge
        //  !!! only the main geometry is regarded
        NIVissimNodeDef* node =
            NIVissimNodeDef::dictionary(myNodeCluster);
        if (node != 0) {
            SUMOReal pos = node->getEdgePosition(edgeid);
            if (pos >= 0) {
                return pos;
            }
        }
        /*
                SUMOReal try1 = GeomHelper::nearest_offset_on_line_to_point(
                    edge->getBegin2D(), edge->getEnd2D(), node->getPos());
                if(try1>=0) {
                    return try1;
                }
                // try to use simple distance
                SUMOReal dist1 =
                    GeomHelper::distance(node->getPos(), edge->getBegin2D());
                SUMOReal dist2 =
                    GeomHelper::distance(node->getPos(), edge->getEnd2D());
                return dist1<dist2
                    ? 0 : edge->getLength();
                    */
    }
    // what else?
    WRITE_WARNING("NIVissimConnectionCluster: how to get an edge's position?");
    // !!!
    assert(myBoundary.xmin() <= myBoundary.xmax());
    NIVissimEdge* edge = NIVissimEdge::dictionary(edgeid);
    std::vector<int>::const_iterator i = find(myEdges.begin(), myEdges.end(), edgeid);
    if (i == myEdges.end()) {
        // edge does not exist!?
        throw 1;
    }
    const PositionVector& edgeGeom = edge->getGeometry();
    Position p = GeomHelper::crossPoint(myBoundary, edgeGeom);
    return GeomHelper::nearest_offset_on_line_to_point2D(
               edgeGeom.front(), edgeGeom.back(), p);
}
Example #22
0
bool
NIVissimDisturbance::addToNode(NBNode* node, NBDistrictCont& dc,
                               NBNodeCont& nc, NBEdgeCont& ec) {
    myNode = 0;
    NIVissimConnection* pc =
        NIVissimConnection::dictionary(myEdge.getEdgeID());
    NIVissimConnection* bc =
        NIVissimConnection::dictionary(myDisturbance.getEdgeID());
    if (pc == nullptr && bc == nullptr) {
        // This has not been tested completely, yet
        // Both competing abstract edges are normal edges
        // We have to find a crossing point, build a node here,
        //  split both edges and add the connections
        NIVissimEdge* e1 = NIVissimEdge::dictionary(myEdge.getEdgeID());
        NIVissimEdge* e2 = NIVissimEdge::dictionary(myDisturbance.getEdgeID());
        WRITE_WARNING("Ugly split to prohibit '" + toString<int>(e1->getID()) + "' by '" + toString<int>(e2->getID()) + "'.");
        Position pos = e1->crossesEdgeAtPoint(e2);
        std::string id1 = toString<int>(e1->getID()) + "x" + toString<int>(e2->getID());
        std::string id2 = toString<int>(e2->getID()) + "x" + toString<int>(e1->getID());
        NBNode* node1 = nc.retrieve(id1);
        NBNode* node2 = nc.retrieve(id2);
        NBNode* node = nullptr;
        assert(node1 == 0 || node2 == 0);
        if (node1 == nullptr && node2 == nullptr) {
            refusedProhibits++;
            return false;
            /*            node = new NBNode(id1, pos.x(), pos.y(), "priority");
                        if(!myNodeCont.insert(node)) {
                             "nope, NIVissimDisturbance" << endl;
                            throw 1;
                        }*/
        } else {
            node = node1 == nullptr ? node2 : node1;
        }
        ec.splitAt(dc, ec.retrievePossiblySplit(toString<int>(e1->getID()), myEdge.getPosition()), node);
        ec.splitAt(dc, ec.retrievePossiblySplit(toString<int>(e2->getID()), myDisturbance.getPosition()), node);
        // !!! in some cases, one of the edges is not being build because it's too short
        // !!! what to do in these cases?
        NBEdge* mayDriveFrom = ec.retrieve(toString<int>(e1->getID()) + "[0]");
        NBEdge* mayDriveTo = ec.retrieve(toString<int>(e1->getID()) + "[1]");
        NBEdge* mustStopFrom = ec.retrieve(toString<int>(e2->getID()) + "[0]");
        NBEdge* mustStopTo = ec.retrieve(toString<int>(e2->getID()) + "[1]");
        if (mayDriveFrom != nullptr && mayDriveTo != nullptr && mustStopFrom != nullptr && mustStopTo != nullptr) {
            node->addSortedLinkFoes(
                NBConnection(mayDriveFrom, mayDriveTo),
                NBConnection(mayDriveFrom, mayDriveTo));
        } else {
            refusedProhibits++;
            return false;
            // !!! warning
        }
//        }
    } else if (pc != nullptr && bc == nullptr) {
        // The prohibited abstract edge is a connection, the other
        //  is not;
        // The connection will be prohibitesd by all connections
        //  outgoing from the "real" edge

        NBEdge* e = ec.retrievePossiblySplit(toString<int>(myDisturbance.getEdgeID()), myDisturbance.getPosition());
        if (e == nullptr) {
            WRITE_WARNING("Could not prohibit '" + toString<int>(myEdge.getEdgeID()) + "' by '" + toString<int>(myDisturbance.getEdgeID()) + "'. Have not found disturbance.");
            refusedProhibits++;
            return false;
        }
        if (e->getFromNode() == e->getToNode()) {
            WRITE_WARNING("Could not prohibit '" + toString<int>(myEdge.getEdgeID()) + "' by '" + toString<int>(myDisturbance.getEdgeID()) + "'. Disturbance connects same node.");
            refusedProhibits++;
            // What to do with self-looping edges?
            return false;
        }
        // get the begin of the prohibited connection
        std::string id_pcoe = toString<int>(pc->getFromEdgeID());
        std::string id_pcie = toString<int>(pc->getToEdgeID());
        NBEdge* pcoe = ec.retrievePossiblySplit(id_pcoe, id_pcie, true);
        NBEdge* pcie = ec.retrievePossiblySplit(id_pcie, id_pcoe, false);
        // check whether it's ending node is the node the prohibited
        //  edge end at
        if (pcoe != nullptr && pcie != nullptr && pcoe->getToNode() == e->getToNode()) {
            // if so, simply prohibit the connections
            NBNode* node = e->getToNode();
            const EdgeVector& connected = e->getConnectedEdges();
            for (EdgeVector::const_iterator i = connected.begin(); i != connected.end(); i++) {
                node->addSortedLinkFoes(
                    NBConnection(e, *i),
                    NBConnection(pcoe, pcie));
            }
        } else {
            WRITE_WARNING("Would have to split edge '" + e->getID() + "' to build a prohibition");
            refusedProhibits++;
            // quite ugly - why was it not build?
            return false;
            /*
            std::string nid1 = e->getID() + "[0]";
            std::string nid2 = e->getID() + "[1]";

            if(ec.splitAt(e, node)) {
                node->addSortedLinkFoes(
                        NBConnection(
                            ec.retrieve(nid1),
                            ec.retrieve(nid2)
                        ),
                        getConnection(node, myEdge.getEdgeID())
                    );
            }
            */
        }
    } else if (bc != nullptr && pc == nullptr) {
        // The prohibiting abstract edge is a connection, the other
        //  is not;
        // We have to split the other one and add the prohibition
        //  description

        NBEdge* e = ec.retrievePossiblySplit(toString<int>(myEdge.getEdgeID()), myEdge.getPosition());
        if (e == nullptr) {
            WRITE_WARNING("Could not prohibit '" + toString<int>(myEdge.getEdgeID()) + "' - it was not built.");
            return false;
        }
        std::string nid1 = e->getID() + "[0]";
        std::string nid2 = e->getID() + "[1]";
        if (e->getFromNode() == e->getToNode()) {
            WRITE_WARNING("Could not prohibit '" + toString<int>(myEdge.getEdgeID()) + "' by '" + toString<int>(myDisturbance.getEdgeID()) + "'.");
            refusedProhibits++;
            // What to do with self-looping edges?
            return false;
        }
        // get the begin of the prohibiting connection
        std::string id_bcoe = toString<int>(bc->getFromEdgeID());
        std::string id_bcie = toString<int>(bc->getToEdgeID());
        NBEdge* bcoe = ec.retrievePossiblySplit(id_bcoe, id_bcie, true);
        NBEdge* bcie = ec.retrievePossiblySplit(id_bcie, id_bcoe, false);
        // check whether it's ending node is the node the prohibited
        //  edge end at
        if (bcoe != nullptr && bcie != nullptr && bcoe->getToNode() == e->getToNode()) {
            // if so, simply prohibit the connections
            NBNode* node = e->getToNode();
            const EdgeVector& connected = e->getConnectedEdges();
            for (EdgeVector::const_iterator i = connected.begin(); i != connected.end(); i++) {
                node->addSortedLinkFoes(
                    NBConnection(bcoe, bcie),
                    NBConnection(e, *i));
            }
        } else {
            WRITE_WARNING("Would have to split edge '" + e->getID() + "' to build a prohibition");
            refusedProhibits++;
            return false;
            /*
            // quite ugly - why was it not build?
            if(ec.splitAt(e, node)) {
                node->addSortedLinkFoes(
                        getConnection(node, myDisturbance.getEdgeID()),
                        NBConnection(
                            ec.retrieve(nid1),
                            ec.retrieve(nid2)
                        )
                    );
            }
            */
        }
    } else {
        // both the prohibiting and the prohibited abstract edges
        //  are connections
        // We can retrieve the conected edges and add the desription
        NBConnection conn1 = getConnection(node, myDisturbance.getEdgeID());
        NBConnection conn2 = getConnection(node, myEdge.getEdgeID());
        if (!conn1.check(ec) || !conn2.check(ec)) {
            refusedProhibits++;
            return false;
        }
        node->addSortedLinkFoes(conn1, conn2);
    }
    return true;
}