Skip to content

Commit

Permalink
Consistently use object:as_*() for geometry creation functions
Browse files Browse the repository at this point in the history
  • Loading branch information
joto committed Apr 11, 2024
1 parent 27eb95b commit e32f2b6
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion themes/basic/topics/generic-boundaries.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ themepark:add_table{
themepark:add_proc('relation', function(object)
if object.tags.type == 'boundary' or (object.tags.type == 'multipolygon' and object.tags.boundary) then
themepark:insert('boundaries', {
geom = object.as_multilinestring(),
geom = object:as_multilinestring(),
tags = object.tags
})
end
Expand Down
2 changes: 1 addition & 1 deletion themes/basic/topics/generic-lines.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ themepark:add_table{
themepark:add_proc('way', function(object)
if not object.is_closed or not theme.has_area_tags(object.tags) then
themepark:insert('lines', {
geom = object.as_linestring(),
geom = object:as_linestring(),
tags = object.tags
})
end
Expand Down
2 changes: 1 addition & 1 deletion themes/basic/topics/generic-points.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ themepark:add_table{

themepark:add_proc('node', function(object)
themepark:insert('points', {
geom = object.as_point(),
geom = object:as_point(),
tags = object.tags
})
end)
Expand Down
4 changes: 2 additions & 2 deletions themes/basic/topics/generic-polygons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ themepark:add_table{
themepark:add_proc('way', function(object)
if object.is_closed and theme.has_area_tags(object.tags) then
themepark:insert('polygons', {
geom = object.as_polygon(),
geom = object:as_polygon(),
tags = object.tags
})
end
Expand All @@ -33,7 +33,7 @@ end)
themepark:add_proc('relation', function(object)
if themepark:relation_is_area(object) then
themepark:insert('polygons', {
geom = object.as_multipolygon(),
geom = object:as_multipolygon(),
tags = object.tags
})
end
Expand Down
2 changes: 1 addition & 1 deletion themes/basic/topics/generic-routes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ themepark:add_table{
themepark:add_proc('relation', function(object)
if object.tags.type == 'route' then
themepark:insert('routes', {
geom = object.as_multilinestring(),
geom = object:as_multilinestring(),
tags = object.tags
})
end
Expand Down
6 changes: 3 additions & 3 deletions themes/basic/topics/nwr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,22 @@ themepark:add_table{

themepark:add_proc('node', function(object)
themepark:insert('nodes', {
geom = object.as_point(),
geom = object:as_point(),
tags = object.tags
})
end)

themepark:add_proc('way', function(object)
themepark:insert('ways', {
geom = object.as_linestring(),
geom = object:as_linestring(),
tags = object.tags,
nodes = '{' .. table.concat(object.nodes, ',') .. '}'
})
end)

themepark:add_proc('relation', function(object)
themepark:insert('relations', {
geom = object.as_geometrycollection(),
geom = object:as_geometrycollection(),
tags = object.tags,
members = object.members
})
Expand Down
2 changes: 1 addition & 1 deletion themes/experimental/topics/rivers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ themepark:add_proc('relation', function(object, data)
kind = t.waterway
}

a.geom = object.as_multilinestring()
a.geom = object:as_multilinestring()
themepark.themes.core.add_name(a, object)
themepark:insert('rivers', a, t)
end)
Expand Down
2 changes: 1 addition & 1 deletion themes/shortbread_v1/topics/bridges.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ themepark:add_proc('area', function(object, data)
layer = data.core.layer
}

for sgeom in object.as_area():geometries() do
for sgeom in object:as_area():geometries() do
a.geom = sgeom
themepark:insert('bridges', a, t)
end
Expand Down
2 changes: 1 addition & 1 deletion themes/shortbread_v1/topics/buildings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ themepark:add_proc('area', function(object, data)
local t = object.tags

if t.building and t.building ~= 'no' then
for sgeom in object.as_area():geometries() do
for sgeom in object:as_area():geometries() do
local a = { geom = sgeom }
themepark:insert('buildings', a, t)
end
Expand Down
4 changes: 2 additions & 2 deletions themes/shortbread_v1/topics/dams.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ themepark:add_proc('way', function(object, data)

if waterway == 'dam' then
local a = { kind = waterway }
a.geom = object.as_linestring()
a.geom = object:as_linestring()
themepark:insert('dam_lines', a, t)
end
end)
Expand All @@ -61,7 +61,7 @@ themepark:add_proc('area', function(object, data)
if waterway == 'dam' then
local a = { kind = waterway }

for sgeom in object.as_area():geometries() do
for sgeom in object:as_area():geometries() do
a.geom = sgeom
themepark:insert('dam_polygons', a, t)
end
Expand Down
2 changes: 1 addition & 1 deletion themes/shortbread_v1/topics/land.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ themepark:add_table{

themepark:add_proc('area', function(object, data)
local t = object.tags
local a = { geom = object.as_area() }
local a = { geom = object:as_area() }

local minzoom = landuse_lookup[t.landuse]
if minzoom then
Expand Down
4 changes: 2 additions & 2 deletions themes/shortbread_v1/topics/piers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ themepark:add_proc('way', function(object, data)

if man_made == 'pier' or man_made == 'breakwater' or man_made == 'groyne' then
local a = { kind = man_made }
a.geom = object.as_linestring()
a.geom = object:as_linestring()
themepark:insert('pier_lines', a, t)
end
end)
Expand All @@ -63,7 +63,7 @@ themepark:add_proc('area', function(object, data)
if man_made == 'pier' or man_made == 'breakwater' or man_made == 'groyne' then
local a = { kind = man_made }

for sgeom in object.as_area():geometries() do
for sgeom in object:as_area():geometries() do
a.geom = sgeom
themepark:insert('pier_polygons', a, t)
end
Expand Down
2 changes: 1 addition & 1 deletion themes/shortbread_v1/topics/sites.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ themepark:add_proc('area', function(object, data)
end
end

a.geom = object.as_area()
a.geom = object:as_area()
themepark.themes.core.add_name(a, object)
themepark:add_debug_info(a, t)
themepark:insert('sites', a)
Expand Down
4 changes: 2 additions & 2 deletions themes/shortbread_v1/topics/water.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ themepark:add_proc('way', function(object, data)
if check_waterway(waterway) then
local a = {
kind = waterway,
geom = object.as_linestring(),
geom = object:as_linestring(),
layer = data.core.layer,
bridge = get_bridge_value(t.bridge),
tunnel = false,
Expand Down Expand Up @@ -157,7 +157,7 @@ themepark:add_proc('area', function(object, data)
return
end

local g = object.as_area():transform(3857)
local g = object:as_area():transform(3857)
local a = {
kind = kind,
way_area = round(g:area()),
Expand Down
2 changes: 1 addition & 1 deletion themes/shortbread_v1_gen/topics/land.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ local check_leisure = osm2pgsql.make_check_values_func({

themepark:add_proc('area', function(object, data)
local t = object.tags
local a = { geom = object.as_area() }
local a = { geom = object:as_area() }

local minzoom = landuse_lookup[t.landuse]
if minzoom then
Expand Down
4 changes: 2 additions & 2 deletions themes/shortbread_v1_gen/topics/water.lua
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ themepark:add_proc('way', function(object, data)
if check_waterway(waterway) then
local a = {
kind = waterway,
geom = object.as_linestring(),
geom = object:as_linestring(),
layer = data.core.layer,
width = parse_width(t.width),
bridge = get_bridge_value(t.bridge),
Expand Down Expand Up @@ -221,7 +221,7 @@ themepark:add_proc('area', function(object, data)
return
end

local g = object.as_area():transform(3857)
local g = object:as_area():transform(3857)
local a = {
kind = kind,
way_area = round(g:area()),
Expand Down

0 comments on commit e32f2b6

Please sign in to comment.