Skip to content

Commit 8176ef2

Browse files
committed
Fix tests. Clean up DataSourceClock. Apply clockStep setting last since it may overrule other settings.
1 parent ea78f49 commit 8176ef2

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

Source/DataSources/DataSourceClock.js

+16-12
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ define([
2020
'use strict';
2121

2222
/**
23-
* Represents CZML document-level clock settings.
23+
* Represents desired clock settings for a particular {@link DataSource}. These settings may be applied
24+
* to the {@link Clock} when the DataSource is loaded.
2425
*
2526
* @alias DataSourceClock
2627
* @constructor
@@ -50,45 +51,48 @@ define([
5051
},
5152

5253
/**
53-
* Gets or sets the start time of the clock to use when looping or clamped.
54+
* Gets or sets the desired start time of the clock.
55+
* See {@link Clock#startTime}.
5456
* @memberof DataSourceClock.prototype
5557
* @type {JulianDate}
5658
*/
5759
startTime : createRawPropertyDescriptor('startTime'),
5860

5961
/**
60-
* Gets or sets the stop time of the clock to use when looping or clamped.
62+
* Gets or sets the desired stop time of the clock.
63+
* See {@link Clock#stopTime}.
6164
* @memberof DataSourceClock.prototype
6265
* @type {JulianDate}
6366
*/
6467
stopTime : createRawPropertyDescriptor('stopTime'),
6568

6669
/**
67-
* Gets or sets the initial time to use when switching to this clock.
70+
* Gets or sets the desired current time when this data source is loaded.
71+
* See {@link Clock#currentTime}.
6872
* @memberof DataSourceClock.prototype
6973
* @type {JulianDate}
7074
*/
7175
currentTime : createRawPropertyDescriptor('currentTime'),
7276

7377
/**
74-
* Gets or sets how the clock should behave when <code>startTime</code> or <code>stopTime</code> is reached.
78+
* Gets or sets the desired clock range setting.
79+
* See {@link Clock#clockRange}.
7580
* @memberof DataSourceClock.prototype
7681
* @type {ClockRange}
7782
*/
7883
clockRange : createRawPropertyDescriptor('clockRange'),
7984

8085
/**
81-
* Gets or sets if clock advancement is frame dependent or system clock dependent.
86+
* Gets or sets the desired clock step setting.
87+
* See {@link Clock#clockStep}.
8288
* @memberof DataSourceClock.prototype
8389
* @type {ClockStep}
8490
*/
8591
clockStep : createRawPropertyDescriptor('clockStep'),
8692

8793
/**
88-
* Gets or sets how much time advances with each tick, negative values allow for advancing backwards.
89-
* If <code>clockStep</code> is set to ClockStep.TICK_DEPENDENT this is the number of seconds to advance.
90-
* If <code>clockStep</code> is set to ClockStep.SYSTEM_CLOCK_MULTIPLIER this value is multiplied by the
91-
* elapsed system time since the last call to tick.
94+
* Gets or sets the desired clock multiplier.
95+
* See {@link Clock#multiplier}.
9296
* @memberof DataSourceClock.prototype
9397
* @type {Number}
9498
*/
@@ -163,10 +167,10 @@ define([
163167
}
164168
result.startTime = this.startTime;
165169
result.stopTime = this.stopTime;
170+
result.currentTime = this.currentTime;
166171
result.clockRange = this.clockRange;
167-
result.clockStep = this.clockStep;
168172
result.multiplier = this.multiplier;
169-
result.currentTime = this.currentTime;
173+
result.clockStep = this.clockStep;
170174
return result;
171175
};
172176

Source/Widgets/ClockViewModel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ define([
107107
}, this);
108108

109109
/**
110-
* Gets or sets the clock range setting
110+
* Gets or sets the clock range setting.
111111
* See {@link Clock#clockRange}.
112112
* This property is observable.
113113
* @type {ClockRange}

Specs/Widgets/Viewer/ViewerSpec.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -687,8 +687,8 @@ defineSuite([
687687
dataSource.clock.stopTime = JulianDate.fromIso8601('2014-08-21T02:00Z');
688688
dataSource.clock.currentTime = JulianDate.fromIso8601('2014-08-02T00:00Z');
689689
dataSource.clock.clockRange = ClockRange.UNBOUNDED;
690-
dataSource.clock.clockStep = ClockStep.SYSTEM_CLOCK;
691-
dataSource.clock.multiplier = 20.0;
690+
dataSource.clock.clockStep = ClockStep.SYSTEM_CLOCK_MULTIPLIER;
691+
dataSource.clock.multiplier = 10.0;
692692

693693
dataSource.changedEvent.raiseEvent(dataSource);
694694

@@ -698,6 +698,13 @@ defineSuite([
698698
expect(viewer.clock.clockRange).toEqual(dataSource.clock.clockRange);
699699
expect(viewer.clock.clockStep).toEqual(dataSource.clock.clockStep);
700700
expect(viewer.clock.multiplier).toEqual(dataSource.clock.multiplier);
701+
702+
dataSource.clock.clockStep = ClockStep.SYSTEM_CLOCK;
703+
dataSource.clock.multiplier = 1.0;
704+
705+
dataSource.changedEvent.raiseEvent(dataSource);
706+
707+
expect(viewer.clock.clockStep).toEqual(dataSource.clock.clockStep);
701708
});
702709

703710
it('can manually control the clock tracking', function() {

0 commit comments

Comments
 (0)