[geojquery] First code for scoping-change approach

Eric Lemoine eric.lemoine at camptocamp.com
Sun Mar 21 07:16:19 EDT 2010


On Sunday, March 21, 2010, Eric Lemoine <eric.lemoine at camptocamp.com> wrote:
> On Saturday, March 20, 2010, Volker Mische <volker.mische at gmail.com> wrote:
>> Hi Marc,
>>
>> I like the "evererything is a plugin" a approach. I'll try to adapt in
>> my code. I really like the way ideas comes up. When we both keep adding
>> the things we like from each other's implementation we might even end up
>> with two implementations of the same public API :)
>
> Hi
>
> I just took a look at the code of jQuery UI. As you probably know
> jQuery UI is a collection of jQuery plugins. And the API of jQuery UI
> looks interesting to me.
>
> To create a widget:
> $("selector").theWidget(options);
>
> To call a method on the widget:
> $("selector").theWidget("methodName", options);
>
> For this to work the widget object is stored using $.data().
>
> For geojquery one could imagine a similar API.  For example to create
> a map and add layers to it one would do:
>
> $("#map").geo(mapOptions);
> $("#map").geo("addLayers",  [
>     new OpenLayers.Layer.WMS(...)
> ]);
>
> The above example assumes that the OpenLayers.Map instance is itself
> stored in the data object and that there's no intermediate object.
>
> Also, the more I think about it the more I think the geo() (or
> whatever it's called) function should return a jQuery object as
> opposed to a map instance. geojquery being about providing a
> jQuery'ish API I think this is important.
>
> Just thoughts. And my sincere apologies if this isn't relevant to the
> current discussions, and for just throwing ideas without writing
> actual code.

I happened to actually write some code, a jQuery UI-based widget that
creates maps.

See <http://gitorious.org/mapquery/mapquery/trees/master>

Cheers,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Geojquery mailing list