Sunday, April 20, 2008

Geosignal French maps in WWJ

Toulouse based Geosignal has made freely available for more than a year a number of interesting layers on their WMS server. Here is a layer class for WorldWind Java that will bring together eight levels of details from the RASTER maps serie.

Geosignal French maps in WorldWind Java
Download GeosignalRasterWMSLayer.java, remove the .txt extension and add to the SDK layers.Earth package.

Geosignal French maps in WorldWind Java
The layer covers continental France and Corsica. The finest levels include street maps for most urban areas.


Geosignal French maps in WorldWind Java

Friday, April 11, 2008

Ray Casting and Line of Sight for WWJ

It is a common issue to be able to find out where in the world does a line intersect the terrain surface. The WorldWind Java SDK allows to resolve the intersection from the eye point of view using the pick process - based on drawing objects in unique colors, but that does not help much when you need to compute such intersections from another perspective, like for line of sight calculations.

Ray casting and line of sight calculations in WorldWind JavaLine of sight calculation from the top of Mount Jackson (3064m),
Glacier National Parc, Montana, USA.

Here is a helper class to answer such questions, along with an example application that will display areas from where you can see a central point.

Download RayCastingSupport.java and LineOfSight.java - remove the .txt extensions, save the first one in 'util' and the application in 'examples'. You may also need the crosshair layer.

Update april 18: there appears to be two dependencies on the not yet published SDK version: centerPosition calculation and PatternFactory.blur() - see this post comments. You can simply comment out the blur, or replace it with a ConvolveOp, and change the center position line with:
Position centerPosition =
     RayCastingSupport.intersectRayWithTerrain(globe,
           view.getEyePoint(), view.getForwardVector(), 30, 3);


Ray castingRay casting - figure 1

The ray casting code samples points at regular intervals along the 'ray' until it finds one which elevation is below ground - figure 1.1. It then recursively resamples the last segment every tenth of the previous sample length - fig 1.2, until that sampling step is smaller then or equal to the required precision.

The longer the initial sample length, the quicker an intersection will be found - 1, and the sub sampling process will start narrowing onto the terrain - 2. However, the larger the value the less accuracy you will get since the ray will be able to go through some surface features in just one step and completely miss them. The default values for sampling length and precision are 100 meters and 10 meters and can be overrided in the methods arguments.

Note that the example application also shows how to 'paint' both on the terrain and on the screen using BufferedImage, Java 2D, SurfaceImage and ScreenAnnotation classes.

Thursday, April 3, 2008

WorldWind Java Splash Screen

Nothing fancy, fast or optimized, just a frame with the NASA WorldWind splash bitmap that has been in the SDK since day one.


Download SplashScreen.java, remove the .txt extension and add to the SDK examples package.

To use it, create a no argument new instance of SplashScreen at the beginning of your application main() and dispose of it just after the main frame has been set visible.

Disclaimer: note that a 'good' splash screen that displays fast without slowing your application startup is somewhat a 'hacky' business for which you can find various kinds of tricks. This example doesn't implement any of them, and will likely make your program slower to start.