Alfredo Capobianchi
Alfredo Capobianchi

Reputation: 115

Cesium CZML Model: is it possible to define multiple clock intervals?

In a Cesium CZML Model, I'd like to define multiple clocks, each one with its own time interval and multiplier, something like:

clock: {
      interval: "2019-06-01T16:00:00Z/2019-06-01T16:10:00Z",
      currentTime: "2019-06-01T16:00:00Z",
      multiplier: 60,
      range: "UNBOUNDED",
      step: "SYSTEM_CLOCK_MULTIPLIER",
    },
clock: {
      interval: "2019-06-01T16:10:00Z/2019-06-01T16:20:00Z",
      currentTime: "2019-06-01T16:10:00Z",
      multiplier: 80,
      range: "UNBOUNDED",
      step: "SYSTEM_CLOCK_MULTIPLIER",
    },

but this is not possible, because clock would be a duplicate key.

Is there a way to define consecutive time intervals, each one with its own clock multiplier?

Upvotes: 2

Views: 937

Answers (1)

emackey
emackey

Reputation: 12448

Unfortunately I think the answer is "no", at least within a single CZML document. However, Cesium Viewer supports loading multiple DataSources at the same time, so you may load multiple CZML documents concurrently, and each will have its own clock settings.

Cesium.Viewer has a constructor option called automaticallyTrackDataSourceClocks that will cause it to update its own clock settings whenever a new dataSource (separate CZML file) is added, and when the active dataSource is removed. It also has a field, viewer.clockTrackedDataSource that is read/write, and can be used to set which dataSource is currently in charge of the viewer's clock settings.

But, you would need to write your own UI to show a list of available dataSources, and select which one controls the clock settings, if that's what's needed here. Cesium will not automatically jump from the end of one clock range to the start of the next, unless you write code to make this happen.

The viewer will always try to show objects from all dataSources that have "availability" during the current time range, even if the clock is tracking a range from another dataSource. When the time ranges overlap, users will see all objects from multiple dataSources together in the scene. When time ranges don't overlap, expired objects won't be shown, but some "permanent" objects such as stationary points may have infinite availability, and so continue to be shown outside of their parent dataSource's clock range. This can be controlled from within a CZML document by limiting such entities to have availability only within their own file's clock ranges.

Upvotes: 3

Related Questions