World Wind Fly View
Home
This example increments the latitude and longitude.
Pitch is level, normally thought of as zero pitch, but World Wind considers it 90 degrees.
Normally -90 is pointing down, 90 is pointing up and zero is straight ahead.
WW has 0 down, 180 up, and 90 straight ahead.
The compass heading is East or 90 (N = 0, E = 90, S = 180, W = 270).
Follow basic set up steps from World Wind Java Sdk - Hello World
import java.awt.Color;
import java.util.LinkedList;
import gov.nasa.worldwind.BasicModel;
import gov.nasa.worldwind.awt.WorldWindowGLCanvas;
import gov.nasa.worldwind.geom.Angle;
import gov.nasa.worldwind.geom.Position;
import gov.nasa.worldwind.layers.RenderableLayer;
import gov.nasa.worldwind.render.Polyline;
import gov.nasa.worldwind.view.firstperson.BasicFlyView;
import javax.swing.JFrame;
public class WWFlyView {
public static void main(String[] args) throws InterruptedException {
//create a WorldWind main object
WorldWindowGLCanvas worldWindCanvas = new WorldWindowGLCanvas();
worldWindCanvas.setModel(new BasicModel());
BasicFlyView flyView = new BasicFlyView();
worldWindCanvas.setView(flyView);
Angle a = new Angle(Angle.fromDegrees(32.96)); //38.9481334
Angle a2 = new Angle(Angle.fromDegrees(-117.39679)); //-92.32679
Position pos = new Position(a,a2 , 20.0);
flyView.setEyePosition(pos);
flyView.setPitch(Angle.fromDegrees(90.0));
flyView.setHeading(Angle.fromDegrees(90.0));
//build Java swing interface
JFrame frame = new JFrame("World Wind");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(worldWindCanvas);
frame.setSize(800,600);
frame.setVisible(true);
Thread.sleep(2000);
for(double j = 0.0; j < 500; j+= .001){
pos = new Position(a,Angle.fromDegrees(a2.getDegrees()+j) , 900.0);
Thread.sleep(50);
flyView.setEyePosition(pos);
worldWindCanvas.repaint();
}
}
}