World Wind Forums

Go Back   World Wind Forums > WorldWind JAVA forums > Development Help

Development Help Help for building applications or diagnosing problems with WWJ

Reply
 
Thread Tools Display Modes
Old 08-15-2010, 12:57 PM   #1
iliTheFallen
Member
 
Join Date: Jul 2010
Posts: 34
iliTheFallen is on a distinguished road
Question KML Parsing & Airspace Objects

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);
	}
And this is my helper class to create Airspace Objects from KMLGeometry Objects :
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;
    }
	
}
What should i do for speeding up rendering? I think the SceneController Or the DrawContext controls the mechanism that "which objects intersect current frustum" :S ...Do i have to write down my own implementation to control rendering? I have noticed that WWJ tries to render my objects every time that i zoom in-out or pan the map...I think there are some unnecessary renderings...What should i do for avoing unnecessary renderings?

Thanks for your replies in advance...
iliTheFallen is offline   Reply With Quote
Old 08-24-2010, 07:46 AM   #2
tag
WWJ Technical Manager
 
Join Date: May 2007
Location: Seattle
Posts: 1,041
tag is on a distinguished road
Default

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.
tag is offline   Reply With Quote
Old 08-24-2010, 09:02 AM   #3
iliTheFallen
Member
 
Join Date: Jul 2010
Posts: 34
iliTheFallen is on a distinguished road
Thumbs up

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...
iliTheFallen is offline   Reply With Quote
Old 08-24-2010, 09:13 AM   #4
tag
WWJ Technical Manager
 
Join Date: May 2007
Location: Seattle
Posts: 1,041
tag is on a distinguished road
Default

We'll post a message to this thread, as well as an announcement on another.
tag is offline   Reply With Quote
Old 08-24-2010, 12:53 PM   #5
nigel_ht
Senior Member
 
Join Date: Aug 2005
Posts: 337
nigel_ht
Default

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...
nigel_ht is offline   Reply With Quote
Old 08-24-2010, 06:50 PM   #6
tag
WWJ Technical Manager
 
Join Date: May 2007
Location: Seattle
Posts: 1,041
tag is on a distinguished road
Default

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.
tag is offline   Reply With Quote
Old 08-31-2010, 09:24 AM   #7
iliTheFallen
Member
 
Join Date: Jul 2010
Posts: 34
iliTheFallen is on a distinguished road
Question

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...
iliTheFallen is offline   Reply With Quote
Old 10-08-2010, 04:49 PM   #8
tag
WWJ Technical Manager
 
Join Date: May 2007
Location: Seattle
Posts: 1,041
tag is on a distinguished road
Default

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
tag is offline   Reply With Quote
Old 10-09-2010, 06:48 PM   #9
iliTheFallen
Member
 
Join Date: Jul 2010
Posts: 34
iliTheFallen is on a distinguished road
Thumbs up

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...
iliTheFallen is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 08:30 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.