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
6c5ff745
Commit
6c5ff745
authored
Feb 17, 2011
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fully working drag and drop for Google Earth
parent
4e5475a3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
102 additions
and
9 deletions
+102
-9
earth.html
images/earth.html
+30
-2
UAS.cc
src/uas/UAS.cc
+1
-1
QGCParamWidget.cc
src/ui/QGCParamWidget.cc
+1
-1
WaypointView.ui
src/ui/WaypointView.ui
+1
-1
QGCGoogleEarthView.cc
src/ui/map3D/QGCGoogleEarthView.cc
+46
-1
QGCGoogleEarthView.h
src/ui/map3D/QGCGoogleEarthView.h
+13
-0
QGCGoogleEarthView.ui
src/ui/map3D/QGCGoogleEarthView.ui
+10
-3
No files found.
images/earth.html
View file @
6c5ff745
...
...
@@ -37,6 +37,11 @@ var currTilt = 40.0; ///<< The tilt angle (in degrees)
var
currFollowTilt
=
40.0
;
var
currView
=
null
;
var
viewMode
=
0
;
var
lastTilt
=
0
;
var
lastRoll
=
0
;
var
lastHeading
=
0
;
var
M_PI
=
3.14159265
;
...
...
@@ -486,11 +491,34 @@ function setCurrentAircraft(id)
/** @brief Set the current view mode
*
* @param mode 0:
map view, 1: chase cam, fixed, 2: chase cam, free
* @param mode 0:
side map view, 1: top/north map view, 2: fixed chase cam, 3: free chase cam
*/
function
setViewMode
(
mode
)
{
viewMode
=
mode
;
var
currView
=
ge
.
getView
().
copyAsLookAt
(
ge
.
ALTITUDE_ABSOLUTE
);
if
(
mode
==
0
)
{
currView
.
setTilt
(
0
);
currView
.
setHeading
(
0
);
}
if
(
mode
==
1
)
{
lastTilt
=
currView
.
getTilt
();
lastHeading
=
currView
.
getHeading
();
var
lastLat2
=
currView
.
getLatitude
();
var
lastLon2
=
currView
.
getLongitude
();
var
lastAlt2
=
currView
.
getAltitude
();
currView
.
setTilt
(
0
);
currView
.
setHeading
(
0
);
currView
.
setLatitude
(
lastLat2
);
currView
.
setLongitude
(
lastLon2
);
currView
.
setAltitude
(
lastAlt2
);
}
ge
.
getView
().
setAbstractView
(
currView
);
}
function
updateFollowAircraft
()
...
...
src/uas/UAS.cc
View file @
6c5ff745
...
...
@@ -661,7 +661,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
alt
=
0
;
emit
textMessageReceived
(
uasId
,
message
.
compid
,
255
,
"GCS ERROR: RECEIVED NaN FOR ALTITUDE"
);
}
emit
valueChanged
(
uasId
,
"altitude"
,
"m"
,
pos
.
alt
/
(
double
)
1E
7
,
time
);
emit
valueChanged
(
uasId
,
"altitude"
,
"m"
,
pos
.
alt
/
(
double
)
1E
3
,
time
);
// Smaller than threshold and not NaN
if
(
pos
.
v
<
1000000
&&
pos
.
v
==
pos
.
v
)
{
...
...
src/ui/QGCParamWidget.cc
View file @
6c5ff745
...
...
@@ -258,7 +258,7 @@ void QGCParamWidget::addParameter(int uas, int component, int paramCount, int pa
bool
justWritten
=
false
;
bool
writeMismatch
=
false
;
bool
lastWritten
=
false
;
//
bool lastWritten = false;
// Mark this parameter as received in write ACK list
QMap
<
QString
,
float
>*
map
=
transmissionMissingWriteAckPackets
.
value
(
component
);
if
(
map
&&
map
->
contains
(
parameterName
))
...
...
src/ui/WaypointView.ui
View file @
6c5ff745
...
...
@@ -161,7 +161,7 @@ QProgressBar::chunk#thrustBar {
<property
name=
"title"
>
<string/>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
stretch=
"1,1,2,
2
,10,10,10,10,10,10,10,10,10,10,10,10,10,1,1,1,1"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
stretch=
"1,1,2,
3
,10,10,10,10,10,10,10,10,10,10,10,10,10,1,1,1,1"
>
<property
name=
"spacing"
>
<number>
2
</number>
</property>
...
...
src/ui/map3D/QGCGoogleEarthView.cc
View file @
6c5ff745
...
...
@@ -38,6 +38,7 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) :
webViewInitialized
(
false
),
jScriptInitialized
(
false
),
gEarthInitialized
(
false
),
currentViewMode
(
QGCGoogleEarthView
::
VIEW_MODE_SIDE
),
#if (defined Q_OS_MAC)
webViewMac
(
new
QWebView
(
this
)),
#endif
...
...
@@ -85,6 +86,7 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) :
connect
(
updateTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
updateState
()));
connect
(
ui
->
resetButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
reloadHTML
()));
connect
(
ui
->
changeViewButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
toggleViewMode
()));
}
QGCGoogleEarthView
::~
QGCGoogleEarthView
()
...
...
@@ -127,6 +129,46 @@ void QGCGoogleEarthView::setViewRange(float range)
javaScript
(
QString
(
"setViewRange(%1);"
).
arg
(
range
,
0
,
'f'
,
5
));
}
void
QGCGoogleEarthView
::
toggleViewMode
()
{
switch
(
currentViewMode
)
{
case
VIEW_MODE_MAP
:
setViewMode
(
VIEW_MODE_SIDE
);
break
;
case
VIEW_MODE_SIDE
:
setViewMode
(
VIEW_MODE_MAP
);
break
;
case
VIEW_MODE_CHASE_LOCKED
:
setViewMode
(
VIEW_MODE_CHASE_FREE
);
break
;
case
VIEW_MODE_CHASE_FREE
:
setViewMode
(
VIEW_MODE_CHASE_LOCKED
);
break
;
}
}
void
QGCGoogleEarthView
::
setViewMode
(
QGCGoogleEarthView
::
VIEW_MODE
mode
)
{
switch
(
mode
)
{
case
VIEW_MODE_MAP
:
ui
->
changeViewButton
->
setText
(
"Free View"
);
break
;
case
VIEW_MODE_SIDE
:
ui
->
changeViewButton
->
setText
(
"Map View"
);
break
;
case
VIEW_MODE_CHASE_LOCKED
:
ui
->
changeViewButton
->
setText
(
"Free Chase"
);
break
;
case
VIEW_MODE_CHASE_FREE
:
ui
->
changeViewButton
->
setText
(
"Fixed Chase"
);
break
;
}
currentViewMode
=
mode
;
javaScript
(
QString
(
"setViewMode(%1);"
).
arg
(
mode
));
}
void
QGCGoogleEarthView
::
addUAS
(
UASInterface
*
uas
)
{
// uasid, type, color (in #rrbbgg format)
...
...
@@ -183,7 +225,7 @@ void QGCGoogleEarthView::updateWaypoint(int uas, Waypoint* wp)
else
{
javaScript
(
QString
(
"updateWaypoint(%1,%2,%3,%4,%5,%6);"
).
arg
(
uas
).
arg
(
wpindex
).
arg
(
wp
->
getLatitude
(),
0
,
'f'
,
18
).
arg
(
wp
->
getLongitude
(),
0
,
'f'
,
18
).
arg
(
wp
->
getAltitude
(),
0
,
'f'
,
18
).
arg
(
wp
->
getAction
()));
qDebug
()
<<
QString
(
"updateWaypoint(%1,%2,%3,%4,%5,%6);"
).
arg
(
uas
).
arg
(
wpindex
).
arg
(
wp
->
getLatitude
(),
0
,
'f'
,
18
).
arg
(
wp
->
getLongitude
(),
0
,
'f'
,
18
).
arg
(
wp
->
getAltitude
(),
0
,
'f'
,
18
).
arg
(
wp
->
getAction
());
//
qDebug() << QString("updateWaypoint(%1,%2,%3,%4,%5,%6);").arg(uas).arg(wpindex).arg(wp->getLatitude(), 0, 'f', 18).arg(wp->getLongitude(), 0, 'f', 18).arg(wp->getAltitude(), 0, 'f', 18).arg(wp->getAction());
}
}
}
...
...
@@ -453,6 +495,9 @@ void QGCGoogleEarthView::initializeGoogleEarth()
// Start update timer
updateTimer
->
start
(
refreshRateMs
);
// Set current view mode
setViewMode
(
currentViewMode
);
follow
(
this
->
followCamera
);
gEarthInitialized
=
true
;
...
...
src/ui/map3D/QGCGoogleEarthView.h
View file @
6c5ff745
...
...
@@ -71,6 +71,14 @@ public:
explicit
QGCGoogleEarthView
(
QWidget
*
parent
=
0
);
~
QGCGoogleEarthView
();
enum
VIEW_MODE
{
VIEW_MODE_SIDE
,
///< View from above, orientation is free
VIEW_MODE_MAP
,
///< View from above, orientation is north (map view)
VIEW_MODE_CHASE_LOCKED
,
///< Locked chase camera
VIEW_MODE_CHASE_FREE
,
///< Position is chasing object, but view can rotate around object
};
public
slots
:
/** @brief Update the internal state. Does not trigger a redraw */
void
updateState
();
...
...
@@ -96,6 +104,10 @@ public slots:
void
setHome
(
double
lat
,
double
lon
,
double
alt
);
/** @brief Set camera view range to aircraft in meters */
void
setViewRange
(
float
range
);
/** @brief Set the view mode */
void
setViewMode
(
VIEW_MODE
mode
);
/** @brief Toggle through the different view modes */
void
toggleViewMode
();
/** @brief Set camera view range to aircraft in centimeters */
void
setViewRangeScaledInt
(
int
range
);
/** @brief Reset Google Earth View */
...
...
@@ -123,6 +135,7 @@ protected:
bool
webViewInitialized
;
bool
jScriptInitialized
;
bool
gEarthInitialized
;
VIEW_MODE
currentViewMode
;
#ifdef _MSC_VER
QGCWebAxWidget
*
webViewWin
;
QAxObject
*
jScriptWin
;
...
...
src/ui/map3D/QGCGoogleEarthView.ui
View file @
6c5ff745
...
...
@@ -23,7 +23,7 @@
<property
name=
"margin"
>
<number>
2
</number>
</property>
<item
row=
"0"
column=
"0"
colspan=
"1
3
"
>
<item
row=
"0"
column=
"0"
colspan=
"1
4
"
>
<layout
class=
"QVBoxLayout"
name=
"webViewLayout"
/>
</item>
<item
row=
"1"
column=
"1"
>
...
...
@@ -58,7 +58,7 @@
</property>
</widget>
</item>
<item
row=
"1"
column=
"1
2
"
>
<item
row=
"1"
column=
"1
3
"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
...
...
@@ -180,13 +180,20 @@
</property>
</widget>
</item>
<item
row=
"1"
column=
"1
1
"
>
<item
row=
"1"
column=
"1
2
"
>
<widget
class=
"QPushButton"
name=
"resetButton"
>
<property
name=
"text"
>
<string>
Reset
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"11"
>
<widget
class=
"QPushButton"
name=
"changeViewButton"
>
<property
name=
"text"
>
<string>
Overhead
</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
...
...
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