Hi folks,
I am trying to get my head around the Clock mechanism in Cesium. I think I am misunderstanding how it should work.
Basically
what I want is a clock which I control. I will set a start time and end time. Then when I load in CZML packets(objects) they will will be displayed if their availability corresponds to my clock current time. So
as I scroll through my timeline czml objects from different datasources
will appear and disappear according to my clock.
Scenario 1:
However so far what I am experiencing is the following.
I create a Cesium.Viewer. This has a clock associated with it. I can set the clock times etc as follows:
viewer.clock.currentTime = now;
viewer.clock.startTime = now.clone();
viewer.clock.stopTime = now.addDays(1.0);
viewer.timeline.updateFromClock();
However
when I load in CZMl files they change the clock settings. In my CZML files I have not specified a clock. I have just specified an availability for each object. This is frustrating as I don’t want the CZML objects to drive the clock.
Scenario 2:
I set a clock in a CZMl file. I then load the file as follows:
var czmlDataSource = new Cesium.CzmlDataSource();
czmlDataSource.loadUrl(dataLocation + czmlFile).then(function() {
viewer.dataSources.add(czmlDataSource);
viewer.homeButton.viewModel.command();
});
For the next file I do as follows:
var czmlDataSource = new Cesium.CzmlDataSource();
czmlDataSource.processUrl(dataLocation + czmlFile).then(function() {
viewer.dataSources.add(czmlDataSource);
viewer.homeButton.viewModel.command();
});
However
the data from the second packet appears to overwrite the first. So the clock I see is always the second one. As I will have multiple files I want one clock independent of these CZML files (and associated clocks).
I saw in the forums one thread where the issue in the second scenario was encountered as follows:
https://groups.google.com/forum/#!searchin/cesium-dev/clock/cesium-dev/cNRs7pb_w1A/5ghJPwjKGg8J
It was suggested to build the application with CesiumWidget and create your own Clock instance. However I would prefer to use the Cesium.Viewer as I want to utilise the Cesium.viewerDynamicObjectMixin. Also I’m not sure how to associate the clock with the CesiumWidget in any event I cant seem to find any examples.
Anyone have any pointers for me. Thanks a mill.
Cheers Dave