[OpenLayers-Users] Overwriting OL classes
Christopher Schmidt
crschmidt at metacarta.com
Mon Apr 6 12:30:28 EDT 2009
On Mon, Apr 06, 2009 at 09:04:56AM -0700, Gregor at HostGIS wrote:
> > * Override methods:
> > * Pass in custom functions to options:
>
> You can pass in function definitions with configuration options? I
> didn't know that! I take it that's a feature of Prototype?
That's a feature of OpenLayers. "options" are -- on all classes where we
have them -- used to extend the existing object, using something like:
OpenLayers.Util.extend(this, options);
"Most OpenLayers object constructors take an options object as one of
their arguments. In general, you can set the value of any API property
in a contructorâs options argument." --
http://docs.openlayers.org/library/syntax.html#the-options-argument
However, that 'property' can also be 'method' -- it's just a question of
what we actually support. (If you override functions like this and
something breaks, my first suggestion will be to remove your overrides
and see if it's still broken.)
> And the override-by-assignment feature using the classes' .prototype
> attribute; very nice too. Thanks for the education in Prototype here too.
s/Prototype/Javascript/
-- Chris
> --
> HostGIS, Open Source solutions for the global GIS community
> Greg Allensworth - SysAdmin, Programmer, GIS Person, Security
> Network+ Server+ A+ Security+
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list