Opened 11 years ago
Last modified 10 years ago
#11496 closed defect
getVisibleLayersInZOrder() -> Comparator is not transitive — at Version 1
| Reported by: | michael2402 | Owned by: | team |
|---|---|---|---|
| Priority: | minor | Milestone: | 15.08 |
| Component: | Core mappaint | Version: | |
| Keywords: | gsoc | Cc: |
Description (last modified by )
if (l1 instanceof OsmDataLayer && l2 instanceof OsmDataLayer) { if (l1 == getActiveLayer()) return -1; if (l2 == getActiveLayer()) return 1; return Integer.compare(layers.indexOf(l1), layers.indexOf(l2)); } else return Integer.compare(layers.indexOf(l1), layers.indexOf(l2));
The current comparator implementation is not transitive. Imagine the following layers:
layers = [OSM1, TMS1, OSM2], activeLayer = OSM1
We have OSM1 < TMS1, TMS1 < OSM2, OSM2 < OSM1.
What was the Idea behind the Comparator? My idea would be that it should push the avtive data layer above all adjacent OSM layers. So it would change this:
[OSM1, OSM2, OSM3, TMS1, OSM4], activeLayer = OSM2 to [OSM1, OSM3, OSM2, TMS1, OSM4]


