+ All Categories
Home > Education > World wind java sdk in progess

World wind java sdk in progess

Date post: 06-Jan-2017
Category:
Upload: oregon-state-university
View: 48 times
Download: 3 times
Share this document with a friend
56
World Wind Java SDK
Transcript
Page 1: World wind java sdk in progess

World Wind Java SDK

Page 2: World wind java sdk in progess

World Wind is an open source 3D interactive world viewer created by NASA's Learning Technologies project, and released in mid-2004.

It is now developed by NASA staff and open source community developers.World Wind is open source software that lets you zoom from satellite altitude into any place on Earth.

Leveraging Landsat satellite imagery and Shuttle Radar Topography Mission data, World Wind lets you experience Earth terrain in visually rich 3D, just as if you were really there.

More…

World Wind is a Component is not an application• A plug-in providing an Earth context for applications• Does the hard stuff

Terrain generation from real and remote dataImage display and selectionRapid management of data retrieval from distributed sourcesViewing and picking

What is World Wind Java?

Page 3: World wind java sdk in progess

World Wind Java uses JOGL as Render Engine JOGL (aka Java ™ OpenGL) is the official :“Java™ Binding for the OpenGL® API (JSR-231), and is designed to

providehardware-supported 3D graphics to applications written in Java.

JOGL provides full access to the APIs in the OpenGL 2.0 specification as well as nearly all vendor extensions, and integrates with the AWT and Swing widget sets.

It is part of a suite of open-source technologiesinitiated by the Game Technology Group at Sun Microsystems.“

What is World Wind Java?

Page 4: World wind java sdk in progess

Where I can find WWJ?

Search on Google: “World Wind Java”

World Wind Project Homepage:

- Code: worldwind.arc.nasa.gov/java- Forums forum.worldwindcentral.com- Bug tracker: issues.worldwind.arc.nasa.gov

Visit the NASA World Wind Java Demo Pageworldwind.arc.nasa.gov/java/demos/

Page 5: World wind java sdk in progess

