Commit 1b6c9a55 authored by LM's avatar LM

Fixed Asctec Firefly model, ready to incorporate 3D models

parent 73be7133
......@@ -7,7 +7,7 @@
<!-- QGroundControl -->
<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 *** -->
<!--<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">
google.load("earth", "1", { 'language': 'en'});
......@@ -99,6 +99,12 @@ var clickMode = 0;
var homePlacemark = null;
// Data / heightmap
var heightMapPlacemark = null;
var heightMapModel = null;
function getGlobal(variable)
{
return variable;
......@@ -415,12 +421,18 @@ function createAircraft(id, type, color)
planeModel.setLocation(planeLoc);
planeLink = ge.createLink('');
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://qgroundcontrol.org/_media/users/models/sfly-hex.dae');
planeLink.setHref('http://qgroundcontrol.org/_media/users/models/ascent-park-glider.dae');
planeLink.setHref('http://qgroundcontrol.org/_media/users/models/sfly-hex.dae');
factor = 1.0/1000.0;
//planeLink.setHref('http://qgroundcontrol.org/_media/users/models/ascent-park-glider.dae');
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);
planeLoc.setLatitude(currLat);
......@@ -555,6 +567,34 @@ function initCallback(object)
enableEventListener();
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;
}
......@@ -678,17 +718,10 @@ function updateFollowAircraft()
if (viewMode != 3) // VIEW_MODE_CHASE_FREE
{
ge.getView().setAbstractView(currView);
var camera = ge.getView().copyAsCamera(ge.ALTITUDE_ABSOLUTE);
camera.setTilt(currFollowTilt);
camera.setRoll(0);
camera.setHeading(currFollowHeading);
ge.getView().setAbstractView(camera);
}
else
{
ge.getView().setAbstractView(currView);
currView.setTilt(currFollowTilt);
currView.setHeading(currFollowHeading);
}
ge.getView().setAbstractView(currView);
}
function failureCallback(object)
......
......@@ -54,15 +54,15 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) :
#ifdef _MSC_VER
// Create layout and attach webViewWin
QFile file("doc.html");
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
qDebug() << __FILE__ << __LINE__ << "Could not open log file";
QTextStream out(&file);
out << webViewWin->generateDocumentation();
out.flush();
file.flush();
file.close();
// QFile file("doc.html");
// if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
// qDebug() << __FILE__ << __LINE__ << "Could not open log file";
// QTextStream out(&file);
// out << webViewWin->generateDocumentation();
// out.flush();
// file.flush();
// file.close();
#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