﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
11496	[Patch] getVisibleLayersInZOrder() -> Comparator is not transitive	michael2402	team	"{{{
#!java
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]"	defect	closed	minor	15.08	Core mappaint		fixed	gsoc	
