Commit 6e5626f9 authored by pixhawk's avatar pixhawk

Working on Google Earth on Windows

parents e84ab17e 43ce5cca
......@@ -297,8 +297,9 @@ win32-msvc2008 {
CONFIG -= console
}
# Special settings for debug
#CONFIG += CONSOLE
debug {
CONFIG += console
}
INCLUDEPATH += $$BASEDIR/lib/sdl/msvc/include \
$$BASEDIR/lib/opal/include \
......@@ -376,6 +377,7 @@ win32-g++ {
debug {
#DESTDIR = $$BUILDDIR/debug
CONFIG += console
}
release {
......
......@@ -1119,41 +1119,9 @@ void MainWindow::loadMAVLinkView()
void MainWindow::presentView()
{
showTheCentralWidget(CENTRAL_3D_LOCAL, currentView);
showTheCentralWidget(CENTRAL_3D_MAP, currentView);
//#ifdef QGC_OSG_ENABLED
// // 3D map
// if (_3DWidget)
// {
// if (centerStack)
// {
// //map3DWidget->setActive(true);
// centerStack->setCurrentWidget(_3DWidget);
// }
// }
//#endif
qDebug() << "LC";
showTheCentralWidget(CENTRAL_LINECHART, currentView);
// FIXME
// if (linechartWidget)
// {
// qDebug () << buildMenuKey (SUB_SECTION_CHECKED,CENTRAL_LINECHART,currentView) <<
// settings.value(buildMenuKey (SUB_SECTION_CHECKED,CENTRAL_LINECHART,currentView)).toBool() ;
// if (settings.value(buildMenuKey (SUB_SECTION_CHECKED,CENTRAL_LINECHART,currentView)).toBool()){
// if (centerStack)
// {
// centerStack->setCurrentWidget(linechartWidget);
// }
// }
// }
// MAP
qDebug() << "MAP";
showTheCentralWidget(CENTRAL_MAP, currentView);
......@@ -1164,16 +1132,17 @@ void MainWindow::presentView()
// HEAD UP DISPLAY
showTheCentralWidget(CENTRAL_HUD, currentView);
// qDebug() << "HUD";
// if (hudWidget){
// qDebug() << buildMenuKey(SUB_SECTION_CHECKED,CENTRAL_HUD,currentView) <<
// settings.value(buildMenuKey (SUB_SECTION_CHECKED,CENTRAL_HUD,currentView)).toBool();
// if (settings.value(buildMenuKey (SUB_SECTION_CHECKED,CENTRAL_HUD,currentView)).toBool()){
// if (centerStack) {
// centerStack->setCurrentWidget(hudWidget);
// }
// }
// }
// GOOGLE EARTH
showTheCentralWidget(CENTRAL_GOOGLE_EARTH, currentView);
// LOCAL 3D VIEW
showTheCentralWidget(CENTRAL_3D_LOCAL, currentView);
// GLOBAL 3D VIEW
showTheCentralWidget(CENTRAL_3D_MAP, currentView);
// Show docked widgets based on current view and autopilot type
......
......@@ -48,6 +48,7 @@ Q3DWidget::Q3DWidget(QWidget* parent)
, robotAttitude(new osg::PositionAttitudeTransform())
, hudGroup(new osg::Switch())
, hudProjectionMatrix(new osg::Projection)
, fps(30.0f)
{
// set initial camera parameters
cameraParams.minZoomRange = 2.0f;
......@@ -70,6 +71,8 @@ Q3DWidget::~Q3DWidget()
void
Q3DWidget::init(float fps)
{
this->fps = fps;
getCamera()->setGraphicsContext(osgGW);
// manually specify near and far clip planes
......@@ -105,6 +108,23 @@ Q3DWidget::init(float fps)
timer.start(static_cast<int>(floorf(1000.0f / fps)));
}
void Q3DWidget::showEvent(QShowEvent* event)
{
// React only to internal (pre/post-display)
// events
if (!event->spontaneous())
{
if (event->type() == QEvent::Hide)
{
timer.stop();
}
else if (event->type() == QEvent::Show)
{
timer.start(static_cast<int>(floorf(1000.0f / fps)));
}
}
}
osg::ref_ptr<osg::Geode>
Q3DWidget::createRobot(void)
{
......
......@@ -257,6 +257,7 @@ protected:
};
CameraParams cameraParams; /**< Struct representing camera parameters. */
float fps;
};
#endif // Q3DWIDGET_H
This diff is collapsed.
......@@ -11,19 +11,36 @@
#ifdef _MSC_VER
#include <ActiveQt/QAxWidget>
#include <ActiveQt/QAxObject>
#include "windows.h"
class QGCWebAxWidget : public QAxWidget
{
public:
//Q_OBJECT
QGCWebAxWidget(QWidget* parent = 0, Qt::WindowFlags f = 0)
: QAxWidget(parent, f)
: QAxWidget(parent, f),
_document(NULL)
{
// Set web browser control
setControl("{8856F961-340A-11D0-A96B-00C04FD705A2}");
//QObject::connect(this, SIGNAL(DocumentComplete(IDispatch*, QVariant&)), this, SLOT(setDocument(IDispatch*, QVariant&)));
}
QAxObject* document()
{
return _document;
}
protected:
void setDocument(IDispatch* dispatch, QVariant& variant)
{
_document = this->querySubObject("Document()");
}
protected:
QAxObject* _document;
virtual bool translateKeyEvent(int message, int keycode) const
{
if (message >= WM_KEYFIRST && message <= WM_KEYLAST)
......@@ -54,14 +71,24 @@ public:
public slots:
/** @brief Update the internal state. Does not trigger a redraw */
void updateState();
/** @brief Add a new MAV/UAS to the visualization */
void addUAS(UASInterface* uas);
/** @brief Set the currently selected UAS */
void setActiveUAS(UASInterface* uas);
/** @brief Update the global position */
void updateGlobalPosition(UASInterface* uas, double lat, double lon, double alt, quint64 usec);
/** @brief Show the vehicle trail */
void showTrail(bool state);
/** @brief Show the waypoints */
void showWaypoints(bool state);
/** @brief Follow the aircraft during flight */
void follow(bool follow);
/** @brief Go to the home location */
void goHome();
/** @brief Set the home location */
void setHome(double lat, double lon, double alt);
/** @brief Initialize Google Earth */
void initializeGoogleEarth();
protected:
void changeEvent(QEvent *e);
......@@ -71,6 +98,7 @@ protected:
bool followCamera;
bool trailEnabled;
bool webViewInitialized;
bool gEarthInitialized;
#ifdef _MSC_VER
QGCWebAxWidget* webViewWin;
#endif
......
This diff is collapsed.
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