TraCIRTree*
TraCIServerAPI_Junction::getTree() {
    TraCIRTree* t = new TraCIRTree();
    const std::map<std::string, MSJunction*>& junctions = MSNet::getInstance()->getJunctionControl().getMyMap();
    for (std::map<std::string, MSJunction*>::const_iterator i = junctions.begin(); i != junctions.end(); ++i) {
        Boundary b = (*i).second->getShape().getBoxBoundary();
        t->addObject((*i).second, b);
    }
    return t;
}
TraCIRTree*
TraCIServerAPI_Polygon::getTree() {
    TraCIRTree* t = new TraCIRTree();
    ShapeContainer& shapeCont = MSNet::getInstance()->getShapeContainer();
    const std::map<std::string, Polygon*>& polygons = shapeCont.getPolygons().getMyMap();
    for (std::map<std::string, Polygon*>::const_iterator i = polygons.begin(); i != polygons.end(); ++i) {
        Boundary b = (*i).second->getShape().getBoxBoundary();
        t->addObject((*i).second, b);
    }
    return t;
}
Пример #3
0
TraCIRTree*
TraCIServerAPI_Lane::getTree() {
    TraCIRTree* t = new TraCIRTree();
    const std::vector<MSEdge*>& edges = MSNet::getInstance()->getEdgeControl().getEdges();
    for (std::vector<MSEdge*>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
        const std::vector<MSLane*>& lanes = (*i)->getLanes();
        for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
            Boundary b = (*j)->getShape().getBoxBoundary();
            b.grow(3.);
            t->addObject(*j, b);
        }
    }
    return t;
}