Skip to content

Commit

Permalink
Merge pull request #4934 from rahwang/replace-developerError-polygon-…
Browse files Browse the repository at this point in the history
…geometry

Replace developerError with Check in polygonGeometry
  • Loading branch information
lilleyse authored Jan 30, 2017
2 parents 86a6128 + ae46551 commit 48266d7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 31 deletions.
25 changes: 9 additions & 16 deletions Source/Core/PolygonGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ define([
'./Cartesian2',
'./Cartesian3',
'./Cartographic',
'./Check',
'./ComponentDatatype',
'./defaultValue',
'./defined',
Expand All @@ -31,6 +32,7 @@ define([
Cartesian2,
Cartesian3,
Cartographic,
Check,
ComponentDatatype,
defaultValue,
defined,
Expand Down Expand Up @@ -556,9 +558,8 @@ define([
*/
function PolygonGeometry(options) {
//>>includeStart('debug', pragmas.debug);
if (!defined(options) || !defined(options.polygonHierarchy)) {
throw new DeveloperError('options.polygonHierarchy is required.');
}
Check.typeOf.object('options', options);
Check.typeOf.object('options.polygonHierarchy', options.polygonHierarchy);
if (defined(options.perPositionHeight) && options.perPositionHeight && defined(options.height)) {
throw new DeveloperError('Cannot use both options.perPositionHeight and options.height');
}
Expand Down Expand Up @@ -623,7 +624,7 @@ define([
* @param {Number} [options.height=0.0] The height of the polygon.
* @param {Number} [options.extrudedHeight] The height of the polygon extrusion.
* @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.
* @param {Number} [options.stRotation=0.0] The rotation of the texture coordiantes, in radians. A positive rotation is counter-clockwise.
* @param {Number} [options.stRotation=0.0] The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise.
* @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
* @param {Number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
* @param {Boolean} [options.perPositionHeight=false] Use the height of options.positions for each position instead of using options.height to determine the height.
Expand Down Expand Up @@ -651,9 +652,7 @@ define([
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

//>>includeStart('debug', pragmas.debug);
if (!defined(options.positions)) {
throw new DeveloperError('options.positions is required.');
}
Check.defined('options.positions', options.positions);
//>>includeEnd('debug');

var newOptions = {
Expand Down Expand Up @@ -684,12 +683,8 @@ define([
*/
PolygonGeometry.pack = function(value, array, startingIndex) {
//>>includeStart('debug', pragmas.debug);
if (!defined(value)) {
throw new DeveloperError('value is required');
}
if (!defined(array)) {
throw new DeveloperError('array is required');
}
Check.typeOf.object('value', value);
Check.defined('array', array);
//>>includeEnd('debug');

startingIndex = defaultValue(startingIndex, 0);
Expand Down Expand Up @@ -737,9 +732,7 @@ define([
*/
PolygonGeometry.unpack = function(array, startingIndex, result) {
//>>includeStart('debug', pragmas.debug);
if (!defined(array)) {
throw new DeveloperError('array is required');
}
Check.defined('array', array);
//>>includeEnd('debug');

startingIndex = defaultValue(startingIndex, 0);
Expand Down
24 changes: 9 additions & 15 deletions Source/Core/PolygonOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ define([
'./arrayRemoveDuplicates',
'./BoundingSphere',
'./Cartesian3',
'./Check',
'./ComponentDatatype',
'./defaultValue',
'./defined',
Expand All @@ -25,6 +26,7 @@ define([
arrayRemoveDuplicates,
BoundingSphere,
Cartesian3,
Check,
ComponentDatatype,
defaultValue,
defined,
Expand Down Expand Up @@ -286,9 +288,9 @@ define([
*/
function PolygonOutlineGeometry(options) {
//>>includeStart('debug', pragmas.debug);
if (!defined(options) || !defined(options.polygonHierarchy)) {
throw new DeveloperError('options.polygonHierarchy is required.');
}
Check.typeOf.object('options', options);
Check.typeOf.object('options.polygonHierarchy', options.polygonHierarchy);

if (defined(options.perPositionHeight) && options.perPositionHeight && defined(options.height)) {
throw new DeveloperError('Cannot use both options.perPositionHeight and options.height');
}
Expand Down Expand Up @@ -335,12 +337,8 @@ define([
*/
PolygonOutlineGeometry.pack = function(value, array, startingIndex) {
//>>includeStart('debug', pragmas.debug);
if (!defined(value)) {
throw new DeveloperError('value is required');
}
if (!defined(array)) {
throw new DeveloperError('array is required');
}
Check.typeOf.object('value', value);
Check.defined('array', array);
//>>includeEnd('debug');

startingIndex = defaultValue(startingIndex, 0);
Expand Down Expand Up @@ -375,9 +373,7 @@ define([
*/
PolygonOutlineGeometry.unpack = function(array, startingIndex, result) {
//>>includeStart('debug', pragmas.debug);
if (!defined(array)) {
throw new DeveloperError('array is required');
}
Check.defined('array', array);
//>>includeEnd('debug');

startingIndex = defaultValue(startingIndex, 0);
Expand Down Expand Up @@ -444,9 +440,7 @@ define([
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

//>>includeStart('debug', pragmas.debug);
if (!defined(options.positions)) {
throw new DeveloperError('options.positions is required.');
}
Check.defined('options.positions', options.positions);
//>>includeEnd('debug');

var newOptions = {
Expand Down

0 comments on commit 48266d7

Please sign in to comment.