Skip to content

Commit e890826

Browse files
committed
comment
1 parent 9201b3b commit e890826

File tree

4 files changed

+30
-27
lines changed

4 files changed

+30
-27
lines changed

NEXT_RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Can be straightforwardly replaced with:
6565
```yaml
6666
planning_area:
6767
$content_schema: monitoring/uss_qualifier/resources/definitions/ResourceDeclaration.json
68-
resource_type: resources.PlanningAreaResource
68+
resource_type: resources.VolumeResource
6969
specification:
7070
template:
7171
outline_polygon:

monitoring/monitorlib/geo.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,18 @@ def from_f3548v21(vol: f3548v21.Volume3D | dict) -> Volume3D:
422422
def to_f3548v21(self) -> f3548v21.Volume3D:
423423
return ImplicitDict.parse(self, f3548v21.Volume3D)
424424

425+
def s2_vertices(self) -> list[s2sphere.LatLng]:
426+
"""Returns the vertices of the 2D area represented by this volume. If the underlying volume is a Polygon, its
427+
original vertices are returned. If it is a Circle, the vertices of the bounding rectangle are returned.
428+
"""
429+
if (
430+
self.outline_polygon is not None
431+
and self.outline_polygon.vertices is not None
432+
):
433+
return [v.as_s2sphere() for v in self.outline_polygon.vertices]
434+
else:
435+
return get_latlngrect_vertices(make_latlng_rect(self))
436+
425437

426438
def make_latlng_rect(area) -> s2sphere.LatLngRect:
427439
"""Make an S2 LatLngRect from the provided input.

monitoring/uss_qualifier/configurations/dev/library/resources.yaml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,19 @@ zurich_planning_area:
156156

157157
zurich_problematically_big_area: # A huge (as in "too big") area for checks around area sizes
158158
$content_schema: monitoring/uss_qualifier/resources/definitions/ResourceDeclaration.json
159-
resource_type: resources.VerticesResource
159+
resource_type: resources.VolumeResource
160160
specification:
161-
vertices:
162-
- lat: 48
163-
lng: 9
164-
- lat: 47
165-
lng: 9
166-
- lat: 47
167-
lng: 8
168-
- lat: 48
169-
lng: 8
161+
template:
162+
outline_polygon:
163+
vertices:
164+
- lat: 48
165+
lng: 9
166+
- lat: 47
167+
lng: 9
168+
- lat: 47
169+
lng: 8
170+
- lat: 48
171+
lng: 8
170172

171173
# ===== NetRID flights data =====
172174

monitoring/uss_qualifier/resources/volume.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
from monitoring.monitorlib.geo import (
55
LatLngPoint,
6-
Volume3D,
7-
get_latlngrect_vertices,
8-
make_latlng_rect,
96
)
107
from monitoring.monitorlib.geotemporal import Volume4DTemplate
118
from monitoring.uss_qualifier.resources.resource import Resource
@@ -20,22 +17,14 @@ class VolumeSpecification(ImplicitDict):
2017
template: Volume4DTemplate
2118

2219
def s2_vertices(self) -> list[s2sphere.LatLng]:
23-
"""Returns the vertices of the 2D area represented by this volume specification. If the underlying volume is a Polygon, its
24-
original vertices are returned. If it is a Circle, the vertices of the bounding rectangle are returned.
20+
"""Returns the vertices of the 2D area represented by this volume specification, after application of the template's transformations.
21+
Note that if the underlying volume contains a Circle, the vertices of its bounding rectangle are returned.
2522
"""
26-
if (
27-
self.template.outline_polygon is not None
28-
and self.template.outline_polygon.vertices is not None
29-
):
30-
return [v.as_s2sphere() for v in self.template.outline_polygon.vertices]
31-
else:
32-
return get_latlngrect_vertices(
33-
make_latlng_rect(Volume3D(outline_circle=self.template.outline_circle))
34-
)
23+
return self.template.resolve({}).volume.s2_vertices()
3524

3625
def vertices(self) -> list[LatLngPoint]:
37-
"""Returns the vertices of the 2D area represented by this volume specification. If the underlying volume is a Polygon, its
38-
original vertices are returned. If it is a Circle, the vertices of the bounding rectangle are returned.
26+
"""Returns the vertices of the 2D area represented by this volume specification, after application of the template's transformations.
27+
Note that if the underlying volume contains a Circle, the vertices of its bounding rectangle are returned.
3928
"""
4029
return [LatLngPoint.from_s2(v) for v in self.s2_vertices()]
4130

0 commit comments

Comments
 (0)