void
NIVissimDistrictConnection::dict_BuildDistrictNodes(NBDistrictCont& dc,
        NBNodeCont& nc) {
    for (std::map<int, std::vector<int> >::iterator k = myDistrictsConnections.begin(); k != myDistrictsConnections.end(); k++) {
        // get the connections
        const std::vector<int>& connections = (*k).second;
        // retrieve the current district
        std::string dsid = toString<int>((*k).first);
        NBDistrict* district = new NBDistrict(dsid);
        dc.insert(district);
        // compute the middle of the district
        PositionVector pos;
        for (std::vector<int>::const_iterator j = connections.begin(); j != connections.end(); j++) {
            NIVissimDistrictConnection* c = dictionary(*j);
            pos.push_back(c->geomPosition());
        }
        Position distCenter = pos.getPolygonCenter();
        if (connections.size() == 1) { // !!! ok, ok, maybe not the best way just to add an offset
            distCenter.add(10, 10);
        }
        district->setCenter(distCenter);
        // build the node
        std::string id = "District" + district->getID();
        NBNode* districtNode =
            new NBNode(id, district->getPosition(), district);
        if (!nc.insert(districtNode)) {
            throw 1;
        }
    }
}
void
NIVissimNodeCluster::buildNBNode(NBNodeCont& nc) {
    if (myConnectors.size() == 0) {
        return; // !!! Check, whether this can happen
    }

    // compute the position
    PositionVector crossings;
    IntVector::iterator i, j;
    // check whether this is a split of an edge only
    if (myAmEdgeSplit) {
// !!! should be        assert(myTLID==-1);
        for (i = myConnectors.begin(); i != myConnectors.end(); i++) {
            NIVissimConnection* c1 = NIVissimConnection::dictionary(*i);
            crossings.push_back_noDoublePos(c1->getFromGeomPosition());
        }
    } else {
        // compute the places the connections cross
        for (i = myConnectors.begin(); i != myConnectors.end(); i++) {
            NIVissimAbstractEdge* c1 = NIVissimAbstractEdge::dictionary(*i);
            c1->buildGeom();
            for (j = i + 1; j != myConnectors.end(); j++) {
                NIVissimAbstractEdge* c2 = NIVissimAbstractEdge::dictionary(*j);
                c2->buildGeom();
                if (c1->crossesEdge(c2)) {
                    crossings.push_back_noDoublePos(c1->crossesEdgeAtPoint(c2));
                }
            }
        }
        // alternative way: compute via positions of crossings
        if (crossings.size() == 0) {
            for (i = myConnectors.begin(); i != myConnectors.end(); i++) {
                NIVissimConnection* c1 = NIVissimConnection::dictionary(*i);
                crossings.push_back_noDoublePos(c1->getFromGeomPosition());
                crossings.push_back_noDoublePos(c1->getToGeomPosition());
            }
        }
    }
    // get the position (center)
    Position pos = crossings.getPolygonCenter();
    // build the node
    /*    if(myTLID!=-1) {
     !!!        NIVissimTL *tl = NIVissimTL::dictionary(myTLID);
            if(tl->getType()=="festzeit") {
                node = new NBNode(getNodeName(), pos.x(), pos.y(),
                    "traffic_light");
            } else {
                node = new NBNode(getNodeName(), pos.x(), pos.y(),
                    "actuated_traffic_light");
            }
        }*/
    NBNode* node = new NBNode(getNodeName(), pos, NODETYPE_PRIORITY_JUNCTION);
    if (!nc.insert(node)) {
        delete node;
        throw 1;
    }
    myNBNode = node;
}