Skip to content

Commit

Permalink
Merge pull request #5413 from WilliamKHo/PolylineGeoUpdaterBug
Browse files Browse the repository at this point in the history
Polyline Crash on Undefined Globe Fix
  • Loading branch information
Hannah authored Jun 2, 2017
2 parents 825e692 + df766b2 commit 04396a9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ Change Log
### 1.35 - 2017-07-05

* Deprecated
* `GoogleEarthImageryProvider` has been deprecated and will be removed in Cesium 1.37, use `GoogleEarthEnterpriseMapsProvider` instead.
* `GoogleEarthImageryProvider` has been deprecated and will be removed in Cesium 1.37, use `GoogleEarthEnterpriseMapsProvider` instead.
* Fixed bug where if polylines were set to follow the surface of an undefined globe, Cesium would crash [#5413] https://github.com/AnalyticalGraphicsInc/cesium/pull/5413
* Fixed a bug where picking clusters would return undefined instead of a list of the clustered entities. [#5286](https://github.com/AnalyticalGraphicsInc/cesium/issues/5286)
* Reduced the amount of Sun bloom post-process effect near the horizon. [#5381](https://github.com/AnalyticalGraphicsInc/cesium/issues/5381)
>>>>>>> master
### 1.34 - 2017-06-01

Expand Down
7 changes: 4 additions & 3 deletions Source/DataSources/PolylineGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,6 @@ define([
this._geometryUpdater = geometryUpdater;
this._positions = [];

generateCartesianArcOptions.ellipsoid = geometryUpdater._scene.globe.ellipsoid;
}
DynamicGeometryUpdater.prototype.update = function(time) {
var geometryUpdater = this._geometryUpdater;
Expand All @@ -537,10 +536,12 @@ define([
}

var followSurface = Property.getValueOrDefault(polyline._followSurface, time, true);
if (followSurface) {
var globe = geometryUpdater._scene.globe;
if (followSurface && defined(globe)) {
generateCartesianArcOptions.ellipsoid = globe.ellipsoid;
generateCartesianArcOptions.positions = positions;
generateCartesianArcOptions.granularity = Property.getValueOrUndefined(polyline._granularity, time);
generateCartesianArcOptions.height = PolylinePipeline.extractHeights(positions, this._geometryUpdater._scene.globe.ellipsoid);
generateCartesianArcOptions.height = PolylinePipeline.extractHeights(positions, globe.ellipsoid);
positions = PolylinePipeline.generateCartesianArc(generateCartesianArcOptions);
}

Expand Down
16 changes: 16 additions & 0 deletions Specs/DataSources/PolylineGeometryUpdaterSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ defineSuite([
'Core/DistanceDisplayCondition',
'Core/DistanceDisplayConditionGeometryInstanceAttribute',
'Core/JulianDate',
'Core/PolylinePipeline',
'Core/ShowGeometryInstanceAttribute',
'Core/TimeInterval',
'Core/TimeIntervalCollection',
Expand All @@ -34,6 +35,7 @@ defineSuite([
DistanceDisplayCondition,
DistanceDisplayConditionGeometryInstanceAttribute,
JulianDate,
PolylinePipeline,
ShowGeometryInstanceAttribute,
TimeInterval,
TimeIntervalCollection,
Expand Down Expand Up @@ -576,4 +578,18 @@ defineSuite([
updater.destroy();
scene.primitives.removeAll();
});

it('followSurface true with undefined globe does not call generateCartesianArc', function() {
var entity = createBasicPolyline();
entity.polyline.width = createDynamicProperty(1);
scene.globe = undefined;
var updater = new PolylineGeometryUpdater(entity, scene);
var dynamicUpdater = updater.createDynamicUpdater(scene.primitives);
spyOn(PolylinePipeline, 'generateCartesianArc').and.callThrough();
dynamicUpdater.update(time);
expect(PolylinePipeline.generateCartesianArc).not.toHaveBeenCalled();
updater.destroy();
scene.primitives.removeAll();
scene.globe = new Globe();
});
}, 'WebGL');

0 comments on commit 04396a9

Please sign in to comment.