![]() |
|
|||||||
| Development Help Help for building applications or diagnosing problems with WWJ |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Jul 2010
Posts: 34
![]() |
Hi, all...
i had used ogc.kml package to parse a KML file and get whole geometry objects....Then I used AirspaceLayer to render those geometry objects... But when zooming in-out or panning, WWJ renders toooooooooooooooooooo slow... This is where i parse and add Airspace Objects(According to my KML File all geometry objects are polygons) : Code:
private void addBinalarLayer() throws IOException, XMLStreamException {
KMLAirSpaceCreator creator = null;
KMLRoot root = new KMLRoot(new File("D:\\SourceFiles\\SungurluBina_2010_8_4_18_25.KML"));
root.parse();
creator = new KMLAirSpaceCreator(root);
//Create Renderable Layer...
AirspaceLayer layer = new AirspaceLayer();
layer.addAirspaces(creator.getPolygons());
layer.setMaxActiveAltitude(1000.0);
//Add Layer To The Current Model...
insertAfterPlacenames(wwd, layer);
}
Code:
public class KMLAirSpaceCreator {
private KMLRoot kmlRoot = null;
private static float POLYGON_HEIGHT = 3.0f;
public KMLAirSpaceCreator(KMLRoot kmlRoot) {
super();
this.kmlRoot = kmlRoot;
}
public List<Airspace> getPolygons() {
KMLAbstractContainer container = null;
List<KMLAbstractFeature> features = null;
double altitude = 0.0;
Polygon tempPolygon = null;
KMLPolygon polygonGeom = null;
List<Airspace> polygons = new ArrayList<Airspace>();
if(!(kmlRoot.getFeature() instanceof KMLAbstractContainer))
return null;
else
container = (KMLAbstractContainer) kmlRoot.getFeature();
features = container.getFeatures();
for(KMLAbstractFeature tempFeature : features) {
if((tempFeature instanceof KMLPlacemark) && (((KMLPlacemark) tempFeature).getGeometry() instanceof KMLPolygon)) {
polygonGeom = (KMLPolygon)((KMLPlacemark) tempFeature).getGeometry();
tempPolygon = new Polygon(getDefaultAttributes());
tempPolygon.setLocations(polygonGeom.getOuterBoundary().getCoordinates().list);
altitude = polygonGeom.getOuterBoundary().getCoordinates().list.iterator().next().getAltitude();
altitude *=POLYGON_HEIGHT;
tempPolygon.setAltitudes(0.0, altitude);
tempPolygon.setTerrainConforming(true, true);
polygons.add(tempPolygon);
}
}
return polygons.size() < 1 ? null : polygons;
}
public KMLRoot getKmlRoot() {
return kmlRoot;
}
public void setKmlRoot(KMLRoot kmlRoot) {
this.kmlRoot = kmlRoot;
}
public static AirspaceAttributes getDefaultAttributes() {
AirspaceAttributes attributes = new BasicAirspaceAttributes();
attributes.setMaterial(new Material(Color.BLACK, Color.LIGHT_GRAY, Color.DARK_GRAY, Color.BLACK, 0.0f));
attributes.setOutlineMaterial(Material.DARK_GRAY);
attributes.setDrawOutline(true);
attributes.setOpacity(0.95);
attributes.setOutlineOpacity(.95);
attributes.setOutlineWidth(2);
return attributes;
}
}
Thanks for your replies in advance... |
|
|
|
|
|
#2 |
|
WWJ Technical Manager
Join Date: May 2007
Location: Seattle
Posts: 1,041
![]() |
It's not clear what's causing the performance problem, but we'll be checking in support for KML polygons this week. I suggest you wait until we do before spending more time on this.
|
|
|
|
|
|
#3 |
|
Member
Join Date: Jul 2010
Posts: 34
![]() |
Very thanks for your reply...Would you mind notifying me when your research is over?? Or Do i have to check for new updates on WWJ site?
Thanks again sir... |
|
|
|
|
|
#4 |
|
WWJ Technical Manager
Join Date: May 2007
Location: Seattle
Posts: 1,041
![]() |
We'll post a message to this thread, as well as an announcement on another.
|
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Aug 2005
Posts: 337
![]() |
Are you looking at the performance of airspace objects in general or just those derived from KML polys? We're parsing Airspace Control Orders and the big ones are slideshows.
![]() Our ATO/ACO parser is still a bit rough...if anyone has a good java one available... |
|
|
|
|
|
#6 |
|
WWJ Technical Manager
Join Date: May 2007
Location: Seattle
Posts: 1,041
![]() |
We're not using Airspaces for KML Polygons. A simpler shape will suffice. Airspaces have (costly) behavior that is not addressed by KML.
As to the performance of Airspaces, we have done quite a big of optimization. If you're encountering bad performance then please try to send us an example that illustrates it. |
|
|
|
|
|
#7 |
|
Member
Join Date: Jul 2010
Posts: 34
![]() |
No, no i read polygon data from KML and use that data to render a shape which has polygons as its base and roof and use elevation data to elevate that shape...I do not know whether there exists other 3D objects to render in WWJ API or not...Airspace objects are the one that i only know...If there are other 3D Objects which has polygons as its base and roof to render, please let me know...
Thanks for your reply in advance... |
|
|
|
|
|
#8 |
|
WWJ Technical Manager
Join Date: May 2007
Location: Seattle
Posts: 1,041
![]() |
KML Polygons are now supported. They are not tessellated across their interior to capture the globe's curvature yet, but all other aspects should work, including extrusion.
For a list of the KML features currently implemented, see this thread: http://forum.worldwindcentral.com/sh...ad.php?t=26187 |
|
|
|
|
|
#9 |
|
Member
Join Date: Jul 2010
Posts: 34
![]() |
Very very thx, sir...I have tried it and it worked excellent
... And Also rendering speed is great compared to past ...Moreover it is very easy to use...I appreciate your excellent work... |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| kml loads, but not as expected | apa | Technical Support | 25 | 02-26-2010 04:29 AM |
| Performance with Objects | Kashank | Development Help | 6 | 01-07-2010 03:34 PM |
| Consolidate KML Parser Efforts? | ecuguru | Development Help | 4 | 01-07-2010 12:26 AM |
| Kml texture IO error | kmf164 | Development Help | 3 | 06-15-2009 09:11 PM |
| SelectListener and SphereAirspace objects | kermit | Development Help | 3 | 05-06-2009 06:48 PM |