Commit 1b6c9a55 authored by LM's avatar LM

Fixed Asctec Firefly model, ready to incorporate 3D models

parent 73be7133
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<!-- QGroundControl --> <!-- QGroundControl -->
<title>QGroundControl Google Earth View</title> <title>QGroundControl Google Earth View</title>
<!-- *** Replace the key below below with your own API key, available at http://code.google.com/apis/maps/signup.html *** --> <!-- *** Replace the key below below with your own API key, available at http://code.google.com/apis/maps/signup.html *** -->
<!--<script type="text/javascript" src="https://getfirebug.com/firebug-lite-beta.js"></script>--> <script type="text/javascript" src="https://getfirebug.com/firebug-lite-beta.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi?key=ABQIAAAA5Q6wxQ6lxKS8haLVdUJaqhSjosg_0jiTTs2iXtkDVG0n0If1mBRHzhWw5VqBZX-j4NuzoVpU-UaHVg"></script> <script type="text/javascript" src="https://www.google.com/jsapi?key=ABQIAAAA5Q6wxQ6lxKS8haLVdUJaqhSjosg_0jiTTs2iXtkDVG0n0If1mBRHzhWw5VqBZX-j4NuzoVpU-UaHVg"></script>
<script type="text/javascript"> <script type="text/javascript">
google.load("earth", "1", { 'language': 'en'}); google.load("earth", "1", { 'language': 'en'});
...@@ -99,6 +99,12 @@ var clickMode = 0; ...@@ -99,6 +99,12 @@ var clickMode = 0;
var homePlacemark = null; var homePlacemark = null;
// Data / heightmap
var heightMapPlacemark = null;
var heightMapModel = null;
function getGlobal(variable) function getGlobal(variable)
{ {
return variable; return variable;
...@@ -417,10 +423,16 @@ function createAircraft(id, type, color) ...@@ -417,10 +423,16 @@ function createAircraft(id, type, color)
planeOrient = ge.createOrientation(''); planeOrient = ge.createOrientation('');
planeModel.setOrientation(planeOrient); planeModel.setOrientation(planeOrient);
var factor = 1.0;
//planeLink.setHref('http://www.asl.ethz.ch/people/rudink/senseSoarDummy.dae'); //planeLink.setHref('http://www.asl.ethz.ch/people/rudink/senseSoarDummy.dae');
//planeLink.setHref('http://qgroundcontrol.org/_media/users/models/sfly-hex.dae'); planeLink.setHref('http://qgroundcontrol.org/_media/users/models/sfly-hex.dae');
planeLink.setHref('http://qgroundcontrol.org/_media/users/models/ascent-park-glider.dae'); factor = 1.0/1000.0;
//planeLink.setHref('http://qgroundcontrol.org/_media/users/models/ascent-park-glider.dae');
planeModel.setLink(planeLink); planeModel.setLink(planeLink);
var scale = planeModel.getScale();
scale.set(scale.getX()*factor, scale.getY()*factor, scale.getZ()*factor)
planeModel.setScale(scale);
planeModel.setAltitudeMode (ge.ALTITUDE_ABSOLUTE); planeModel.setAltitudeMode (ge.ALTITUDE_ABSOLUTE);
planeLoc.setLatitude(currLat); planeLoc.setLatitude(currLat);
...@@ -555,6 +567,34 @@ function initCallback(object) ...@@ -555,6 +567,34 @@ function initCallback(object)
enableEventListener(); enableEventListener();
document.getElementById('JScript_initialized').setAttribute('value','true'); document.getElementById('JScript_initialized').setAttribute('value','true');
// Load heightmap
// http://www.inf.ethz.ch/personal/lomeier/data/untex-environment.dae
heightMapPlacemark = ge.createPlacemark('');
heightMapPlacemark.setName('aircraft');
heightMapModel = ge.createModel('');
ge.getFeatures().appendChild(heightMapPlacemark);
planeLoc = ge.createLocation('');
heightMapModel.setLocation(planeLoc);
planeLink = ge.createLink('');
planeOrient = ge.createOrientation('');
heightMapModel.setOrientation(planeOrient);
planeLink.setHref('http://www.inf.ethz.ch/personal/lomeier/data/untex-environment.dae');
heightMapModel.setLink(planeLink);
var scale = heightMapModel.getScale();
var factor = 1.0;//1.0/1000.0;
scale.set(scale.getX()*factor, scale.getY()*factor, scale.getZ()*factor)
heightMapModel.setScale(scale);
heightMapModel.setAltitudeMode (ge.ALTITUDE_ABSOLUTE);
planeLoc.setLatitude(currLat);
planeLoc.setLongitude(currLon);
planeLoc.setAltitude(currAlt);
heightMapPlacemark.setGeometry(heightMapModel);
initialized = true; initialized = true;
} }
...@@ -678,17 +718,10 @@ function updateFollowAircraft() ...@@ -678,17 +718,10 @@ function updateFollowAircraft()
if (viewMode != 3) // VIEW_MODE_CHASE_FREE if (viewMode != 3) // VIEW_MODE_CHASE_FREE
{ {
ge.getView().setAbstractView(currView); currView.setTilt(currFollowTilt);
var camera = ge.getView().copyAsCamera(ge.ALTITUDE_ABSOLUTE); currView.setHeading(currFollowHeading);
camera.setTilt(currFollowTilt);
camera.setRoll(0);
camera.setHeading(currFollowHeading);
ge.getView().setAbstractView(camera);
} }
else
{
ge.getView().setAbstractView(currView); ge.getView().setAbstractView(currView);
}
} }
function failureCallback(object) function failureCallback(object)
......
...@@ -54,15 +54,15 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) : ...@@ -54,15 +54,15 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) :
#ifdef _MSC_VER #ifdef _MSC_VER
// Create layout and attach webViewWin // Create layout and attach webViewWin
QFile file("doc.html"); // QFile file("doc.html");
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) // if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
qDebug() << __FILE__ << __LINE__ << "Could not open log file"; // qDebug() << __FILE__ << __LINE__ << "Could not open log file";
QTextStream out(&file); // QTextStream out(&file);
out << webViewWin->generateDocumentation(); // out << webViewWin->generateDocumentation();
out.flush(); // out.flush();
file.flush(); // file.flush();
file.close(); // file.close();
#else #else
......
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