[OpenLayers-Users] Custome Layer Control

bradleyspencer brad at cubewerx.com.au
Wed May 23 18:14:12 EDT 2007


Ok I appreciate you at least responding to my question. I am not a trained
OO programmer (just a hacker really) but I will try to muddle through this.

Brad Spencer

-----Original Message-----
From: Christopher Schmidt [mailto:crschmidt at metacarta.com]
Sent: Wednesday, 23 May 2007 9:22 PM
To: bradleyspencer
Cc: openlayers users
Subject: Re: [OpenLayers-Users] Custome Layer Control

On Wed, May 23, 2007 at 06:56:31PM +1000, bradleyspencer wrote:
> Maybe someone has done this? Certainly it has been done inside the
> layerSwitcher control. I do not want to delve into the source code myself
> unless I have to.

As a developer, "I'd like to write my own code without having to
read/understand the existing code" is a frustrating position to have
someone take. We've spent a lot of time making the code easy to
read/understand: for example, in the case of the LayerSwitcher, there's
a 7 line function whose comment is:

"""
 Cycles through the loaded data and base layer input arrays and makes
 the necessary calls to the Map object such that that the map's
 visual state corresponds to what the user has selected in the
 control
"""

Reading this function would lead you to the setVisibility function,
which is well documented:

http://dev.openlayers.org/docs/OpenLayers/Layer.html#setVisibility

I understand that not everything is that simple, but looking at the code
in this case would probably have been easier than sending the email.
Keep this in mind as you develop, and don't be afraid to explore the
existing code: We've designed it so that it is explorable, and it's a
much better resource for how to do things than the mailing list will
typically be.

Regards,
--
Christopher Schmidt
MetaCarta




More information about the Users mailing list