Commit 37275ad4 authored by lm's avatar lm

Added smoothing of Google Earth positions

parent 2d8aacd0
......@@ -45,6 +45,8 @@ var planeOrient;
var planeLoc;
var aircraft = [];
var aircraftLocations = [];
var aircraftLastLocations = [];
var attitudes = [];
var locations = [];
var trails = [];
......@@ -134,7 +136,8 @@ function createAircraft(id, type, color)
// Write into global structure
aircraft[id] = planePlacemark;
attitudes[id] = planeOrient;
locations[id] = planeLoc;
aircraftLocations[id] = planeLoc;
aircraftLastLocations[id] = ge.createLocation('');
//planeColor = color;
createTrail(id, color);
......@@ -192,7 +195,7 @@ function addTrailPosition(id, lat, lon, alt)
trails[id].setAltitudeMode(ge.ALTITUDE_ABSOLUTE);
// Add LineString points
trails[id].getCoordinates().pushLatLngAlt(lat, lon, alt);
trails[id].getCoordinates().pushLatLngAlt(lat, lon, alt);
// Create a style and set width and color of line
trailPlacemarks[id].setStyleSelector(ge.createStyle(''));
......@@ -238,18 +241,18 @@ function setAircraftPositionAttitude(id, lat, lon, alt, roll, pitch, yaw)
currLon = lon;
currAlt = alt;
//currFollowHeading = ((yaw/M_PI)+1.0)*360.0;
}
// FIXME Currently invalid conversion from right-handed z-down to z-up frame
planeOrient.setRoll(((roll/M_PI)+1.0)*360.0);
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);
//planeLoc.setLatitude(lat);
//planeLoc.setLongitude(lon);
//planeLoc.setAltitude(alt);
}
......@@ -284,18 +287,24 @@ function setCurrentAircraft(id)
function updateFollowAircraft()
{
currView = ge.getView().copyAsLookAt(ge.ALTITUDE_ABSOLUTE);
// Interpolate
currView.setLatitude(lastLat*0.7+currLat*0.3);
currView.setLongitude(lastLon*0.7+currLon*0.3);
currView.setAltitude(lastAlt*0.7+currAlt*0.3);
// Set new states
// 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);
currView.setRange(currViewRange);
currView.setTilt(currFollowTilt);
currFollowHeading = 0;// 0.9*currFollowHeading+0.1*((Math.atan2(lastLat-currLat, lastLon-currLon)/M_PI)+1.0)*360.0;
currView.setHeading(currFollowHeading-0.0);
// FIXME Shouldn't update aircraft in here, but works for now
planeLoc.setLatitude(lastLat);
planeLoc.setLongitude(lastLon);
planeLoc.setAltitude(lastAlt);
ge.getView().setAbstractView(currView);
}
......
......@@ -58,12 +58,18 @@ macx {
debug {
#QMAKE_CXXFLAGS += -finstrument-functions
#LIBS += -lSaturn
CONFIG += console
}
} else {
# x64 Mac OS X Snow Leopard 10.6 and later
CONFIG += x86_64 cocoa
CONFIG -= x86 phonon
message(Building for Mac OS X 64bit/Snow Leopard 10.6 and later)
debug {
#QMAKE_CXXFLAGS += -finstrument-functions
#LIBS += -lSaturn
CONFIG += console
}
}
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.5
......@@ -151,12 +157,13 @@ linux-g++ {
debug {
DESTDIR = $$TARGETDIR/debug
CONFIG += debug
CONFIG += debug console
}
release {
DESTDIR = $$TARGETDIR/release
DEFINES += QT_NO_DEBUG
CONFIG -= console
}
QMAKE_POST_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/.
......@@ -221,12 +228,13 @@ linux-g++-64 {
debug {
DESTDIR = $$TARGETDIR/debug
CONFIG += debug
CONFIG += debug console
}
release {
DESTDIR = $$TARGETDIR/release
DEFINES += QT_NO_DEBUG
CONFIG -= console
}
QMAKE_POST_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/.
......
......@@ -39,7 +39,6 @@ BASEDIR = $$IN_PWD
TARGETDIR = $$OUT_PWD
BUILDDIR = $$TARGETDIR/build
LANGUAGE = C++
CONFIG += console
OBJECTS_DIR = $$BUILDDIR/obj
MOC_DIR = $$BUILDDIR/moc
UI_HEADERS_DIR = src/ui/generated
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment