Crash double-clicking an entity

Hi,

Clicking on the red polyline causes a crash in EntityView. I am at the head of cesium as of just earlier today.

Scott

var viewer = new Cesium.Viewer(‘cesiumContainer’);

viewer.clock.startTime = Cesium.JulianDate.fromIso8601(“2014-03-14T00:00:00.000Z”);

viewer.clock.stopTime = Cesium.JulianDate.fromIso8601(“2014-03-15T00:00:00.000Z”);

viewer.clock.currentTime = Cesium.JulianDate.fromIso8601(“2014-03-14T00:00:00.000Z”);

viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;

var entities = viewer.entities;

var flights = entities.add(new Cesium.Entity());

var aircraftPositions = new Cesium.SampledPositionProperty();

{

aircraftPositions.addSample("2014-03-14T16:00:00.000", Cesium.Cartesian3.fromDegrees(-80.000, 28.400,      0.000));

aircraftPositions.addSample("2014-03-14T16:00:05.000", Cesium.Cartesian3.fromDegrees(-79.828, 28.599,  14449.133));

aircraftPositions.addSample("2014-03-14T16:00:10.000", Cesium.Cartesian3.fromDegrees(-79.656, 28.796,  28785.919));

aircraftPositions.addSample("2014-03-14T16:00:15.000", Cesium.Cartesian3.fromDegrees(-79.485, 28.993,  43010.562));

aircraftPositions.addSample("2014-03-14T16:00:20.000", Cesium.Cartesian3.fromDegrees(-79.313, 29.188,  57123.264));

aircraftPositions.addSample("2014-03-14T16:00:25.000", Cesium.Cartesian3.fromDegrees(-79.142, 29.382,  71124.228));

aircraftPositions.addSample("2014-03-14T16:00:30.000", Cesium.Cartesian3.fromDegrees(-78.970, 29.575,  85013.653));

aircraftPositions.addSample("2014-03-14T16:00:35.000", Cesium.Cartesian3.fromDegrees(-78.799, 29.767,  98791.739));

aircraftPositions.addSample("2014-03-14T16:00:40.000", Cesium.Cartesian3.fromDegrees(-78.628, 29.957, 112458.685));

aircraftPositions.addSample("2014-03-14T16:00:45.000", Cesium.Cartesian3.fromDegrees(-78.457, 30.147, 126014.688));

aircraftPositions.addSample("2014-03-14T16:00:50.000", Cesium.Cartesian3.fromDegrees(-78.286, 30.336, 139459.944));

aircraftPositions.addSample("2014-03-14T16:00:55.000", Cesium.Cartesian3.fromDegrees(-78.115, 30.523, 152794.648));

}

var aircraftPositions2 = ;

{

aircraftPositions2.push(Cesium.Cartesian3.fromDegrees(-80.000, 28.400,      0.000));

aircraftPositions2.push(Cesium.Cartesian3.fromDegrees(-79.828, 28.599,  14449.133));

aircraftPositions2.push(Cesium.Cartesian3.fromDegrees(-79.656, 28.796,  28785.919));

aircraftPositions2.push(Cesium.Cartesian3.fromDegrees(-79.485, 28.993,  43010.562));

aircraftPositions2.push(Cesium.Cartesian3.fromDegrees(-79.313, 29.188,  57123.264));

aircraftPositions2.push(Cesium.Cartesian3.fromDegrees(-79.142, 29.382,  71124.228));

aircraftPositions2.push(Cesium.Cartesian3.fromDegrees(-78.970, 29.575,  85013.653));

aircraftPositions2.push(Cesium.Cartesian3.fromDegrees(-78.799, 29.767,  98791.739));

aircraftPositions2.push(Cesium.Cartesian3.fromDegrees(-78.628, 29.957, 112458.685));

aircraftPositions2.push(Cesium.Cartesian3.fromDegrees(-78.457, 30.147, 126014.688));

aircraftPositions2.push(Cesium.Cartesian3.fromDegrees(-78.286, 30.336, 139459.944));

aircraftPositions2.push(Cesium.Cartesian3.fromDegrees(-78.115, 30.523, 152794.648));

}

var aircraft = entities.add({

parent: flights,

name: "XYX1308",

description: "A flight roughly from Florida to Ireland.",

position: aircraftPositions,

polyline: {

    positions: aircraftPositions2,

    followSurface: false,

    width: 5.0,

    material: Cesium.Color.RED

}

});

``

Thanks for the bug report. It looks like has been around for a while (at least 1.6). The issue is that the polyline exists forever while the position is time-limited. When you double click on the polyline it sees that is has a position property and is trying to use it to track that position, which is undefined at the current animation time.

I think the ideal behavior is that we would detect that the position is undefined and zoom to the extent of the polyline instead, just like we would do with a polyline without a position property at all. The only downside I see to this is that the object’s position will not be automatically tracked when it does come into existence, but I’m not sure if doing so would be good behavior anyway since it would cause an immediate camera jump out of nowhere. If the object does exist at the time you double click, you will track it at usual.

Longer term, we need to overhaul the default camera functionality in Viewer to make it more consistent and predictable. Right now you get inconsistent results when you double click, depending on the type of visualization and I’d like to change that.

I opened a pull request with the fix: https://github.com/AnalyticalGraphicsInc/cesium/pull/2774