planOfile

Plan your trips and collaborate with others. 3D day/night Earth, animated cloud and timezone information.


System Upgrade
planOfile is undergoing a complete system upgrade. You can still view trips and use the flight planner. You won't be able to save new data to the server until the upgrade is complete.

Home
Stats
Earth
iGoogle Gadget
Earth Applet
Earth Applet Detailed
Trip Collaboration
Social Collaboration
Flight Planning / Navigation
GPS
Awards
About

Design Print E-mail
Article Index
Design
Multiple Servers (Scalability)
Google Maps Interface (JavaScript)
JDO, H2, Swing and Background Processing

Google Maps Interface (JavaScript)

Google Maps uses JavaScript and planOfile uses Java. Java and JavaScript can communicate, but different browser/platform combinations give varying success, depending on the approach used. The following paragraphs describe what was found to work.

JavaScript can call a Java applet function without problem as long as it passes primitive types or strings as parameters. Sharing objects between Java and JavaScript doesn't seem to work on all platforms; which turns out not to be required in practice anyway.

Mouse clicks on the Google Map are mostly handled by the Java applet. The JavaScript event handler calls a Java applet function which handles the event. The Java applet function generally returns a string containing the JavaScript commands that are eval'd by the JavaScript after calling the applet function. This is a quite effective way of binding JavaScript events to Java applet functionality.

The web page also run a periodic (half second) poll of the Java applet to obtain the latest positions and other information to be displayed on the Google Map. There are a lot of calculations required to obtain these positions and doing this in Java seems to work quickly and without the memory management issues that you find when using JavaScript. The result of the polled Java applet function is a string which contains JavaScript function calls to be eval'd to update the Google Map to update marker and other positions on the map.

It is possible to use JSObject to eval() JavaScript commands directly from the Java applet. But for the moment, all interaction with Google Maps does not require this and can be handled in response to Google Map and periodic events.