X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/f727620859cacfa39146642b31ad446762212262..9397bf54b89c1ae0b41115673d2f38582cd03ed9:/test/bdd/steps/geometry_factory.py diff --git a/test/bdd/steps/geometry_factory.py b/test/bdd/steps/geometry_factory.py index 7eedfc37..0a403839 100644 --- a/test/bdd/steps/geometry_factory.py +++ b/test/bdd/steps/geometry_factory.py @@ -9,7 +9,7 @@ class GeometryFactory: defpath = Path(__file__) / '..' / '..' / '..' / 'scenes' / 'data' self.scene_path = os.environ.get('SCENE_PATH', defpath.resolve()) self.scene_cache = {} - self.clear_grid() + self.grid = {} def parse_geometry(self, geom, scene): """ Create a WKT SQL term for the given geometry. @@ -103,11 +103,20 @@ class GeometryFactory: return scene - def clear_grid(self): + def set_grid(self, lines, grid_step): + """ Replace the grid with one from the given lines. + """ self.grid = {} - - def add_grid_node(self, nodeid, x, y): - self.grid[nodeid] = (x, y) + y = 0 + for line in lines: + x = 0 + for pt_id in line: + if pt_id.isdigit(): + self.grid[int(pt_id)] = (x, y) + x += grid_step + y += grid_step def grid_node(self, nodeid): + """ Get the coordinates for the given grid node. + """ return self.grid.get(nodeid)