GWT - Earth Need fetchKml()

2 views
Skip to first unread message

littlejodo

unread,
Nov 4, 2009, 10:27:21 AM11/4/09
to Google Web Toolkit
I am using the gwt-earth classes to load a google earth instance /
plugin into a GWT project. I noticed that the classes have a parseKml
method, but what I really would like is to use the fetchKml method
that is in the earth javascript api. I have tried creating a
javascript native method to do this. I do not get any errors, yet the
kml is not being shown and I am not sure if it is even being loaded.
Has anyone out there done this? Any advice?

This is the method I am using. It is inside the GoogleEarthWidget
class:

private native void jsFetchKml (String s, GEPlugin plugin) /*-{
var ge;
var instance = this;
function initCB(obj) {
ge = obj;

function finished(object) {
if (!object) {
// wrap alerts in API callbacks and event handlers
// in a setTimeout to prevent deadlock in some browsers
setTimeout(function() {
alert('Bad or null KML.');
}, 0);
plugin.getFeatures().appendChild(object);
return;
}

}

// fetch the KML
var url = s;
google.earth.fetchKml(plugin, url, finished);


}-*/;

littlejodo

unread,
Nov 11, 2009, 7:01:50 AM11/11/09
to Google Web Toolkit
Nevermind, I realized that I can access the javascript function
(written in html page) through jsni.
Reply all
Reply to author
Forward
0 new messages