Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OverlayRemoveListener #201

Open
copepod opened this issue Feb 8, 2019 · 0 comments
Open

OverlayRemoveListener #201

copepod opened this issue Feb 8, 2019 · 0 comments

Comments

@copepod
Copy link

copepod commented Feb 8, 2019

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;
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant