Well I don't need that much events. The dragging doesn't have to emit an event, just the final dragend (which already exists in the gmap2 project). So the runtime would be more like:

The end of dragging a marker should emit events (which it does)
The GCG should pick these up and reverse geocode the lat-long. (which I'm atm doing with the server-side-geocoder) The result should be shown in the browser (which I can do with the server-side-geocoder, and I guess with the client-side-geocoder the showing in the browser could be an update of a label in the method which is fired when the dragging is ended).

So the problem is how the GCG should notice the end of dragging and do the reverse geocoding.

The other point where I need the reverse geocoding is:

The clicking of the map should create a new marker
The marker's (click's) location should be reverse geocoded
the reverse geocoded location should be shown in the browser.

(Similar functionality as this thing has (I just want to create markers instead of infoboxes): http://gmaps-samples.googlecode.com/svn/trunk/geocoder/reverse.html )

I've been trying to add some new javascript to wicket-gmap.js to combine the event of clicking to the reverse geocoding (about like in that example), but without luck so far. I feel that I don't understand enough of the combination between wicket and javascript (and nor do i understand enough javascript).

br,

Jesse

On Thu, 18 Jun 2009, Martin Funk wrote:

Now that's getting quite JavaScript'isch,

out of the box, this might not be possible.

May I recap on this though, just to see if I got it right. A good starting point in this area to me allways seems to get aware of the runtime calling sequence and then think of the code that could set just that up.
So if I got it right it is happing all on the Browser side:

The dragging of a marker should emit events.
These should get picked up by GClientGeocoder.
The GCG should reverse geocode the lat lang of the marker.
The return value should be displayed in the Browser.
And eventually, maybe when the marker is droped
the server should be informed of the last result too.

For the first step I'd come up with a new implementation of GEventListenerBehavior
The public String getJSaddListener() would have to be overridden.
Instead of letting it render a call to addListener(...) it would have
to render a call to another yet to be implemented addXXXXX(...) method.
After that it get's dissy in my head :-(

mf
P.S.: But never mind, if you come up with soemthing, ask for write access to wicket-stuff, and commit it. Your implementation of reverseDecode might be a good enough candidate already.



Am 18.06.2009 um 11:30 schrieb Jesse Kivialho:

Hi,

I'm using wicket 1.3.5. and downloaded the wicket contrib gmap2 from the wicket-stuff 1.3.x branch (https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/branches/wicket-1.3.x/wicket-contrib-gmap2/)

I've noticed that the GClientGeocoder knows the reverse geocoding also. When I try the example Geocoder in contrib-gmap2-examples it gives me a name of the place if write to the address-field ie. 60,20.

Also, I managed to do the reverse geocoding with the server geocoder (wicket.contrib.gmap.util.Geocoder) by mostly copy-pasting an additional decoding method (since the original assumes the response to be type GlatLng):

public String reverseDecode(String response) throws GeocoderException {

        StringTokenizer gLatLng = new StringTokenizer(response, ",");

        String status = gLatLng.nextToken();
        gLatLng.nextToken(); // skip precision
        String address = "";
        while (gLatLng.hasMoreTokens()) {
                address += gLatLng.nextToken();
        }

        if (Integer.parseInt(status) != GeocoderException.G_GEO_SUCCESS) {
                throw new GeocoderException(Integer.parseInt(status));
        }
        return address;
}

With reverse geocoding I want to show the markers location in text, not in latitude-longitude-pairs. So, when the user adds a new marker by clicking on the map or moves an existing marker by dragging it, I want to show the city name the marker is in (instead of latlng). With that additional server geocoding method I'm able to do it. I'd like to be able to do it client-side, since my fear is that the dragging will cause quite many reverse geocoding requests.

So how could I give the GClientGeocoder a TextField-object which would have the user-clicked latitude-longitude-pair? Or alternatively, how should I modify the GClientGeocoder to be able to hook in to the click. I've also looked into the click listener, but the request has always already been made in the onEvent-method, so I don't know how to alter the request.

The gmap2 extension is working nicely and helps me a lot, thanks!

br,

Jesse Kivialho

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to