Commit 1f2b0334 authored by pixhawk's avatar pixhawk

Fixed compile error, reverted HTML file to clean state

parent 0198993e
...@@ -13,13 +13,12 @@ google.load("earth", "1", { 'language': 'en'}); ...@@ -13,13 +13,12 @@ google.load("earth", "1", { 'language': 'en'});
var ge = null; var ge = null;
var initialized = false; var initialized = false;
var aircraft = new Array();
var currAircraft = 220; var currAircraft = 220;
var followAircraft = false; var followEnabled = false;
var currLat = 47.3769; var currLat = 47.3769;
var currLon = 8.549444; var currLon = 8.549444;
var currAlt = 470; var currAlt = 470;
var currFollowHeading = 0.0;
var homeLat = 0; var homeLat = 0;
var homeLon = 0; var homeLon = 0;
...@@ -33,11 +32,17 @@ var currTilt = 40.0; ///<< The tilt angle (in degrees) ...@@ -33,11 +32,17 @@ var currTilt = 40.0; ///<< The tilt angle (in degrees)
var currFollowTilt = 40.0; var currFollowTilt = 40.0;
var currView = null; var currView = null;
var M_PI = 3.14159265;
var planeOrient; var planeOrient;
var planeLoc; var planeLoc;
var aircraft = [];
var attitudes = [];
var locations = [];
var trails = [];
var trail; var trail;
var lineStringPlacemark; var lineStringPlacemark;
var lineStyle; var lineStyle;
...@@ -57,7 +62,10 @@ function init() { ...@@ -57,7 +62,10 @@ function init() {
function setCurrAircraft(id)
{
currAircraft = id;
}
function setGCSHome(lat, lon, alt) function setGCSHome(lat, lon, alt)
{ {
...@@ -90,13 +98,6 @@ function setGCSHome(lat, lon, alt) ...@@ -90,13 +98,6 @@ function setGCSHome(lat, lon, alt)
{ {
homeGroundLevel = alt; homeGroundLevel = alt;
} }
goHome();
} }
function createAircraft(id, type, color) function createAircraft(id, type, color)
...@@ -204,17 +205,19 @@ function setAircraftPositionAttitude(id, lat, lon, alt, roll, pitch, yaw) ...@@ -204,17 +205,19 @@ function setAircraftPositionAttitude(id, lat, lon, alt, roll, pitch, yaw)
currLat = lat; currLat = lat;
currLon = lon; currLon = lon;
currAlt = alt; currAlt = alt;
currFollowHeading = ((yaw/M_PI)+1.0)*360.0;
} }
planeOrient.setRoll(roll); // FIXME Currently invalid conversion from right-handed z-down to z-up frame
planeOrient.setTilt(pitch); planeOrient.setRoll(((roll/M_PI)+1.0)*360.0);
planeOrient.setHeading(yaw); planeOrient.setTilt(((pitch/M_PI)+1.0)*360.0);
planeOrient.setHeading(((yaw/M_PI)+1.0)*360.0);
planeLoc.setLatitude(lat); planeLoc.setLatitude(lat);
planeLoc.setLongitude(lon); planeLoc.setLongitude(lon);
planeLoc.setAltitude(alt); planeLoc.setAltitude(alt);
} }
...@@ -246,24 +249,16 @@ function setCurrentAircraft(id) ...@@ -246,24 +249,16 @@ function setCurrentAircraft(id)
currAircraft = id; currAircraft = id;
} }
function enableFollowing(follow)
{
followEnabled = follow;
}
function updateFollowAircraft() function updateFollowAircraft()
{ {
if (followEnabled)
{
currView = ge.getView().copyAsLookAt(ge.ALTITUDE_ABSOLUTE); currView = ge.getView().copyAsLookAt(ge.ALTITUDE_ABSOLUTE);
currView.setLatitude(currLat); currView.setLatitude(currLat);
currView.setLongitude(currLon); currView.setLongitude(currLon);
currView.setAltitude(currAlt); currView.setAltitude(currAlt);
currView.setRange(currViewRange); currView.setRange(currViewRange);
currView.setTilt(currFollowTilt); currView.setTilt(currFollowTilt);
currView.setHeading(currFollowHeading-90.0);
ge.getView().setAbstractView(currView); ge.getView().setAbstractView(currView);
}
} }
function failureCallback(object) function failureCallback(object)
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
#include <QDir> #include <QDir>
#include <QShowEvent> #include <QShowEvent>
#include <QSettings> #include <QSettings>
#include <QAxObject>
#include <QUuid>
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
...@@ -16,7 +14,12 @@ ...@@ -16,7 +14,12 @@
#include "QGCWebPage.h" #include "QGCWebPage.h"
#endif #endif
#include "QGC.h" #ifdef _MSC_VER
#include <QAxObject>
#include <QUuid>
#endif
#include "QGC.h"
#include "ui_QGCGoogleEarthView.h" #include "ui_QGCGoogleEarthView.h"
#include "QGCGoogleEarthView.h" #include "QGCGoogleEarthView.h"
...@@ -103,8 +106,8 @@ QGCGoogleEarthView::~QGCGoogleEarthView() ...@@ -103,8 +106,8 @@ QGCGoogleEarthView::~QGCGoogleEarthView()
void QGCGoogleEarthView::addUAS(UASInterface* uas) void QGCGoogleEarthView::addUAS(UASInterface* uas)
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
// uasid, type, color (in aarrbbgg format) // uasid, type, color (in aarrbbgg format)
webViewMac->page()->currentFrame()->evaluateJavaScript(QString("createAircraft(%1, %2, %3);").arg(uas->getUASID()).arg(uas->getSystemType()).arg(uas->getColor().name().remove(0, 1).prepend("50"))); webViewMac->page()->currentFrame()->evaluateJavaScript(QString("createAircraft(%1, %2, %3);").arg(uas->getUASID()).arg(uas->getSystemType()).arg(uas->getColor().name().remove(0, 1).prepend("50")));
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER
//if (webViewMac->page()->currentFrame()->evaluateJavaScript("isInitialized();").toBool()) //if (webViewMac->page()->currentFrame()->evaluateJavaScript("isInitialized();").toBool())
...@@ -136,9 +139,9 @@ void QGCGoogleEarthView::updateGlobalPosition(UASInterface* uas, double lat, dou ...@@ -136,9 +139,9 @@ void QGCGoogleEarthView::updateGlobalPosition(UASInterface* uas, double lat, dou
Q_UNUSED(usec); Q_UNUSED(usec);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
webViewMac->page()->currentFrame()->evaluateJavaScript(QString("addTrailPosition(%1, %2, %3, %4);").arg(uas->getUASID()).arg(lat, 0, 'f', 15).arg(lon, 0, 'f', 15).arg(alt, 0, 'f', 15)); webViewMac->page()->currentFrame()->evaluateJavaScript(QString("addTrailPosition(%1, %2, %3, %4);").arg(uas->getUASID()).arg(lat, 0, 'f', 15).arg(lon, 0, 'f', 15).arg(alt, 0, 'f', 15));
//qDebug() << QString("addTrailPosition(%1, %2, %3, %4);").arg(uas->getUASID()).arg(lat, 0, 'f', 15).arg(lon, 0, 'f', 15).arg(alt, 0, 'f', 15); //qDebug() << QString("addTrailPosition(%1, %2, %3, %4);").arg(uas->getUASID()).arg(lat, 0, 'f', 15).arg(lon, 0, 'f', 15).arg(alt, 0, 'f', 15);
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER
//if (webViewMac->page()->currentFrame()->evaluateJavaScript("isInitialized();").toBool()) //if (webViewMac->page()->currentFrame()->evaluateJavaScript("isInitialized();").toBool())
...@@ -185,16 +188,16 @@ void QGCGoogleEarthView::setHome(double lat, double lon, double alt) ...@@ -185,16 +188,16 @@ void QGCGoogleEarthView::setHome(double lat, double lon, double alt)
#endif #endif
} }
void QGCGoogleEarthView::hideEvent(QHideEvent* event) void QGCGoogleEarthView::hideEvent(QHideEvent* event)
{ {
Q_UNUSED(event) updateTimer->stop(); Q_UNUSED(event) updateTimer->stop();
} }
void QGCGoogleEarthView::showEvent(QShowEvent* event) void QGCGoogleEarthView::showEvent(QShowEvent* event)
{ {
// React only to internal (pre-display) // React only to internal (pre-display)
// events // events
Q_UNUSED(event) Q_UNUSED(event)
{ {
// Enable widget, initialize on first run // Enable widget, initialize on first run
if (!webViewInitialized) if (!webViewInitialized)
...@@ -286,9 +289,9 @@ void QGCGoogleEarthView::initializeGoogleEarth() ...@@ -286,9 +289,9 @@ void QGCGoogleEarthView::initializeGoogleEarth()
void QGCGoogleEarthView::updateState() void QGCGoogleEarthView::updateState()
{ {
#if (QGC_EVENTLOOP_DEBUG) #if (QGC_EVENTLOOP_DEBUG)
qDebug() << "EVENTLOOP:" << __FILE__ << __LINE__; qDebug() << "EVENTLOOP:" << __FILE__ << __LINE__;
#endif #endif
if (gEarthInitialized) if (gEarthInitialized)
{ {
int uasId = 0; int uasId = 0;
......
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