WorldWindJava
WorldWindJava copied to clipboard
Very high CPU load when zooming in at North or South edge of Mercator projection
Steps to Reproduce
- Run the example
- Zoom into the north edge of the map
- Keep zooming
Expected behavior: CPU load stays relatively constant
Actual behavior: CPU load increases, application becomes sluggish and unresponsive, number of tiles increases to over 1000
Reproduces how often: 100%
Operating System and Version
Redhat 6u8 with WorlwindWind 2.0.0, also reproduced with 2.1.0
Example to recreate the issue
import java.awt.EventQueue; import java.lang.reflect.Field;
import javax.swing.JFrame;
import gov.nasa.worldwind.BasicModel; import gov.nasa.worldwind.Configuration; import gov.nasa.worldwind.WorldWind; import gov.nasa.worldwind.avlist.AVKey; import gov.nasa.worldwind.awt.WorldWindowGLCanvas; import gov.nasa.worldwind.globes.EarthFlat; import gov.nasa.worldwind.layers.LatLonGraticuleLayer; import gov.nasa.worldwind.layers.ScalebarLayer; import gov.nasa.worldwind.terrain.RectangularTessellator; import gov.nasa.worldwind.terrain.SectorGeometryList; import gov.nasa.worldwind.terrain.ZeroElevationModel; import gov.nasa.worldwind.view.orbit.FlatOrbitView;
public class WorldWindHighCpuLoadExample {
public static void main(String[] args) { EventQueue.invokeLater(() -> { Configuration.setValue(AVKey.NETWORK_RETRIEVAL_ENABLED, false); Configuration.setValue(AVKey.GLOBE_CLASS_NAME, EarthFlat.class.getName()); Configuration.setValue(AVKey.VIEW_CLASS_NAME, FlatOrbitView.class.getName()); WorldWind.getNetworkStatus().setOfflineMode(true); JFrame frame = new JFrame(); WorldWindowGLCanvas wwd = new WorldWindowGLCanvas(); wwd.setPreferredSize(new java.awt.Dimension(1000, 800)); frame.getContentPane().add(wwd, java.awt.BorderLayout.CENTER); frame.pack(); wwd.setModel(new BasicModel()); wwd.getModel().getGlobe().setElevationModel(new ZeroElevationModel()); wwd.getModel().getLayers().clear(); wwd.getModel().getLayers().add(new LatLonGraticuleLayer()); wwd.getModel().getLayers().add(new ScalebarLayer()); frame.setVisible(true); new Thread(() -> { while (true) { try { Field declaredField = RectangularTessellator.class.getDeclaredField("currentTiles"); declaredField.setAccessible(true); SectorGeometryList list = (SectorGeometryList) declaredField .get(wwd.getModel().getGlobe().getTessellator()); System.out.println(list.size()); Thread.sleep(3000); } catch (Exception e) { e.printStackTrace(); } } }).start(); }); }
}
Apologies, further testing shows this problem isn't present in 2.1.0