Hi Eric,
Thanks for the reply. Yeah I couldn't find where the 'index"
parameter was documented in the Javascript API, so I wasn't sure if
the docs were stale, or that sample was experimental. Now I know..
For what it's worth, I was able to do what I needed to by looping
through all the verts. In case anyone else is looking to do this,
here's the code:
This is the 'onClick' handler for a polyline. The polyline is 'poly'
int vertCount = poly.getVertexCount();
if (vertCount ==2 ) {
// maps rejects vertex deletion when you'd end up with a point
// hack to fix:
poly.deleteVertex(1);
poly.deleteVertex(0);
poly.setEditingEnabled(false);
map.removeOverlay(poly);
return;
}
LatLng clickedLatLng = event.getLatLng();
for (int i = 0; i < vertCount; i++) {
if ( clickedLatLng.isEquals((poly.getVertex(i))) ){
poly.deleteVertex(i);
break;
}
}
-- I initally thought that the latlng compare would fail, as the level
of precision is so high, it seemed nearly impossible for anyone to
click the exact same place twice. Turns out though that when a vertex
is clicked, even if it's somewhere within the vertex 'box' it always
returns the latlng of the original vert clicked -- sweet.
P.S. While I'm thinking about maps... the sample code on the maps for
gwt website showing how to bring in the js script in the index.html
using a dummy key for localhost didn't work -- I had to generate a key
from the maps api site for "localhost:8888" in order to run in hosted
mode. Otherwise, it just popped a message box saying the key was
invalid.
On Oct 13, 2:31 pm, "Eric Ayers" <
zun...@google.com> wrote:
> Um, sorry about that - there is no gwt-maps list, I mean the Google
> Maps API group
>
>
http://groups.google.com/group/Google-Maps-API
>
> -Eric.
>
>
>
> On Mon, Oct 13, 2008 at 2:30 PM, Eric Ayers <
zun...@google.com> wrote:
> > Hi Brian,
>
> > Thanks for bringing this up. I checked at:
>
> >
http://code.google.com/apis/maps/documentation/reference.html#GPolygon
>
> > and I don't see the 'index' parameter documented for the polyline
> > 'click' event. At present, I'm not adding bindings for any
> > undocumented features (there are many of them!) I noticed that on FF3
> > on Linux, the polyline example in the site you sent me fails
> > miserably... maybe that's why it isn't documented yet?
>
> > Anyway, if you'd like to see this feature published, you might want to
> > lobby for it on the gwt-maps mailing list. Please read their
> > guidelines before posting.
>
> > Regards,
> > -Eric.
>