Select to view content in your preferred language

Layer Reordering

1407
5
08-29-2016 07:54 PM
steelissteelis
Deactivated User

Hi Everyone,

I am trying to use the order of the MapView.Layers to track the layer order in my program.

However, I realized that when I remove a layer from the MapView then subsequently adding the layer back, the layer in the operations will eventually become invisible. I have tried setting the layer opacity and visibility but the layer just does not appear. Even if I add additional Graphics to test the layer, the objects in the layer just does not appear. However, I can still find the layer and all the Graphics, even the recently added but still as invisible ones, when I debug the program at break points. Here is a section of the code that I have used for reordering of Layers.

if (actualToPosition >= 0 && fromPositionLayer instanceof GraphicsLayer) {
    GraphicsLayer graphicsLayer = (GraphicsLayer) fromPositionLayer;
    mapView.removeLayer(graphicsLayer);
    mapView.addLayer(graphicsLayer, actualToPosition);
}

Does anyone know if there's missing operation that I need to do for the MapView to "redraw" or "reload" a layer.

I have the other option of reassigning DrawOrder of each Graphic object in a layer instead of a remove and add but the operation seems too heavy when dealing with a heavily populated layer.

I could also reload the layer by serializing then de-serializing but it is again a very heavy operation.

If anyone have any alternatives that I am missing out at the moment, do let me know as well.

Thanks in advance for any help.

Edit: I realized that if I perform the 3 operations again after I pinch to zoom, the Graphics will reappear.

Android 6.0.1

Esri 10.2.8-1

0 Kudos
5 Replies
steelissteelis
Deactivated User

Note for people having the same issues, Quartz does not have the same issue but upgrading from 10.2.8 is not a simple change in Gradle.

0 Kudos
steelissteelis
Deactivated User

I have checked that the same issue occurs in SDK version 10.2.5 which probably indicates that the issue occurred for quite a long time.

Since the issue is easy to replicate but there isn't any other with the same issue, may I know if there's any methods of reordering layer on the MapView that I should be using instead?

0 Kudos
AlexanderNohe1
Honored Contributor

Do any of your layers have a transparency applied to them?

0 Kudos
steelissteelis
Deactivated User

Hi,

Nope, no transparency (opacity) is required to replicate the problem at my side.

0 Kudos
AlexanderNohe1
Honored Contributor

Are you able to see this on multiple devices?  Is this occurring across multiple Android versions?

0 Kudos