[OpenLayers-Users] Custome Layer Control
Christopher Schmidt
crschmidt at metacarta.com
Wed May 23 07:21:48 EDT 2007
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