From c519e2b0e1c820d19b22e96c6c59179f5fc22343 Mon Sep 17 00:00:00 2001 From: Ottavio Hartman Date: Tue, 13 Jun 2017 19:30:26 -0400 Subject: [PATCH 01/10] Update coding docs to include ESLint shareable config --- Documentation/Contributors/CodingGuide/README.md | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Documentation/Contributors/CodingGuide/README.md b/Documentation/Contributors/CodingGuide/README.md index b4630246492..1f6413a669a 100644 --- a/Documentation/Contributors/CodingGuide/README.md +++ b/Documentation/Contributors/CodingGuide/README.md @@ -135,6 +135,25 @@ function Model(options) { * Text files, including JavaScript files, end with a newline to minimize the noise in diffs. +## Code Linting + +We use [ESLint](http://eslint.org/) to check that our code adheres to syntax and style guidelines. In order to keep our ESLint guidelines +the same across repositories, we use a [shareable config](http://eslint.org/docs/developer-guide/shareable-configs): +[`eslint-config-cesium`](https://www.npmjs.com/package/eslint-config-cesium). + +The two common configurations defined in `eslint-config-cesium` are `browser` (used for Javascript and HTML which will run in the browser) and `node` (used +for Node.js packages.) If we look inside [obj2gltf](https://github.com/AnalyticalGraphicsInc/obj2gltf)'s `.eslintrc.json`, we see: +```json +{ + "extends": "cesium/node" +} +``` +`extends` tells ESLint that we inherit the `node` configuration from our shareable config. Now we can run + ```bash + $ npm run eslint + ``` + to check if our changes adhere to the Cesium style and syntax guidelines. + * When [disabling rules with inline comments](http://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments), place the comments on new lines and as close to the associated code as possible: ```js /*eslint-disable no-empty*/ @@ -145,6 +164,14 @@ try { /*eslint-enable no-empty*/ ``` +* If possible, use `//eslint-disable-line` to disable specific rules for one line. +```js +fn multiplyByThree(foo) { + var unusedVar = 5; //eslint-disable-line no-unused-vars + return foo * 3; +} +``` + ## Units * Cesium uses SI units: From d7485a595c273adff9b6dbbbfe8f9adabe357bcf Mon Sep 17 00:00:00 2001 From: Ottavio Hartman Date: Wed, 14 Jun 2017 15:05:54 -0400 Subject: [PATCH 02/10] Updated coding guide --- Documentation/Contributors/CodingGuide/README.md | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/Documentation/Contributors/CodingGuide/README.md b/Documentation/Contributors/CodingGuide/README.md index 1f6413a669a..91d05563888 100644 --- a/Documentation/Contributors/CodingGuide/README.md +++ b/Documentation/Contributors/CodingGuide/README.md @@ -14,6 +14,7 @@ To some extent, this guide can be summarized as _make new code similar to existi * [Naming](#naming) * [Formatting](#formatting) +* [Code Guidelines](#code-guidelines) * [Units](#units) * [Basic Code Construction](#basic-code-construction) * [Functions](#functions) @@ -135,24 +136,11 @@ function Model(options) { * Text files, including JavaScript files, end with a newline to minimize the noise in diffs. -## Code Linting +## Code Guidelines -We use [ESLint](http://eslint.org/) to check that our code adheres to syntax and style guidelines. In order to keep our ESLint guidelines -the same across repositories, we use a [shareable config](http://eslint.org/docs/developer-guide/shareable-configs): -[`eslint-config-cesium`](https://www.npmjs.com/package/eslint-config-cesium). - -The two common configurations defined in `eslint-config-cesium` are `browser` (used for Javascript and HTML which will run in the browser) and `node` (used -for Node.js packages.) If we look inside [obj2gltf](https://github.com/AnalyticalGraphicsInc/obj2gltf)'s `.eslintrc.json`, we see: -```json -{ - "extends": "cesium/node" -} -``` -`extends` tells ESLint that we inherit the `node` configuration from our shareable config. Now we can run - ```bash - $ npm run eslint - ``` - to check if our changes adhere to the Cesium style and syntax guidelines. +For syntax and style guidelines, we adhere to the common JavaScript "recommended" rules, according to [ESLint](http://eslint.org/docs/rules/). Some +additions include enabling [`no-new`](http://eslint.org/docs/rules/no-new) and [`no-extend-native`](http://eslint.org/docs/rules/no-extend-native). +For a complete list of what rules are enabled, look in `index.js`, `browser.js`, and `node.js` in the [`eslint-config-cesium`](https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Tools/eslint-config-cesium) folder. * When [disabling rules with inline comments](http://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments), place the comments on new lines and as close to the associated code as possible: ```js From a4a8d104020ace246b7b065339f113f2a8bbff71 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Sat, 24 Jun 2017 17:10:40 -0400 Subject: [PATCH 03/10] Fix evaluating variables within unary/binary/ternary functions --- Source/Scene/Expression.js | 18 +++++++++--------- Specs/Scene/ExpressionSpec.js | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Source/Scene/Expression.js b/Source/Scene/Expression.js index 860e9a88706..3dd75d70374 100644 --- a/Source/Scene/Expression.js +++ b/Source/Scene/Expression.js @@ -897,27 +897,27 @@ define([ function getEvaluateUnaryFunction(call) { var evaluate = unaryFunctions[call]; - return function(feature) { - var left = this._left.evaluate(feature); + return function(frameState, feature) { + var left = this._left.evaluate(frameState, feature); return evaluate(call, left); }; } function getEvaluateBinaryFunction(call) { var evaluate = binaryFunctions[call]; - return function(feature) { - var left = this._left.evaluate(feature); - var right = this._right.evaluate(feature); + return function(frameState, feature) { + var left = this._left.evaluate(frameState, feature); + var right = this._right.evaluate(frameState, feature); return evaluate(call, left, right); }; } function getEvaluateTernaryFunction(call) { var evaluate = ternaryFunctions[call]; - return function(feature) { - var left = this._left.evaluate(feature); - var right = this._right.evaluate(feature); - var test = this._test.evaluate(feature); + return function(frameState, feature) { + var left = this._left.evaluate(frameState, feature); + var right = this._right.evaluate(frameState, feature); + var test = this._test.evaluate(frameState, feature); return evaluate(call, left, right, test); }; } diff --git a/Specs/Scene/ExpressionSpec.js b/Specs/Scene/ExpressionSpec.js index e67410f727c..087f4effb3c 100644 --- a/Specs/Scene/ExpressionSpec.js +++ b/Specs/Scene/ExpressionSpec.js @@ -121,6 +121,9 @@ defineSuite([ expression = new Expression('\'${undefined}\''); expect(expression.evaluate(frameState, feature)).toEqual(''); + expression = new Expression('abs(-${height}) + max(${height}, ${width}) + clamp(${height}, 0, 2)'); + expect(expression.evaluate(frameState, feature)).toEqual(22); + expect(function() { return new Expression('${height'); }).toThrowRuntimeError(); From b98e6804e90a13fa1320a84263b30dacef596975 Mon Sep 17 00:00:00 2001 From: Ottavio Hartman Date: Tue, 27 Jun 2017 10:16:39 -0400 Subject: [PATCH 04/10] Update Linting section in CodingGuide --- Documentation/Contributors/CodingGuide/README.md | 29 +++++++++++++----------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Documentation/Contributors/CodingGuide/README.md b/Documentation/Contributors/CodingGuide/README.md index 91d05563888..78756851731 100644 --- a/Documentation/Contributors/CodingGuide/README.md +++ b/Documentation/Contributors/CodingGuide/README.md @@ -14,7 +14,7 @@ To some extent, this guide can be summarized as _make new code similar to existi * [Naming](#naming) * [Formatting](#formatting) -* [Code Guidelines](#code-guidelines) +* [Linting](#linting) * [Units](#units) * [Basic Code Construction](#basic-code-construction) * [Functions](#functions) @@ -136,13 +136,22 @@ function Model(options) { * Text files, including JavaScript files, end with a newline to minimize the noise in diffs. -## Code Guidelines +## Linting -For syntax and style guidelines, we adhere to the common JavaScript "recommended" rules, according to [ESLint](http://eslint.org/docs/rules/). Some -additions include enabling [`no-new`](http://eslint.org/docs/rules/no-new) and [`no-extend-native`](http://eslint.org/docs/rules/no-extend-native). -For a complete list of what rules are enabled, look in `index.js`, `browser.js`, and `node.js` in the [`eslint-config-cesium`](https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Tools/eslint-config-cesium) folder. +For syntax and style guidelines, we use the [ESLint](http://eslint.org/docs/rules/) recommended settings as a base +and extend it with additional rules. For a list of what rules are enabled, look in `index.js`, `browser.js`, and `node.js` +in the [`eslint-config-cesium`](https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Tools/eslint-config-cesium) folder. +These are contained in the Node module [`eslint-config-cesium`](https://www.npmjs.com/package/eslint-config-cesium), which is maintained in the Cesium repository and is +available for use on other projects as well. -* When [disabling rules with inline comments](http://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments), place the comments on new lines and as close to the associated code as possible: +* When disabling linting for one line, use `//eslint-disable-line`: +```js +function exit(warningMessage) { + window.alert('Cannot exit: ' + warningMessage); //eslint-disable-line no-alert +} +``` + +* When disabling linting for blocks of code, place `eslint-disable` comments on new lines and as close to the associated code as possible: ```js /*eslint-disable no-empty*/ try { @@ -152,13 +161,7 @@ try { /*eslint-enable no-empty*/ ``` -* If possible, use `//eslint-disable-line` to disable specific rules for one line. -```js -fn multiplyByThree(foo) { - var unusedVar = 5; //eslint-disable-line no-unused-vars - return foo * 3; -} -``` +* See [Disabling Rules with Inline Comments](http://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments) for more examples. ## Units From c367ea0d361d825c4ad9199dc8395fbf923b2e32 Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Tue, 27 Jun 2017 10:37:18 -0400 Subject: [PATCH 05/10] Add .eslintcache to .npmignore It shouldn't be part of our npm package. --- .npmignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.npmignore b/.npmignore index 5c1ffb023c0..6074008c799 100644 --- a/.npmignore +++ b/.npmignore @@ -1,3 +1,4 @@ +/.eslintcache /.externalToolBuilders /.gitattributes /.github From f2a56db7326452311325def9d29400b56fe18215 Mon Sep 17 00:00:00 2001 From: Ottavio Hartman Date: Tue, 27 Jun 2017 10:29:09 -0400 Subject: [PATCH 06/10] Enable Node rules: global-require, no-buffer-constructor, no-new-require. Also: Bump ESLint module to 2.0.0 in preperation to deploy. --- Tools/eslint-config-cesium/CHANGES.md | 6 +++++- Tools/eslint-config-cesium/node.js | 5 +++++ Tools/eslint-config-cesium/package.json | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Tools/eslint-config-cesium/CHANGES.md b/Tools/eslint-config-cesium/CHANGES.md index 28b4bebfeb7..1ea31fcd8b7 100644 --- a/Tools/eslint-config-cesium/CHANGES.md +++ b/Tools/eslint-config-cesium/CHANGES.md @@ -1,7 +1,7 @@ Change Log ========== -### 2.0.0 +### 2.0.0 - 2017-06-27 * Enable [no-floating-decimal](http://eslint.org/docs/rules/no-floating-decimal). * Enable [no-use-before-define](http://eslint.org/docs/rules/no-use-before-define). @@ -16,6 +16,10 @@ Change Log * Enable [no-unused-expressions](http://eslint.org/docs/rules/no-unused-expressions). * Enable [no-sequences](http://eslint.org/docs/rules/no-lonely-if). * Enable [block-scoped-var](http://eslint.org/docs/rules/block-scoped-var). +* Enable Node-specific rules: + * [global-require](http://eslint.org/docs/rules/global-require) + * [no-buffer-constructor](http://eslint.org/docs/rules/no-buffer-constructor) + * [no-new-require](http://eslint.org/docs/rules/no-new-require) ### 1.0.0 - 2017-06-12 diff --git a/Tools/eslint-config-cesium/node.js b/Tools/eslint-config-cesium/node.js index 2686d2251d8..9e4d2eeb57b 100644 --- a/Tools/eslint-config-cesium/node.js +++ b/Tools/eslint-config-cesium/node.js @@ -4,5 +4,10 @@ module.exports = { extends: './index.js', env: { node: true + }, + rules: { + 'global-require' : 'error', + 'no-buffer-constructor' : 'error', + 'no-new-require' : 'error' } }; diff --git a/Tools/eslint-config-cesium/package.json b/Tools/eslint-config-cesium/package.json index afa7027fbe8..3a9eea20eb8 100644 --- a/Tools/eslint-config-cesium/package.json +++ b/Tools/eslint-config-cesium/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-cesium", - "version": "1.0.0", + "version": "2.0.0", "description": "ESLint shareable configs for Cesium", "homepage": "http://cesiumjs.org", "license": "Apache-2.0", From 03c82ed8d8c2756b11736f11862bd72d22e29b26 Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Tue, 27 Jun 2017 11:19:16 -0400 Subject: [PATCH 07/10] Minor tweas. --- Documentation/Contributors/CodingGuide/README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Documentation/Contributors/CodingGuide/README.md b/Documentation/Contributors/CodingGuide/README.md index 78756851731..5e03df2fbca 100644 --- a/Documentation/Contributors/CodingGuide/README.md +++ b/Documentation/Contributors/CodingGuide/README.md @@ -138,11 +138,7 @@ function Model(options) { ## Linting -For syntax and style guidelines, we use the [ESLint](http://eslint.org/docs/rules/) recommended settings as a base -and extend it with additional rules. For a list of what rules are enabled, look in `index.js`, `browser.js`, and `node.js` -in the [`eslint-config-cesium`](https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Tools/eslint-config-cesium) folder. -These are contained in the Node module [`eslint-config-cesium`](https://www.npmjs.com/package/eslint-config-cesium), which is maintained in the Cesium repository and is -available for use on other projects as well. +For syntax and style guidelines, we use the [ESLint](http://eslint.org/docs/rules/) recommended settings as a base and extend it with additional rules via a shared config Node module, [eslint-config-cesium](https://www.npmjs.com/package/eslint-config-cesium), which is maintained as part of the Cesium repository and also used throughout the Cesium ecosystem. For a list of which rules are enabled, look in [index.js](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Tools/eslint-config-cesium/index.js), [browser.js](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Tools/eslint-config-cesium/browser.js), and [node.js](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Tools/eslint-config-cesium/node.js). * When disabling linting for one line, use `//eslint-disable-line`: ```js From 151c313c7470a0e70c07fa9c4df24b28109c4df7 Mon Sep 17 00:00:00 2001 From: Patrick Cozzi Date: Tue, 27 Jun 2017 14:11:02 -0400 Subject: [PATCH 08/10] Reorder 1.35 in CHANGES.md --- CHANGES.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 74816b67617..f572fc657a3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,18 +5,8 @@ Change Log * Deprecated * `GoogleEarthImageryProvider` has been deprecated and will be removed in Cesium 1.37, use `GoogleEarthEnterpriseMapsProvider` instead. - * The `throttleRequest` parameter for `TerrainProvider.requestTileGeometry`, `CesiumTerrainProvider.requestTileGeometry`, `VRTheWorldTerrainProvider.requestTileGeometry`, and `EllipsoidTerrainProvider.requestTileGeometry` is deprecated and will be replaced with an optional `Request` object. The `throttleRequests` parameter will be removed in 1.37. Instead to throttle requests set the request's `throttle` property to `true`. + * The `throttleRequest` parameter for `TerrainProvider.requestTileGeometry`, `CesiumTerrainProvider.requestTileGeometry`, `VRTheWorldTerrainProvider.requestTileGeometry`, and `EllipsoidTerrainProvider.requestTileGeometry` is deprecated and will be replaced with an optional `Request` object. The `throttleRequests` parameter will be removed in 1.37. Instead set the request's `throttle` property to `true` to throttle requests. * The ability to provide a Promise for the `options.url` parameter of `loadWithXhr` and for the `url` parameter of `loadArrayBuffer`, `loadBlob`, `loadImageViaBlob`, `loadText`, `loadJson`, `loadXML`, `loadImage`, `loadCRN`, `loadKTX`, and `loadCubeMap` is deprecated. This will be removed in 1.37, instead `url` must be a string. -* Added an `options.request` parameter to `loadWithXhr` and a `request` parameter to `loadArrayBuffer`, `loadBlob`, `loadImageViaBlob`, `loadText`, `loadJson`, `loadJsonp`, `loadXML`, `loadImageFromTypedArray`, `loadImage`, `loadCRN`, and `loadKTX`. -* Fixed bug where if polylines were set to follow the surface of an undefined globe, Cesium would crash [#5413](https://github.com/AnalyticalGraphicsInc/cesium/pull/5413) -* Fixed a bug where picking clusters would return undefined instead of a list of the clustered entities. [#5286](https://github.com/AnalyticalGraphicsInc/cesium/issues/5286) -* Fixed a bug where picking would break when the Sun came into view [#5478](https://github.com/AnalyticalGraphicsInc/cesium/issues/5478) -* Reduced the amount of Sun bloom post-process effect near the horizon. [#5381](https://github.com/AnalyticalGraphicsInc/cesium/issues/5381) -* Updated glTF/glb MIME types. [#5420](https://github.com/AnalyticalGraphicsInc/cesium/issues/5420) -* Fixed a bug where camera zooming worked incorrectly when the display height was greater than the display width [#5421](https://github.com/AnalyticalGraphicsInc/cesium/pull/5421) -* Added Sandcastle demo for ArcticDEM data. [#5224](https://github.com/AnalyticalGraphicsInc/cesium/issues/5224) -* `CzmlDataSource` and `KmlDataSource` load functions now take an optional `query` object, which will append query parameters to all network requests. [#5419](https://github.com/AnalyticalGraphicsInc/cesium/pull/5419), [#5434](https://github.com/AnalyticalGraphicsInc/cesium/pull/5434) -* Fixed geocoder bug so geocoder can accurately handle NSEW inputs [#5407](https://github.com/AnalyticalGraphicsInc/cesium/pull/5407) * Added support for [3D Tiles](https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/README.md) for streaming massive heterogeneous 3D geospatial datasets. The new Cesium APIs are: * `Cesium3DTileset` * `Cesium3DTileStyle`, `StyleExpression`, `Expression`, and `ConditionsExpression` @@ -25,8 +15,18 @@ Change Log * `Cesium3DTileFeature` * `Cesium3DTilesInspector`, `Cesium3DTilesInspectorViewModel`, and `viewerCesium3DTilesInspectorMixin` * `Cesium3DTileColorBlendMode` -* Added a Sandcastle demo for setting time with the Clock API [#5457](https://github.com/AnalyticalGraphicsInc/cesium/pull/5457); -* Added support for `ParticleSystem`s. [#5212](https://github.com/AnalyticalGraphicsInc/cesium/pull/5212) +* Added a particle system for effects like smoke, fire, sparks, etc. See `ParticleSystem`, `Particle`, `ParticleBurst`, `BoxEmitter`, `CircleEmitter`, `ConeEmitter`, `ParticleEmitter`, and `SphereEmitter`, and the new Sandcastle examples: `Particle System` and `Particle System Fireworks`. [#5212](https://github.com/AnalyticalGraphicsInc/cesium/pull/5212) +* Added an `options.request` parameter to `loadWithXhr` and a `request` parameter to `loadArrayBuffer`, `loadBlob`, `loadImageViaBlob`, `loadText`, `loadJson`, `loadJsonp`, `loadXML`, `loadImageFromTypedArray`, `loadImage`, `loadCRN`, and `loadKTX`. +* `CzmlDataSource` and `KmlDataSource` load functions now take an optional `query` object, which will append query parameters to all network requests. [#5419](https://github.com/AnalyticalGraphicsInc/cesium/pull/5419), [#5434](https://github.com/AnalyticalGraphicsInc/cesium/pull/5434) +* Added Sandcastle demo for setting time with the Clock API [#5457](https://github.com/AnalyticalGraphicsInc/cesium/pull/5457); +* Added Sandcastle demo for ArcticDEM data. [#5224](https://github.com/AnalyticalGraphicsInc/cesium/issues/5224) +* Fixed geocoder bug so geocoder can accurately handle NSEW inputs [#5407](https://github.com/AnalyticalGraphicsInc/cesium/pull/5407) +* Fixed a bug where picking would break when the Sun came into view [#5478](https://github.com/AnalyticalGraphicsInc/cesium/issues/5478) +* Fixed a bug where picking clusters would return undefined instead of a list of the clustered entities. [#5286](https://github.com/AnalyticalGraphicsInc/cesium/issues/5286) +* Fixed bug where if polylines were set to follow the surface of an undefined globe, Cesium would throw an exception. [#5413](https://github.com/AnalyticalGraphicsInc/cesium/pull/5413) +* Reduced the amount of Sun bloom post-process effect near the horizon. [#5381](https://github.com/AnalyticalGraphicsInc/cesium/issues/5381) +* Fixed a bug where camera zooming worked incorrectly when the display height was greater than the display width [#5421](https://github.com/AnalyticalGraphicsInc/cesium/pull/5421) +* Updated glTF/glb MIME types. [#5420](https://github.com/AnalyticalGraphicsInc/cesium/issues/5420) * Added `Cesium.Math.randomBetween`. ### 1.34 - 2017-06-01 From 451f1d04110ff2eb781b3bc624e4a54e62eb2d8b Mon Sep 17 00:00:00 2001 From: Rudraksha20 Date: Tue, 27 Jun 2017 15:57:04 -0400 Subject: [PATCH 09/10] EllipsoidGeodesic Updated with Check --- CONTRIBUTORS.md | 3 ++- Source/Core/EllipsoidGeodesic.js | 30 +++++++++--------------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index f32f702a586..1e938ac7cc6 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -147,4 +147,5 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu * [Ryan King](https://github.com/ryki2658) * [Jason Wohlgemuth](https://github.com/jhwohlgemuth) * [Hülya Yurtman](https://github.com/hulyayurtman) -* [Esra ERİK](https://github.com/esraerik) \ No newline at end of file +* [Esra ERİK](https://github.com/esraerik) +* [Rudraksha Shah](https://github.com/Rudraksha20) diff --git a/Source/Core/EllipsoidGeodesic.js b/Source/Core/EllipsoidGeodesic.js index 166942f77dd..b70dc331848 100644 --- a/Source/Core/EllipsoidGeodesic.js +++ b/Source/Core/EllipsoidGeodesic.js @@ -1,5 +1,6 @@ /*global define*/ define([ + './Check', './Cartesian3', './Cartographic', './defaultValue', @@ -9,6 +10,7 @@ define([ './Ellipsoid', './Math' ], function( + Check, Cartesian3, Cartographic, defaultValue, @@ -179,9 +181,7 @@ define([ var lastCartesian = Cartesian3.normalize(ellipsoid.cartographicToCartesian(end, scratchCart2), scratchCart2); //>>includeStart('debug', pragmas.debug); - if (Math.abs(Math.abs(Cartesian3.angleBetween(firstCartesian, lastCartesian)) - Math.PI) < 0.0125) { - throw new DeveloperError('geodesic position is not unique'); - } + Check.typeOf.number.greaterThanOrEquals('value', Math.abs(Math.abs(Cartesian3.angleBetween(firstCartesian, lastCartesian)) - Math.PI), 0.0125) //>>includeEnd('debug'); vincentyInverseFormula(ellipsoidGeodesic, ellipsoid.maximumRadius, ellipsoid.minimumRadius, @@ -244,9 +244,7 @@ define([ surfaceDistance : { get : function() { //>>includeStart('debug', pragmas.debug); - if (!defined(this._distance)) { - throw new DeveloperError('set end positions before getting surfaceDistance'); - } + Check.defined('distance', this._distance); //>>includeEnd('debug'); return this._distance; @@ -286,9 +284,7 @@ define([ startHeading : { get : function() { //>>includeStart('debug', pragmas.debug); - if (!defined(this._distance)) { - throw new DeveloperError('set end positions before getting startHeading'); - } + Check.defined('distance', this._distance); //>>includeEnd('debug'); return this._startHeading; @@ -304,9 +300,7 @@ define([ endHeading : { get : function() { //>>includeStart('debug', pragmas.debug); - if (!defined(this._distance)) { - throw new DeveloperError('set end positions before getting endHeading'); - } + Check.defined('distance', this._distance); //>>includeEnd('debug'); return this._endHeading; @@ -322,12 +316,8 @@ define([ */ EllipsoidGeodesic.prototype.setEndPoints = function(start, end) { //>>includeStart('debug', pragmas.debug); - if (!defined(start)) { - throw new DeveloperError('start cartographic position is required'); - } - if (!defined(end)) { - throw new DeveloperError('end cartgraphic position is required'); - } + Check.defined('start', start); + Check.defined('end', end); //>>includeEnd('debug'); computeProperties(this, start, end, this._ellipsoid); @@ -355,9 +345,7 @@ define([ */ EllipsoidGeodesic.prototype.interpolateUsingSurfaceDistance = function(distance, result) { //>>includeStart('debug', pragmas.debug); - if (!defined(this._distance)) { - throw new DeveloperError('start and end must be set before calling function interpolateUsingSurfaceDistance'); - } + Check.defined('distance', this._distance); //>>includeEnd('debug'); var constants = this._constants; From 701f282aa3a56dc80c139b515b90594a78eac1b9 Mon Sep 17 00:00:00 2001 From: Rudraksha20 Date: Tue, 27 Jun 2017 17:23:04 -0400 Subject: [PATCH 10/10] Updated EllipsoidGeodesic, removied DevError --- Source/Core/EllipsoidGeodesic.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/Core/EllipsoidGeodesic.js b/Source/Core/EllipsoidGeodesic.js index b70dc331848..920ec78aad0 100644 --- a/Source/Core/EllipsoidGeodesic.js +++ b/Source/Core/EllipsoidGeodesic.js @@ -6,7 +6,6 @@ define([ './defaultValue', './defined', './defineProperties', - './DeveloperError', './Ellipsoid', './Math' ], function( @@ -16,7 +15,6 @@ define([ defaultValue, defined, defineProperties, - DeveloperError, Ellipsoid, CesiumMath) { 'use strict'; @@ -181,7 +179,7 @@ define([ var lastCartesian = Cartesian3.normalize(ellipsoid.cartographicToCartesian(end, scratchCart2), scratchCart2); //>>includeStart('debug', pragmas.debug); - Check.typeOf.number.greaterThanOrEquals('value', Math.abs(Math.abs(Cartesian3.angleBetween(firstCartesian, lastCartesian)) - Math.PI), 0.0125) + Check.typeOf.number.greaterThanOrEquals('value', Math.abs(Math.abs(Cartesian3.angleBetween(firstCartesian, lastCartesian)) - Math.PI), 0.0125); //>>includeEnd('debug'); vincentyInverseFormula(ellipsoidGeodesic, ellipsoid.maximumRadius, ellipsoid.minimumRadius,