[OpenLayers-Users] Extensions on OpenLayers code
Paul Spencer
pagameba at gmail.com
Wed Apr 2 14:50:57 EDT 2008
try OpenLayers.Map.prototype
Cheers
Paul
On 2-Apr-08, at 2:44 PM, Linda Rawson wrote:
> Is that the right syntax?
>
> On Wed, Apr 2, 2008 at 12:16 PM, Christopher Schmidt <crschmidt at metacarta.com
> > wrote:
> On Wed, Apr 02, 2008 at 10:57:31AM -0600, Linda Rawson wrote:
> > I have several custom enhancements I have made to the source
> code. With the
> > onset of a new release I would like to put these in a separate
> file and
> > "override" the code that is in the release. For instance I might
> want to
> > add the following function, just an example, it might already be
> in there to
> > Map.js
> >
> > getLayerByName: function(name) {
> > var foundLayer = null;
> > for (var i = 0; i < this.layers.length; i++) {
> > var layer = this.layers[i];
> > if (layer.name == name) {
> > foundLayer = layer;
> > }
> > }
> > return foundLayer;
> > },
> > Would I do something like the following in a .js file to be called
> after
> > Openlayers.js?
> >
> > Map.prototype.getLayerByName=function(name) {
> > var foundLayer = null;
> > for (var i = 0; i < this.layers.length; i++) {
> > var layer = this.layers[i];
> > if (layer.name == name) {
> > foundLayer = layer;
> > }
> > }
> > return foundLayer;
> > }
> >
>
> Yes, this is what I would do.
>
> Regards,
> --
> Christopher Schmidt
> MetaCarta
>
>
>
> --
> Linda Rawson _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
More information about the Users
mailing list