Buggy Screen Overlay with Example

20 views
Skip to first unread message

kdd

unread,
Jul 17, 2008, 2:47:49 PM7/17/08
to KML Developer Support - Google Earth Browser Plugin
Hi,
So I finally have an example for you guys.

Original threads with my questions:
http://groups.google.com/group/google-earth-browser-plugin/browse_thread/thread/f5a2771349802921/3bb9c91b2db51450?lnk=st&q=#3bb9c91b2db51450
http://groups.google.com/group/google-earth-browser-plugin/browse_thread/thread/6082f6c11307c433/09ebd3007348f43f?lnk=raot#09ebd3007348f43f

Example:
http://iplacebook.com/temp/testG.php

Here, red overlay should be in the background, white overlay should be
in foreground, and yellow overlay should be in the middle of them. So,
red, yellow, white from bottom to top should be the order.

Key 1 of num-pad is to show/hide overlays.

Press key 1 on num-pad, and sometimes the red overlay gets on top of
the other two. This should not happen. Also, MORE importantly, there's
no definite way to "guess" or "put" screen-overlays on top of one
another. There's no way, after including 10s of overlays, I can
definitely say that the red overlay will "always" appear at the
bottom. The orderings are randomly determined that it may look fine,
but after including many more overlays, it'll mess up everything...

Hope you understand my problem.

Thanks for the help.

K.

Roman N

unread,
Jul 18, 2008, 12:29:47 PM7/18/08
to KML Developer Support - Google Earth Browser Plugin
K,

The API provides two methods, getDrawOrder() and setDrawOrder(), on
screen overlay objects. These methods are directly analogous to the
<drawOrder> KML element, which is described at
http://code.google.com/apis/kml/documentation/kmlreference.html#draworder.
<drawOrder> is similar in concept to z-index in CSS.

Some example usage:

// higher draw order overlay
var overlay1 = ge.createScreenOverlay('');
overlay1.setDrawOrder(20);
ge.getFeatures().appendChild(overlay1);

// lower draw order overlay
var overlay2 = ge.createScreenOverlay('');
overlay2.setDrawOrder(10);
ge.getFeatures().appendChild(overlay2);


overlay1 will be rendered above overlay2 regardless of the order in
which they were added to the Earth DOM (object model).

- Roman

On Jul 17, 11:47 am, kdd wrote:
> Hi,
> So I finally have an example for you guys.
>
> Original threads with my questions:http://groups.google.com/group/google-earth-browser-plugin/browse_thr...http://groups.google.com/group/google-earth-browser-plugin/browse_thr...

kdd

unread,
Jul 18, 2008, 1:19:24 PM7/18/08
to KML Developer Support - Google Earth Browser Plugin
Yay!

I had no idea about this, so this is just awesome! Thank you so much
Roman! :)
Reply all
Reply to author
Forward
0 new messages