view.addPanToAnimator(posCenter, heading, pitch, dblZoom, true);
}
public void resetWwdViewDefault()
{
BasicOrbitView view = (BasicOrbitView) super.getView();
/*
* This code works, but there is a trouble-shooting when reseting default veis
* in Flat world.
* This code has been taken from demo : RoundWorldEarthquakes
*
* In this demo, the following is performed :
Configuration.setValue(AVKey.INITIAL_LATITUDE, 0);
Configuration.setValue(AVKey.INITIAL_LONGITUDE, 0);
Configuration.setValue(AVKey.INITIAL_ALTITUDE, 50e6);
*
* It ensures could behaviour when reseting default view with flat map.
* In the applis, the AvKeys are kept to worldwin defaults, i.e :
* definel in : ressources/config/worldwind.xml
* <Property name="gov.nasa.worldwind.avkey.InitialLatitude" value="38"/>
* <Property name="gov.nasa.worldwind.avkey.InitialAltitude" value="19.07e6"/>
* The initial longitude is set in :
* gov.nasa.worldwind.Configuration.initializeDefaults()
* and depends on user time zone.
*
*/
Double lat = -9999.9d; //Configuration.getDoubleValue(AVKey.INITIAL_LATITUDE);
Double lon = -9999.9d; // Configuration.getDoubleValue(AVKey.INITIAL_LONGITUDE);
Double elevation = -9999.9d; // Configuration.getDoubleValue(AVKey.INITIAL_ALTITUDE);
// beg bantchao
Globe glbDefault = getModel().getGlobe();
if (glbDefault instanceof FlatGlobe)
{
lat = 0d;
lon = 0d;
elevation = 50e6d;
}
else if (glbDefault instanceof Earth)
{
lat = Configuration.getDoubleValue(AVKey.INITIAL_LATITUDE);
lon = Configuration.getDoubleValue(AVKey.INITIAL_LONGITUDE);
elevation = 19.07e6d; // memo: default value, not really needed
}
else
{
System.err.println("Uncaught instanceof glbDefault: " + glbDefault.getClass().toString());
System.exit(1);
}
// end bantchao
Position targetPos = Position.fromDegrees(lat, lon, 0);
view.addPanToAnimator(
// The elevation component of 'targetPos' here is not the surface elevation,
// so we ignore it when specifying the view center position.
new Position(targetPos, 0),
Angle.ZERO,
Angle.ZERO,//pitch