mohitsgw / earth-api-samples

Automatically exported from code.google.com/p/earth-api-samples
0 stars 0 forks source link

KmlGroundOverlay doesn't implement GEEventEmitter #960

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This is possibly related to this bug:
https://code.google.com/p/earth-api-samples/issues/detail?id=595

And this enhancement:
https://code.google.com/p/earth-api-samples/issues/detail?id=525

What steps will reproduce the problem?
1. Create a KmlGroundOvelay
2. Attach a mouse event handler to it 
3. Handle the KmlMouseEvent

What is the expected output or behavior? What do you see instead?

The KmlGroundOverlay is a KmlObject so it should inherit from the 
GEEventEmitter.
It should have the standard KmlMouseEvents; mousedown, mouseup, mousemove, etc.

You can see this in the documentation. 
https://developers.google.com/earth/documentation/reference/interface_kml_ground
_overlay-members

I would expect the event to be raised as normal as for any other KmlObject.
However no events seem to be implemented.

I believe this same issue to be true of a number of objects, for example the 
KmlScreenOverlay.

It is hard to know if it just the documentation that is wrong and these objects 
are not meant to support KmlMouseEvents, or else if it is a bug. 

Which plugin version are you using?
Plugin: 7.1.1.1888
Api: 1.010

Please provide any additional information (code snippets/links) below.

 // this shows the problem for KmlGroundOverlays
 var groundOverlay = ge.createGroundOverlay('');
 var icon = ge.createIcon('');
 icon.setHref("http://www.google.com/logos/earthday08.gif");
 groundOverlay.setIcon(icon);
 var latLonBox = ge.createLatLonBox('');
 latLonBox.setBox(48.80, 48.75, -121.77, -121.85, 0);
 groundOverlay.setLatLonBox(latLonBox);
 ge.getFeatures().appendChild(groundOverlay);

 google.earth.addEventListener(groundOverlay, 'click', function (e) {
     console.log("hello"); // never called
 });

As a workaround one idea is to place a polygon under the overlay and then use 
that as the event target. 

I made a working example of the custom overlay idea here.

http://jsfiddle.net/fraser/2bUXQ/

Original issue reported on code.google.com by fraser.c...@gmail.com on 29 Jul 2013 at 2:18

GoogleCodeExporter commented 8 years ago
Also could be covered by this:
https://code.google.com/p/earth-api-samples/issues/detail?id=123

Original comment by fraser.c...@gmail.com on 29 Jul 2013 at 2:36

GoogleCodeExporter commented 8 years ago
It'd be great if grounded overlays would generate mouse events. In the case of 
overlapping overlays, perhaps events would fire only for the top-most overlay.

The work-around of 'ghosting' each overlay with a nearly-transparent polygon 
doesn't work for me as I need to control/manipulate overlay drawing order, 
which is supported for grounded overlays (yay!) but not for polygons (some of 
my overlays can overlap).

My application is geoscience.  I want to bring possibly-partially-overlapping 
overlays to the top as the mouse moves over them.

My thanks to Fraser for doing the work to define the bug/short-coming.

Original comment by elder....@gmail.com on 29 Jul 2013 at 6:17