Skip to content

Commit

Permalink
Fix the build, removing all callers of Polygon::into_ring. #951
Browse files Browse the repository at this point in the history
And fix a bad Polygon::rectangle caller from widgetry.
  • Loading branch information
dabreegster committed Sep 3, 2022
1 parent 01be175 commit 254b527
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions apps/game/src/edit/roads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1016,8 +1016,8 @@ fn fade_irrelevant(app: &App, r: RoadID) -> GeomBatch {
match Polygon::convex_hull(holes) {
Ok(hole) => {
let fade_area = Polygon::with_holes(
map.get_boundary_polygon().clone().into_ring(),
vec![hole.into_ring()],
map.get_boundary_polygon().get_outer_ring(),
vec![hole.get_outer_ring()],
);
GeomBatch::from(vec![(app.cs.fade_map_dark, fade_area)])
}
Expand Down
4 changes: 2 additions & 2 deletions apps/game/src/edit/traffic_signals/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -981,8 +981,8 @@ pub fn fade_irrelevant(app: &App, members: &BTreeSet<IntersectionID>) -> GeomBat
match Polygon::convex_hull(holes) {
Ok(hole) => {
let fade_area = Polygon::with_holes(
app.primary.map.get_boundary_polygon().clone().into_ring(),
vec![hole.into_ring()],
app.primary.map.get_boundary_polygon().get_outer_ring(),
vec![hole.get_outer_ring()],
);
GeomBatch::from(vec![(app.cs.fade_map_dark, fade_area)])
}
Expand Down
2 changes: 1 addition & 1 deletion apps/ltn/src/draw_cells.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl RenderCellsBuilder {
// enum with 3 cases, just assign a new index to mean "boundary."
let boundary_marker = neighbourhood.cells.len();
for (pt, _) in
geom::PolyLine::unchecked_new(boundary_polygon.clone().into_ring().into_points())
geom::PolyLine::unchecked_new(boundary_polygon.get_outer_ring().into_points())
.step_along(Distance::meters(RESOLUTION_M / 2.0), Distance::ZERO)
{
// TODO Refactor helpers to transform between map-space and the grid tiles. Possibly
Expand Down
4 changes: 2 additions & 2 deletions apps/ltn/src/neighbourhood.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ impl Neighbourhood {
n.borders.insert(road.dst_i);
}
let fade_area = Polygon::with_holes(
map.get_boundary_polygon().clone().into_ring(),
map.get_boundary_polygon().get_outer_ring(),
vec![app
.session
.partitioning
.neighbourhood_boundary_polygon(app, id)
.into_ring()],
.get_outer_ring()],
);
n.fade_irrelevant = GeomBatch::from(vec![(app.cs.fade_map_dark, fade_area)]).upload(ctx);

Expand Down
2 changes: 1 addition & 1 deletion apps/santa/src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl Player {
} else {
// Find the exact point on the boundary where we go out of bounds
let old_ring = match self.on {
On::Intersection(i) => app.map.get_i(i).polygon.clone().into_ring(),
On::Intersection(i) => app.map.get_i(i).polygon.get_outer_ring(),
On::Road(r, _, _) => {
let road = app.map.get_r(r);
road.center_pts.to_thick_ring(road.get_width())
Expand Down
2 changes: 1 addition & 1 deletion convert_osm/src/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub fn extract_osm(
abstio::write_binary(map.name.city.input_path("footways.bin"), &extra_footways);
}

let boundary = map.streets.boundary_polygon.clone().into_ring();
let boundary = map.streets.boundary_polygon.get_outer_ring();

// TODO Fill this out in a separate loop to keep a mutable borrow short. Maybe do this in
// reader, or stop doing this entirely.
Expand Down
2 changes: 1 addition & 1 deletion headless/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ fn export_geometry(map: &Map, i: IntersectionID) -> geojson::GeoJson {
pairs.push((
i.polygon
.translate(-center.x(), -center.y())
.into_ring()
.get_outer_ring()
.to_geojson(None),
props,
));
Expand Down
6 changes: 2 additions & 4 deletions map_model/src/make/transit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ fn create_route(
// Find the first time the route shape hits the map boundary
let entry_pt = *map
.boundary_polygon
.clone()
.into_ring()
.get_outer_ring()
.all_intersections(&route.shape)
.get(0)
.ok_or_else(|| anyhow!("couldn't find where shape enters map"))?;
Expand All @@ -191,8 +190,7 @@ fn create_route(
// Find the last time the route shape hits the map boundary
let exit_pt = *map
.boundary_polygon
.clone()
.into_ring()
.get_outer_ring()
.all_intersections(&route.shape)
.last()
.ok_or_else(|| anyhow!("couldn't find where shape leaves map"))?;
Expand Down
2 changes: 1 addition & 1 deletion map_model/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ impl Map {
let mut props = serde_json::Map::new();
props.insert("type".to_string(), "intersection".into());
props.insert("id".to_string(), i.orig_id.to_string().into());
pairs.push((i.polygon.clone().into_ring().to_geojson(gps_bounds), props));
pairs.push((i.polygon.get_outer_ring().to_geojson(gps_bounds), props));
}
for r in self.all_roads() {
let mut props = serde_json::Map::new();
Expand Down
2 changes: 1 addition & 1 deletion widgetry/src/widgets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ impl Widget {
}

pub fn horiz_separator(ctx: &EventCtx, pct_container_width: f64) -> Widget {
GeomBatch::from(vec![(Color::CLEAR, Polygon::rectangle(0.0, 2.0))])
GeomBatch::from(vec![(Color::CLEAR, Polygon::rectangle(0.1, 2.0))])
.into_widget(ctx)
.container()
.bg(ctx.style().section_outline.1)
Expand Down

0 comments on commit 254b527

Please sign in to comment.