From 482379eb3fefca1d3d28cf8a2cc879f8c6ad0841 Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Thu, 19 Sep 2019 14:38:55 -0400 Subject: [PATCH] Make dynamic polyline create the given arcType --- CHANGES.md | 1 + Source/DataSources/PolylineGeometryUpdater.js | 6 +++++- .../DataSources/PolylineGeometryUpdaterSpec.js | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 127a05c942b5..36556f7f973d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -23,6 +23,7 @@ Change Log * 3D Tiles geometric error now scales with transform. [#8182](https://github.com/AnalyticalGraphicsInc/cesium/pull/8182) * Fixed per-feature post processing from sometimes selecting the wrong feature. [#7929](https://github.com/AnalyticalGraphicsInc/cesium/pull/7929) * Fixed labels not showing for individual entities in data sources when clustering is enabled. [#6087](https://github.com/AnalyticalGraphicsInc/cesium/issues/6087) +* Fixed a bug where dynamic polylines did not use the given arcType. [#8191](https://github.com/AnalyticalGraphicsInc/cesium/issues/8191) ### 1.61 - 2019-09-03 diff --git a/Source/DataSources/PolylineGeometryUpdater.js b/Source/DataSources/PolylineGeometryUpdater.js index 1ce073bea471..f29323f3dc1c 100644 --- a/Source/DataSources/PolylineGeometryUpdater.js +++ b/Source/DataSources/PolylineGeometryUpdater.js @@ -712,7 +712,11 @@ define([ generateCartesianArcOptions.positions = positions; generateCartesianArcOptions.granularity = Property.getValueOrUndefined(polyline._granularity, time); generateCartesianArcOptions.height = PolylinePipeline.extractHeights(positions, globe.ellipsoid); - positions = PolylinePipeline.generateCartesianArc(generateCartesianArcOptions); + if (arcType === ArcType.GEODESIC) { + positions = PolylinePipeline.generateCartesianArc(generateCartesianArcOptions); + } else { + positions = PolylinePipeline.generateCartesianRhumbArc(generateCartesianArcOptions); + } } line.show = true; diff --git a/Specs/DataSources/PolylineGeometryUpdaterSpec.js b/Specs/DataSources/PolylineGeometryUpdaterSpec.js index 0c4bb0ca6ac0..659307d78c40 100644 --- a/Specs/DataSources/PolylineGeometryUpdaterSpec.js +++ b/Specs/DataSources/PolylineGeometryUpdaterSpec.js @@ -831,6 +831,23 @@ describe('DataSources/PolylineGeometryUpdater', function() { expect(scene.groundPrimitives.length).toBe(0); }); + it('calls generateCartesianRhumbArc for RHUMB arcType', function() { + var entity = createBasicPolyline(); + entity.polyline.width = createDynamicProperty(1); + entity.polyline.arcType = ArcType.RHUMB; + + var updater = new PolylineGeometryUpdater(entity, scene); + var dynamicUpdater = updater.createDynamicUpdater(scene.primitives, scene.groundPrimitives); + spyOn(PolylinePipeline, 'generateCartesianRhumbArc').and.callThrough(); + dynamicUpdater.update(time); + expect(PolylinePipeline.generateCartesianRhumbArc).toHaveBeenCalled(); + dynamicUpdater.destroy(); + updater.destroy(); + + expect(scene.primitives.length).toBe(0); + expect(scene.groundPrimitives.length).toBe(0); + }); + it('arcType GEODESIC with undefined globe does not call generateCartesianArc', function() { if (!Entity.supportsPolylinesOnTerrain(scene)) { return;