I've reproduced it (at least on Chrome 45 and Firefox 40).
The below code creates alternating red/green outlines via a time interval. There is a lot of weird behaviour.
1. When the page first loads the outline is white. If you pause immediately and drag the slider to 08:00:19 and back to 08:00:00 it will change the outline to green.
2. If you drag the slider forwards past 08:00:20 again and back to 08:00:00 it'll change the outline to red or green (seems to vary, oddly).
3. If you uncomment the "//seconds = 21;" line the interval appears to be completely broken and the outline just displays as black.
My question is:
How do I only delete all interval data before (and including) 08:00:20?
I am loading live data and they just build up until the browser runs out of memory. If I try to remove them, this happens.
Paste the following into sandcastle:
var viewer = new Cesium.Viewer('cesiumContainer');
var entities = viewer.entities;
//Set bounds of our simulation time
var start = Cesium.JulianDate.fromDate(new Date(2015, 2, 25, 16, 0, 0));
var stop = Cesium.JulianDate.addSeconds(start, 360, new Cesium.JulianDate());
//Make sure viewer is at the desired time.
viewer.clock.startTime = start.clone();
viewer.clock.stopTime = stop.clone();
viewer.clock.currentTime = start.clone();
//Set timeline to simulation bounds
viewer.timeline.zoomTo(start, stop);
// Create alternating colours
function computeColors() {
var colorIntervalCollection = new Cesium.TimeIntervalCollectionProperty();
var increment = 80;
var iteration = 0;
for (var i = -60; i <= 360; i += increment) {
iteration += 1;
var time = Cesium.JulianDate.addSeconds(start, i, new Cesium.JulianDate());
var nextTime = Cesium.JulianDate.addSeconds(time, increment, new Cesium.JulianDate());
var color = Cesium.Color.RED;
if (iteration % 2){
color = Cesium.Color.GREEN;
}
colorIntervalCollection.intervals.addInterval(new Cesium.TimeInterval({
start: time,
stop: nextTime,
isStartIncluded: true,
isStopIncluded: true,
data: color
}));
}
return colorIntervalCollection;
}
var colorInterval = computeColors();
// Ages before the first interval
var removeStart = Cesium.JulianDate.fromDate(new Date(2000, 1, 1, 0, 0, 0));
// Relevant part:
// This doesn't appear to break anything. Dragging the slider before 08:00:19 shows the color red
var seconds = 19;
// Uncomment this to remove the red interval and show green instead before 08:00:20
//seconds = 20;
// Uncomment this to break everything
//seconds = 21;
var removeEnd = Cesium.JulianDate.fromDate(new Date(2015, 2, 25, 16, 0, seconds));
// Remove interval
colorInterval.intervals.removeInterval(new Cesium.TimeInterval({
start: removeStart,
stop: removeEnd,
isStartIncluded: true,
isStopIncluded: true
}));
// Add entity to viewer entitycollection
var entity = entities.add({
rectangle : {
coordinates : Cesium.Rectangle.fromDegrees(-92.0, 20.0, -86.0, 27.0),
outline : true,
outlineColor : colorInterval,
outlineWidth : 12,
material: Cesium.Color.BLUE
}
});