Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make style.lua code nicer #53

Closed
systemed opened this issue Jul 19, 2013 · 1 comment
Closed

Make style.lua code nicer #53

systemed opened this issue Jul 19, 2013 · 1 comment

Comments

@systemed
Copy link
Contributor

You should be able to cut out a bunch of the if statements this way.

Add before the function definitions:

polygon_keys = { 'building', 'landuse', 'amenity', 'harbour', 'historic', 'leisure', 
                 'man_made', 'military', 'natural', 'office', 'place', 'power',
                 'public_transport', 'shop', 'sport', 'tourism', 'waterway',
                 'wetland', 'water', 'aeroway' }

then replace the if statements in filter_tags_way with:

    for i,k in ipairs(polygon_keys) do
        if keyvalues[k] then
            poly=1
            break
        end
    end
apmon added a commit that referenced this issue Jul 21, 2013
Replaced lists of if-statements with tables over which to iterate

This was suggested in #53 by systemed
@apmon
Copy link
Contributor

apmon commented Jul 21, 2013

Thanks for the suggestion. I have cleaned up the style.lua which is in the repository a bit according to this.

I think this might have made processing slower though (~10%). I haven't really done many benchmarks though.

@apmon apmon closed this as completed Jul 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants