tirsdag den 14. oktober 2008

KML Layer Support Growing in WWJava


KML bliver GIS data standarden på webben - det er der ingen tvivl om. Resten bliver baggrundskort klippet i kvadrater baseret på oceaner af konventionel data.
/Sik


KML is going to be the GIS data standard on the Web - no doubt about it. The rest is packed into base maps cut up into squares based on oceans of conventionel data.
/Sik


Quote


Right now there is support for: ploygons (including extruded polygons with holes), lines (including tesselated lines, no extrusion) and points (but only displayed as pushpins).   There is no support for overlays, complex(dae) 3d models, regions, animation, etc.  It only knows how to read a few things from the KML file.  So if you load a file with it and see nothing, that feature is probably just not supported.

There are five main pieces of the code:

The Model:
The model package contains a representation of the KML file as an Object Model.  I made the model look like something that makes sense, rather than using something like JAXB to make something that looks exactly like the XML.  Right now, the only things in the model are things that I render.  So it is /not/ a complete KML model (yet).

The Parser:
KMLParser takes a file name and returns a (parsed) model.  Right now, I only parse basic things (and things I know how to render).

The Layer:
KMLLayer is a WWJava layer that draws a model.  All the drawing code is in the layer, rather than spread out in the model. That may not be “object oriented” enough for some, but it seems to work pretty well for me.

The Tree:
There is a /very basic/ tree model that wraps a kmlmodel so that it can be displayed in a JTree.

The Client:
I hacked up the “SimpleClient” that came with WWJ to demonstrate the KMLLayer.  It loads three sample KML files to  demonstrate its use (make sure your working directory is /this/ directory).  It has a tree pane that can be used to inspect the document trees.  If you double-click on a leaf node in that tree, it will pan/zoom to the approximate place on the globe where that placemark is located.

Ingen kommentarer:

Send en kommentar