Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ellipsoid bug in GroundPolylineGeometry.unpack #7566

Merged
merged 1 commit into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Change Log
* Fixed an issue where some ground polygons crossing the Prime Meridian would have incorrect bounding rectangles. [#7533](https://github.com/AnalyticalGraphicsInc/cesium/pull/7533)
* Fixed an issue where polygons on terrain using rhumb lines where being rendered incorrectly. [#7538](https://github.com/AnalyticalGraphicsInc/cesium/pulls/7538)
* Fixed an issue with `EllipsoidRhumbLines.findIntersectionWithLongitude` when longitude was IDL. [#7551](https://github.com/AnalyticalGraphicsInc/cesium/issues/7551)
* Fixed an issue with ground polylines on globes that use ellipsoids other than WGS84. [#7552](https://github.com/AnalyticalGraphicsInc/cesium/issues/7552)

### 1.54 - 2019-02-01

Expand Down
11 changes: 2 additions & 9 deletions Source/Core/GroundPolylineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,16 +331,9 @@ define([
var scene3DOnly = (array[index++] === 1.0);

if (!defined(result)) {
var geometry = new GroundPolylineGeometry({
positions : positions,
granularity : granularity,
loop : loop,
arcType : arcType,
ellipsoid : ellipsoid
result = new GroundPolylineGeometry({
positions : positions
});
geometry._projectionIndex = projectionIndex;
geometry._scene3DOnly = scene3DOnly;
return geometry;
}

result._positions = positions;
Expand Down
31 changes: 29 additions & 2 deletions Specs/Core/GroundPolylineGeometrySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ defineSuite([
granularity : 10.0 // no interpolative subdivision
});
groundPolylineGeometry._scene3DOnly = true;
GroundPolylineGeometry.setProjectionAndEllipsoid(groundPolylineGeometry, new WebMercatorProjection(Ellipsoid.WGS84));
GroundPolylineGeometry.setProjectionAndEllipsoid(groundPolylineGeometry, new WebMercatorProjection(Ellipsoid.UNIT_SPHERE));

var packedArray = [0];
GroundPolylineGeometry.pack(groundPolylineGeometry, packedArray, 1);
Expand All @@ -548,11 +548,38 @@ defineSuite([
expect(Cartesian3.equals(scratchPositions[1], groundPolylineGeometry._positions[1])).toBe(true);
expect(scratch.loop).toBe(true);
expect(scratch.granularity).toEqual(10.0);
expect(scratch._ellipsoid.equals(Ellipsoid.WGS84)).toBe(true);
expect(scratch._ellipsoid.equals(Ellipsoid.UNIT_SPHERE)).toBe(true);
expect(scratch._scene3DOnly).toBe(true);
expect(scratch._projectionIndex).toEqual(1);
});

it('can unpack onto a new instance', function() {
var groundPolylineGeometry = new GroundPolylineGeometry({
positions : Cartesian3.fromDegreesArray([
-1.0, 0.0,
1.0, 0.0
]),
loop : true,
granularity : 10.0 // no interpolative subdivision
});
groundPolylineGeometry._scene3DOnly = true;
GroundPolylineGeometry.setProjectionAndEllipsoid(groundPolylineGeometry, new WebMercatorProjection(Ellipsoid.UNIT_SPHERE));

var packedArray = [0];
GroundPolylineGeometry.pack(groundPolylineGeometry, packedArray, 1);
var result = GroundPolylineGeometry.unpack(packedArray, 1);

var scratchPositions = result._positions;
expect(scratchPositions.length).toEqual(2);
expect(Cartesian3.equals(scratchPositions[0], groundPolylineGeometry._positions[0])).toBe(true);
expect(Cartesian3.equals(scratchPositions[1], groundPolylineGeometry._positions[1])).toBe(true);
expect(result.loop).toBe(true);
expect(result.granularity).toEqual(10.0);
expect(result._ellipsoid.equals(Ellipsoid.UNIT_SPHERE)).toBe(true);
expect(result._scene3DOnly).toBe(true);
expect(result._projectionIndex).toEqual(1);
});

it('provides a method for setting projection and ellipsoid', function() {
var groundPolylineGeometry = new GroundPolylineGeometry({
positions : Cartesian3.fromDegreesArray([
Expand Down