OpenLayers Wrapper - Layer visibility and ClickEvents

Hello everybody!

I’ve got an OpenLayersMap with several WMS Layers added setVisible(false).

OnClick they can be set to visible which works fine BUT if I try to set them invisible AGAIN nothing happens. I tried to repaint the layer, the map and even the splitpanel :wink: but nothing.

After adding the layers to the map I store them in a HashMap for easy access which could be part of the problem.


Update
Implemented a work-around: Instead of changing the visbility I add and remove WMS layers from the map.
Problem is after adding 3 layers to the map 1 click generates 3 ClickEvents.
Whereas if I add the 3 layers before adding the MapClickListener only 1 ClickEvent occurs.

Any help is appreciated!

Thanks in advance,
Stefan

Hi,

Have you checked if the project page has issue reports about these issues? If not, please add them. That’s probably the best contribution you can do if you don’t dare to try fixing the bug by yourself. Also if you have a small code snippet that reproduces these issues, attach that to the ticket.

cheers,
matti

Couldn’t find my specific issue so I added a new one.

Also gained some more insight…

Every change I make to the map after the ClickListener was added results in one more ClickEvent per click.
Does not matter if I add or remove a layer. The source of the ClickEvent seems to be the same component (the map).

That brings me back to my initial approach (adjusting the visbility).
Unfortunately it shows no effect at all if I set the visbility of a layer to false :-/

Thanks in advance,
Stefan

Hi,

I haven’t checked but it seems like the client side is just adding a new listener on each update. It should add it just once. I think this should be quite easy to fix. I can hint Özgün (the developer who added this specific feature) about the issue.

cheers,
matti

Thanks Matti,

… would help me big times if this got fixed.

Hi,

Özgün added a fix to this, although he didn’t manage to build a proper test case :
http://code.google.com/p/vopenlayers/source/diff?spec=svn153&r=153&format=side&path=/trunk/src/main/java/org/vaadin/vol/client/ui/VOpenLayersMap.java

Could you try to build a new version from trunk and test if the issue is still reproduced?

cheers,
matti

Hi!

Unfortunately the problem still persists… but I wrote a test case and added it to the issue.

I stumbled across some other issues and wondered if it’s better to start a new thread or add those in here?

Best regards,
Stefan

Little update on the issue

If I add/remove layers the ClickEvents DO STILL increase BUT after I hit “F5” in the browser there’s only one ClickEvent per click.

Ok, good. Test case will definitely help me or somebody else to catch to bug.

And definitely separate threads for separate issue.

cheers,
matti

I ran into the same problems. After adding and removing popups within a layer, I get 3 click events instead of 1. Cleaning the registered listeners after each change does not help me out neither. Are there any fixes or workarounds in the meantime?

Hi Matti,
I will try to reproduce this next days.

Kind regards,
Eiko