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
3e6dcd8b
Commit
3e6dcd8b
authored
Feb 19, 2011
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GOOGLE EARTH WORKS ON WINDOWS! FULL SUPPORT NOW!
parent
4008102c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
18 deletions
+53
-18
earth.html
images/earth.html
+27
-3
QGCGoogleEarthView.cc
src/ui/map3D/QGCGoogleEarthView.cc
+26
-15
No files found.
images/earth.html
View file @
3e6dcd8b
...
...
@@ -110,11 +110,13 @@ function setDraggingAllowed(allowed)
function
setNewWaypointPending
(
pending
)
{
newWaypointPending
=
pending
;
document
.
getElementById
(
'
JScript_newWaypointPending
'
).
setAttribute
(
'
value
'
,
pending
);
}
function
setDragWaypointPending
(
pending
)
{
dragWaypointPending
=
pending
;
document
.
getElementById
(
'
JScript_dragWaypointPending
'
).
setAttribute
(
'
value
'
,
pending
);
}
function
isInitialized
()
...
...
@@ -164,10 +166,15 @@ google.earth.addEventListener(ge.getGlobe(), 'mousemove', function(event)
point
.
setLongitude
(
event
.
getLongitude
());
dragInfo
.
dragged
=
true
;
dragWaypointIndex
=
dragInfo
.
placemark
.
getDescription
();
document
.
getElementById
(
'
JScript_dragWaypointIndex
'
).
setAttribute
(
'
value
'
,
dragWaypointIndex
);
dragWaypointLatitude
=
event
.
getLatitude
();
dragWaypointLongitude
=
event
.
getLongitude
();
dragWaypointAltitude
=
point
.
getAltitude
();
dragWaypointPending
=
true
;
document
.
getElementById
(
'
JScript_dragWaypointLatitude
'
).
setAttribute
(
'
value
'
,
dragWaypointLatitude
);
document
.
getElementById
(
'
JScript_dragWaypointLongitude
'
).
setAttribute
(
'
value
'
,
dragWaypointLongitude
);
document
.
getElementById
(
'
JScript_dragWaypointAltitude
'
).
setAttribute
(
'
value
'
,
dragWaypointAltitude
);
document
.
getElementById
(
'
JScript_dragWaypointPending
'
).
setAttribute
(
'
value
'
,
true
);
}
}
});
...
...
@@ -184,11 +191,16 @@ google.earth.addEventListener(ge.getWindow(), 'mouseup', function(event)
event
.
preventDefault
();
// Get drag end location
dragWaypointIndex
=
dragInfo
.
placemark
.
getDescription
();
document
.
getElementById
(
'
JScript_dragWaypointIndex
'
).
setAttribute
(
'
value
'
,
dragWaypointIndex
);
var
point
=
dragInfo
.
placemark
.
getGeometry
();
dragWaypointLatitude
=
event
.
getLatitude
();
dragWaypointLongitude
=
event
.
getLongitude
();
dragWaypointAltitude
=
point
.
getAltitude
();
dragWaypointPending
=
true
;
document
.
getElementById
(
'
JScript_dragWaypointLatitude
'
).
setAttribute
(
'
value
'
,
dragWaypointLatitude
);
document
.
getElementById
(
'
JScript_dragWaypointLongitude
'
).
setAttribute
(
'
value
'
,
dragWaypointLongitude
);
document
.
getElementById
(
'
JScript_dragWaypointAltitude
'
).
setAttribute
(
'
value
'
,
dragWaypointAltitude
);
document
.
getElementById
(
'
JScript_dragWaypointPending
'
).
setAttribute
(
'
value
'
,
true
);
}
dragInfo
=
null
;
...
...
@@ -206,6 +218,10 @@ google.earth.addEventListener(ge.getGlobe(), 'dblclick', function(event){
newWaypointLongitude
=
event
.
getLongitude
();
newWaypointAltitude
=
ge
.
getGlobe
().
getGroundAltitude
(
newWaypointLatitude
,
newWaypointLongitude
);
newWaypointPending
=
true
;
document
.
getElementById
(
'
JScript_newWaypointLatitude
'
).
setAttribute
(
'
value
'
,
newWaypointLatitude
);
document
.
getElementById
(
'
JScript_newWaypointLongitude
'
).
setAttribute
(
'
value
'
,
newWaypointLongitude
);
document
.
getElementById
(
'
JScript_newWaypointAltitude
'
).
setAttribute
(
'
value
'
,
newWaypointAltitude
);
document
.
getElementById
(
'
JScript_newWaypointPending
'
).
setAttribute
(
'
value
'
,
true
);
}
});
}
...
...
@@ -447,7 +463,7 @@ function initCallback(object)
ge
.
getLayerRoot
().
enableLayerById
(
ge
.
LAYER_TREES
,
true
);
enableEventListener
();
document
.
getElementById
(
'
JScript_initialized
'
).
setAttribute
(
'
value
'
,
'
true
'
)
document
.
getElementById
(
'
JScript_initialized
'
).
setAttribute
(
'
value
'
,
'
true
'
)
;
initialized
=
true
;
}
...
...
@@ -602,7 +618,15 @@ function failureCallback(object)
<center>
<div
id=
'map3d'
style=
'margin: 0; spacing: 0; height: 100%; width: 100%'
></div>
</center>
<input
type=
"hidden"
id=
"JScript_initialized"
value=
"false"
/>
<input
type=
"hidden"
id=
"JScript_dragWaypointIndex"
value=
"581"
/>
<input
type=
"hidden"
id=
"JScript_initialized"
value=
"false"
/>
<input
type=
"hidden"
id=
"JScript_dragWaypointIndex"
value=
"0"
/>
<input
type=
"hidden"
id=
"JScript_dragWaypointLatitude"
value=
"0"
/>
<input
type=
"hidden"
id=
"JScript_dragWaypointLongitude"
value=
"0"
/>
<input
type=
"hidden"
id=
"JScript_dragWaypointAltitude"
value=
"0"
/>
<input
type=
"hidden"
id=
"JScript_dragWaypointPending"
value=
"false"
/>
<input
type=
"hidden"
id=
"JScript_newWaypointLatitude"
value=
"0"
/>
<input
type=
"hidden"
id=
"JScript_newWaypointLongitude"
value=
"0"
/>
<input
type=
"hidden"
id=
"JScript_newWaypointAltitude"
value=
"0"
/>
<input
type=
"hidden"
id=
"JScript_newWaypointPending"
value=
"false"
/>
</body>
</html>
src/ui/map3D/QGCGoogleEarthView.cc
View file @
3e6dcd8b
...
...
@@ -388,7 +388,7 @@ void QGCGoogleEarthView::showEvent(QShowEvent* event)
// Reloading the webpage, this resets Google Earth
gEarthInitialized
=
false
;
QTimer
::
singleShot
(
10
000
,
this
,
SLOT
(
initializeGoogleEarth
()));
QTimer
::
singleShot
(
3
000
,
this
,
SLOT
(
initializeGoogleEarth
()));
}
else
{
...
...
@@ -404,7 +404,7 @@ void QGCGoogleEarthView::printWinException(int no, QString str1, QString str2, Q
QVariant
QGCGoogleEarthView
::
javaScript
(
QString
javaScript
)
{
#ifdef Q_OS_MAC
if
(
!
g
EarthInitialized
)
if
(
!
j
EarthInitialized
)
{
return
QVariant
(
false
);
}
...
...
@@ -461,22 +461,33 @@ QVariant QGCGoogleEarthView::documentElement(QString name)
documentWin
->
queryInterface
(
IID_IHTMLDocument3
,
(
void
**
)
&
doc
);
params
.
append
(
name
);
IHTMLElement
*
element
=
NULL
;
HRESULT
res
=
doc
->
getElementById
(
L"JScript_dragWaypointIndex"
,
&
element
);
// Append alias
name
.
prepend
(
"JScript_"
);
HRESULT
res
=
doc
->
getElementById
(
QStringToBSTR
(
name
),
&
element
);
//BSTR elemString;
if
(
element
)
{
//element->get_innerHTML(&elemString);
VARIANT
value
;
element
->
getAttribute
(
L"value"
,
0
,
&
value
);
QVariant
qtValue
;
bool
success
=
QVariantToVARIANT
(
qtValue
,
value
);
qDebug
()
<<
"Convert MS VARIANT to QVariant:"
<<
success
;
if
(
success
)
VARIANT
var
;
var
.
vt
=
VT_BSTR
;
HRESULT
res
=
element
->
getAttribute
(
L"value"
,
0
,
&
var
);
if
(
SUCCEEDED
(
res
)
&&
(
var
.
vt
!=
VT_NULL
))
{
//VariantChangeType(&var, &var, 0, VT_BSTR);
//qDebug() << "GOT ATTRIBUTE";
//_bstr_t bstrHello(var.bstrVal); // passing true means
// you should not call
// SysFreeString
//qDebug() << "BSTR:" << LPCSTR(bstrHello);
}
else
{
qDebug
()
<<
"initialized is:"
<<
qtValue
.
toInt
();
return
qtValue
;
qDebug
()
<<
"JAVASCRIPT ATTRIBUTE"
<<
name
<<
"NOT FOUND"
;
}
QByteArray
typeName
;
QVariant
qtValue
=
VARIANTToQVariant
(
var
,
typeName
);
return
qtValue
;
//element->toString(&elemString);
...
...
@@ -543,15 +554,15 @@ void QGCGoogleEarthView::initializeGoogleEarth()
qDebug
()
<<
"COULD NOT GET DOCUMENT OBJECT! Aborting"
;
}
#endif
QTimer
::
singleShot
(
2
500
,
this
,
SLOT
(
initializeGoogleEarth
()));
QTimer
::
singleShot
(
1
500
,
this
,
SLOT
(
initializeGoogleEarth
()));
return
;
}
if
(
!
gEarthInitialized
)
{
if
(
0
==
1
)
//(!javaScript("isInitialized();
").toBool())
if
(
!
documentElement
(
"initialized
"
).
toBool
())
{
QTimer
::
singleShot
(
5
00
,
this
,
SLOT
(
initializeGoogleEarth
()));
QTimer
::
singleShot
(
3
00
,
this
,
SLOT
(
initializeGoogleEarth
()));
qDebug
()
<<
"NOT INITIALIZED, WAITING"
;
}
else
...
...
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