fn fix_parking_lot_driveways(map: &mut Map, input: Vec<ParkingLotID>) {
    // TODO Partly copying from make/parking_lots.rs
    let mut center_per_lot: Vec<(ParkingLotID, HashablePt2D)> = Vec::new();
    let mut query: HashSet<HashablePt2D> = HashSet::new();
    for id in input {
        let center = map.get_pl(id).polygon.center().to_hashable();
        center_per_lot.push((id, center));
        query.insert(center);
    }

    let sidewalk_buffer = Distance::meters(7.5);
    let sidewalk_pts = match_points_to_lanes(
        map.get_bounds(),
        query,
        map.all_lanes(),
        |l| l.is_walkable(),
        sidewalk_buffer,
        Distance::meters(1000.0),
        &mut Timer::throwaway(),
    );

    for (id, center) in center_per_lot {
        match snap_driveway(center, &map.get_pl(id).polygon, &sidewalk_pts, map) {
            Ok((driveway_line, driving_pos, sidewalk_line, sidewalk_pos)) => {
                let pl = &mut map.parking_lots[id.0];
                pl.driveway_line = driveway_line;
                pl.driving_pos = driving_pos;
                pl.sidewalk_line = sidewalk_line;
                pl.sidewalk_pos = sidewalk_pos;
            }
            Err(err) => {
                // TODO Not sure what to do here yet.
                error!("{} isn't snapped to a sidewalk now: {}", id, err);
            }
        }
    }
}
/// Recalculate the driveways of some parking lots after map edits.
Recalculate the driveways of some parking lots after map edits.
Recalculate the driveways of some parking lots after map edits .
fn fix_parking_lot_driveways(map: &mut Map, input: Vec<ParkingLotID>) {
    // TODO Partly copying from make/parking_lots.rs
    let mut center_per_lot: Vec<(ParkingLotID, HashablePt2D)> = Vec::new();
    let mut query: HashSet<HashablePt2D> = HashSet::new();
    for id in input {
        let center = map.get_pl(id).polygon.center().to_hashable();
        center_per_lot.push((id, center));
        query.insert(center);
    }
    let sidewalk_buffer = Distance::meters(7.5);
    let sidewalk_pts = match_points_to_lanes(
        map.get_bounds(),
        query,
        map.all_lanes(),
        |l| l.is_walkable(),
        sidewalk_buffer,
        Distance::meters(1000.0),
        &mut Timer::throwaway(),
    );
    for (id, center) in center_per_lot {
        match snap_driveway(center, &map.get_pl(id).polygon, &sidewalk_pts, map) {
            Ok((driveway_line, driving_pos, sidewalk_line, sidewalk_pos)) => {
                let pl = &mut map.parking_lots[id.0];
                pl.driveway_line = driveway_line;
                pl.driving_pos = driving_pos;
                pl.sidewalk_line = sidewalk_line;
                pl.sidewalk_pos = sidewalk_pos;
            }
            Err(err) => {
                // TODO Not sure what to do here yet.
                error!("{} isn't snapped to a sidewalk now: {}", id, err);
            }
        }
    }
}
fn fix_parking_lot_driveways ( map : & mut Map , input : Vec < ParkingLotID > ) { // TODO Partly copying from make/parking_lots.rs let mut center_per_lot : Vec < ( ParkingLotID , HashablePt2D ) > = Vec :: new ( ) ; let mut query : HashSet < HashablePt2D > = HashSet :: new ( ) ; for id in input { let center = map . get_pl ( id ) . polygon . center ( ) . to_hashable ( ) ; center_per_lot . push ( ( id , center ) ) ; query . insert ( center ) ; } let sidewalk_buffer = Distance :: meters ( 7.5 ) ; let sidewalk_pts = match_points_to_lanes ( map . get_bounds ( ) , query , map . all_lanes ( ) , | l | l . is_walkable ( ) , sidewalk_buffer , Distance :: meters ( 1000.0 ) , & mut Timer :: throwaway ( ) , ) ; for ( id , center ) in center_per_lot { match snap_driveway ( center , & map . get_pl ( id ) . polygon , & sidewalk_pts , map ) { Ok ( ( driveway_line , driving_pos , sidewalk_line , sidewalk_pos ) ) => { let pl = & mut map . parking_lots [ id . 0 ] ; pl . driveway_line = driveway_line ; pl . driving_pos = driving_pos ; pl . sidewalk_line = sidewalk_line ; pl . sidewalk_pos = sidewalk_pos ; } Err ( err ) => { // TODO Not sure what to do here yet. error ! ( " " id err ) ; } } } }
Recalculate the driveways of some parking lots after map edits.
Recalculate the driveways of some parking lots after map edits .
map
&mut Map
input
Vec<ParkingLotID>