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: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to