You need a IDE (e.g. Eclipse http://www.eclipse.org/)

Dowload the source code from NASA WWJ Portal

The release comes with 6.25 MB of Blue Marble Next Generation data, which makes a nice globe appear the first time you run an app.

The source includes javadoc Java 0.2 SDK API, a README, Design and Coding Guidelines, and the appropriate libraries (JOGL) to run WWJ.

Extract the sources in your Workspacec:\software\dev\worldwind.release

Import the project in your IDE- Start Eclipse - to File -> New -> Project. Choose a Java Project.

How to compile and run WWJ?

Page 6: World wind java sdk in progess

In the new project wizard, make sure to select "Create project from existing source" and point to the unzipped directory. Then press "Finish."

Setup the Environment Variables or use the Ant file

NOTE:Remember to configure IDE network settingLike: -Dhttp.proxyHost=proxy.unitn.it

-Dhttp.proxyPort=3128 -Dhttp.nonProxyHosts=serv-etto -Xms512M (Initial Java Heap Size) -Xmx1024M (Maximum Java Heap Size)

You are ready to use World Wind Java…but….Where is the main?!?!

How to compile and run WWJ?

Page 7: World wind java sdk in progess

Where is the main?

Page 9: World wind java sdk in progess

Application

Configuration (Global)

Scene Controller

View Frame Controller Canvas

Window Environment (Swing, SWT, etc.)

Globe

Tessellator

Layer Model

WorldWindow

Cache

Web

Notifier (Global)

How works World Wind Java?

Fine….but…

Page 10: World wind java sdk in progess

World Wind Map Tile System

World Wind uses map imagery/dem data in the Plate Carree projection (also know as geographics projection). It allows World Wind to take a rectangular image (2x1 ratio) and map it to a sphere

For performance reasons, World Wind store multiple copies of the same map in successively higher resolutions. Each additional layer quadriples the number of tiles (and size)

How World Wind works?

Page 11: World wind java sdk in progess

Each tile is (e.g.) a 512 x 512 pixel square that can be stored in any image format such as PNG, JPG, DDS, etc.

Positioning on the globe is stored in the file and folders names.

The coordinate system for World Wind starts at the lower left corner

Remember: 180 degree of latitude and 360 degree of longitude

How World Wind works?

Page 12: World wind java sdk in progess

If, for example, the layer divides the world into 36x36 degree pices starting at Level 0

Level 0: 36 degrees 50 tilesLevel 1: 18 degrees 200 tilesLevel 2: 9 degrees800 tilesLevel 3: 4.5 degrees 3200 tilesLevel n: Level (n – 1) / 2 Level (n – 1) * 2World Wind store all tiles in folders based on detail level. Coordinate information is stored in the file name of the tile

How World Wind works?

Page 13: World wind java sdk in progess

How World Wind works?

Page 14: World wind java sdk in progess

• If you want to work with the cached files in worl wind you can find all the necessary class in the gov.nasa.worldwind.cache

Create a new file:File f = WorldWind.getDataFileCache().newFile(fileName);//write file

Retrieve a file from the cache:File f = WorldWind.getDataFileCache().

findFile(fileName, checkClassPath);

Work with cache in WWJ

Page 15: World wind java sdk in progess

World Wind try to use the following directories in this specific order:

1. All User Cache Dir : ▫ Mac : "/Library/Caches“▫ Windows: System.getenv("ALLUSERSPROFILE") + "\\

Application Data";▫ Linux Unix Solaris: "/var/cache/";

2. System.getProperty("user.dir");3. System.getProperty("user.home");4. System.getProperty("java.io.tmpdir");

In order to change the order, add or remove something edit: DataFileCache.xml

Work with cache in WWJ

Page 16: World wind java sdk in progess

The basic application works well, but if we want to use it in commercial projects how can we customize it?

How:▫ Display our data?▫ Low level spending time to customize application?▫ Better way to access information (Tree TOC)?▫ Make the tranfert of information faster?▫ Change the Interface?

How to customize WWJ?

Page 17: World wind java sdk in progess

Application

Configuration (Global)

Scene Controller

View Frame Controller Canvas

Window Environment (Swing, SWT, etc.)

Globe

Tessellator

Layer Model

WorldWindow

Cache

Web

Notifier (Global)

GT ConfigurationGT

Configuration

Web

CacheCache

How to customize WWJ?

Page 18: World wind java sdk in progess

GT Configuration File

We create a Remote-Clustering Configuration Standard that provides

Not only information about the Data Provider Service (WMS, WFS (placename only), Tiling, Icons…)

Style and behavior of the single Layer

Information about TOC Structure and the relationship between leafs and nodes

Launch WWJ

Read Remote Configuration

Add “Remote” Layer to basic

Layer

Update TOC

WWJ Ready to Work!

How to customize WWJ?

Page 19: World wind java sdk in progess

How to customize WWJ?

GT as Data Provider

But What is a Layer?

Page 20: World wind java sdk in progess

We have mainly three different data type that can be display in World Wind Java

• DEM (Digital Elevation Model)

• Image (Ortophoto)

• Vectorial Data (shapefile)

How to customize WWJ?

Page 21: World wind java sdk in progess

• First a formal error: is not correct “refer” to DEM as a data type…it is a data format but we can use it!

• We usually work with DTM data that is a digital elevation model that refers to a representation of the Earth's surface (or subset of this), excluding features such as vegetation, buildings, bridges, etc. A digital surface model (DSM) on the other hand includes buildings, vegetation, and roads, as well as natural terrain features.

• Usually in GIS world we work on DTM data in ASCII WKT format

• World Wind doesn’t use DTM directly but use BIL

• We use commercial program (Global Mapper) to transform it to BIL tiled file or use our programs to do something else (merge different ASCII files, export in the correct BIL format pyramids files).

• We need to tranfert these files to world wind client -> we use a web GeoService

How to work with DEM Data?

Page 22: World wind java sdk in progess

Difference

ASCII BIL2D grid 2D gridWKT binary (16float)Parameters at the beginning of the file NO parametersPosition, step, num column and rows, no value

How to work with DEM Data?

Page 23: World wind java sdk in progess

BIL is stored in cache like images (pyramid cache)

To read BIL you must know the number of :Columns and Rows (the resolution)

You can import your BIL in World Wind but you must create it in correct way

- correct BIL format (each elevation value in 16bit float) - numer of Columns/Rows constant for each tile- correct name of the tile = correct position of the tile- all BIL file must have the same resolution (in the older version)

- 150x150 points (referring to class EarthElevationModel)

More:http://patmurris.blogspot.com/2007/10/couple-tricks-to-speed-up-wwj.html

How to work with DEM Data?

Page 24: World wind java sdk in progess

Implements an elevation model based on a quad tree of elevation tiles. Meant to be subclassed by very specific classes, e.g. Earth/SRTM. A Descriptor passed in at construction gives the configuration parameters. Eventually Descriptor will be replaced by an XML configuration document.

A "tile" corresponds to one tile of the data set, which has a corresponding unique row/column address in the data set. An inner class implements Tile. An inner class also implements TileKey, which is used to address the corresponding Tile in the memory cache.

Clients of this class get elevations from it by first getting an Elevations object for a specific Sector, then querying that object for the elevation at individual lat/lon positions. The Elevations object captures information that is used to compute elevations.

When an elevation tile is needed but is not in memory, a task is threaded off to find it. If it's in the file cache then it's loaded by the task into the memory cache. If it's not in the file cache then a retrieval is initiated by the task. The disk is never accessed during a call to getElevations(sector, resolution) because that method is likely being called when a frame is being rendered.

How to work with DEM Data?

Page 25: World wind java sdk in progess

• If you want to manipolate the mesh in world wind you can find all the necessary class in the gov.nasa.worldwind.globes and in RectangularTessellator class.

• In this package you can find different globe rappresentation:▫ ElipsoidalGlobe▫ FlatGlobe▫ Other planet too!

How to work with DEM Data?

Page 26: World wind java sdk in progess
Page 27: World wind java sdk in progess

Tessellation of the globe

Tessellation breaks down the surface of an object into manageable polygons. Triangles or quadrilaterals are two usually used polygons in drawing graphical objects because computer hardware can easy manipulate and calculate these two simple polygons.

Using the terrain elevation model builds the vertices and texture coordinates for each tile

In World Wind the Tessellator uses Rectangular Tile

The default implementation for the tessellator in WWJ is: gov.nasa.worldwind.globes .RectangularTessellator

How to work with DEM Data?

Page 28: World wind java sdk in progess

How to work with DEM Data?

Page 29: World wind java sdk in progess

How to work with DEM Data? public RenderInfo buildVerts(DrawContext dc, RectTile tile, int resolution, boolean makeSkirts) { int density = tile.density; int numVertices = (density + 3) * (density + 3); java.nio.DoubleBuffer verts = BufferUtil.newDoubleBuffer(numVertices * 3);

Globe globe = dc.getGlobe(); ElevationModel.Elevations elevations = globe.getElevationModel().getElevations(tile.sector, resolution);

Angle latMax = tile.sector.getMaxLatitude(); Angle dLat = tile.sector.getDeltaLat().divide(density);

Angle lonMin = tile.sector.getMinLongitude(); Angle lonMax = tile.sector.getMaxLongitude(); Angle dLon = tile.sector.getDeltaLon().divide(density);

int iv = 0; Angle lat = tile.sector.getMinLatitude(); double verticalExaggeration = dc.getVerticalExaggeration(); double exaggeratedMinElevation = makeSkirts ? globe.getMinElevation() * verticalExaggeration : 0;

LatLon centroid = tile.sector.getCentroid(); Vec4 refCenter = globe.computePointFromPosition(centroid.getLatitude(), centroid.getLongitude(), 0d);

for (int j = 0; j <= density + 2; j++) {Angle lon = lonMin; for (int i = 0; i <= density + 2; i++) {double elevation = verticalExaggeration * elevations.getElevation(lat.radians, lon.radians); if (j == 0 || j >= tile.density + 2 || i == 0 || i >= tile.density + 2) { // use abs to account for negative elevation. elevation -= exaggeratedMinElevation >= 0 ? exaggeratedMinElevation : -exaggeratedMinElevation;}

Vec4 p = globe.computePointFromPosition(lat, lon, elevation); verts.put(iv++, p.x - refCenter.x).put(iv++, p.y - refCenter.y).put(iv++, p.z - refCenter.z);

if (i > density) lon = lonMax; else if (i != 0) lon = lon.add(dLon); } if (j > density) lat = latMax; else if (j != 0) lat = lat.add(dLat); } return new RenderInfo(density, verts, getTextureCoordinates(density), refCenter, elevations.getResolution()); }

public SectorGeometryList tessellate(DrawContext dc) { if (dc == null) {String msg = Logging.getMessage("nullValue.DrawContextIsNull"); Logging.logger().severe(msg); throw new IllegalArgumentException(msg)}

if (dc.getView() == null) { String msg = Logging.getMessage("nullValue.ViewIsNull"); Logging.logger().severe(msg); throw new IllegalStateException(msg); }

if (!WorldWind.getMemoryCacheSet().containsCache(CACHE_ID)) { long size = Configuration.getLongValue(AVKey.SECTOR_GEOMETRY_CACHE_SIZE, 20000000L); MemoryCache cache = new BasicMemoryCache((long) (0.85 * size), size); cache.setName(CACHE_NAME); WorldWind.getMemoryCacheSet().addCache(CACHE_ID, cache); }

if (this.topLevels == null) this.topLevels = this.createTopLevelTiles(dc);

this.currentTiles.clear(); this.currentLevel = 0; this.currentCoverage = null;

this.currentFrustum = dc.getView().getFrustumInModelCoordinates(); for (RectTile tile : this.topLevels) { this.selectVisibleTiles(dc, tile); }

this.currentTiles.setSector(this.currentCoverage);

for (SectorGeometry tile : this.currentTiles) { this.makeVerts(dc, (RectTile) tile); }

return this.currentTiles; }

Page 30: World wind java sdk in progess

private long render(DrawContext dc, RectTile tile, int numTextureUnits) { if (tile.ri == null) { String msg = Logging.getMessage("nullValue.RenderInfoIsNull"); Logging.logger().severe(msg); throw new IllegalStateException(msg); }

dc.getView().pushReferenceCenter(dc, tile.ri.referenceCenter);

GL gl = dc.getGL(); gl.glPushClientAttrib(GL.GL_CLIENT_VERTEX_ARRAY_BIT); gl.glEnableClientState(GL.GL_VERTEX_ARRAY); gl.glVertexPointer(3, GL.GL_DOUBLE, 0, tile.ri.vertices.rewind());

for (int i = 0; i < numTextureUnits; i++) { gl.glClientActiveTexture(GL.GL_TEXTURE0 + i); gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY); gl.glTexCoordPointer(2, GL.GL_DOUBLE, 0, tile.ri.texCoords.rewind()); }

gl.glDrawElements(javax.media.opengl.GL.GL_TRIANGLE_STRIP, tile.ri.indices.limit(), javax.media.opengl.GL.GL_UNSIGNED_INT, tile.ri.indices.rewind());

gl.glPopClientAttrib();

dc.getView().popReferenceCenter(dc);

return tile.ri.indices.limit() - 2; // return number of triangles rendered }

private void renderWireframe(DrawContext dc, RectTile tile, boolean showTriangles, boolean showTileBoundary) { if (dc == null) { String msg = Logging.getMessage("nullValue.DrawContextIsNull"); Logging.logger().severe(msg); throw new IllegalArgumentException(msg); }

if (tile.ri == null) { String msg = Logging.getMessage("nullValue.RenderInfoIsNull"); Logging.logger().severe(msg); throw new IllegalStateException(msg); }

java.nio.IntBuffer indices = getIndices(tile.ri.density); indices.rewind();

dc.getView().pushReferenceCenter(dc, tile.ri.referenceCenter);

javax.media.opengl.GL gl = dc.getGL(); gl.glPushAttrib( GL.GL_DEPTH_BUFFER_BIT | GL.GL_POLYGON_BIT | GL.GL_TEXTURE_BIT | GL.GL_ENABLE_BIT | GL.GL_CURRENT_BIT); gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE); gl.glDisable(javax.media.opengl.GL.GL_DEPTH_TEST); gl.glEnable(javax.media.opengl.GL.GL_CULL_FACE); gl.glCullFace(javax.media.opengl.GL.GL_BACK); gl.glDisable(javax.media.opengl.GL.GL_TEXTURE_2D); gl.glColor4d(1d, 1d, 1d, 0.2); gl.glPolygonMode(javax.media.opengl.GL.GL_FRONT, javax.media.opengl.GL.GL_LINE);

if (showTriangles) { gl.glPushClientAttrib(GL.GL_CLIENT_VERTEX_ARRAY_BIT); gl.glEnableClientState(GL.GL_VERTEX_ARRAY);

gl.glVertexPointer(3, GL.GL_DOUBLE, 0, tile.ri.vertices); gl.glDrawElements(javax.media.opengl.GL.GL_TRIANGLE_STRIP, indices.limit(), javax.media.opengl.GL.GL_UNSIGNED_INT, indices);

gl.glPopClientAttrib(); }

dc.getView().popReferenceCenter(dc);

if (showTileBoundary) this.renderPatchBoundary(dc, tile, gl);

gl.glPopAttrib(); }

How to work with DEM Data?

Page 31: World wind java sdk in progess

• Image in GIS context are not so different from the “classic” image concept

• The differences are:▫They are big (very big) in term of dimension

and resolution▫They are georeferenced (there are more that

one file associated to them)

How display Image on WWJ?

Page 32: World wind java sdk in progess

• For sure, first to use a image in GIS you need elaborate it!

• To do that you need special program (not Photoshop) like Global Mapper that can read image of many GigaByte without problem and manipolate them without losing the georeferencing.

• You can for example, reproject image from one projection system to another, crop it, recolor it, merge with other images, change the resolution or change the format (GeoTiff, GeoJpeg, GeoPng, Jpeg2000, and Ecw)

How display Image on WWJ?

Page 33: World wind java sdk in progess

•But ▫How I can display a so big image into my

thin 3D GIS client (WWJ)?

▫How I can transmit throw the www my image data?

How display Image on WWJ?

Page 34: World wind java sdk in progess

User request

Geo Server

geoDB

Discover data

Load data

“Maps” data

Reproject/Crop data

Send dataServer response

How Work a GeoService?

Example…

Page 35: World wind java sdk in progess

WMS Service: a GeoService for the images

- Open standard (Open GIS Consortium).- Server hides and embodies esoteric knowledge of

formats, projections, multiple scales, etc.- HTTP protocol, easy to implement on client-side.- Provides data abstraction to clients:

- maps that are seamless, of arbitrary scales and extents, composed from multiple data sources.

- free of artificial server-side constraints.

How display Image on WWJ?

Page 36: World wind java sdk in progess

Image request using WMS protocolpublic class LandsatI3WMSLayer extends WMSTiledImageLayer{ private static final String xmlState;

static { long expiryTime = new GregorianCalendar(2008, 3, 11).getTimeInMillis(); xmlState = new String( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<restorableState>" + "<stateObject name=\"gov.nasa.worldwind.avkey.NumEmptyLevels\">4</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avkey.ImageFormat\">image/dds</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avkey.DataCacheNameKey\">Earth/NASA LandSat I3 WMS</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avkey.ServiceURLKey\">http://www.nasa.network.com/wms?SERVICE=WMS&amp;</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avkey.Title\">i-cubed Landsat</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avkey.NumLevels\">10</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avkey.FormatSuffixKey\">.dds</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avkey.LevelZeroTileDelta.Latitude\">36.0</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avkey.LevelZeroTileDelta.Longitude\">36.0</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avkey.DatasetNameKey\">|esat</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avkey.TileHeightKey\">512</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avkey.TileWidthKey\">512</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avkey.LayerNames\">|esat</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avKey.Sector.MinLatitude\">-90.0</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avKey.Sector.MaxLatitude\">90.0</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avKey.Sector.MinLongitude\">-180.0</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avKey.Sector.MaxLongitude\">180.0</stateObject>" + "<stateObject name=\"gov.nasa.worldwind.avkey.ExpiryTime\">" + expiryTime + "</stateObject>" + "<stateObject name=\"wms.UseTransparentTextures\">true</stateObject>" + "<stateObject name=\"wms.LayerName\">i-cubed Landsat</stateObject>" + "<stateObject name=\"wms.LayerEnabled\">true</stateObject>" + "</restorableState>" ); }

How display Image on WWJ?

Page 37: World wind java sdk in progess

Image request using a “Servlet” protocol

public class LandsatI3 extends BasicTiledImageLayer{ public LandsatI3() { super(makeLevels()); this.setUseTransparentTextures(true); this.setUseMipMaps(true); }

private static LevelSet makeLevels() { AVList params = new AVListImpl();

params.setValue(AVKey.TILE_WIDTH, 512); params.setValue(AVKey.TILE_HEIGHT, 512); params.setValue(AVKey.DATA_CACHE_NAME, "Earth/NASA LandSat I3"); params.setValue(AVKey.SERVICE, "http://worldwind25.arc.nasa.gov/lstile/lstile.aspx"); params.setValue(AVKey.DATASET_NAME, "esat_worlddds"); params.setValue(AVKey.FORMAT_SUFFIX, ".dds"); params.setValue(AVKey.NUM_LEVELS, 10); params.setValue(AVKey.NUM_EMPTY_LEVELS, 4); params.setValue(AVKey.LEVEL_ZERO_TILE_DELTA, new LatLon(Angle.fromDegrees(36d), Angle.fromDegrees(36d))); params.setValue(AVKey.SECTOR, Sector.FULL_SPHERE); params.setValue(AVKey.EXPIRY_TIME, new GregorianCalendar(2007, 2, 22).getTimeInMillis());

return new LevelSet(params); }

}

How display Image on WWJ?

Page 38: World wind java sdk in progess

How display Image on WWJ?

Page 39: World wind java sdk in progess

What is a vectorial data?

• Vector is a data structure, used to store spatial data.

• Vector data is comprised of points, lines, arcs, polygons and areas

• A vector based GIS is defined by the vectorial representation of its geographic data. According with the characteristics of this data model, geographic objects are explicitly represented and, within the spatial characteristics, the thematic aspects are associated.

How display vectorial data on WWJ?

Page 40: World wind java sdk in progess

• One of the common way is to transform it into an image and transmit to the client.

• I can do this process at client side or server side.

• Better at server side becouse usually this process is very expensive in computational resouces

• To perform the process I need special application (ESRI ArcGis, MapServer, GeoTools...) that “maps” the vectorial data in a styled rappresentation choosed by user

• A GeoService again…

How display vectorial data on WWJ?

Page 41: World wind java sdk in progess

Application

Configuration (Global)

Scene Controller

View Frame Controller Canvas

Window Environment (Swing, SWT, etc.)

Globe

Tessellator

Layer Model

WorldWindow

Cache

Web

Notifier (Global)

How works World Wind Java?

Page 42: World wind java sdk in progess

Layer

Renderer StorageManager Retriever Web

Cache

What is Layer in World Wind?

Is all that I can display and “put” over the 3D World (and not only!)

A Layer can be:

- Image (ortophoto or not)- DEM (Digital Elevation Model)- Icons- 3D Objects-Placenames- GeoRSS…

How to customize WWJ?

Page 43: World wind java sdk in progess

• If you want to manipolate the layer in world wind you can find all the necessary classes in the gov.nasa.worldwind.layers and gov.nasa.worldwind.layers.Earth

Work with layers in WWJ?

Page 44: World wind java sdk in progess

Annotation Objects for rendering and picking. CompassLayer Compass render CrosshairLayer Renders a crosshair icon in the viewport FogLayer Sets fog range/density according to view altitude. Renderable Objects for rendering, picking, and disposal. ScalebarLayer Renders a scalebar graphic in a screen corner. SkyColorLayer Paints the sky color background depending on altitude. TerrainProfileLayer Displays a terrain profile graph in a screen corner. IconLayer The IconLayer class manages a collection of WWIcon objects for rendering and picking.

Work with layers in WWJ?

Page 45: World wind java sdk in progess

• Extends interface Layer with some usefull methods:

• isLayerInView - Indicates whether the layer is in the view.

• isLayerActive - Indicates whether the layer is active based on arbitrary criteria. By default the layer is active if the current altitude is within the layer's min and max active altitudes.

• render – If enabled, visible and active call doRender (abstract)

• pick - If enabled, visible and active call doPick (abstract)

• …

Work with layers in WWJ?

Page 46: World wind java sdk in progess

First problem working with WWJ?

• World Wind Java considers each information layer as phisical different layer to put over the mesh

• Each layer is typically an image layer

• Each image layer have different detail levels and quadtree tile strategy

• For each tile the client request image from the GeoServer

• You aren’t a static user...you move around

• You aren’t the unique user...

• The server becames slow...very slow...

Page 47: World wind java sdk in progess

What is a servlet?

Java Servlet technology provides Web developers with a simple, consistent mechanism for extending the functionality of a Web server and for accessing existing business systems.

A servlet can almost be thought of as an applet that runs on the server side-without a face.

Servlets provide a component-based, platform-independent method for building Web-based applications, without the performance limitations of CGI programs

How works GT-servlet?

Page 48: World wind java sdk in progess

The concept is easy!

The servlet “copies” the pre–processed data (pre-cached) and send it to the WWJ client

The advantages are:• No processing time (like WMS or WFS service)• Faster transmission • Clustering of server architecture

Problems:•You must pre-processing data•You need a lot of space on file system to create the pyramids file for all the zoom level

Request

Discover

Data

Response

How works GT-servlet?

Page 49: World wind java sdk in progess

GT-WMS

MapServer

Processed and organized (tiled) data and supporting structures:

WMS data repository

clientclient web

DB

WMS

How works GT-servlet?

Page 50: World wind java sdk in progess

How works GT-servlet?

Workflow of GeoData process

Input Data Cached Data

Page 51: World wind java sdk in progess
Page 52: World wind java sdk in progess

Work with reder obj in WWJ•If you want to manipolate the layer in

world wind you can find all the necessary class in the gov.nasa.worldwind.render

Page 53: World wind java sdk in progess

Create a renderable layer

RenderableLayer class that extends AbstractLayer and manages a collection of Renderable objects for rendering, picking, and disposal.

public class BasicLayer extends RenderableLayer {public BasicLayer () {

this.setName("Layer Name"); this.addRenderable(new RenderableObject());…

}}

Page 54: World wind java sdk in progess

Create a renderable object

public final class RenderableObject implements Renderable, Disposable {Shape shape = new Sphere ();

public void render(DrawContext dc) { GL gl = dc.getGL(); // Draw here

if (!shape.isInitialized()) shape.initialize(dc);shape.render(dc, centerA, radius);shape.render(dc, centerB, radius);

} public void dispose() { // Cleanup here

} }

Page 55: World wind java sdk in progess

public class Sphere extends Shape {@Overridepublic void initialize(DrawContext dc) {

super.initialize(dc);this.name = "Sphere";double radius = 1;int slices = 36; // number of subdivisions around the z axis (longitude).int stacks = 18; // number of subdivisions along the z axis (latitude).

dc.getGL().glNewList(this.glListId, GL.GL_COMPILE);dc.getGLU().gluSphere(this.quadric, radius, slices, stacks);dc.getGL().glEndList();

}

@Overridepublic void doRender(DrawContext dc, Vec4 point, double radius) {

dc.getGL().glScaled(radius, radius, radius);dc.getGL().glCallList(this.glListId);

}}

Create a renderable object

Page 56: World wind java sdk in progess

public abstract class Shape {

protected String name;protected int glListId;protected GLUquadric quadric;

abstract public void doRender(DrawContext dc, Vec4 point, double radius);

public void initialize(DrawContext dc) {this.glListId = dc.getGL().glGenLists(1);this.quadric = dc.getGLU().gluNewQuadric();dc.getGLU().gluQuadricDrawStyle(quadric, GLU.GLU_FILL);dc.getGLU().gluQuadricNormals(quadric, GLU.GLU_SMOOTH);dc.getGLU().gluQuadricOrientation(quadric, GLU.GLU_OUTSIDE);dc.getGLU().gluQuadricTexture(quadric, false);

}

public void render(DrawContext dc, Vec4 point, double radius) {dc.getView().pushReferenceCenter(dc, point);this.doRender(dc, point, radius);dc.getView().popReferenceCenter(dc);

}}

Create a renderable object


Recommended