[OpenLayers-Users] Augmenting a method?

Erik Uzureau erik.uzureau at metacarta.com
Fri Jul 6 11:28:08 EDT 2007


right. im sorry... in my head the 'arguments' was supposed to be
pseudo code for "your list of arguments", rather than the actual
JavaScript keyword 'arguments'. Sorry about that

correct code is:

>     OpenLayers.Layer.GML.prototype.addFeatures.apply(this, [features]);

(like you said)... or

>     OpenLayers.Layer.GML.prototype.addFeatures.apply(this, arguments);

++E


On 7/6/07, Jeff Dege <jdege at korterra.com> wrote:
> Shouldn't that be?
>
>   addFeatures: function(features) {
>     /// your code
>     OpenLayers.Layer.GML.prototype.addFeatures.apply(this, [features]);
>     /// your code
>   },
>
>
> > -----Original Message-----
> > From: euzuro at gmail.com [mailto:euzuro at gmail.com] On Behalf Of
> > Erik Uzureau
> > Sent: Thursday, July 05, 2007 4:00 PM
> > To: Jeff Dege
> > Cc: users at openlayers.org
> > Subject: Re: [OpenLayers-Users] Augmenting a method?
> >
> > >     addFeatures: function(features) {
> > >              /// your code
> > >
> > OpenLayers.Layer.GML.prototype.addFeatures.apply(this, [arguments]);
> > >              /// your code
> > >         },
> >
> > -e
> >
> >
> >
> > On 7/5/07, Jeff Dege <jdege at korterra.com> wrote:
> > > In a derived class, how do I override a method, and then call the
> > > parent's implementation of that method?
> > >
> > > In C++:
> > >
> > >    class Foo()
> > >    {
> > >       virtual void snaffle() { cout << "Snaffle!" << endl; }
> > >    }
> > >
> > >    class Bar: public Foo
> > >    {
> > >       virtual void snaffle() { Foo::snaffle(); Foo::snaffle(); }
> > >    }
> > >
> > > In OpenLayers Javascript?
> > >
> > >
> > > OpenLayers.Layer.MyGML = OpenLayers.Class.create();
> > > OpenLayers.Layer.MyGML.prototype =
> > >   OpenLayers.Class.inherit( OpenLayers.Layer.GML, {
> > >      initialize: function(name, url, options) {
> > >         var newArguments = new Array()
> > >         newArguments.push(name, options);
> > >         OpenLayers.Layer.GML.prototype.initialize.apply(this,
> > > newArguments);
> > >         this.url = url;
> > >     },
> > >     addFeatures: function(features) {
> > >                 How???
> > >         },
> > >     /** @final @type String */
> > >     CLASS_NAME: "OpenLayers.Layer.MyGML"
> > >     });
> > > _______________________________________________
> > > Users mailing list
> > > Users at openlayers.org
> > > http://openlayers.org/mailman/listinfo/users
> > >
> >
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list