Skip to content

Commit 9d6c4cd

Browse files
authored
Merge pull request #4843 from shehzan10/remove-4506
Remove separate heading, pitch, roll from Transform
2 parents ce2b1b9 + 9fe21ef commit 9d6c4cd

File tree

3 files changed

+17
-47
lines changed

3 files changed

+17
-47
lines changed

CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Change Log
44
### 1.30 - 2017-02-01
55
* Deprecated
66
* The properties `url` and `key` will be removed from `GeocoderViewModel` in 1.31. These properties will be available on geocoder services that support them, like `BingMapsGeocoderService`.
7+
* Breaking changes
8+
* Removed separate `heading`, `pitch`, `roll` parameters from `Transform.headingPitchRollToFixedFrame` and `Transform.headingPitchRollQuaternion`. Pass a `headingPitchRoll` object instead. [#4843](https://github.com/AnalyticalGraphicsInc/cesium/pull/4843)
79
* Added support for custom geocoder services and autocomplete [#4723](https://github.com/AnalyticalGraphicsInc/cesium/pull/4723).
810
* Added [Custom Geocoder Sandcastle example](http://localhost:8080/Apps/Sandcastle/index.html?src=Custom%20Geocoder.html)
911
* Added `GeocoderService`, an interface for geocoders.

Source/Core/Transforms.js

+11-31
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ define([
55
'./Cartesian3',
66
'./Cartesian4',
77
'./Cartographic',
8+
'./Check',
89
'./defaultValue',
910
'./defined',
10-
'./deprecationWarning',
1111
'./DeveloperError',
1212
'./EarthOrientationParameters',
1313
'./EarthOrientationParametersSample',
@@ -27,9 +27,9 @@ define([
2727
Cartesian3,
2828
Cartesian4,
2929
Cartographic,
30+
Check,
3031
defaultValue,
3132
defined,
32-
deprecationWarning,
3333
DeveloperError,
3434
EarthOrientationParameters,
3535
EarthOrientationParametersSample,
@@ -473,27 +473,19 @@ define([
473473
* var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
474474
* var transform = Cesium.Transforms.headingPitchRollToFixedFrame(center, hpr);
475475
*/
476-
Transforms.headingPitchRollToFixedFrame = function(origin, headingPitchRoll, pitch, roll, ellipsoid, result) {
477-
var heading;
478-
if (typeof headingPitchRoll === 'object') {
479-
// Shift arguments using assignments to encourage JIT optimization.
480-
ellipsoid = pitch;
481-
result = roll;
482-
heading = headingPitchRoll.heading;
483-
pitch = headingPitchRoll.pitch;
484-
roll = headingPitchRoll.roll;
485-
} else {
486-
deprecationWarning('headingPitchRollToFixedFrame', 'headingPitchRollToFixedFrame with separate heading, pitch, and roll arguments was deprecated in 1.27. It will be removed in 1.30. Use a HeadingPitchRoll object.');
487-
heading = headingPitchRoll;
488-
}
476+
Transforms.headingPitchRollToFixedFrame = function(origin, headingPitchRoll, ellipsoid, result) {
477+
Check.typeOf.object(headingPitchRoll, 'headingPitchRoll');
478+
var heading = headingPitchRoll.heading;
479+
var pitch = headingPitchRoll.pitch;
480+
var roll = headingPitchRoll.roll;
481+
489482
// checks for required parameters happen in the called functions
490483
var hprQuaternion = Quaternion.fromHeadingPitchRoll(heading, pitch, roll, scratchHPRQuaternion);
491484
var hprMatrix = Matrix4.fromTranslationQuaternionRotationScale(Cartesian3.ZERO, hprQuaternion, scratchScale, scratchHPRMatrix4);
492485
result = Transforms.eastNorthUpToFixedFrame(origin, ellipsoid, result);
493486
return Matrix4.multiply(result, hprMatrix, result);
494487
};
495488

496-
var scratchHPR = new HeadingPitchRoll();
497489
var scratchENUMatrix4 = new Matrix4();
498490
var scratchHPRMatrix3 = new Matrix3();
499491

@@ -518,22 +510,10 @@ define([
518510
* var hpr = new HeadingPitchRoll(heading, pitch, roll);
519511
* var quaternion = Cesium.Transforms.headingPitchRollQuaternion(center, hpr);
520512
*/
521-
Transforms.headingPitchRollQuaternion = function(origin, headingPitchRoll, pitch, roll, ellipsoid, result) {
522-
var hpr;
523-
if (typeof headingPitchRoll === 'object') {
524-
// Shift arguments using assignment to encourage JIT optimization.
525-
hpr = headingPitchRoll;
526-
ellipsoid = pitch;
527-
result = roll;
528-
} else {
529-
deprecationWarning('headingPitchRollQuaternion', 'headingPitchRollQuaternion with separate heading, pitch, and roll arguments was deprecated in 1.27. It will be removed in 1.30. Use a HeadingPitchRoll object.');
530-
scratchHPR.heading = headingPitchRoll;
531-
scratchHPR.pitch = pitch;
532-
scratchHPR.roll = roll;
533-
hpr = scratchHPR;
534-
}
513+
Transforms.headingPitchRollQuaternion = function(origin, headingPitchRoll, ellipsoid, result) {
535514
// checks for required parameters happen in the called functions
536-
var transform = Transforms.headingPitchRollToFixedFrame(origin, hpr, ellipsoid, scratchENUMatrix4);
515+
Check.typeOf.object(headingPitchRoll, 'headingPitchRoll');
516+
var transform = Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, scratchENUMatrix4);
537517
var rotation = Matrix4.getRotation(transform, scratchHPRMatrix3);
538518
return Quaternion.fromRotationMatrix(rotation, result);
539519
};

Specs/Core/TransformsSpec.js

+4-16
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ defineSuite([
357357
var transform = Transforms.headingPitchRollToFixedFrame(origin, hpr, Ellipsoid.UNIT_SPHERE);
358358
var expected = Matrix4.getRotation(transform, new Matrix3());
359359

360-
var quaternion = Transforms.headingPitchRollQuaternion(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE);
360+
var quaternion = Transforms.headingPitchRollQuaternion(origin, hpr, Ellipsoid.UNIT_SPHERE);
361361
var actual = Matrix3.fromQuaternion(quaternion);
362362
expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON11);
363363
});
@@ -388,7 +388,7 @@ defineSuite([
388388
var expected = Matrix4.getRotation(transform, new Matrix3());
389389

390390
var result = new Quaternion();
391-
var quaternion = Transforms.headingPitchRollQuaternion(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE, result);
391+
var quaternion = Transforms.headingPitchRollQuaternion(origin, hpr, Ellipsoid.UNIT_SPHERE, result);
392392
var actual = Matrix3.fromQuaternion(quaternion);
393393
expect(quaternion).toBe(result);
394394
expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON11);
@@ -923,21 +923,9 @@ defineSuite([
923923
}).toThrowDeveloperError();
924924
});
925925

926-
it('headingPitchRollToFixedFrame throws without an heading', function() {
927-
expect(function() {
928-
Transforms.headingPitchRollToFixedFrame(Cartesian3.ZERO, undefined, 0.0, 0.0);
929-
}).toThrowDeveloperError();
930-
});
931-
932-
it('headingPitchRollToFixedFrame throws without an pitch', function() {
933-
expect(function() {
934-
Transforms.headingPitchRollToFixedFrame(Cartesian3.ZERO, 0.0, undefined, 0.0);
935-
}).toThrowDeveloperError();
936-
});
937-
938-
it('headingPitchRollToFixedFrame throws without an roll', function() {
926+
it('headingPitchRollToFixedFrame throws without a headingPitchRoll', function() {
939927
expect(function() {
940-
Transforms.headingPitchRollToFixedFrame(Cartesian3.ZERO, 0.0, 0.0, undefined);
928+
Transforms.headingPitchRollToFixedFrame(Cartesian3.ZERO, undefined);
941929
}).toThrowDeveloperError();
942930
});
943931

0 commit comments

Comments
 (0)