Hello
I have two types of layers in my application:
SimpleMarkerOverlay and InMemoryFeatureLayer (with is an LayerOverlay)
I also have a "Dummy Layer" which represents the merge of all the entities in the SimpleMarkerOverlay and InMemoryFeatureLayer . (this is for UI purpose only)
I display a tree view of "Dummy layers" and I need to enable the user to change the Z order of the "dummy " layers
This means that each time i change the ZIndex of InMemoryFeatureLayer, i need to also change the zindex of its corresponding SimpleMarkerOverlay.
I have no problem to change the zIndex of SimpleMarkerOverlay. I simply chanage the location of the overlay inside the WpfMap.Overlayes collection
But if I do that for a SimpleMarkerOverlay it does not have any affect. It seams that SimpleMarkerOverlay is always on top.
I found the following example:but it only gives a solution regarding to change Zindex between several SimpleMarkerOverlay (and will not work if I have additional InMemoryFeatureLayer )
thinkgeo.com/forums/MapSuite/tabid/143/aft/10873/Default.aspx
I also found the following example:but I think it does not help in my case
thinkgeo.com/forums/MapSuite/tabid/143/aft/7212/Default.aspx
Can you please advise my on this issue?
Thank you
zIndex for mark and feature layer
Hi Miri,
The 2nd link is for web, that’s different for WPF so it isn’t helpful.
I think change zindex don’t works because some of our logic reorder the overlay.
Could you please try like this:
wpfMap1.OverlayDrawing += new System.EventHandler<OverlayDrawingWpfMapEventArgs>(wpfMap1_OverlayDrawing);
void wpfMap1_OverlayDrawing(object sender, OverlayDrawingWpfMapEventArgs e)
{
//Loop all overlays and reset z-index here
}
Please let me know whether that works for you.
Regards,
Don
Thank you for your answer, but I did not fully understood you
What do you mean buy "reset Z index " inside the event handler.
For my understanding the Z Index is been controlled by changing the position of the Overlay inside the WpfMap.Overlays collection
In my application I changed the position (when receiving a trigger of user operation in the UI) of SimpalMarkersOverlays in the WpfMap.Overlays , when I get to the event handler the position of the SimpalMarkersOverlays in the WpfMap.Overlays is good . So what do you mean by "reset the z Index). Can you explain what should I do in the event handler please?
what do you mean by saying that you change the overlays order internally? WpfMap.Overlays collection is in my control.
Thank you
Hi Miri,
By default adjust order in Overlays will works.
But it looks for WPF edition, the MarkerOverlay have higher priority and it will be keep shows on top, you cannot adjust this by modify the order in overlays collection.
So you can only reset zindex for each overlay manual like this:
System.Windows.Controls.Canvas.SetZIndex(yourOverlay.OverlayCanvas, newIndex);
Wish that’s helpful.
Regards,
Don
Hi Miri,
About your scenario, I have another suggestion.
If marker overlay is covered by other layer or overlay, the markers will be only a image, you cannot do any special operation for it.
So I think you can use InmemoryFeatureLayer instead of it if the marker overlay won’t be on top. If it be moved to top, just use MarkerOverlay again.
I think it should be a better solution.
Regards,
Don