Skip to content

Commit

Permalink
Merge pull request #5635 from AnalyticalGraphicsInc/deprecated
Browse files Browse the repository at this point in the history
Remove deprecated function parameters
  • Loading branch information
pjcozzi authored Jul 14, 2017
2 parents 47cd712 + 2e4b5c1 commit e86f34a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 51 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Change Log

### 1.36 - 2017-08-01

* Breaking changes
* The function `Quaternion.fromHeadingPitchRoll(heading, pitch, roll, result)` was removed. Use `Quaternion.fromHeadingPitchRoll(hpr, result)` instead where `hpr` is a `HeadingPitchRoll`.
* The function `Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, result)` was removed. Use `Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result)` instead where `fixedFrameTransform` is a a 4x4 transformation matrix (see `Transforms.localFrameToFixedFrameGenerator`).
* The function `Transforms.headingPitchRollQuaternion(origin, headingPitchRoll, ellipsoid, result)` was removed. Use `Transforms.headingPitchRollQuaternion(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result)` instead where `fixedFrameTransform` is a a 4x4 transformation matrix (see `Transforms.localFrameToFixedFrameGenerator`).
* Added ability to show tile urls in the 3D Tiles Inspector. [#5592](https://github.com/AnalyticalGraphicsInc/cesium/pull/5592)
* Added behavior to `Cesium3DTilesInspector` that selects the first tileset hovered over if no tilest is specified. [#5139](https://github.com/AnalyticalGraphicsInc/cesium/issues/5139)
* Added ability to provide a `width` and `height` to `scene.pick`. [#5602](https://github.com/AnalyticalGraphicsInc/cesium/pull/5602)
Expand Down
27 changes: 6 additions & 21 deletions Source/Core/Quaternion.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ define([
'./Check',
'./defaultValue',
'./defined',
'./deprecationWarning',
'./FeatureDetection',
'./freezeObject',
'./HeadingPitchRoll',
Expand All @@ -14,7 +13,6 @@ define([
Check,
defaultValue,
defined,
deprecationWarning,
FeatureDetection,
freezeObject,
HeadingPitchRoll,
Expand Down Expand Up @@ -186,28 +184,15 @@ define([
* @param {Quaternion} [result] The object onto which to store the result.
* @returns {Quaternion} The modified result parameter or a new Quaternion instance if none was provided.
*/
Quaternion.fromHeadingPitchRoll = function(headingOrHeadingPitchRoll, pitchOrResult, roll, result) {
Quaternion.fromHeadingPitchRoll = function(headingPitchRoll, result) {
//>>includeStart('debug', pragmas.debug);
if (headingOrHeadingPitchRoll instanceof HeadingPitchRoll) {
Check.typeOf.object('headingPitchRoll', headingOrHeadingPitchRoll);
} else {
Check.typeOf.number('heading', headingOrHeadingPitchRoll);
Check.typeOf.number('pitch', pitchOrResult);
Check.typeOf.number('roll', roll);
}
Check.typeOf.object('headingPitchRoll', headingPitchRoll);
//>>includeEnd('debug');
var hpr;
if (headingOrHeadingPitchRoll instanceof HeadingPitchRoll) {
hpr = headingOrHeadingPitchRoll;
result = pitchOrResult;
} else {
deprecationWarning('Quaternion.fromHeadingPitchRoll(heading, pitch, roll,result)', 'The method was deprecated in Cesium 1.32 and will be removed in version 1.33. ' + 'Use Quaternion.fromHeadingPitchRoll(hpr,result) where hpr is a HeadingPitchRoll');
hpr = new HeadingPitchRoll(headingOrHeadingPitchRoll, pitchOrResult, roll);
}
scratchRollQuaternion = Quaternion.fromAxisAngle(Cartesian3.UNIT_X, hpr.roll, scratchHPRQuaternion);
scratchPitchQuaternion = Quaternion.fromAxisAngle(Cartesian3.UNIT_Y, -hpr.pitch, result);

scratchRollQuaternion = Quaternion.fromAxisAngle(Cartesian3.UNIT_X, headingPitchRoll.roll, scratchHPRQuaternion);
scratchPitchQuaternion = Quaternion.fromAxisAngle(Cartesian3.UNIT_Y, -headingPitchRoll.pitch, result);
result = Quaternion.multiply(scratchPitchQuaternion, scratchRollQuaternion, scratchPitchQuaternion);
scratchHeadingQuaternion = Quaternion.fromAxisAngle(Cartesian3.UNIT_Z, -hpr.heading, scratchHPRQuaternion);
scratchHeadingQuaternion = Quaternion.fromAxisAngle(Cartesian3.UNIT_Z, -headingPitchRoll.heading, scratchHPRQuaternion);
return Quaternion.multiply(scratchHeadingQuaternion, result, result);
};

Expand Down
28 changes: 8 additions & 20 deletions Source/Core/Transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ define([
'./Check',
'./defaultValue',
'./defined',
'./deprecationWarning',
'./DeveloperError',
'./EarthOrientationParameters',
'./EarthOrientationParametersSample',
Expand All @@ -29,7 +28,6 @@ define([
Check,
defaultValue,
defined,
deprecationWarning,
DeveloperError,
EarthOrientationParameters,
EarthOrientationParametersSample,
Expand Down Expand Up @@ -317,7 +315,7 @@ define([
* @param {Cartesian3} origin The center point of the local reference frame.
* @param {HeadingPitchRoll} headingPitchRoll The heading, pitch, and roll.
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation.
* @param {Transforms~LocalFrameToFixedFrame} [fixedFrameTransformOrResult=Transforms.eastNorthUpToFixedFrame] A 4x4 transformation
* @param {Transforms~LocalFrameToFixedFrame} [fixedFrameTransform=Transforms.eastNorthUpToFixedFrame] A 4x4 transformation
* matrix from a reference frame to the provided ellipsoid's fixed reference frame
* @param {Matrix4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if none was provided.
Expand All @@ -331,21 +329,15 @@ define([
* var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
* var transform = Cesium.Transforms.headingPitchRollToFixedFrame(center, hpr);
*/
Transforms.headingPitchRollToFixedFrame = function(origin, headingPitchRoll, ellipsoid, fixedFrameTransformOrResult, result) {
Transforms.headingPitchRollToFixedFrame = function(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result) {
//>>includeStart('debug', pragmas.debug);
Check.typeOf.object( 'HeadingPitchRoll', headingPitchRoll);
//>>includeEnd('debug');

// checks for required parameters happen in the called functions
if(fixedFrameTransformOrResult instanceof Matrix4){
result = fixedFrameTransformOrResult;
fixedFrameTransformOrResult = undefined;
deprecationWarning('Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, result)', 'The method was deprecated in Cesium 1.31 and will be removed in version 1.33. Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result) where fixedFrameTransform is a a 4x4 transformation matrix (see Transforms.localFrameToFixedFrameGenerator)');
}
fixedFrameTransformOrResult = defaultValue(fixedFrameTransformOrResult,Transforms.eastNorthUpToFixedFrame);
fixedFrameTransform = defaultValue(fixedFrameTransform, Transforms.eastNorthUpToFixedFrame);
var hprQuaternion = Quaternion.fromHeadingPitchRoll(headingPitchRoll, scratchHPRQuaternion);
var hprMatrix = Matrix4.fromTranslationQuaternionRotationScale(Cartesian3.ZERO, hprQuaternion, scratchScale, scratchHPRMatrix4);
result = fixedFrameTransformOrResult(origin, ellipsoid, result);
result = fixedFrameTransform(origin, ellipsoid, result);
return Matrix4.multiply(result, hprMatrix, result);
};

Expand All @@ -361,7 +353,7 @@ define([
* @param {Cartesian3} origin The center point of the local reference frame.
* @param {HeadingPitchRoll} headingPitchRoll The heading, pitch, and roll.
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation.
* @param {Transforms~LocalFrameToFixedFrame} [fixedFrameTransformOrResult=Transforms.eastNorthUpToFixedFrame] A 4x4 transformation
* @param {Transforms~LocalFrameToFixedFrame} [fixedFrameTransform=Transforms.eastNorthUpToFixedFrame] A 4x4 transformation
* matrix from a reference frame to the provided ellipsoid's fixed reference frame
* @param {Quaternion} [result] The object onto which to store the result.
* @returns {Quaternion} The modified result parameter or a new Quaternion instance if none was provided.
Expand All @@ -375,16 +367,12 @@ define([
* var hpr = new HeadingPitchRoll(heading, pitch, roll);
* var quaternion = Cesium.Transforms.headingPitchRollQuaternion(center, hpr);
*/
Transforms.headingPitchRollQuaternion = function(origin, headingPitchRoll, ellipsoid, fixedFrameTransformOrResult, result) {
Transforms.headingPitchRollQuaternion = function(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result) {
//>>includeStart('debug', pragmas.debug);
Check.typeOf.object( 'HeadingPitchRoll', headingPitchRoll);
//>>includeEnd('debug');
if (fixedFrameTransformOrResult instanceof Quaternion) {
result = fixedFrameTransformOrResult;
fixedFrameTransformOrResult = undefined;
deprecationWarning('Transforms.headingPitchRollQuaternion(origin, headingPitchRoll, ellipsoid, result)', 'The method was deprecated in Cesium 1.31 and will be removed in version 1.33. Transforms.headingPitchRollQuaternion(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result) where fixedFrameTransform is a a 4x4 transformation matrix (see Transforms.localFrameToFixedFrameGenerator)');
}
var transform = Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid,fixedFrameTransformOrResult, scratchENUMatrix4);

var transform = Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, scratchENUMatrix4);
var rotation = Matrix4.getRotation(transform, scratchHPRMatrix3);
return Quaternion.fromRotationMatrix(rotation, result);
};
Expand Down
10 changes: 0 additions & 10 deletions Specs/Core/QuaternionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,6 @@ defineSuite([
expect(quaternion).toEqualEpsilon(expected, CesiumMath.EPSILON11);
});

it('fromHeadingPitchRoll works with individual angle parameters', function() {
var heading = CesiumMath.toRadians(180.0);
var pitch = CesiumMath.toRadians(-45.0);
var roll = CesiumMath.toRadians(45.0);
var hpr = new HeadingPitchRoll( heading, pitch, roll);
var quaternion1 = Quaternion.fromHeadingPitchRoll(hpr);
var quaternion2 = Quaternion.fromHeadingPitchRoll(heading, pitch, roll);
expect(quaternion1).toEqual(quaternion2);
});

it('clone without a result parameter', function() {
var quaternion = new Quaternion(1.0, 2.0, 3.0, 4.0);
var result = quaternion.clone();
Expand Down

0 comments on commit e86f34a

Please sign in to comment.