@ -71,6 +71,11 @@ function init()
@@ -71,6 +71,11 @@ function init()
google.earth.createInstance("map3d", initCallback, failureCallback);
}
function setFollowEnabled(enable)
{
followEnabled = enable;
}
function setCurrAircraft(id)
@ -214,8 +219,8 @@ function initCallback(object)
@@ -214,8 +219,8 @@ function initCallback(object)
ge.getWindow().setVisibility(true);
ge.getOptions().setStatusBarVisibility(true);
ge.getOptions().setScaleLegendVisibility(true);
ge.getOptions().setFlyToSpeed(5.0);
// ge.getOptions().setFlyToSpeed(ge.SPEED_TELEPORT);
// ge.getOptions().setFlyToSpeed(5.0);
ge.getOptions().setFlyToSpeed(ge.SPEED_TELEPORT);
ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);
ge.getLayerRoot().enableLayerById(ge.LAYER_TERRAIN, true);
@ -233,11 +238,15 @@ function setAircraftPositionAttitude(id, lat, lon, alt, roll, pitch, yaw)
@@ -233,11 +238,15 @@ function setAircraftPositionAttitude(id, lat, lon, alt, roll, pitch, yaw)
if (lastLat == 0)
{
lastLat = currLat;
lastLon = last Lon;
lastLon = curr Lon;
}
currLat = lat;
currLon = lon;
currAlt = alt;
// Interpolate between t-1 and t and set new states
lastLat = lastLat*0.8+currLat*0.2;
lastLon = lastLon*0.8+currLon*0.2;
lastAlt = lastAlt*0.8+currAlt*0.2;
//currFollowHeading = ((yaw/M_PI)+1.0)*360.0;
@ -246,10 +255,14 @@ function setAircraftPositionAttitude(id, lat, lon, alt, roll, pitch, yaw)
@@ -246,10 +255,14 @@ function setAircraftPositionAttitude(id, lat, lon, alt, roll, pitch, yaw)
planeOrient.setTilt(((pitch/M_PI)+1.0)*360.0);
planeOrient.setHeading(((yaw/M_PI)+1.0)*360.0);
planeLoc.setLatitude(lat);
planeLoc.setLongitude(lon);
planeLoc.setAltitude(alt);
currFollowHeading = ((yaw/M_PI)+1.0)*360.0;
planeLoc.setLatitude(lastLat);
planeLoc.setLongitude(lastLon);
planeLoc.setAltitude(lastAlt);
planeModel.setLocation(planeLoc);
if (followEnabled) updateFollowAircraft();
}
}
@ -284,10 +297,6 @@ function setCurrentAircraft(id)
@@ -284,10 +297,6 @@ function setCurrentAircraft(id)
function updateFollowAircraft()
{
currView = ge.getView().copyAsLookAt(ge.ALTITUDE_ABSOLUTE);
// Interpolate between t-1 and t and set new states
lastLat = lastLat*0.7+currLat*0.3;
lastLon = lastLon*0.7+currLon*0.3;
lastAlt = lastAlt*0.7+currAlt*0.3;
currView.setLatitude(lastLat);
currView.setLongitude(lastLon);
currView.setAltitude(lastAlt);