4 changed files with 394 additions and 320 deletions
@ -1,310 +1,360 @@ |
|||||||
#include <QApplication> |
#include <QApplication> |
||||||
#include <QDir> |
#include <QDir> |
||||||
#include <QShowEvent> |
#include <QShowEvent> |
||||||
#include <QSettings> |
#include <QSettings> |
||||||
|
#include <QAxObject> |
||||||
#include <QDebug> |
#include <QUuid> |
||||||
#include "UASManager.h" |
|
||||||
|
#include <QDebug> |
||||||
#ifdef Q_OS_MAC |
#include <QFile> |
||||||
#include <QWebFrame> |
#include <QTextStream> |
||||||
#include <QWebPage> |
#include "UASManager.h" |
||||||
#include "QGCWebPage.h" |
|
||||||
#endif |
#ifdef Q_OS_MAC |
||||||
|
#include <QWebFrame> |
||||||
|
#include <QWebPage> |
||||||
|
#include "QGCWebPage.h" |
||||||
|
#endif |
||||||
|
|
||||||
#include "QGC.h" |
#include "QGC.h" |
||||||
#include "ui_QGCGoogleEarthView.h" |
#include "ui_QGCGoogleEarthView.h" |
||||||
#include "QGCGoogleEarthView.h" |
#include "QGCGoogleEarthView.h" |
||||||
|
|
||||||
#define QGCGOOGLEEARTHVIEWSETTINGS QString("GoogleEarthViewSettings_") |
#define QGCGOOGLEEARTHVIEWSETTINGS QString("GoogleEarthViewSettings_") |
||||||
|
|
||||||
QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) : |
QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) : |
||||||
QWidget(parent), |
QWidget(parent), |
||||||
updateTimer(new QTimer(this)), |
updateTimer(new QTimer(this)), |
||||||
refreshRateMs(80), |
refreshRateMs(80), |
||||||
mav(NULL), |
mav(NULL), |
||||||
followCamera(true), |
followCamera(true), |
||||||
trailEnabled(true), |
trailEnabled(true), |
||||||
webViewInitialized(false), |
webViewInitialized(false), |
||||||
gEarthInitialized(false), |
gEarthInitialized(false), |
||||||
#if (defined Q_OS_MAC) |
#if (defined Q_OS_MAC) |
||||||
webViewMac(new QWebView(this)), |
webViewMac(new QWebView(this)), |
||||||
#endif |
#endif |
||||||
#ifdef _MSC_VER |
#ifdef _MSC_VER |
||||||
webViewWin(new QGCWebAxWidget(this)), |
webViewWin(new QGCWebAxWidget(this)), |
||||||
#endif |
#endif |
||||||
#if (defined _MSC_VER) |
#if (defined _MSC_VER) |
||||||
ui(new Ui::QGCGoogleEarthView) |
ui(new Ui::QGCGoogleEarthView) |
||||||
#else |
#else |
||||||
ui(new Ui::QGCGoogleEarthView) |
ui(new Ui::QGCGoogleEarthView) |
||||||
#endif |
#endif |
||||||
{ |
{ |
||||||
#ifdef _MSC_VER |
#ifdef _MSC_VER |
||||||
// Create layout and attach webViewWin
|
// Create layout and attach webViewWin
|
||||||
#else |
|
||||||
#endif |
/*
|
||||||
|
QFile file("doc.html"); |
||||||
// Load settings
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) |
||||||
QSettings settings; |
qDebug() << __FILE__ << __LINE__ << "Could not open log file"; |
||||||
followCamera = settings.value(QGCGOOGLEEARTHVIEWSETTINGS + "follow", followCamera).toBool(); |
|
||||||
trailEnabled = settings.value(QGCGOOGLEEARTHVIEWSETTINGS + "trail", trailEnabled).toBool(); |
QTextStream out(&file); |
||||||
|
out << webViewWin->generateDocumentation(); |
||||||
ui->setupUi(this); |
out.flush(); |
||||||
#if (defined Q_OS_MAC) |
file.flush(); |
||||||
ui->webViewLayout->addWidget(webViewMac); |
file.close();*/ |
||||||
connect(webViewMac, SIGNAL(loadFinished(bool)), this, SLOT(initializeGoogleEarth(bool))); |
|
||||||
#endif |
|
||||||
|
#else |
||||||
#ifdef _MSC_VER |
#endif |
||||||
ui->webViewLayout->addWidget(webViewWin); |
|
||||||
#endif |
// Load settings
|
||||||
|
QSettings settings; |
||||||
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); |
followCamera = settings.value(QGCGOOGLEEARTHVIEWSETTINGS + "follow", followCamera).toBool(); |
||||||
connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateState())); |
trailEnabled = settings.value(QGCGOOGLEEARTHVIEWSETTINGS + "trail", trailEnabled).toBool(); |
||||||
|
|
||||||
// Follow checkbox
|
ui->setupUi(this); |
||||||
ui->followAirplaneCheckbox->setChecked(followCamera); |
#if (defined Q_OS_MAC) |
||||||
connect(ui->followAirplaneCheckbox, SIGNAL(toggled(bool)), this, SLOT(follow(bool))); |
ui->webViewLayout->addWidget(webViewMac); |
||||||
|
connect(webViewMac, SIGNAL(loadFinished(bool)), this, SLOT(initializeGoogleEarth(bool))); |
||||||
// Trail checkbox
|
#endif |
||||||
ui->trailCheckbox->setChecked(trailEnabled); |
|
||||||
connect(ui->trailCheckbox, SIGNAL(toggled(bool)), this, SLOT(showTrail(bool))); |
#ifdef _MSC_VER |
||||||
|
ui->webViewLayout->addWidget(webViewWin); |
||||||
// Go home
|
#endif |
||||||
connect(ui->goHomeButton, SIGNAL(clicked()), this, SLOT(goHome())); |
|
||||||
} |
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); |
||||||
|
connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateState())); |
||||||
QGCGoogleEarthView::~QGCGoogleEarthView() |
|
||||||
{ |
// Follow checkbox
|
||||||
QSettings settings; |
ui->followAirplaneCheckbox->setChecked(followCamera); |
||||||
settings.setValue(QGCGOOGLEEARTHVIEWSETTINGS + "follow", followCamera); |
connect(ui->followAirplaneCheckbox, SIGNAL(toggled(bool)), this, SLOT(follow(bool))); |
||||||
settings.setValue(QGCGOOGLEEARTHVIEWSETTINGS + "trail", trailEnabled); |
|
||||||
settings.sync(); |
// Trail checkbox
|
||||||
delete ui; |
ui->trailCheckbox->setChecked(trailEnabled); |
||||||
} |
connect(ui->trailCheckbox, SIGNAL(toggled(bool)), this, SLOT(showTrail(bool))); |
||||||
|
|
||||||
void QGCGoogleEarthView::addUAS(UASInterface* uas) |
// Go home
|
||||||
{ |
connect(ui->goHomeButton, SIGNAL(clicked()), this, SLOT(goHome())); |
||||||
#ifdef Q_OS_MAC |
} |
||||||
|
|
||||||
|
QGCGoogleEarthView::~QGCGoogleEarthView() |
||||||
|
{ |
||||||
|
QSettings settings; |
||||||
|
settings.setValue(QGCGOOGLEEARTHVIEWSETTINGS + "follow", followCamera); |
||||||
|
settings.setValue(QGCGOOGLEEARTHVIEWSETTINGS + "trail", trailEnabled); |
||||||
|
settings.sync(); |
||||||
|
delete ui; |
||||||
|
} |
||||||
|
|
||||||
|
void QGCGoogleEarthView::addUAS(UASInterface* uas) |
||||||
|
{ |
||||||
|
#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())
|
||||||
#endif |
#endif |
||||||
|
|
||||||
// Automatically receive further position updates
|
// Automatically receive further position updates
|
||||||
connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); |
connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); |
||||||
} |
} |
||||||
|
|
||||||
void QGCGoogleEarthView::setActiveUAS(UASInterface* uas) |
void QGCGoogleEarthView::setActiveUAS(UASInterface* uas) |
||||||
{ |
{ |
||||||
if (uas) |
if (uas) |
||||||
{ |
{ |
||||||
mav = uas; |
mav = uas; |
||||||
#ifdef Q_OS_MAC |
#ifdef Q_OS_MAC |
||||||
if (webViewMac->page()->currentFrame()->evaluateJavaScript("isInitialized();").toBool()) |
if (webViewMac->page()->currentFrame()->evaluateJavaScript("isInitialized();").toBool()) |
||||||
{ |
{ |
||||||
webViewMac->page()->currentFrame()->evaluateJavaScript(QString("setCurrAircraft(%1);").arg(uas->getUASID())); |
webViewMac->page()->currentFrame()->evaluateJavaScript(QString("setCurrAircraft(%1);").arg(uas->getUASID())); |
||||||
} |
} |
||||||
#endif |
#endif |
||||||
#ifdef _MSC_VER |
#ifdef _MSC_VER |
||||||
//if (webViewMac->page()->currentFrame()->evaluateJavaScript("isInitialized();").toBool())
|
//if (webViewMac->page()->currentFrame()->evaluateJavaScript("isInitialized();").toBool())
|
||||||
#endif |
#endif |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
void QGCGoogleEarthView::updateGlobalPosition(UASInterface* uas, double lat, double lon, double alt, quint64 usec) |
void QGCGoogleEarthView::updateGlobalPosition(UASInterface* uas, double lat, double lon, double alt, quint64 usec) |
||||||
{ |
{ |
||||||
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())
|
||||||
#endif |
#endif |
||||||
} |
} |
||||||
|
|
||||||
void QGCGoogleEarthView::showTrail(bool state) |
void QGCGoogleEarthView::showTrail(bool state) |
||||||
{ |
{ |
||||||
ui->trailCheckbox->setChecked(state); |
ui->trailCheckbox->setChecked(state); |
||||||
} |
} |
||||||
|
|
||||||
void QGCGoogleEarthView::showWaypoints(bool state) |
void QGCGoogleEarthView::showWaypoints(bool state) |
||||||
{ |
{ |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
void QGCGoogleEarthView::follow(bool follow) |
void QGCGoogleEarthView::follow(bool follow) |
||||||
{ |
{ |
||||||
ui->followAirplaneCheckbox->setChecked(follow); |
ui->followAirplaneCheckbox->setChecked(follow); |
||||||
followCamera = follow; |
followCamera = follow; |
||||||
} |
} |
||||||
|
|
||||||
void QGCGoogleEarthView::goHome() |
void QGCGoogleEarthView::goHome() |
||||||
{ |
{ |
||||||
// Disable follow and update
|
// Disable follow and update
|
||||||
follow(false); |
follow(false); |
||||||
updateState(); |
updateState(); |
||||||
// Go to home location
|
// Go to home location
|
||||||
#ifdef Q_OS_MAC |
#ifdef Q_OS_MAC |
||||||
webViewMac->page()->currentFrame()->evaluateJavaScript("goHome();"); |
webViewMac->page()->currentFrame()->evaluateJavaScript("goHome();"); |
||||||
#endif |
#endif |
||||||
#ifdef _MSC_VER |
#ifdef _MSC_VER |
||||||
webViewWin.dynamicCall("InvokeScript(\"goHome\");"); |
webViewWin->dynamicCall("InvokeScript(\"goHome\");"); |
||||||
#endif |
#endif |
||||||
} |
} |
||||||
|
|
||||||
void QGCGoogleEarthView::setHome(double lat, double lon, double alt) |
void QGCGoogleEarthView::setHome(double lat, double lon, double alt) |
||||||
{ |
{ |
||||||
#ifdef Q_OS_MAC |
#ifdef Q_OS_MAC |
||||||
webViewMac->page()->currentFrame()->evaluateJavaScript(QString("setGCSHome(%1,%2,%3);").arg(lat, 0, 'f', 15).arg(lon, 0, 'f', 15).arg(alt, 0, 'f', 15)); |
webViewMac->page()->currentFrame()->evaluateJavaScript(QString("setGCSHome(%1,%2,%3);").arg(lat, 0, 'f', 15).arg(lon, 0, 'f', 15).arg(alt, 0, 'f', 15)); |
||||||
#endif |
#endif |
||||||
#ifdef _MSC_VER |
#ifdef _MSC_VER |
||||||
webViewWin.dynamicCall(QString("InvokeScript(\"setGCSHome\", %1, %2, %3);").arg(lat, 0, 'f', 15).arg(lon, 0, 'f', 15).arg(alt, 0, 'f', 15)); |
webViewWin->dynamicCall((QString("InvokeScript(\"setGCSHome\", %1, %2, %3)").arg(lat, 0, 'f', 15).arg(lon, 0, 'f', 15).arg(alt, 0, 'f', 15)).toStdString().c_str()); |
||||||
#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) |
||||||
{ |
{ |
||||||
#if (defined Q_OS_MAC) |
#if (defined Q_OS_MAC) |
||||||
webViewMac->setPage(new QGCWebPage(webViewMac)); |
webViewMac->setPage(new QGCWebPage(webViewMac)); |
||||||
webViewMac->settings()->setAttribute(QWebSettings::PluginsEnabled, true); |
webViewMac->settings()->setAttribute(QWebSettings::PluginsEnabled, true); |
||||||
webViewMac->load(QUrl("earth.html")); |
webViewMac->load(QUrl("earth.html")); |
||||||
#endif |
#endif |
||||||
|
|
||||||
#ifdef _MSC_VER |
#ifdef _MSC_VER |
||||||
//webViewWin->dynamicCall("GoHome()");
|
//webViewWin->dynamicCall("GoHome()");
|
||||||
webViewWin->dynamicCall("Navigate(const QString&)", QApplication::applicationDirPath() + "/earth.html"); |
webViewWin->dynamicCall("Navigate(const QString&)", QApplication::applicationDirPath() + "/earth.html"); |
||||||
#endif |
/*
|
||||||
|
|
||||||
webViewInitialized = true; |
Sleep(4000); |
||||||
// Reloading the webpage, this resets Google Earth
|
|
||||||
gEarthInitialized = false; |
|
||||||
|
QAxObject* doc = webViewWin->querySubObject("Document()"); |
||||||
QTimer::singleShot(1000, this, SLOT(initializeGoogleEarth())); |
IUnknown* winDoc = NULL; |
||||||
updateTimer->start(refreshRateMs); |
doc->queryInterface(QUuid("{25336920-03F9-11CF-8FD0-00AA00686F13}"), (void**)(&winDoc)); |
||||||
} |
//if (winDoc)
|
||||||
} |
{ |
||||||
} |
doc = new QAxObject(winDoc, webViewWin); |
||||||
|
} |
||||||
void QGCGoogleEarthView::initializeGoogleEarth() |
|
||||||
{ |
QFile file("ie-doc.html"); |
||||||
if (!gEarthInitialized) |
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) |
||||||
{ |
qDebug() << __FILE__ << __LINE__ << "Could not open log file"; |
||||||
#ifdef Q_OS_MAC |
|
||||||
if (!webViewMac->page()->currentFrame()->evaluateJavaScript("isInitialized();").toBool()) |
QTextStream out(&file); |
||||||
#endif |
out << doc->generateDocumentation(); |
||||||
#ifdef _MSC_VER |
out.flush(); |
||||||
//if (!webViewMac->page()->currentFrame()->evaluateJavaScript("isInitialized();").toBool())
|
file.flush(); |
||||||
#endif |
file.close(); |
||||||
{ |
while(1); |
||||||
QTimer::singleShot(200, this, SLOT(initializeGoogleEarth())); |
*/ |
||||||
} |
|
||||||
else |
#endif |
||||||
{ |
|
||||||
// Set home location
|
webViewInitialized = true; |
||||||
setHome(47.3769, 8.549444, 500); |
// Reloading the webpage, this resets Google Earth
|
||||||
|
gEarthInitialized = false; |
||||||
// Move to home location
|
|
||||||
goHome(); |
QTimer::singleShot(1000, this, SLOT(initializeGoogleEarth())); |
||||||
|
updateTimer->start(refreshRateMs); |
||||||
// Set current UAS
|
} |
||||||
setActiveUAS(mav); |
} |
||||||
|
} |
||||||
// Add all MAVs
|
|
||||||
QList<UASInterface*> mavs = UASManager::instance()->getUASList(); |
void QGCGoogleEarthView::initializeGoogleEarth() |
||||||
foreach (UASInterface* mav, mavs) |
{ |
||||||
{ |
if (!gEarthInitialized) |
||||||
addUAS(mav); |
{ |
||||||
} |
#ifdef Q_OS_MAC |
||||||
|
if (!webViewMac->page()->currentFrame()->evaluateJavaScript("isInitialized();").toBool()) |
||||||
// Add any further MAV automatically
|
#endif |
||||||
connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(addUAS(UASInterface*))); |
#ifdef _MSC_VER |
||||||
|
if (!webViewWin->dynamicCall("InvokeScript(const QString&)", QString("isInitialized")).toBool()) |
||||||
gEarthInitialized = true; |
#endif |
||||||
} |
{ |
||||||
} |
QTimer::singleShot(200, this, SLOT(initializeGoogleEarth())); |
||||||
} |
} |
||||||
|
else |
||||||
void QGCGoogleEarthView::updateState() |
{ |
||||||
{ |
// Set home location
|
||||||
|
setHome(47.3769, 8.549444, 500); |
||||||
|
|
||||||
|
// Move to home location
|
||||||
|
goHome(); |
||||||
|
|
||||||
|
// Set current UAS
|
||||||
|
setActiveUAS(mav); |
||||||
|
|
||||||
|
// Add all MAVs
|
||||||
|
QList<UASInterface*> mavs = UASManager::instance()->getUASList(); |
||||||
|
foreach (UASInterface* mav, mavs) |
||||||
|
{ |
||||||
|
addUAS(mav); |
||||||
|
} |
||||||
|
|
||||||
|
// Add any further MAV automatically
|
||||||
|
connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(addUAS(UASInterface*))); |
||||||
|
|
||||||
|
gEarthInitialized = true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
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; |
||||||
double lat = 47.3769; |
double lat = 47.3769; |
||||||
double lon = 8.549444; |
double lon = 8.549444; |
||||||
double alt = 470.0; |
double alt = 470.0; |
||||||
|
|
||||||
float roll = 0.0f; |
float roll = 0.0f; |
||||||
float pitch = 0.0f; |
float pitch = 0.0f; |
||||||
float yaw = 0.0f; |
float yaw = 0.0f; |
||||||
|
|
||||||
// Update all MAVs
|
// Update all MAVs
|
||||||
QList<UASInterface*> mavs = UASManager::instance()->getUASList(); |
QList<UASInterface*> mavs = UASManager::instance()->getUASList(); |
||||||
foreach (UASInterface* mav, mavs) |
foreach (UASInterface* mav, mavs) |
||||||
{ |
{ |
||||||
uasId = mav->getUASID(); |
uasId = mav->getUASID(); |
||||||
lat = mav->getLatitude(); |
lat = mav->getLatitude(); |
||||||
lon = mav->getLongitude(); |
lon = mav->getLongitude(); |
||||||
alt = mav->getAltitude(); |
alt = mav->getAltitude(); |
||||||
roll = mav->getRoll(); |
roll = mav->getRoll(); |
||||||
pitch = mav->getPitch(); |
pitch = mav->getPitch(); |
||||||
yaw = mav->getYaw(); |
yaw = mav->getYaw(); |
||||||
|
|
||||||
#ifdef Q_OS_MAC |
#ifdef Q_OS_MAC |
||||||
webViewMac->page()->currentFrame()->evaluateJavaScript(QString("setAircraftPositionAttitude(%1, %2, %3, %4, %6, %7, %8);") |
webViewMac->page()->currentFrame()->evaluateJavaScript(QString("setAircraftPositionAttitude(%1, %2, %3, %4, %6, %7, %8);") |
||||||
.arg(uasId) |
.arg(uasId) |
||||||
.arg(lat) |
.arg(lat) |
||||||
.arg(lon) |
.arg(lon) |
||||||
.arg(alt+500) |
.arg(alt+500) |
||||||
.arg(roll) |
.arg(roll) |
||||||
.arg(pitch) |
.arg(pitch) |
||||||
.arg(yaw)); |
.arg(yaw)); |
||||||
#endif |
#endif |
||||||
#ifdef _MSC_VER |
#ifdef _MSC_VER |
||||||
|
webViewWin->dynamicCall((QString("InvokeScript(\"setAircraftPositionAttitude\", %1, %2, %3, %4, %6, %7, %8);") |
||||||
#endif |
.arg(uasId) |
||||||
} |
.arg(lat) |
||||||
|
.arg(lon) |
||||||
if (followCamera) |
.arg(alt+500) |
||||||
{ |
.arg(roll) |
||||||
#ifdef Q_OS_MAC |
.arg(pitch) |
||||||
webViewMac->page()->currentFrame()->evaluateJavaScript(QString("updateFollowAircraft()")); |
.arg(yaw)).toStdString().c_str()); |
||||||
#endif |
#endif |
||||||
#ifdef _MSC_VER |
} |
||||||
#endif |
|
||||||
} |
if (followCamera) |
||||||
} |
{ |
||||||
} |
#ifdef Q_OS_MAC |
||||||
|
webViewMac->page()->currentFrame()->evaluateJavaScript(QString("updateFollowAircraft()")); |
||||||
|
#endif |
||||||
void QGCGoogleEarthView::changeEvent(QEvent *e) |
#ifdef _MSC_VER |
||||||
{ |
webViewWin->dynamicCall("InvokeScript(\"updateFollowAircraft\");"); |
||||||
QWidget::changeEvent(e); |
#endif |
||||||
switch (e->type()) { |
} |
||||||
case QEvent::LanguageChange: |
} |
||||||
ui->retranslateUi(this); |
} |
||||||
break; |
|
||||||
default: |
|
||||||
break; |
void QGCGoogleEarthView::changeEvent(QEvent *e) |
||||||
} |
{ |
||||||
} |
QWidget::changeEvent(e); |
||||||
|
switch (e->type()) { |
||||||
|
case QEvent::LanguageChange: |
||||||
|
ui->retranslateUi(this); |
||||||
|
break; |
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
Loading…
Reference in new issue