Refactor coordinate processing into Polygons class

We have a bunch of stuff for doing lat/long transformation in the
`BroadcastMessage` class. This is not a good separation of concerns, now
that we have a separate class for dealing with polygons and coordinates.
This commit is contained in:
Chris Hill-Scott
2020-08-25 16:55:09 +01:00
parent c49a6338af
commit 3d9d663b27
7 changed files with 52 additions and 83 deletions

View File

@@ -18,13 +18,19 @@ def test_simple_polygons(fake_uuid):
))
assert [
[len(polygon) for polygon in broadcast_message.polygons],
[len(polygon) for polygon in broadcast_message.simple_polygons],
[
len(polygon)
for polygon in broadcast_message.polygons.as_coordinate_pairs_lat_long
],
[
len(polygon)
for polygon in broadcast_message.simple_polygons.as_coordinate_pairs_lat_long
],
] == [
# One polygon for each area
[27, 31],
# Because the areas are close to each other, the simplification
# and unioning process results in a single polygon with fewer
# total coordinates
[34],
[55],
]