mirror of
https://github.com/nasa/openmct.git
synced 2024-12-19 05:07:52 +00:00
Fixed delta format issue on navigation
This commit is contained in:
parent
f4e1879a2d
commit
579233ade9
@ -99,6 +99,7 @@ define(
|
||||
if (this.conductor.timeSystem()) {
|
||||
$scope.timeSystemModel.selected = this.conductor.timeSystem();
|
||||
$scope.timeSystemModel.format = this.conductor.timeSystem().formats()[0];
|
||||
$scope.timeSystemModel.deltaFormat = this.conductor.timeSystem().deltaFormat();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -194,6 +195,9 @@ define(
|
||||
TimeConductorController.prototype.setMode = function (newModeKey, oldModeKey) {
|
||||
if (newModeKey !== oldModeKey) {
|
||||
var newMode = undefined;
|
||||
var timeSystems = [];
|
||||
var timeSystem = undefined;
|
||||
|
||||
this.$scope.modeModel.selectedKey = newModeKey;
|
||||
|
||||
if (this.conductorService.mode()) {
|
||||
@ -202,26 +206,31 @@ define(
|
||||
|
||||
switch (newModeKey) {
|
||||
case 'fixed':
|
||||
newMode = new FixedMode(this.conductor, this._timeSystems, newModeKey);
|
||||
timeSystems = this._timeSystems;
|
||||
timeSystem = timeSystems[0];
|
||||
newMode = new FixedMode(this.conductor, timeSystem, newModeKey);
|
||||
break;
|
||||
case 'realtime':
|
||||
// Filter time systems to only those with clock tick
|
||||
// sources
|
||||
newMode = new FollowMode(this.conductor, this.timeSystemsForSourceType('clock'), newModeKey);
|
||||
timeSystems = this.timeSystemsForSourceType('clock');
|
||||
timeSystem = timeSystems[0];
|
||||
newMode = new FollowMode(this.conductor, timeSystem, newModeKey);
|
||||
break;
|
||||
case 'latest':
|
||||
// Filter time systems to only those with data tick
|
||||
// sources
|
||||
newMode = new FollowMode(this.conductor, this.timeSystemsForSourceType('data'), newModeKey);
|
||||
timeSystems = this.timeSystemsForSourceType('data');
|
||||
timeSystem = timeSystems[0];
|
||||
newMode = new FollowMode(this.conductor, timeSystem, newModeKey);
|
||||
break;
|
||||
}
|
||||
newMode.initialize();
|
||||
this.conductorService.mode(newMode);
|
||||
var timeSystem = newMode.selectedTimeSystem();
|
||||
|
||||
//Synchronize scope with time system on mode
|
||||
this.$scope.timeSystemModel.options = newMode.timeSystems().map(function (timeSystem) {
|
||||
return timeSystem.metadata;
|
||||
this.$scope.timeSystemModel.options = timeSystems.map(function (t) {
|
||||
return t.metadata;
|
||||
});
|
||||
|
||||
this.setTimeSystem(timeSystem);
|
||||
@ -272,7 +281,7 @@ define(
|
||||
this.$scope.timeSystemModel.format = newTimeSystem.formats()[0];
|
||||
this.$scope.timeSystemModel.deltaFormat = newTimeSystem.deltaFormat();
|
||||
var mode = this.conductorService.mode();
|
||||
mode.selectedTimeSystem(newTimeSystem);
|
||||
mode.timeSystem(newTimeSystem);
|
||||
this.setDeltasFromTimeSystem(newTimeSystem);
|
||||
}
|
||||
};
|
||||
|
@ -32,8 +32,8 @@ define(
|
||||
* @param timeSystems
|
||||
* @constructor
|
||||
*/
|
||||
function FixedMode(conductor, timeSystems, key) {
|
||||
TimeConductorMode.call(this, conductor, timeSystems, key);
|
||||
function FixedMode(conductor, timeSystem, key) {
|
||||
TimeConductorMode.call(this, conductor, timeSystem, key);
|
||||
}
|
||||
|
||||
FixedMode.prototype = Object.create(TimeConductorMode.prototype);
|
||||
@ -49,8 +49,8 @@ define(
|
||||
* @param timeSystem
|
||||
* @returns {*}
|
||||
*/
|
||||
FixedMode.prototype.selectedTimeSystem = function (timeSystem){
|
||||
TimeConductorMode.prototype.selectedTimeSystem.apply(this, arguments);
|
||||
FixedMode.prototype.timeSystem = function (timeSystem){
|
||||
TimeConductorMode.prototype.timeSystem.apply(this, arguments);
|
||||
|
||||
if (timeSystem) {
|
||||
var defaults = timeSystem.defaults()[0];
|
||||
@ -62,7 +62,7 @@ define(
|
||||
|
||||
this.conductor.timeSystem(timeSystem, bounds);
|
||||
}
|
||||
return this._selectedTimeSystem;
|
||||
return this._timeSystem;
|
||||
};
|
||||
|
||||
return FixedMode;
|
||||
|
@ -33,8 +33,8 @@ define(
|
||||
* the mode relevant, with both offsets defined relative to it.
|
||||
* @constructor
|
||||
*/
|
||||
function FollowMode(conductor, timeSystems, key) {
|
||||
TimeConductorMode.call(this, conductor, timeSystems, key);
|
||||
function FollowMode(conductor, timeSystem, key) {
|
||||
TimeConductorMode.call(this, conductor, timeSystem, key);
|
||||
|
||||
this._deltas = undefined;
|
||||
}
|
||||
@ -63,10 +63,8 @@ define(
|
||||
* @param tickSource
|
||||
*/
|
||||
FollowMode.prototype.listenToTickSource = function () {
|
||||
if (this._selectedTimeSystem &&
|
||||
this._timeSystems[0]) {
|
||||
|
||||
var tickSource = this._timeSystems[0].tickSources()[0];
|
||||
if (this._timeSystem) {
|
||||
var tickSource = this._timeSystem.tickSources()[0];
|
||||
if (tickSource) {
|
||||
this.tickSourceUnlisten = tickSource.listen(this.tick.bind(this));
|
||||
}
|
||||
@ -79,8 +77,8 @@ define(
|
||||
* @param timeSystem
|
||||
* @returns {TimeSystem}
|
||||
*/
|
||||
FollowMode.prototype.selectedTimeSystem = function (timeSystem) {
|
||||
TimeConductorMode.prototype.selectedTimeSystem.apply(this, arguments);
|
||||
FollowMode.prototype.timeSystem = function (timeSystem) {
|
||||
TimeConductorMode.prototype.timeSystem.apply(this, arguments);
|
||||
|
||||
if (timeSystem) {
|
||||
if (this.tickSourceUnlisten) {
|
||||
@ -106,7 +104,7 @@ define(
|
||||
this.listenToTickSource();
|
||||
}
|
||||
}
|
||||
return this._selectedTimeSystem;
|
||||
return this._timeSystem;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -33,9 +33,9 @@ define(
|
||||
* @constructor
|
||||
* @param {TimeConductorMetadata} metadata
|
||||
*/
|
||||
function TimeConductorMode(conductor, timeSystems, key) {
|
||||
function TimeConductorMode(conductor, timeSystem, key) {
|
||||
this.conductor = conductor;
|
||||
this._timeSystems = timeSystems;
|
||||
this._timeSystem = timeSystem;
|
||||
this._key = key;
|
||||
}
|
||||
|
||||
@ -43,18 +43,7 @@ define(
|
||||
* Function is called when mode becomes active (ie. is selected)
|
||||
*/
|
||||
TimeConductorMode.prototype.initialize = function () {
|
||||
this.selectedTimeSystem(this._timeSystems[0]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the time systems supported by this mode. Modes are
|
||||
* expected to determine which time systems they will support by
|
||||
* filtering a provided list of all time systems.
|
||||
*
|
||||
* @returns {TimeSystem[]} The time systems supported by this mode
|
||||
*/
|
||||
TimeConductorMode.prototype.timeSystems = function () {
|
||||
return this._timeSystems;
|
||||
this.timeSystem(this._timeSystem);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -62,15 +51,11 @@ define(
|
||||
* @param timeSystem
|
||||
* @returns {TimeSystem} the currently selected time system
|
||||
*/
|
||||
TimeConductorMode.prototype.selectedTimeSystem = function (timeSystem) {
|
||||
TimeConductorMode.prototype.timeSystem = function (timeSystem) {
|
||||
if (arguments.length > 0) {
|
||||
if (this._timeSystems.indexOf(timeSystem) === -1){
|
||||
throw new Error("Unsupported time system");
|
||||
} else {
|
||||
this._selectedTimeSystem = timeSystem;
|
||||
}
|
||||
this._timeSystem = timeSystem;
|
||||
}
|
||||
return this._selectedTimeSystem;
|
||||
return this._timeSystem;
|
||||
};
|
||||
|
||||
TimeConductorMode.prototype.key = function () {
|
||||
|
Loading…
Reference in New Issue
Block a user