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
4008102c
Commit
4008102c
authored
Feb 19, 2011
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved windows google earth support. Very close to full closed loop.
parent
ed692bfd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
17 deletions
+63
-17
earth.html
images/earth.html
+3
-1
QGCGoogleEarthView.cc
src/ui/map3D/QGCGoogleEarthView.cc
+60
-16
No files found.
images/earth.html
View file @
4008102c
...
...
@@ -447,7 +447,7 @@ function initCallback(object)
ge
.
getLayerRoot
().
enableLayerById
(
ge
.
LAYER_TREES
,
true
);
enableEventListener
();
document
.
getElementById
(
'
JScript_initialized
'
).
setAttribute
(
'
value
'
,
'
true
'
)
initialized
=
true
;
}
...
...
@@ -602,5 +602,7 @@ 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"
/>
</body>
</html>
src/ui/map3D/QGCGoogleEarthView.cc
View file @
4008102c
...
...
@@ -19,6 +19,8 @@
#include <QAxObject>
#include <QUuid>
#include <mshtml.h>
#include <comdef.h>
#include <qaxtypes.h>
#endif
#include "QGC.h"
...
...
@@ -443,22 +445,64 @@ QVariant QGCGoogleEarthView::documentElement(QString name)
}
else
{
QVariantList
params
;
QString
javaScript
(
"getGlobal(%1)"
);
params
.
append
(
javaScript
.
arg
(
name
));
params
.
append
(
"JScript"
);
QVariant
result
=
jScriptWin
->
dynamicCall
(
"execScript(QString, QString)"
,
params
);
qDebug
()
<<
"JScript result: "
<<
result
<<
result
.
toDouble
();
// if (documentWin)
// {
// // Get HTMLElement object
// QVariantList params;
// params.append(name);
// //QAxObject* elementWin = documentWin->dynamicCall("getElementById(QString)", params);
// QVariant result =documentWin->dynamicCall("toString()");
// qDebug() << "GOT RESULT" << result;
// return QVariant(0);//QVariant(result);
// }
// QString javaScript("getGlobal(%1)");
// params.append(javaScript.arg(name));
// params.append("JScript");
// QVariant result = jScriptWin->dynamicCall("execScript(QString, QString)", params);
// qDebug() << "JScript result: " << result << result.toDouble();
if
(
documentWin
)
{
QString
resultString
;
// Get HTMLElement object
QVariantList
params
;
IHTMLDocument3
*
doc
;
documentWin
->
queryInterface
(
IID_IHTMLDocument3
,
(
void
**
)
&
doc
);
params
.
append
(
name
);
IHTMLElement
*
element
=
NULL
;
HRESULT
res
=
doc
->
getElementById
(
L"JScript_dragWaypointIndex"
,
&
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
)
{
qDebug
()
<<
"initialized is:"
<<
qtValue
.
toInt
();
return
qtValue
;
}
//element->toString(&elemString);
//_bstr_t bstrHello(elemString, true); // passing true means
// you should not call
// SysFreeString
//qDebug() << "BSTR:" << LPCSTR(bstrHello);
//QAxObject* elementWin = new QAxObject(element, documentWin);
//if (elementWin)
//{
// QVariant result = elementWin->dynamicCall("toString()");
// qDebug() << "GOT RESULT" << result << result.toString();
//}
//else
//{
// qDebug() << "CREATING HTML ELEMENT FAILED";
//}
}
else
{
qDebug
()
<<
"DID NOT GET HTML ELEMENT"
;
}
return
QVariant
(
0
);
//QVariant(result);
}
}
#endif
}
...
...
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