Skip to content

OverlayRemoveListener #201

@ghost

Description

Hi, I am using the onOverlayRemove method to register a listener. Now I noticed that when the map loads and the layer was preselected to be active = true, then this method is called even though the layer is NOT being removed. Is this a bug?

I have got a PolygonMap where I override the on OverlayRemove method.

@OverRide
public void onOverlayRemove(LeafletOverlayRemoveEvent event)
{
for (Layer layer : layers.getOverlays())
{
if (layer.getCaption().equals(event.getName()))
{
layer.setActiveIndicator(false);
}
}
}

And I got Layers like this one, where I keep track wether the layer is active or not.
import org.vaadin.addon.leaflet.LWmsLayer;

public class LMTBLayer extends LWmsLayer implements Layer
{
private String name;
private boolean active;

LMTBLayer(String geoserverURL)
{
setUrl(geoserverURL);
setLayers("werbeo:mtb");
setTransparent(true);
setFormat("image/png");
setActive(true);
setEnabled(true);
name = "MTB";
setCaption("Messtischblatt");
}

@OverRide
public boolean isActive()
{
return active;
}

@OverRide
public void setActive(boolean active)
{
setActiveIndicator(active);
super.setActive(active);
}

@OverRide
public void setActiveIndicator(boolean active)
{
this.active = active;
}

@OverRide
public boolean isActiveIndicator()
{
return active;
}

@OverRide
public String getName()
{
return name;
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions