-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Replaces DeveloperError(s) with Check(s) in Ellipsoid #5425
Changes from 1 commit
08e2702
a6d90ad
f32928f
b572487
b25fbc2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/*global define*/ | ||
define([ | ||
'./Check', | ||
'./Cartesian3', | ||
'./Cartographic', | ||
'./defaultValue', | ||
|
@@ -10,6 +11,7 @@ define([ | |
'./Math', | ||
'./scaleToGeodeticSurface' | ||
], function( | ||
Check, | ||
Cartesian3, | ||
Cartographic, | ||
defaultValue, | ||
|
@@ -27,10 +29,13 @@ define([ | |
z = defaultValue(z, 0.0); | ||
|
||
//>>includeStart('debug', pragmas.debug); | ||
if (x < 0.0 || y < 0.0 || z < 0.0) { | ||
/*if (x < 0.0 || y < 0.0 || z < 0.0) { | ||
throw new DeveloperError('All radii components must be greater than or equal to zero.'); | ||
} | ||
}*/ | ||
//>>includeEnd('debug'); | ||
Check.typeOf.number.greaterThanOrEquals('x', x, 0.0); | ||
Check.typeOf.number.greaterThanOrEquals('y', y, 0.0); | ||
Check.typeOf.number.greaterThanOrEquals('z', z, 0.0); | ||
|
||
ellipsoid._radii = new Cartesian3(x, y, z); | ||
|
||
|
@@ -283,13 +288,15 @@ define([ | |
*/ | ||
Ellipsoid.pack = function(value, array, startingIndex) { | ||
//>>includeStart('debug', pragmas.debug); | ||
if (!defined(value)) { | ||
/*if (!defined(value)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove comment. |
||
throw new DeveloperError('value is required'); | ||
} | ||
if (!defined(array)) { | ||
throw new DeveloperError('array is required'); | ||
} | ||
}*/ | ||
//>>includeEnd('debug'); | ||
Check.defined('value', value); | ||
Check.defined('array', array); | ||
|
||
startingIndex = defaultValue(startingIndex, 0); | ||
|
||
|
@@ -308,10 +315,11 @@ define([ | |
*/ | ||
Ellipsoid.unpack = function(array, startingIndex, result) { | ||
//>>includeStart('debug', pragmas.debug); | ||
if (!defined(array)) { | ||
/*if (!defined(array)) { | ||
throw new DeveloperError('array is required'); | ||
} | ||
}*/ | ||
//>>includeEnd('debug'); | ||
Check.defined('array', array); | ||
|
||
startingIndex = defaultValue(startingIndex, 0); | ||
|
||
|
@@ -338,10 +346,11 @@ define([ | |
*/ | ||
Ellipsoid.prototype.geodeticSurfaceNormalCartographic = function(cartographic, result) { | ||
//>>includeStart('debug', pragmas.debug); | ||
if (!defined(cartographic)) { | ||
/*if (!defined(cartographic)) { | ||
throw new DeveloperError('cartographic is required.'); | ||
} | ||
}*/ | ||
//>>includeEnd('debug'); | ||
Check.defined('cartographic', cartographic); | ||
|
||
var longitude = cartographic.longitude; | ||
var latitude = cartographic.latitude; | ||
|
@@ -422,10 +431,11 @@ define([ | |
*/ | ||
Ellipsoid.prototype.cartographicArrayToCartesianArray = function(cartographics, result) { | ||
//>>includeStart('debug', pragmas.debug); | ||
if (!defined(cartographics)) { | ||
/*if (!defined(cartographics)) { | ||
throw new DeveloperError('cartographics is required.'); | ||
} | ||
//>>includeEnd('debug'); | ||
}*/ | ||
//>>includeEnd('debug') | ||
Check.defined('cartographics', cartographics); | ||
|
||
var length = cartographics.length; | ||
if (!defined(result)) { | ||
|
@@ -496,10 +506,11 @@ define([ | |
*/ | ||
Ellipsoid.prototype.cartesianArrayToCartographicArray = function(cartesians, result) { | ||
//>>includeStart('debug', pragmas.debug); | ||
if (!defined(cartesians)) { | ||
/*if (!defined(cartesians)) { | ||
throw new DeveloperError('cartesians is required.'); | ||
} | ||
}*/ | ||
//>>includeEnd('debug'); | ||
Check.defined('cartesians', cartesians); | ||
|
||
var length = cartesians.length; | ||
if (!defined(result)) { | ||
|
@@ -536,10 +547,11 @@ define([ | |
*/ | ||
Ellipsoid.prototype.scaleToGeocentricSurface = function(cartesian, result) { | ||
//>>includeStart('debug', pragmas.debug); | ||
if (!defined(cartesian)) { | ||
/*if (!defined(cartesian)) { | ||
throw new DeveloperError('cartesian is required.'); | ||
} | ||
}*/ | ||
//>>includeEnd('debug'); | ||
Check.defined('cartesian', cartesian); | ||
|
||
if (!defined(result)) { | ||
result = new Cartesian3(); | ||
|
@@ -633,17 +645,27 @@ define([ | |
*/ | ||
Ellipsoid.prototype.getSurfaceNormalIntersectionWithZAxis = function(position, buffer, result) { | ||
//>>includeStart('debug', pragmas.debug); | ||
if (!defined(position)) { | ||
/*if (!defined(position)) { | ||
throw new DeveloperError('position is required.'); | ||
} | ||
if (!CesiumMath.equalsEpsilon(this._radii.x, this._radii.y, CesiumMath.EPSILON15)) { | ||
throw new DeveloperError('Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)'); | ||
} | ||
if (this._radii.z === 0) { | ||
throw new DeveloperError('Ellipsoid.radii.z must be greater than 0'); | ||
} | ||
}*/ | ||
//>>includeEnd('debug'); | ||
|
||
Check.defined('position', position); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment. |
||
|
||
// While it would be more idiomatic to use a Check.typeOf.number.something here, | ||
// the resulting error message is a lot harder to read. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's fine to remove this comment. |
||
if (!CesiumMath.equalsEpsilon(this._radii.x, this._radii.y, CesiumMath.EPSILON15)) { | ||
throw new DeveloperError('Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)'); | ||
} | ||
|
||
Check.typeOf.number.greaterThan('_radii.z', this._radii.z, 0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change the string to |
||
|
||
buffer = defaultValue(buffer, 0.0); | ||
|
||
var sqauredXOverSquaredZ = this._sqauredXOverSquaredZ; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this PR was submitted alongside #5424 it has some of the same issues. Do a pass over the file to make sure commented code is deleted, checks are within
includeStart/includeEnd
, and the appropriateCheck.typeOf
is used.