This make it possible to have properly 'cascading' styles, with more specific
selector taking the priority over less specific ones.
[REVERTED] Allows keeping multiple styles at a given scale level #33
skadge/kothic:style_fallbacks into master This make it possible to have properly 'cascading' styles, with more specific selector taking the priority over less specific ones
Would this cause Z-fighting though?
@x7z4w
Here a quick test with a simple mapcss file:
node|z14[amenity=fuel][prefs:engine_type!=ev],
{icon-image: fuel-s.svg;}
node|z15-[amenity=fuel][prefs:engine_type!=ev],
{icon-image: fuel-m.svg;}
node|z16-[amenity=fuel][prefs:engine_type=ev],
{icon-image: fuel-dispenser-m.svg;}
Running:
python3 ../tools/kothic/src/libkomwm.py --txt -s test.mapcss -o test_proto -p styles/default/include/
generates:
cont {
name: "amenity-fuel"
element {
scale: 14
symbol {
name: "fuel-s"
priority: 4270
}
apply_if: "prefs:engine_type!=ev"
}
element {
scale: 15
symbol {
name: "fuel-m"
priority: 4270
}
apply_if: "prefs:engine_type!=ev"
}
element {
scale: 16
symbol {
name: "fuel-m"
priority: 4270
}
apply_if: "prefs:engine_type!=ev"
}
element {
scale: 16
symbol {
name: "fuel-dispenser-m"
priority: 4270
}
apply_if: "prefs:engine_type=ev"
}
element {
scale: 17
symbol {
name: "fuel-m"
priority: 4270
}
apply_if: "prefs:engine_type!=ev"
}
element {
scale: 17
symbol {
name: "fuel-dispenser-m"
priority: 4270
}
apply_if: "prefs:engine_type=ev"
}
element {
scale: 18
symbol {
name: "fuel-m"
priority: 4270
}
apply_if: "prefs:engine_type!=ev"
}
element {
scale: 18
symbol {
name: "fuel-dispenser-m"
priority: 4270
}
apply_if: "prefs:engine_type=ev"
}
element {
scale: 19
symbol {
name: "fuel-m"
priority: 4270
}
apply_if: "prefs:engine_type!=ev"
}
element {
scale: 19
symbol {
name: "fuel-dispenser-m"
priority: 4270
}
apply_if: "prefs:engine_type=ev"
}
element {
scale: 20
symbol {
name: "fuel-m"
priority: 4270
}
apply_if: "prefs:engine_type!=ev"
}
element {
scale: 20
symbol {
name: "fuel-dispenser-m"
priority: 4270
}
apply_if: "prefs:engine_type=ev"
}
}
This looks ok to me, but maybe you had something specific in mind with 'z-figthing'?
OK, after thinking a bit it doesn't matter, because this PR just allows overriding styles with specific tags.
@skadge wrote in #33 (comment):
priority: 4270
FYI, we have issues with two areas Z-fighting because they have the same priority+zoom level.
Maybe we can tweak kothic to bump the priority if the same priority+zoom level pair already exists?
thanks for merging!
@skadge When I run generate_drules.sh on the current main style files it produces weird comment changes, e.g.
-leisure-garden # area z12- (also has icon z16-, caption(optional) z16-)
+leisure-garden # area z12- (also has icon z16-, caption(optional) z16-, caption z17-)
Could you please fix it?
@pastk -- looking into it, I think the new generated captions are actually correct...
Looking at leisure-garden:
This is the mapcss:
area|z17-[leisure],
{text: name;text-color: @poi_label;text-offset: 1;font-size: 10;}
area|z14-[leisure=park][name],
area|z14-[landuse=forest][name],
area|z16-[leisure=garden][garden:type!=residential][name]
{text: name;text-color: @park_label;text-halo-color: @halo_park_label;text-halo-radius: 0.5;text-halo-opacity: 0.8;icon-min-distance: 8;text-offset: 1;font-size: 10;}
area|z16-[leisure=park][name]::int_name,
area|z16-[landuse=forest][name]::int_name,
area|z16-[leisure=garden][garden:type!=residential][name]::int_name
{text: int_name;text-color: @park_label;text-halo-color: @halo_park_label;text-halo-radius: 0.5;text-halo-opacity: 0.8;text-offset: 1;font-size: 10;}
[...]
If I'm correct, at level 17 and above, the caption (name) will always be displayed (while it is optional at level 16 and below). So the updated comment is correct, no?
Thanks!
caption(optional) means there is also an icon which is the main handle for the POI and a caption becoming optional.
Indeed an icon is present on z16-17 for named gardens only and then z18- for all gardens (incl. no-name ones).
Hence caption(optional) z16- makes sense although it doesn't cover that z16-17 doesn't apply to no-name gardens.
caption z17- is confusing still.
I.e. on z18- all leisure-garden have an icon, so it can't apply to z18-.
And for no-name gardens there is no caption at all, so caption z17- also doesn't make sense.
And the named / no-name gardens distinction starts from z16- so its also not clear where does z17- comes from...
Perhaps caption z17- is somehow wrongly inferred from area|z17-[leisure], line.
Though captions for no-name gardens are explicitly removed by
area|z16-[leisure=garden][garden:type!=residential][!name],
{text: none}
So in the end caption z17- is wrong and confusing.
(please check data/drules_proto_default_light.txt to see actual drawing rules (drules) produced where its more clear if icon/caption are present on particular zooms etc.; I've also checked source mapcss and the drules seem to be generated right)
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?