Exploring Leaflet Base Classes

In my previous Leftlet post, I gave an example that showed that shapes and click events were preserved across the Cloudmade and OSM map tiles, but not for Google. Before I go off and try writing my own Leaflet plugin for Google I must first learn the Leaflet API. For me, that starts with class diagrams since I am a visual learner.

L is the namespace for all Leaflet classes, not to be confused with the character “L” from Death Note.

l

L (エル, Eru)

L is shown in the class diagram with only a few of its many functions. The functions shown are all assigned from L.Util.

Leaflet Base Classes

Leaflet Base Classes

L.Util contains core utility functions used throughout Leaflet. The code snippet below shows L.Util function assignments to L. Instead of calling L.Util.extend(), for instance, you can call L.extend().

Lextend

L.extend is, in turn, used in functions of L.Class.

classExtend

L.Class is the base class used for object oriented design in Leaflet. In my next post, we’ll start looking at Leaflet’s object classes, all of which extend from L.Class.

Finally, the Leaflet event model is based on L.Mixin. L.Mixin is included in L.Draggable, L.FeatureGroup, L.ImageOverlay, L.Map, L.Marker, L.Path,  L.Popup,  L.PosAnnimation, and L.TileLayer, all of which I’ll explore my the next few posts.

Advertisements

One thought on “Exploring Leaflet Base Classes

  1. Pingback: Exploring Leaflet Geographic Classes | Exploring Spatial

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s