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

Idea for more flexible access to relations #541

Closed
geoneutrino opened this issue Sep 22, 2023 Discussed in #540 · 2 comments
Closed

Idea for more flexible access to relations #541

geoneutrino opened this issue Sep 22, 2023 Discussed in #540 · 2 comments

Comments

@geoneutrino
Copy link

Discussed in #540

Originally posted by geoneutrino September 22, 2023
Hello,

way_function in lua is normally a lot of calls to sub-functions to process the different types of elements/layers needed (streets, landuse, boundaries, labels ...)

when accepting multiple type of relations the current concept is a bit unclean from a software engineering perspective:
Accessing relations in one of those sub-functions with the while .. NextRelation() loop mentioned in the docs/RELATIONS.md results in the relationSubscript variable incremented in OsmLuaProcessing::NextRelation() until the end of the list and afterwards i can never reset it to use again in another function

kaguya::optional<int> OsmLuaProcessing::NextRelation() {

An easy improvement for this scenario would be to expose a simple "ResetRelationSubscript" method in osm_lua_processing to set relationSubscript to -1

A more complex but maybe also useful in the future would be to expose methods for accessing the relations in a more flexible way, kind of dictionary e.g. add a method NextRelationOfType("abc") that loops overs relations with attribute type=abc

Thanks

@systemed
Copy link
Owner

systemed commented Oct 4, 2023

Have a look at #548 - does this fix it for you?

@geoneutrino
Copy link
Author

looks good

@systemed systemed closed this as completed Oct 9, 2023
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