Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
958bd1de
Commit
958bd1de
authored
Dec 06, 2010
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Slight improved to Google Earth widget
parent
e2d84e55
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
142 additions
and
29 deletions
+142
-29
qgroundcontrol.pro
qgroundcontrol.pro
+2
-1
QGCGoogleEarthControls.ui
src/ui/map3D/QGCGoogleEarthControls.ui
+21
-0
QGCGoogleEarthView.cc
src/ui/map3D/QGCGoogleEarthView.cc
+40
-9
QGCGoogleEarthView.h
src/ui/map3D/QGCGoogleEarthView.h
+26
-3
QGCGoogleEarthView.ui
src/ui/map3D/QGCGoogleEarthView.ui
+53
-16
No files found.
qgroundcontrol.pro
View file @
958bd1de
...
@@ -142,7 +142,8 @@ FORMS += src/ui/MainWindow.ui \
...
@@ -142,7 +142,8 @@ FORMS += src/ui/MainWindow.ui \
src
/
ui
/
QMap3D
.
ui
\
src
/
ui
/
QMap3D
.
ui
\
src
/
ui
/
QGCWebView
.
ui
\
src
/
ui
/
QGCWebView
.
ui
\
src
/
ui
/
map3D
/
QGCGoogleEarthView
.
ui
\
src
/
ui
/
map3D
/
QGCGoogleEarthView
.
ui
\
src
/
ui
/
map3D
/
QGCGoogleEarthViewWin
.
ui
src
/
ui
/
map3D
/
QGCGoogleEarthViewWin
.
ui
\
src
/
ui
/
map3D
/
QGCGoogleEarthControls
.
ui
#
src
/
ui
/
WaypointGlobalView
.
ui
#
src
/
ui
/
WaypointGlobalView
.
ui
INCLUDEPATH
+=
src
\
INCLUDEPATH
+=
src
\
...
...
src/ui/map3D/QGCGoogleEarthControls.ui
0 → 100644
View file @
958bd1de
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>Form</class>
<widget class="QWidget" name="Form" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
</widget>
<pixmapfunction></pixmapfunction>
<connections/>
</ui>
src/ui/map3D/QGCGoogleEarthView.cc
View file @
958bd1de
...
@@ -6,7 +6,9 @@
...
@@ -6,7 +6,9 @@
#include "QGCGoogleEarthView.h"
#include "QGCGoogleEarthView.h"
#include "QGCWebPage.h"
#include "QGCWebPage.h"
#include "UASManager.h"
#include "UASManager.h"
#include "ui_QGCGoogleEarthControls.h"
#if (defined Q_OS_WIN) && !(defined __MINGW32__)
#if (defined Q_OS_WIN) && !(defined __MINGW32__)
#include "ui_QGCGoogleEarthViewWin.h"
#else
#else
#include "ui_QGCGoogleEarthView.h"
#include "ui_QGCGoogleEarthView.h"
#endif
#endif
...
@@ -16,20 +18,34 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) :
...
@@ -16,20 +18,34 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) :
updateTimer
(
new
QTimer
(
this
)),
updateTimer
(
new
QTimer
(
this
)),
mav
(
NULL
),
mav
(
NULL
),
followCamera
(
true
),
followCamera
(
true
),
#if (defined Q_OS_WIN) && !(defined __MINGW32__)
#if (defined Q_OS_MAC)
webViewMac
(
new
QWebView
(
this
)),
#endif
#if (defined Q_OS_WIN) & !(defined __MINGW32__)
webViewWin
(
new
QGCWebAxWidget
(
this
)),
webViewWin
(
new
QGCWebAxWidget
(
this
)),
#else
#else
ui
(
new
Ui
::
QGCGoogleEarthView
)
ui
(
new
Ui
::
QGCGoogleEarthView
)
#endif
#endif
{
{
#if (defined Q_OS_WIN) &
&
!(defined __MINGW32__)
#if (defined Q_OS_WIN) & !(defined __MINGW32__)
// Create layout and attach webViewWin
// Create layout and attach webViewWin
#else
#else
#endif
ui
->
setupUi
(
this
);
ui
->
setupUi
(
this
);
ui
->
webView
->
setPage
(
new
QGCWebPage
(
ui
->
webView
));
ui
->
webView
->
settings
()
->
setAttribute
(
QWebSettings
::
PluginsEnabled
,
true
);
ui
->
webView
->
load
(
QUrl
(
"earth.html"
));
#if (defined Q_OS_MAC)
ui
->
webViewLayout
->
addWidget
(
webViewMac
);
webViewMac
->
setPage
(
new
QGCWebPage
(
webViewMac
));
webViewMac
->
settings
()
->
setAttribute
(
QWebSettings
::
PluginsEnabled
,
true
);
webViewMac
->
load
(
QUrl
(
"earth.html"
));
#endif
#if (defined Q_OS_WIN) & !(defined __MINGW32__)
webViewWin
->
load
(
QUrl
(
"earth.html"
));
#endif
#if ((defined Q_OS_MAC) | ((defined Q_OS_WIN) & !(defined __MINGW32__)))
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
setActiveUAS
(
UASInterface
*
)));
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
setActiveUAS
(
UASInterface
*
)));
connect
(
updateTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
updateState
()));
connect
(
updateTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
updateState
()));
updateTimer
->
start
(
200
);
updateTimer
->
start
(
200
);
...
@@ -54,14 +70,29 @@ void QGCGoogleEarthView::setActiveUAS(UASInterface* uas)
...
@@ -54,14 +70,29 @@ void QGCGoogleEarthView::setActiveUAS(UASInterface* uas)
mav
=
uas
;
mav
=
uas
;
}
}
void
QGCGoogleEarthView
::
showTrail
(
int
state
)
{
}
void
QGCGoogleEarthView
::
showWaypoints
(
int
state
)
{
}
void
QGCGoogleEarthView
::
follow
(
bool
follow
)
{
}
void
QGCGoogleEarthView
::
updateState
()
void
QGCGoogleEarthView
::
updateState
()
{
{
if
(
ui
->
webView
->
page
()
->
currentFrame
()
->
evaluateJavaScript
(
"isInitialized();"
).
toBool
())
if
(
webViewMac
->
page
()
->
currentFrame
()
->
evaluateJavaScript
(
"isInitialized();"
).
toBool
())
{
{
static
bool
initialized
=
false
;
static
bool
initialized
=
false
;
if
(
!
initialized
)
if
(
!
initialized
)
{
{
ui
->
webView
->
page
()
->
currentFrame
()
->
evaluateJavaScript
(
"setGCSHome(22.679833,8.549444, 470);"
);
webViewMac
->
page
()
->
currentFrame
()
->
evaluateJavaScript
(
"setGCSHome(22.679833,8.549444, 470);"
);
initialized
=
true
;
initialized
=
true
;
}
}
int
uasId
=
0
;
int
uasId
=
0
;
...
@@ -83,7 +114,7 @@ void QGCGoogleEarthView::updateState()
...
@@ -83,7 +114,7 @@ void QGCGoogleEarthView::updateState()
pitch
=
mav
->
getPitch
();
pitch
=
mav
->
getPitch
();
yaw
=
mav
->
getYaw
();
yaw
=
mav
->
getYaw
();
}
}
ui
->
webView
->
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
)
...
@@ -94,7 +125,7 @@ void QGCGoogleEarthView::updateState()
...
@@ -94,7 +125,7 @@ void QGCGoogleEarthView::updateState()
if
(
followCamera
)
if
(
followCamera
)
{
{
ui
->
webView
->
page
()
->
currentFrame
()
->
evaluateJavaScript
(
QString
(
"updateFollowAircraft()"
));
webViewMac
->
page
()
->
currentFrame
()
->
evaluateJavaScript
(
QString
(
"updateFollowAircraft()"
));
}
}
}
}
}
}
...
...
src/ui/map3D/QGCGoogleEarthView.h
View file @
958bd1de
...
@@ -5,6 +5,10 @@
...
@@ -5,6 +5,10 @@
#include <QTimer>
#include <QTimer>
#include <UASInterface.h>
#include <UASInterface.h>
#if (defined Q_OS_MAC)
#include <QWebView>
#endif
#if (defined Q_OS_WIN) && !(defined __MINGW32__)
#if (defined Q_OS_WIN) && !(defined __MINGW32__)
QGCWebAxWidget
*
webViewWin
;
QGCWebAxWidget
*
webViewWin
;
#include <ActiveQt/QAxWidget>
#include <ActiveQt/QAxWidget>
...
@@ -30,7 +34,12 @@ protected:
...
@@ -30,7 +34,12 @@ protected:
};
};
#else
#else
namespace
Ui
{
namespace
Ui
{
class
QGCGoogleEarthControls
;
#if (defined Q_OS_WIN) && !(defined __MINGW32__)
class
QGCGoogleEarthViewWin
;
#else
class
QGCGoogleEarthView
;
class
QGCGoogleEarthView
;
#endif
}
}
#endif
#endif
...
@@ -47,17 +56,31 @@ public slots:
...
@@ -47,17 +56,31 @@ public slots:
void
updateState
();
void
updateState
();
/** @brief Set the currently selected UAS */
/** @brief Set the currently selected UAS */
void
setActiveUAS
(
UASInterface
*
uas
);
void
setActiveUAS
(
UASInterface
*
uas
);
/** @brief Show the vehicle trail */
void
showTrail
(
int
state
);
/** @brief Show the waypoints */
void
showWaypoints
(
int
state
);
/** @brief Follow the aircraft during flight */
void
follow
(
bool
follow
);
protected:
protected:
void
changeEvent
(
QEvent
*
e
);
void
changeEvent
(
QEvent
*
e
);
QTimer
*
updateTimer
;
QTimer
*
updateTimer
;
UASInterface
*
mav
;
UASInterface
*
mav
;
bool
followCamera
;
bool
followCamera
;
#if (defined Q_OS_WIN) && !(defined __MINGW32__)
WebAxWidget
*
webViewWin
;
#endif
#if (defined Q_OS_MAC)
QWebView
*
webViewMac
;
#endif
#if (defined Q_OS_WIN) && !(defined __MINGW32__)
#else
private:
private:
Ui
::
QGCGoogleEarthView
*
ui
;
Ui
::
QGCGoogleEarthControls
*
controls
;
#if (defined Q_OS_WIN) && !(defined __MINGW32__)
Ui
::
QGCGoogleEarthViewWin
*
ui
;
#else
Ui
::
QGCGoogleEarthView
*
ui
;
#endif
#endif
};
};
...
...
src/ui/map3D/QGCGoogleEarthView.ui
View file @
958bd1de
...
@@ -6,35 +6,72 @@
...
@@ -6,35 +6,72 @@
<rect>
<rect>
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
400
</width>
<width>
597
</width>
<height>
300
</height>
<height>
300
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"windowTitle"
>
<property
name=
"windowTitle"
>
<string>
Form
</string>
<string>
Form
</string>
</property>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<property
name=
"horizontalSpacing"
>
<number>
10
</number>
</property>
<property
name=
"verticalSpacing"
>
<number>
5
</number>
</property>
<property
name=
"margin"
>
<property
name=
"margin"
>
<number>
0
</number>
<number>
2
</number>
</property>
<item
row=
"0"
column=
"0"
colspan=
"6"
>
<layout
class=
"QVBoxLayout"
name=
"webViewLayout"
/>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QComboBox"
name=
"mavComboBox"
/>
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QPushButton"
name=
"goHomeButton"
>
<property
name=
"text"
>
<string>
Home
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"2"
>
<widget
class=
"QCheckBox"
name=
"followAirplaneCheckbox"
>
<property
name=
"text"
>
<string>
Follow
</string>
</property>
</property>
<item>
</widget>
<widget
class=
"QWebView"
name=
"webView"
>
</item>
<property
name=
"url"
>
<item
row=
"1"
column=
"3"
>
<url>
<widget
class=
"QCheckBox"
name=
"trailCheckbox"
>
<string>
about:blank
</string>
<property
name=
"text"
>
</url>
<string>
Trail
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"4"
>
<widget
class=
"QPushButton"
name=
"clearWPButton"
>
<property
name=
"text"
>
<string>
Clear WPs
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"1"
column=
"5"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
177
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
</layout>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>
QWebView
</class>
<extends>
QWidget
</extends>
<header>
QtWebKit/QWebView
</header>
</customwidget>
</customwidgets>
<resources/>
<resources/>
<connections/>
<connections/>
</ui>
</ui>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment