[MapQuery] Merge requests #9-12
Volker Mische
volker.mische at gmail.com
Mon Jan 17 12:46:50 EST 2011
Hi all,
Drew Wells did some hard work on the code. The changes were so many,
that I went through all the code and checked what I think make sense. At
the end of the mail I'll append a log of the changes and comments why I
merged/didn't merge them.
The code was not merged with current master, but with a recent working
copy of my repository. The result is a huge change, that will break any
code that is currently using MapQuery (mostly because of finally moving
everything into a proper MapQuery namespace).
I merged the code, when I was working on the popup/featureinfo widget. I
know it is not a good practice to have one big blurb of changes and new
features which aren't clearly separated, I'm sorry for that.
Here are some highlights you get from the merge:
- proper naming within the project (no "geoMap" any more)
- a popup/featureinfo widget
- a WMTS layer type
- a WMTS demo that works offline (and can be used for other demos as well)
- better default options handling
- simply better code
What is missing?
- the popup and the featureinfo should be an example for inheritance.
I haven't had time to work on it, yet (at the moment it's much
duplicated code)
- feedback!
The whole code lives in the featureinfo branch in my repo:
http://gitorious.org/~vmx/mapquery/vmx-mapquery/trees/featureinfo
I've also created a merge request with the same text at:
http://gitorious.org/mapquery/mapquery/merge_requests/13
As those changes are so many and fundamental, I'd like you *all* to give
feedback, or at least a simple +1 or -1 status, so that I know if it can
be merged.
Cheers,
Volker
Comments
========
Comments to changes in merge request #12
----------------------------------------
### jquery.mapquery.core.js
#### Changes from Drew Wells
[yes] Renaming main entry point from $.fn.geoMap to $.fn.mapQuery
[yes] Renaming main data object from geoMap to mapQuery
[yes] Using $.fn.mapQuery.defaults for default options
[no] Changing `layersList` from an object to an array?
Now you need to iterate over all layers in the `getLayer()` and
`removeLayer()` function.
[half] Having a new API for the `layer()` function
In your implementation you add the possibility to add several layers
when passing in an array. So we have:
- getter:
To get a layer, just pass in the ID as string
- setter:
- single layer:
To add a single layer, pass in an object
- multiple layers:
To add multiple layer at once, pass in an array
of (single layer) objects
I like to keep that a getter setter for only one layer. The reason is
that I like a function to return always the same, in this case a
single layer. When you pass in several layers, which one should be
returned? Or perhaps an array? I think this leads to confusion.
The basic idea is that MapQuery is chainable, just as jQuery is. The
difference is that there are multiple chains. One for the map and one
for the layers. If an array is returned, that chain would be
broken. An alternative might be to do it like jQuery and wrap the
result in an array (this needs discussion :)
Though the API changed to a single parameter call. Passing in a string
returns a layer, passing in an object adds a new layer.
[yes] New `center` function in `Map` object. XXX where's the test?
[yes] Extending the Layer object with a property called "types".
[yes] New ecwp layer. XXX where's the test?
[No] Default layer type is WMS.
Explicit is better than implicit. Always specify a layer type.
#### My changes
New layers: WMTS, JSON
Event handling (used by JSON layer)
More comprehensive option handling for layers
### jquery.mapquery.layercontrol.js
#### Changes from Drew Wells
[no] Strip out the possibility to pass in either a jQuery object that
contains a mapQuery object, or an object with options.
Should be kept as is. This behavior is based on discussions at the
FOSS4G 2010.
[no] Display layer label or its ID.
This is now handled in the core. If no label is set, the ID is used
[yes] Refactor an add function out
[yes] Using jQuery-templ
[no] addLayer event
I got the idea, but not really the comment above the
implementation. Therefore I leave it out at the moment (needs further
discussions).
#### My changes
Moved from geo. namespace to mapquery. namespace
More information about the MapQuery
mailing list