WorldWindJava icon indicating copy to clipboard operation
WorldWindJava copied to clipboard

fixed LayerList.moveHigher in case of duplicates

Open basisbit opened this issue 8 years ago • 4 comments

If the LayerList contained the same layer more then once, moveHigher did not actually move a visible Layer "higher" (making it visible). Using lastIndexOf, the function should work for all cases as desired.

basisbit avatar Sep 12 '16 12:09 basisbit

Hi basisbit. I'm unclear on the motivation for duplicate layers in the layer list. What are the use cases in which you're encountering duplicate layers?

pdavidc avatar Sep 12 '16 12:09 pdavidc

WorldWindJava is an SDK, so there are various cases where for example because of (bad) user configuration or having one non-deselectable layer-duplicate sort of as fallback layer could cause duplicate layers within the LayerList. Anyways, there is nothing to check for duplicates in the LayerList.add function, so duplicates should be handled correctly.

basisbit avatar Sep 12 '16 13:09 basisbit

We're certainly aware that WWJ is an SDK. It's still unclear to me why, in the cases you mention, this is the right thing to do.

Your point about handling duplicates makes sense, but we like to understand what motivates a change. The cases you describe appear to be problems best handled by the application.

pdavidc avatar Sep 12 '16 14:09 pdavidc

I agree that these cases in many situations should best be handled by the application because usually, there shouldn't be any duplicate layers in the list. But anyways, the API specification does not state that anywhere and also doesn't check for duplicates before adding additional layers. Thus, "this.indexOf(targetLayer)" is not correct here, but should be "this.lastIndexOf(targetLayer)" instead.

For many use cases, the end user may edit the layers configuration in some config file and thus can set duplicates for whatever reason (maybe for easier grouping / legacy reasons / ...).

basisbit avatar Oct 17 '16 15:10 basisbit