<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>Idea: New Layer Event: clicklayer</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Arial">I was thinking about the 'changelayer' event and how to use it in my environment, and I think I've come up with a cleaner solution for my specific application. However, I don't know how this aligns with the overall architecture/philosophy of the OpenLayers code, so I'd love to get some feedback on the idea to see if I'm doing something wrong/weird or if it merits integration into the code base.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">What I want is when I click on one overlay layer in the LayerSwitcher, then I want a corresponding layer that does not appear in the LayerSwitcher to change its visibility to the one I just clicked. When I click on a marker layer in the Layer Switcher, I want its corresponding line layer to appear or disappear along with the markers. As I emailed earlier this week, changelayer isn't working in this instance in the 2.4 baseline.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">I decided to create a new event called 'clicklayer' (probably not the best name for it) as an Event type in the Layer class. I then changed the LayerSwitcher to generate a clicklayer event during a call to the onInputClick() method. Finally, I registered an event handler for clicklayer with my marker layer whose callback sets the corresponding line layer's visibility to that of the associated marker layer (whether visible or not).</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Long story short: when I check and uncheck my marker layer in the LayerSwitcher, both my marker and line layers appear and disappear. This is exactly what I want. It also allows me to target the specific event better than trying to make sense of a could-be-triggered-anywhere changelayer event &#8230; the code &quot;feels&quot; right.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Question: Is adding a new event type &quot;okay&quot;? How tightly are event types controlled?</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">-eP</FONT>
</P>

</BODY>
</HTML>