Closed GoogleCodeExporter closed 8 years ago
Hi,
The click returns a Placemark because...the object *is* a Placemark! When you
create a line-string to display in the plug-in it is attached to a place-mark
object. e.g.
var pm = ge.createPlacemark('');
var lineString = ge.createLineString('');
pm.setGeometry(lineString);
As you can see the line-string is set to the geometry property of the
place-mark.
So, what you need to do is to detect the type of geometry within the placemark.
Something like the following should work (...although I just typed it here so
there maybe typos).
void geWebBrowser1_KmlEvent(object sender, GEEventArgs e)
{
e.ApiObject.preventDefault();
dynamic kmlObject = e.ApiObject.getTarget();
string type = kmlObject.getType();
if (type == ApiType.KmlPlacemark)
{
dynamic geometry = kmlObject.getGeometry();
switch(geometry)
{
case ApiType.KmlLineString :
// Handle KmlLineStrings here...
break;
case ApiType.KmlPoint :
break;
case ApiType.KmlPolygon :
break;
default:
break;
}
}
}
Failing that using IDs as you suggested is a good approach, indeed that is what
generally do when I am using events in the api.
Hope that helps.
Fraser.
Original comment by fraser.c...@gmail.com
on 1 Jun 2011 at 12:49
Thanks for clarifying that for me! Great!
-------------
To the interest of others the following needed adjusted from
dynamic geometry = kmlObject.getGeometry(); to
string geometry = kmlObject.getGeometry().getType();
Original comment by tho...@gmail.com
on 4 Jun 2011 at 9:04
Hey,
No worries - sorry for the typo, looks like you got it working though - good
stuff.
F.
Original comment by fraser.c...@gmail.com
on 4 Jun 2011 at 9:22
Original issue reported on code.google.com by
tho...@gmail.com
on 31 May 2011 at 10:59