[geojquery] First code for scoping-change approach

Marc Jansen jansen at terrestris.de
Fri Mar 19 06:30:19 EDT 2010


Hi list, Hi Volker,

fine, your example really looks promising (I hope to have a deeper look 
soon)!

Yesterday I threw away everything I recently commited and rewrote "my" 
approach from scratch, so update your SVN checkout, please. (Volker, I 
don't see us two competing either).

The idea behind the rewrite was to have a plugin system, that could 
fullfill the different needs we already have in the user base [1]. Think 
of the simple-map-plugin vs. the Rich-User-Interface. Erics point ("you 
can not wrap all OL objects, methods, attributes") was also helpful: 
Through the plugin system we only need to implement major functionality, 
any new Layertype in OL can be mapped to geohjquery within minutes: That 
is the code for WMS-Layers:

...
    /**
     * registering Layertype WMS
     */
    $.jqmapRegisterLayerType('wms', function(opts) {
        var lyr = new OpenLayers.Layer.WMS(
            opts.title,
            opts.baseurl,
            {
                layers: opts.layers
            }
        );
        return lyr;
    });
...

(I didn't implement all options of a WMS-Layer, but that should be easy^tm)

All Layertypes are registered as plugins to geojquery base, as are all 
usual methods to work with them (in the future controls shall behave as 
layers currently do). The End-User API hasn't changed a bit, but the 
internal structure has. This would also enable us to divide our code 
into smaller files that are easier to manage (I already think of custom 
builds).

Examples:
http://www.geojquery.org/files/geojquery/examples/simple-map.html
http://www.geojquery.org/files/geojquery/examples/multiple-maps.html

The plugin with the declarations of the methods to extend the plugin itself:
http://www.geojquery.org/files/geojquery/geojquery.js

Again, everything ist still in changing, both implementation and 
possible API.

Have a look and share your ideas!

Regards,
Marc

[1] BTW I think the plugin approach was one reason of the big success of 
jQuery


Volker Mische wrote:
> Hi,
>
> here are the first bits for my currently preferred approach. It's still
> in flux and we'll see what will happen. I would have create a branch on
> SVN, but I wasn't sure if those files would have been accessible
> somewhere, so I've put it on my webspace. Please have a look at:
>
> http://vmx.cx/tmp/geojq/example1.html
>
> The important bits for the library (and the layer loading) are in:
> http://vmx.cx/tmp/geojq/geojq.js
>
> The basic layer control (to play with the API a bit) is at:
> http://vmx.cx/tmp/geojq/layercontrol.js
>
> The benefits I see in this approach is that you can manipulate the
> layers without caring about the map object at all, as they have there
> own scope.
>
> Please don't count that as a Volker vs. Marc. We both have the same
> goals. We are still in the brainstorming phase (at least I am) and I
> think it's helpful to have a lot of code to play with.
>
> Cheers,
>   Volker
>
> _______________________________________________
> Geojquery mailing list
> Geojquery at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geojquery
>
>   


-- 


  Dipl.-Geogr. Marc Jansen
  - Anwendungsentwickler -

  terrestris GmbH & Co. KG
  Irmintrudisstraße 17
  53111 Bonn

  Tel:    ++49 (0)228 / 96 28 99 -53
  Fax:    ++49 (0)228 / 96 28 99 -57

  Email:  jansen at terrestris.de
  Web:    http://www.terrestris.de

  Amtsgericht Bonn, HRA 6835
  Komplementärin:  terrestris Verwaltungsgesellschaft mbH
  vertreten durch: Hinrich Paulsen, Till Adams  




More information about the Geojquery mailing list