Gesendet: Freitag, 10. Januar 2020 11:29
I've also used default method for the augmentsWith... in Rule, Op,
yes, it would probably be better to know if the function is for a
polyline or polygon. A patch would be welcomed.
And yes, the expected result for the case you describe is not yet
clear. See b13 and b14 in my example file.
Firstly to be able to correctly handle the case where the rule.way
runs
around a hole in the target.polygon - all of the rule.line is in the
target, but only part of the rule.polygon is in the target.
On Thu, 2020-01-09 at 11:43 +0000, Gerd Petermann wrote:
Hi all,
the branch version r4408 implements the style function is_in with
three parameters tag-key,tag-value,method
- tag-key can be something like landuse or natural or amenity
- tag-value would be the expected value for that tag-key
- method has to be "any" or "all".
Example usage in lines:
# no cycling within a cemetery
highway=* & bicycle!=* & is_in(landuse,cemetery,all) {add
bicycle=dismount}
Before any style rule is evaluated the function evaluates the list
of
all ways found in the input file. When a way matches the given tag
(key+value) and is closed and complete the shape geometry is stored
in a spatial index.
With the current implementation this index is created for
appearance
of the is_in function in a style rule (subject to optimization)
When the style function is called it retrieves the stored shape(s)
which intersect the boundary of the element.
If none is found "false" is returned.
If there are multiple such shapes the are merged where possible, so
that overlapping or touching shapes are combined to a single shape
which may include holes.
The list of (outer) shapes is then tested one after the other until
one shape is found which either contains the element completely or
-
when "any" is used as method - partially. If none is found the
value
"false" is returned.
If a match is found and the combined shapes have holes, a final
test
is done to find out if the element is within the hole.
If method "any" is used and the shape is completey within one hole
"false" is returned.
If method "all" is used and the shape is partly within one hole
"false" is returned.
If we get here true is "returned"
I've also slightly changed the behaviour of the LocationHook and
the
ResidentialHook. The results should be a bit more predictable now
as
searches are done with higher precsion. Still, both try to find a
nearby boundary(shape) if none is found at the exact position.
The ResidentialHook is now automatically disabled when the style
doesn't use mkgmap:residential anywhere.
TODO:
- various possible special cases need more testing
- maybe add more methods for cases where parts of the tested
element
touch the boundary of the shape.
- tuning
- unit tests
As always with branch version the binary can be found at the bottom
of the download page.
I've tested this with the example file posted before, accept for
b18
all cases work as expected.
Gerd
_______________________________________________
mkgmap-dev mailing list
_______________________________________________
mkgmap-dev mailing list