From 8bfc4f36763b58fc5260fcaac024963c52e57ef0 Mon Sep 17 00:00:00 2001 From: Sergey Vartanov Date: Mon, 7 Feb 2022 23:20:43 +0300 Subject: [PATCH] Refactor node boundary box. --- map_machine/osm/osm_reader.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/map_machine/osm/osm_reader.py b/map_machine/osm/osm_reader.py index 2541fa9..d923409 100644 --- a/map_machine/osm/osm_reader.py +++ b/map_machine/osm/osm_reader.py @@ -171,6 +171,14 @@ class OSMNode(Tagged): coordinates=np.array((structure["lat"], structure["lon"])), ) + def get_boundary_box(self) -> BoundaryBox: + return BoundaryBox( + self.coordinates[1], + self.coordinates[0], + self.coordinates[1], + self.coordinates[0], + ) + def __hash__(self) -> int: return self.id_ @@ -346,12 +354,7 @@ class OSMData: self.time.update(node.timestamp) if not self.boundary_box: - self.boundary_box = BoundaryBox( - node.coordinates[1], - node.coordinates[0], - node.coordinates[1], - node.coordinates[0], - ) + self.boundary_box = node.get_boundary_box() self.boundary_box.update(node.coordinates) def add_way(self, way: OSMWay) -> None: