Hi Phil,
Thanks for the reply. No i do understand javascript. What I did not
understand in http://dpaste.de/t214A/
was the 'arguments' variable which was passed in the prototype,
OpenLayers.Control.prototype.initialize.apply(
this, arguments
);
Also, what does 'options && options.handlerOptions || {}' mean in,
this.handlerOptions = OpenLayers.Util.extend(
options && options.handlerOptions || {},
this.defaultHandlerOptions
);
And finally what is the significance of including this,
CLASS_NAME: "OpenLayers.Control.Click"
Thanks,
Smaran
On Sun, Aug 5, 2012 at 3:12 PM, Phil Scadden <[email protected]> wrote:
>
> i am trying to understand the initialize code in the
> link<http://dpaste.de/t214A/>
> .
>
> It is encapsulated in the OpenLayers.Click command,
>
> OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
> link<http://dpaste.de/t214A/>
> });
>
> I am not able to understand what exactly the initialization code is
> doing and what 'this' implies?
>
>
> First, you dont need to understand this to use it. You would work with
> this in openlayers by manipulating openlayer.control properties. This is
> code for creating a new descendent of an openlayers control. The kind that
> live in openlayers/lib/control.
>
> If you havent worked with OO languages, this probably isnt the best place
> to start.
>
> Anyway, the basics of it are to create a new descend of the
> openlayer.control class. when your code does a myvar = new
> Openlayers.control.click, then the initialise code is called. "this" is the
> way you refer to owner of the function - the specific instance of the
> class. What the code does is:
> - combines the various options into the handleroptions property.
> - call the prototype (Openlayers.control) initialize method
> - set the handler property of the handler to be a new instance of the
> openlayers click handler control, using the handleroption property.
>
> A javascript language reference text would be a good place to go. The
> openlayers list isnt really a place to learn javascript.
>
> Notice: This email and any attachments are confidential. If received in
> error please destroy and immediately notify us. Do not copy or disclose the
> contents.
>
>
>
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
--
Thanks & Regards
Smaran Harihar
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users