NASAWorldWind / WorldWindJava

The NASA WorldWind Java SDK (WWJ) is for building cross-platform 3D geospatial desktop applications in Java.
716 stars 325 forks source link

how to construct CompoundVecBuffer? request for documentation #96

Open basisbit opened 7 years ago

basisbit commented 7 years ago

I am currently trying to make worldwind display multiple surface polygons with 70.000 points (country borders) without too much of a performance hit. It looks like SurfacePolygons would do the job, but I have no idea how to construct them from lists of coordinates. It requires CompoundVecBuffer objects and these seem to require some weird format that I don't understand yet. I googled for it but there seems to be no documentation available on it.

Any help would be great. I'll post the results in the forum once it is working. :smiley:

basisbit commented 7 years ago

No reply here.... But anyways, I managed to get a solution which works quite well. I created a new class which extends SurfacePolygon. Inside that class, I did override assembleContours(Angle maxEdgerLength), commented out the this.subdivideContour(contour, maxEdgeLength); and did the following changes to the following lines after List<Vertex> contour = new ArrayList<Vertex>();

LatLon previousLocation = LatLon.ZERO; for (LatLon location : locations) { Angle edgeLength = LatLon.linearDistance(location, previousLocation); if (edgeLength.compareTo(minEdgeLength) < 0 || contour.size() > 32000-32) { continue; }

Set whatever you like as minEdgeLength. Something like a tenth (angle) of maxEdgeLength gives good results.

This is just to give others an idea. You should handle the max accelerated texels value issue differently. (Short.MAX_VALUE seems to work good for most graphics cards) and might want to not loose any important edges.

basisbit commented 7 years ago

ran into an issue using the above described solution: there is a memory leak and I don't understand how the java garbage collector works. Java VisualVM shows that there are hundreds of MB of Angle data. Any ideas how to fix that?