Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring the API #2

Open
Drachenkaetzchen opened this issue Jan 14, 2011 · 5 comments
Open

Refactoring the API #2

Drachenkaetzchen opened this issue Jan 14, 2011 · 5 comments

Comments

@Drachenkaetzchen
Copy link

Hi,

I'm working with GMapPanel3 for a few days now, and there are a few issues that came into my attention. The API seems to be tied to a specific behavior, e.g. if you call geoCodeLookup(), it always centers the map to the found address, with no or limited possibilities to do custom stuff. IMHO geoCodeLookup should simply lookup the given address, and calling a callback afterwards, instead of trying to center the map all the time, which is probably not what the developer needs.

I might refactor the API on my fork, but if you have suggestions or things that you want to have changed, we could work together on that.

cheers,
Timo

@abraxxa
Copy link

abraxxa commented Jan 14, 2011

I have a custom GMapPanel3 version in use since about a year which adds the feature to remember all markers and center + zoom the map so all of them are visible.
I had'nt enough time to fork the current version so it gets merged into the main version but I'd contribute my code if you like to look into it.

@VinylFox
Copy link
Owner

tim, the geoCodeLookup accepts a center argument that is a bool that decides to center the map or not:

geoCodeLookup : function(addr, marker, clear, center, listeners)

If this is not working, then that would be a bug.

I'm certainly open to pulling in changes that you have, as long as they are generic changes that can be used by all. In other words, nothing that is specific to your usage.

@Drachenkaetzchen
Copy link
Author

Well, IMHO most functions do too much.

For example, I expect that geoCodeLookup only triggers an address lookup via the geocoder, then doing a callback to the function which decides what to do then. Instead, geoCodeLookup has "hardwired" actions (center, marker, clear etc) which makes it difficult to add custom callbacks.

Also, quite some methods have a huge parameter list (where huge is 4 or more parameters) which makes it difficult to handle.

I will try to refactor the API to make it simpler to use, but I don't think I can keep API compatibility, at least not for GMapPanel3 (which I'm using).

@Drachenkaetzchen
Copy link
Author

I just pushed my first additions to my fork. I try to maintain API compatibility.

New methods:
setMapCenter - centers the map on the given google.maps.LatLng coordinate
getGeocoder - returns an instance of the geocoder
lookupAddress - looks up the coordinates for a given address and calls back an user-supplied function

@Mazzo
Copy link

Mazzo commented Sep 27, 2011

I agree with timoahummel.
geoCodeLookup() should have a callback where to handle the LatLng data.

I had to modify the method behaviour to accept a zoom value to use after centering.
Obviuosly this is going to break on next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants