Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clock should not animate by default #6154

Merged
merged 4 commits into from
Jan 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Apps/Sandcastle/gallery/3D Models Coloring.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
var viewer = new Cesium.Viewer('cesiumContainer', {
infoBox : false,
selectionIndicator : false,
shadows : true
shadows : true,
shouldAnimate : true
});

var entity;
Expand Down
5 changes: 3 additions & 2 deletions Apps/Sandcastle/gallery/3D Models.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
var viewer = new Cesium.Viewer('cesiumContainer', {
infoBox : false,
selectionIndicator : false,
shadows : true
shadows : true,
shouldAnimate : true
});

function createModel(url, height) {
Expand Down Expand Up @@ -94,4 +95,4 @@
}
</script>
</body>
</html>
</html>
5 changes: 4 additions & 1 deletion Apps/Sandcastle/gallery/CZML Custom Properties.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@
}
}];

var viewer = new Cesium.Viewer('cesiumContainer');
var viewer = new Cesium.Viewer('cesiumContainer', {
shouldAnimate : true
});

var dataSource = new Cesium.CzmlDataSource();

function scaleProperty(property, scalingFactor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@
}
}];

var viewer = new Cesium.Viewer('cesiumContainer');
var viewer = new Cesium.Viewer('cesiumContainer', {
shouldAnimate : true
});

var dataSourcePromise = viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));

dataSourcePromise.then(function(dataSource){
Expand Down
5 changes: 4 additions & 1 deletion Apps/Sandcastle/gallery/CZML Model.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
}
}];

var viewer = new Cesium.Viewer('cesiumContainer');
var viewer = new Cesium.Viewer('cesiumContainer', {
shouldAnimate : true
});

var dataSourcePromise = viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));

dataSourcePromise.then(function(dataSource){
Expand Down
11 changes: 6 additions & 5 deletions Apps/Sandcastle/gallery/CZML Path.html
Original file line number Diff line number Diff line change
Expand Up @@ -1864,17 +1864,18 @@
}];

var terrainProvider = new Cesium.CesiumTerrainProvider({
url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles',
requestVertexNormals : true
url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles',
requestVertexNormals : true
});

var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProvider : terrainProvider,
baseLayerPicker : false
terrainProvider : terrainProvider,
baseLayerPicker : false,
shouldAnimate : true
});

viewer.dataSources.add(Cesium.CzmlDataSource.load(czml)).then(function(ds) {
viewer.trackedEntity = ds.entities.getById('path');
viewer.trackedEntity = ds.entities.getById('path');
});

//Sandcastle_End
Expand Down
5 changes: 4 additions & 1 deletion Apps/Sandcastle/gallery/CZML Point - Time Dynamic.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@
}
}];

var viewer = new Cesium.Viewer('cesiumContainer');
var viewer = new Cesium.Viewer('cesiumContainer', {
shouldAnimate : true
});

viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));

//Sandcastle_End
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@
}
}];

var viewer = new Cesium.Viewer('cesiumContainer');
var viewer = new Cesium.Viewer('cesiumContainer', {
shouldAnimate : true
});

viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@
}
}];

var viewer = new Cesium.Viewer('cesiumContainer');
var viewer = new Cesium.Viewer('cesiumContainer', {
shouldAnimate : true
});

viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));

//Sandcastle_End
Expand Down
4 changes: 3 additions & 1 deletion Apps/Sandcastle/gallery/CZML.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
var viewer = new Cesium.Viewer('cesiumContainer', {
shouldAnimate : true
});

Sandcastle.addDefaultToolbarButton('Satellites', function() {
viewer.dataSources.add(Cesium.CzmlDataSource.load('../../SampleData/simple.czml'));
Expand Down
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/Callback Property.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
// Use a CallbackProperty when your data can't be pre-computed
// or needs to be derived from other properties at runtime.
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.clock.shouldAnimate = true;

var startLatitude = 35;
var startLongitude = -120;
Expand Down
1 change: 1 addition & 0 deletions Apps/Sandcastle/gallery/Cardboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
viewer.clock.currentTime = start.clone();
viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
viewer.clock.multiplier = 1.0;
viewer.clock.shouldAnimate = true;

function computeCirclularFlight(lon, lat, radius) {
var property = new Cesium.SampledPositionProperty();
Expand Down
3 changes: 2 additions & 1 deletion Apps/Sandcastle/gallery/Clock.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
stopTime : Cesium.JulianDate.fromIso8601("2013-12-26"),
clockRange : Cesium.ClockRange.LOOP_STOP, // loop when we hit the end time
clockStep : Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER,
multiplier : 4000 // how much time to advance each tick
multiplier : 4000, // how much time to advance each tick
shouldAnimate : true // Animation on by default
});

var viewer = new Cesium.Viewer('cesiumContainer', {
Expand Down
5 changes: 4 additions & 1 deletion Apps/Sandcastle/gallery/HeadingPitchRoll.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ <h1>Loading...</h1>
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
var viewer = new Cesium.Viewer('cesiumContainer', {
shouldAnimate : true
});

var canvas = viewer.canvas;
canvas.setAttribute('tabindex', '0'); // needed to put focus on the canvas
canvas.addEventListener('click', function() {
Expand Down
3 changes: 2 additions & 1 deletion Apps/Sandcastle/gallery/Interpolation.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProviderViewModels : [], //Disable terrain changing
infoBox : false, //Disable InfoBox widget
selectionIndicator : false //Disable selection indicator
selectionIndicator : false, //Disable selection indicator
shouldAnimate : true // Enable animations
});

//Enable lighting based on sun/moon positions
Expand Down
4 changes: 3 additions & 1 deletion Apps/Sandcastle/gallery/Particle System Fireworks.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
var viewer = new Cesium.Viewer('cesiumContainer', {
shouldAnimate : true
});

var scene = viewer.scene;
scene.debugShowFramesPerSecond = true;
Expand Down
3 changes: 2 additions & 1 deletion Apps/Sandcastle/gallery/Particle System.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
viewer.clock.currentTime = start.clone();
viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP; //Loop at the end
viewer.clock.multiplier = 1;
viewer.clock.shouldAnimate = true;

//Set timeline to simulation bounds
viewer.timeline.zoomTo(start, stop);
Expand Down Expand Up @@ -287,7 +288,7 @@
lifeTime : 16.0,

emitter : new Cesium.CircleEmitter(2.0),

emitterModelMatrix : computeEmitterModelMatrix(),

forces : [applyGravity]
Expand Down
3 changes: 2 additions & 1 deletion Apps/Sandcastle/gallery/Physically-Based Materials.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
currentTime : Cesium.JulianDate.fromIso8601("2017-07-11T10:00:00Z"),
clockRange : Cesium.ClockRange.LOOP_STOP,
clockStep : Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER,
multiplier : 1000
multiplier : 1000,
shouldAnimate : true
});

var viewer = new Cesium.Viewer('cesiumContainer', {
Expand Down
3 changes: 2 additions & 1 deletion Apps/Sandcastle/gallery/Shadows.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
infoBox : false,
selectionIndicator : false,
shadows : true,
terrainShadows : Cesium.ShadowMode.ENABLED
terrainShadows : Cesium.ShadowMode.ENABLED,
shouldAnimate : true
});

viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
Expand Down
3 changes: 2 additions & 1 deletion Apps/Sandcastle/gallery/Terrain Clipping Planes.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
// Clipping planes are not currently supported in Internet Explorer.

var viewer = new Cesium.Viewer('cesiumContainer', {
skyAtmosphere: false
skyAtmosphere: false,
shouldAnimate : true
});

viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
Expand Down
5 changes: 4 additions & 1 deletion Apps/Sandcastle/gallery/Video.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer', {showRenderLoopErrors : false});
var viewer = new Cesium.Viewer('cesiumContainer', {
showRenderLoopErrors : false,
shouldAnimate : true
});

var videoElement = document.getElementById('trailer');

Expand Down
4 changes: 3 additions & 1 deletion Apps/Sandcastle/gallery/Web Map Tile Service with Time.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
var viewer = new Cesium.Viewer('cesiumContainer', {
shouldAnimate : true
});

function dataCallback(interval, index) {
var time;
Expand Down
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Change Log
### 1.42 - 2018-02-01

* Breaking changes
*
* The clock does not animate by default. Set the `shouldAnimate` option to `true` when creating the Viewer to enable animation.
* Deprecated
* For all classes/functions that can now take a `Resource` instance, all additional parameters that are part of the `Resource` class have been deprecated and will be removed in Cesium 1.44. This generally includes `proxy`, `headers` and `query` parameters.
* Major refactor of URL handling. All classes that take a url parameter, can now take a Resource or a String. This includes all imagery providers, all terrain providers, `Cesium3DTileset`, `KMLDataSource`, `CZMLDataSource`, `GeoJsonDataSource`, `Model`, `Billboard`, along with all the low level `load*()` functions.
Expand Down Expand Up @@ -34,6 +34,7 @@ Change Log
* Fixed a glTF animation bug that caused certain animations to jitter. [#5740](https://github.com/AnalyticalGraphicsInc/cesium/pull/5740)
* Fixed a bug when creating billboard and model entities without a globe. [#6109](https://github.com/AnalyticalGraphicsInc/cesium/pull/6109)
* Added support for vertex shader uniforms when `tileset.colorBlendMode` is `MIX` or `REPLACE`. [#5874](https://github.com/AnalyticalGraphicsInc/cesium/pull/5874)
* Added `shouldAnimate` option to the `Viewer` constructor to indicate if the clock should begin animating immediately.[#6154](https://github.com/AnalyticalGraphicsInc/cesium/pull/6154)
* Added separate file for the Cesium [Code of Conduct](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CODE_OF_CONDUCT.md). [#6129](https://github.com/AnalyticalGraphicsInc/cesium/pull/6129)
* Fixed applying a translucent style to a point cloud tileset. [#6113](https://github.com/AnalyticalGraphicsInc/cesium/pull/6113)
* Fixed sandcastle Particle System example for better visual [#6132](https://github.com/AnalyticalGraphicsInc/cesium/pull/6132)
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ define([
* @param {ClockStep} [options.clockStep=ClockStep.SYSTEM_CLOCK_MULTIPLIER] Determines if calls to {@link Clock#tick} are frame dependent or system clock dependent.
* @param {ClockRange} [options.clockRange=ClockRange.UNBOUNDED] Determines how the clock should behave when {@link Clock#startTime} or {@link Clock#stopTime} is reached.
* @param {Boolean} [options.canAnimate=true] Indicates whether {@link Clock#tick} can advance time. This could be false if data is being buffered, for example. The clock will only tick when both {@link Clock#canAnimate} and {@link Clock#shouldAnimate} are true.
* @param {Boolean} [options.shouldAnimate=true] Indicates whether {@link Clock#tick} should attempt to advance time. The clock will only tick when both {@link Clock#canAnimate} and {@link Clock#shouldAnimate} are true.
* @param {Boolean} [options.shouldAnimate=false] Indicates whether {@link Clock#tick} should attempt to advance time. The clock will only tick when both {@link Clock#canAnimate} and {@link Clock#shouldAnimate} are true.
*
* @exception {DeveloperError} startTime must come before stopTime.
*
Expand Down Expand Up @@ -144,8 +144,8 @@ define([

this.currentTime = currentTime;
this.multiplier = defaultValue(options.multiplier, 1.0);
this.shouldAnimate = defaultValue(options.shouldAnimate, false);
this.clockStep = defaultValue(options.clockStep, ClockStep.SYSTEM_CLOCK_MULTIPLIER);
this.shouldAnimate = defaultValue(options.shouldAnimate, true);
}

defineProperties(Clock.prototype, {
Expand Down
5 changes: 5 additions & 0 deletions Source/Widgets/Viewer/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ define([
* @param {Boolean} [options.navigationHelpButton=true] If set to false, the navigation help button will not be created.
* @param {Boolean} [options.navigationInstructionsInitiallyVisible=true] True if the navigation instructions should initially be visible, or false if the should not be shown until the user explicitly clicks the button.
* @param {Boolean} [options.scene3DOnly=false] When <code>true</code>, each geometry instance will only be rendered in 3D to save GPU memory.
* @param {Boolean} [options.shouldAnimate=false] <code>true</code> if the clock should attempt to advance simulation time by default, <code>false</code> otherwise. This option takes precedence over setting {@link Viewer#clockViewModel}.
* @param {ClockViewModel} [options.clockViewModel=new ClockViewModel(options.clock)] The clock view model to use to control current time.
* @param {ProviderViewModel} [options.selectedImageryProviderViewModel] The view model for the current base imagery layer, if not supplied the first available base layer is used. This value is only valid if options.baseLayerPicker is set to true.
* @param {ProviderViewModel[]} [options.imageryProviderViewModels=createDefaultImageryProviderViewModels()] The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if options.baseLayerPicker is set to true.
Expand Down Expand Up @@ -421,6 +422,10 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to
destroyClockViewModel = true;
}

if (defined(options.shouldAnimate)) {
clock.shouldAnimate = options.shouldAnimate;
}

// Cesium widget
var cesiumWidget = new CesiumWidget(cesiumWidgetContainer, {
terrainProvider : options.terrainProvider,
Expand Down
Loading