#15525 closed enhancement (fixed)
Add parent_osm_id for mapcss
| Reported by: | Owned by: | team | |
|---|---|---|---|
| Priority: | normal | Milestone: | 17.11 |
| Component: | Core mappaint | Version: | |
| Keywords: | mapcss | Cc: |
Description
Currently, it is only possible to access the parent_tag but it would be very helpful to be able to get the parent's osm_id. It should be very easy to implement following https://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java#L457 and https://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java#L780.
Attachments (0)
Change History (6)
follow-up: 3 comment:1 by , 8 years ago
comment:3 by , 8 years ago
| Milestone: | → 17.11 |
|---|
Replying to Klumbumbus:
What if the object has several parent objects?
It is now restricted to the parent object matched by child selector, i.e. in
relation[type=route][route=foot] > way {...}
it selects the first parent relation with given tags.
follow-up: 6 comment:4 by , 8 years ago
This piece of code is not correct:
public static long parent_osm_id(final Environment env) { // NO_UCD (unused code) return env.parent == null ? null : env.parent.getUniqueId(); }
if env.parent is null, the auto-boxing of (Long) null to long will throw an NPE.
comment:6 by , 8 years ago
Replying to Don-vip:
This piece of code is not correct:
public static long parent_osm_id(final Environment env) { // NO_UCD (unused code) return env.parent == null ? null : env.parent.getUniqueId(); }if
env.parentis null, the auto-boxing of(Long) nulltolongwill throw an NPE.
Okay, this happens when you commit code without testing. :)



What if the object has several parent objects?