void NBHeightMapper::addTriangle(PositionVector corners) { Triangle* triangle = new Triangle(corners); myTriangles.push_back(triangle); Boundary b = corners.getBoxBoundary(); const float cmin[2] = {(float) b.xmin(), (float) b.ymin()}; const float cmax[2] = {(float) b.xmax(), (float) b.ymax()}; myRTree.Insert(cmin, cmax, triangle); }
void TraCIServer::collectObjectsInRange(int domain, const PositionVector& shape, SUMOReal range, std::set<std::string>& into) { // build the look-up tree if not yet existing if (myObjects.find(domain) == myObjects.end()) { switch (domain) { case CMD_GET_INDUCTIONLOOP_VARIABLE: myObjects[CMD_GET_INDUCTIONLOOP_VARIABLE] = TraCIServerAPI_InductionLoop::getTree(); break; case CMD_GET_EDGE_VARIABLE: case CMD_GET_LANE_VARIABLE: case CMD_GET_VEHICLE_VARIABLE: myObjects[CMD_GET_EDGE_VARIABLE] = 0; myObjects[CMD_GET_LANE_VARIABLE] = 0; myObjects[CMD_GET_VEHICLE_VARIABLE] = 0; myLaneTree = new RTree<MSLane*, MSLane, float, 2, TraCIServerAPI_Lane::StoringVisitor>(&MSLane::visit); MSLane::fill(*myLaneTree); break; case CMD_GET_POI_VARIABLE: myObjects[CMD_GET_POI_VARIABLE] = TraCIServerAPI_POI::getTree(); break; case CMD_GET_POLYGON_VARIABLE: myObjects[CMD_GET_POLYGON_VARIABLE] = TraCIServerAPI_Polygon::getTree(); break; case CMD_GET_JUNCTION_VARIABLE: myObjects[CMD_GET_JUNCTION_VARIABLE] = TraCIServerAPI_Junction::getTree(); break; default: break; } } const Boundary b = shape.getBoxBoundary().grow(range); const float cmin[2] = {(float) b.xmin(), (float) b.ymin()}; const float cmax[2] = {(float) b.xmax(), (float) b.ymax()}; switch (domain) { case CMD_GET_INDUCTIONLOOP_VARIABLE: case CMD_GET_POI_VARIABLE: case CMD_GET_POLYGON_VARIABLE: case CMD_GET_JUNCTION_VARIABLE: { Named::StoringVisitor sv(into); myObjects[domain]->Search(cmin, cmax, sv); } break; case CMD_GET_EDGE_VARIABLE: case CMD_GET_LANE_VARIABLE: case CMD_GET_VEHICLE_VARIABLE: { TraCIServerAPI_Lane::StoringVisitor sv(into, shape, range, domain); myLaneTree->Search(cmin, cmax, sv); } break; default: break; } }