Skip to content

Commit 6aabbf5

Browse files
committed
Refactor street polygon code
1 parent cd64700 commit 6aabbf5

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

themes/shortbread_v1/topics/streets.lua

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,16 +288,13 @@ local process_as_area = function(object, data)
288288
a.tunnel = as_bool(t.tunnel) or t.tunnel == 'building_passage' or t.covered == 'yes'
289289
a.bridge = as_bool(t.bridge)
290290

291-
a.geom = object:as_polygon()
291+
a.geom = object:as_polygon():transform(3857)
292+
local has_name = themepark.themes.core.add_name(a, object)
293+
themepark:insert('street_polygons', a, t)
292294

293-
294-
if themepark.themes.core.add_name(a, object) then
295-
local g = a.geom:transform(3857)
296-
themepark:insert('street_polygons', a, t)
297-
a.geom = g:pole_of_inaccessibility()
295+
if has_name then
296+
a.geom = a.geom:pole_of_inaccessibility()
298297
themepark:insert('streets_polygons_labels', a, t)
299-
else
300-
themepark:insert('street_polygons', a, t)
301298
end
302299
end
303300

themes/shortbread_v1_gen/topics/streets.lua

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,15 +325,13 @@ local process_as_area = function(object, data)
325325
a.tunnel = as_bool(t.tunnel) or t.tunnel == 'building_passage' or t.covered == 'yes'
326326
a.bridge = as_bool(t.bridge)
327327

328-
a.geom = object:as_polygon()
328+
a.geom = object:as_polygon():transform(3857)
329+
local has_name = themepark.themes.core.add_name(a, object)
330+
themepark:insert('street_polygons', a, t)
329331

330-
if themepark.themes.core.add_name(a, object) then
331-
local g = a.geom:transform(3857)
332-
themepark:insert('street_polygons', a, t)
333-
a.geom = g:pole_of_inaccessibility()
332+
if has_name then
333+
a.geom = a.geom:pole_of_inaccessibility()
334334
themepark:insert('streets_polygons_labels', a, t)
335-
else
336-
themepark:insert('street_polygons', a, t)
337335
end
338336
end
339337

0 commit comments

Comments
 (0)