Skip to content

Commit

Permalink
ISS move smoothly
Browse files Browse the repository at this point in the history
  • Loading branch information
Ysurac committed Sep 20, 2016
1 parent d1c2313 commit 3f4c1e0
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 additions & 12 deletions js/map.3d.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,15 +473,15 @@ function displayData(data) {
for (var i = 0; i < viewer.dataSources.get(dsn).entities.values.length; i++) {
var entity = viewer.dataSources.get(dsn).entities.values[i];
// console.log(entity);
if (entity.isShowing === false) {
console.log('Remove an entity show');
viewer.dataSources.get(dsn).entities.remove(entity);
}
// if (entity.isShowing === false) {
// console.log('Remove an entity show');
// viewer.dataSources.get(dsn).entities.remove(entity);
// }
//console.log(entity.isAvailable(Cesium.JulianDate.now()));
if (entity.isAvailable(Cesium.JulianDate.now()) === false) {
console.log('Remove an entity julian');
viewer.dataSources.get(dsn).entities.remove(entity);
}
// if (entity.isAvailable(Cesium.JulianDate.now()) === false) {
// console.log('Remove an entity julian');
// viewer.dataSources.get(dsn).entities.remove(entity);
// }
//console.log(entity.lastupdate);
if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>)) {
console.log('Remove an entity date');
Expand Down Expand Up @@ -528,18 +528,36 @@ function updateISS() {
var altitude = Math.round(data.altitude*10000)/10;
var entity = viewer.entities.getById('iss');
if (typeof entity == 'undefined') {
//var time = Cesium.JulianDate.now();
var property = new Cesium.SampledPositionProperty();
var currenttime = viewer.clock.currentTime;
var time = currenttime;
var position = Cesium.Cartesian3.fromDegrees(data.longitude,data.latitude,altitude);
property.addSample(time, position);

entity = viewer.entities.add({
id: 'iss',
name: 'iss',
position: Cesium.Cartesian3.fromDegrees(data.longitude,data.latitude,altitude),
position: property,
model : {
uri : '<?php print $globalURL; ?>/models/iss.glb',
minimumPixelSize : 5000,
maximumScale : 30000
}
});

//entity.position.setInterpolationOptions({
// interpolationDegree : 30,
// interpolationAlgorithm : Cesium.HermitePolynomialApproximation
//});
} else {
entity.position = Cesium.Cartesian3.fromDegrees(data.longitude,data.latitude,altitude);
var property = entity.position;
var currenttime = viewer.clock.currentTime;
var time = Cesium.JulianDate.addSeconds(currenttime, 30, new Cesium.JulianDate());
var position = Cesium.Cartesian3.fromDegrees(data.longitude,data.latitude,altitude);
property.addSample(time, position);
entity.position = property;
//entity.position = Cesium.Cartesian3.fromDegrees(data.longitude,data.latitude,altitude);
}
//viewer.trackedEntity = entity;
});
Expand Down Expand Up @@ -626,6 +644,8 @@ function updateISS() {
//});
var czmlds = new Cesium.CzmlDataSource();


updateData();
<?php
if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') {
?>
Expand All @@ -635,8 +655,6 @@ function updateISS() {
}
?>

updateData();

<?php
if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
?>
Expand Down

0 comments on commit 3f4c1e0

Please sign in to comment.