From e0d0341e4041f9c97db12cd78729fba98fac07bb Mon Sep 17 00:00:00 2001 From: Chris Cooper Date: Mon, 1 Sep 2014 16:17:02 +1000 Subject: [PATCH 01/14] first pass --- Apps/TileLoad.html | 57 ++++++++++++++++++++++++++++ Source/Core/CesiumTerrainProvider.js | 17 +++++++++ Source/Core/TerrainProvider.js | 3 ++ Source/Scene/GlobeSurfaceTile.js | 7 +++- 4 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 Apps/TileLoad.html diff --git a/Apps/TileLoad.html b/Apps/TileLoad.html new file mode 100644 index 000000000000..2c937ecb7349 --- /dev/null +++ b/Apps/TileLoad.html @@ -0,0 +1,57 @@ + + + + + + + + + +Cesium Demo + + + + + + +
+
+ + + diff --git a/Source/Core/CesiumTerrainProvider.js b/Source/Core/CesiumTerrainProvider.js index eced9b6c2390..caf9b6d20128 100644 --- a/Source/Core/CesiumTerrainProvider.js +++ b/Source/Core/CesiumTerrainProvider.js @@ -636,5 +636,22 @@ define([ return false; } + CesiumTerrainProvider.prototype.supportsTileDataAvailable = function() { + var available = this._availableTiles; + if (!available || available.length === 0) { + return false; + } else { + return true; + } + }; + + CesiumTerrainProvider.prototype.getTileDataAvailable = function(level, x, y) { + var available = this._availableTiles; + if( level >= available.length) + return false; + var levelAvailable = available[level]; + return isTileInRange(levelAvailable, x, y); + }; + return CesiumTerrainProvider; }); \ No newline at end of file diff --git a/Source/Core/TerrainProvider.js b/Source/Core/TerrainProvider.js index 825a97d5fbe4..bc4133418af6 100644 --- a/Source/Core/TerrainProvider.js +++ b/Source/Core/TerrainProvider.js @@ -192,5 +192,8 @@ define([ */ TerrainProvider.prototype.getLevelMaximumGeometricError = DeveloperError.throwInstantiationError; + TerrainProvider.prototype.supportsTileDataAvailable = DeveloperError.throwInstantiationError; + TerrainProvider.prototype.getTileDataAvailable = DeveloperError.throwInstantiationError; + return TerrainProvider; }); \ No newline at end of file diff --git a/Source/Scene/GlobeSurfaceTile.js b/Source/Scene/GlobeSurfaceTile.js index 6906e0a621f4..5cf415e7c4d2 100644 --- a/Source/Scene/GlobeSurfaceTile.js +++ b/Source/Scene/GlobeSurfaceTile.js @@ -378,7 +378,7 @@ define([ surfaceTile.upsampledTerrain = new TileTerrain(upsampleTileDetails); } - if (isDataAvailable(tile)) { + if (isDataAvailable(tile, terrainProvider)) { surfaceTile.loadedTerrain = new TileTerrain(); } @@ -618,7 +618,10 @@ define([ } } - function isDataAvailable(tile) { + function isDataAvailable(tile, terrainProvider) { + if (terrainProvider.supportsTileDataAvailable()) { + return terrainProvider.getTileDataAvailable(tile.level, tile.x, tile.y); + } var parent = tile.parent; if (!defined(parent)) { // Data is assumed to be available for root tiles. From 7a380e915e5e5149bd92daf574d3d32521d4913a Mon Sep 17 00:00:00 2001 From: Chris Cooper Date: Mon, 1 Sep 2014 16:32:48 +1000 Subject: [PATCH 02/14] add default function definition for supportsTileDataAvailable() --- Source/Core/CesiumTerrainProvider.js | 2 +- Source/Core/TerrainProvider.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Core/CesiumTerrainProvider.js b/Source/Core/CesiumTerrainProvider.js index caf9b6d20128..4e459dc08fe9 100644 --- a/Source/Core/CesiumTerrainProvider.js +++ b/Source/Core/CesiumTerrainProvider.js @@ -647,7 +647,7 @@ define([ CesiumTerrainProvider.prototype.getTileDataAvailable = function(level, x, y) { var available = this._availableTiles; - if( level >= available.length) + if (level >= available.length) return false; var levelAvailable = available[level]; return isTileInRange(levelAvailable, x, y); diff --git a/Source/Core/TerrainProvider.js b/Source/Core/TerrainProvider.js index bc4133418af6..fbe908f7b836 100644 --- a/Source/Core/TerrainProvider.js +++ b/Source/Core/TerrainProvider.js @@ -192,7 +192,9 @@ define([ */ TerrainProvider.prototype.getLevelMaximumGeometricError = DeveloperError.throwInstantiationError; - TerrainProvider.prototype.supportsTileDataAvailable = DeveloperError.throwInstantiationError; + TerrainProvider.prototype.supportsTileDataAvailable = function() { + return false; + }; TerrainProvider.prototype.getTileDataAvailable = DeveloperError.throwInstantiationError; return TerrainProvider; From 6a60a5b6454197832e8bbdeba63338b04dbf0dc9 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Mon, 1 Sep 2014 20:01:38 -0400 Subject: [PATCH 03/14] Don't crash if supportsTileDataAvailable is not defined. --- Source/Scene/GlobeSurfaceTile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Scene/GlobeSurfaceTile.js b/Source/Scene/GlobeSurfaceTile.js index 5cf415e7c4d2..b4c733f98af8 100644 --- a/Source/Scene/GlobeSurfaceTile.js +++ b/Source/Scene/GlobeSurfaceTile.js @@ -619,7 +619,7 @@ define([ } function isDataAvailable(tile, terrainProvider) { - if (terrainProvider.supportsTileDataAvailable()) { + if (defined(terrainProvider.supportsTileDataAvailable) && terrainProvider.supportsTileDataAvailable()) { return terrainProvider.getTileDataAvailable(tile.level, tile.x, tile.y); } var parent = tile.parent; From 427b6ac7cca823a17544483fecf19d30890f2334 Mon Sep 17 00:00:00 2001 From: Chris Cooper Date: Tue, 2 Sep 2014 11:10:19 +1000 Subject: [PATCH 04/14] use single function getTileDataAvailable() and add to other terrain providers --- .../Core/ArcGisImageServerTerrainProvider.js | 12 +++++++++ Source/Core/CesiumTerrainProvider.js | 26 +++++++++++-------- Source/Core/EllipsoidTerrainProvider.js | 12 +++++++++ Source/Core/TerrainProvider.js | 12 ++++++--- Source/Core/VRTheWorldTerrainProvider.js | 12 +++++++++ Source/Scene/GlobeSurfaceTile.js | 9 +++++-- 6 files changed, 67 insertions(+), 16 deletions(-) diff --git a/Source/Core/ArcGisImageServerTerrainProvider.js b/Source/Core/ArcGisImageServerTerrainProvider.js index 296355dc1a3c..c76c060d048f 100644 --- a/Source/Core/ArcGisImageServerTerrainProvider.js +++ b/Source/Core/ArcGisImageServerTerrainProvider.js @@ -244,5 +244,17 @@ define([ return this._levelZeroMaximumGeometricError / (1 << level); }; + /** + * Determines whether data for a tile is available to be loaded. + * + * @param {Number} x The X coordinate of the tile for which to request geometry. + * @param {Number} y The Y coordinate of the tile for which to request geometry. + * @param {Number} level The level of the tile for which to request geometry. + * @returns {Number} Undefined if not supported, otherwise true or false. + */ + ArcGisImageServerTerrainProvider.prototype.getTileDataAvailable = function(x, y, level) { + return undefined; + }; + return ArcGisImageServerTerrainProvider; }); \ No newline at end of file diff --git a/Source/Core/CesiumTerrainProvider.js b/Source/Core/CesiumTerrainProvider.js index 4e459dc08fe9..e68dc57d9475 100644 --- a/Source/Core/CesiumTerrainProvider.js +++ b/Source/Core/CesiumTerrainProvider.js @@ -636,22 +636,26 @@ define([ return false; } - CesiumTerrainProvider.prototype.supportsTileDataAvailable = function() { + /** + * Determines whether data for a tile is available to be loaded. + * + * @param {Number} x The X coordinate of the tile for which to request geometry. + * @param {Number} y The Y coordinate of the tile for which to request geometry. + * @param {Number} level The level of the tile for which to request geometry. + * @returns {Number} Undefined if not supported, otherwise true or false. + */ + CesiumTerrainProvider.prototype.getTileDataAvailable = function(x, y, level) { var available = this._availableTiles; + if (!available || available.length === 0) { - return false; + return undefined; } else { - return true; + if (level >= available.length) + return false; + var levelAvailable = available[level]; + return isTileInRange(levelAvailable, x, y); } }; - CesiumTerrainProvider.prototype.getTileDataAvailable = function(level, x, y) { - var available = this._availableTiles; - if (level >= available.length) - return false; - var levelAvailable = available[level]; - return isTileInRange(levelAvailable, x, y); - }; - return CesiumTerrainProvider; }); \ No newline at end of file diff --git a/Source/Core/EllipsoidTerrainProvider.js b/Source/Core/EllipsoidTerrainProvider.js index 9d1242998011..637c4439ee4b 100644 --- a/Source/Core/EllipsoidTerrainProvider.js +++ b/Source/Core/EllipsoidTerrainProvider.js @@ -166,5 +166,17 @@ define([ return this._levelZeroMaximumGeometricError / (1 << level); }; + /** + * Determines whether data for a tile is available to be loaded. + * + * @param {Number} x The X coordinate of the tile for which to request geometry. + * @param {Number} y The Y coordinate of the tile for which to request geometry. + * @param {Number} level The level of the tile for which to request geometry. + * @returns {Number} Undefined if not supported, otherwise true or false. + */ + EllipsoidTerrainProvider.prototype.getTileDataAvailable = function(x, y, level) { + return undefined; + }; + return EllipsoidTerrainProvider; }); \ No newline at end of file diff --git a/Source/Core/TerrainProvider.js b/Source/Core/TerrainProvider.js index fbe908f7b836..3525ed10859a 100644 --- a/Source/Core/TerrainProvider.js +++ b/Source/Core/TerrainProvider.js @@ -192,9 +192,15 @@ define([ */ TerrainProvider.prototype.getLevelMaximumGeometricError = DeveloperError.throwInstantiationError; - TerrainProvider.prototype.supportsTileDataAvailable = function() { - return false; - }; + /** + * Determines whether data for a tile is available to be loaded. + * @function + * + * @param {Number} x The X coordinate of the tile for which to request geometry. + * @param {Number} y The Y coordinate of the tile for which to request geometry. + * @param {Number} level The level of the tile for which to request geometry. + * @returns {Number} Undefined if not supported by the terrain provider, otherwise true or false. + */ TerrainProvider.prototype.getTileDataAvailable = DeveloperError.throwInstantiationError; return TerrainProvider; diff --git a/Source/Core/VRTheWorldTerrainProvider.js b/Source/Core/VRTheWorldTerrainProvider.js index c6cef39f7d28..c962875e1fcc 100644 --- a/Source/Core/VRTheWorldTerrainProvider.js +++ b/Source/Core/VRTheWorldTerrainProvider.js @@ -335,5 +335,17 @@ define([ return !Rectangle.isEmpty(Rectangle.intersectWith(tileRectangle, rectangle, rectangleScratch)); } + /** + * Determines whether data for a tile is available to be loaded. + * + * @param {Number} x The X coordinate of the tile for which to request geometry. + * @param {Number} y The Y coordinate of the tile for which to request geometry. + * @param {Number} level The level of the tile for which to request geometry. + * @returns {Number} Undefined if not supported, otherwise true or false. + */ + VRTheWorldTerrainProvider.prototype.getTileDataAvailable = function(x, y, level) { + return undefined; + }; + return VRTheWorldTerrainProvider; }); \ No newline at end of file diff --git a/Source/Scene/GlobeSurfaceTile.js b/Source/Scene/GlobeSurfaceTile.js index b4c733f98af8..2d617fc2a8c6 100644 --- a/Source/Scene/GlobeSurfaceTile.js +++ b/Source/Scene/GlobeSurfaceTile.js @@ -619,9 +619,14 @@ define([ } function isDataAvailable(tile, terrainProvider) { - if (defined(terrainProvider.supportsTileDataAvailable) && terrainProvider.supportsTileDataAvailable()) { - return terrainProvider.getTileDataAvailable(tile.level, tile.x, tile.y); + + if (defined(terrainProvider.getTileDataAvailable)) { + var tileDataAvailable = terrainProvider.getTileDataAvailable(tile.x, tile.y, tile.level); + if (defined(tileDataAvailable)) { + return tileDataAvailable; + } } + var parent = tile.parent; if (!defined(parent)) { // Data is assumed to be available for root tiles. From 576320aae2db69988498aef1bdab9cf9f747e672 Mon Sep 17 00:00:00 2001 From: Chris Cooper Date: Tue, 2 Sep 2014 11:36:28 +1000 Subject: [PATCH 05/14] move profile scene --- Apps/TileLoad.html => Specs/Profile/HalfDome.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename Apps/TileLoad.html => Specs/Profile/HalfDome.html (93%) diff --git a/Apps/TileLoad.html b/Specs/Profile/HalfDome.html similarity index 93% rename from Apps/TileLoad.html rename to Specs/Profile/HalfDome.html index 2c937ecb7349..17fc665fc9f1 100644 --- a/Apps/TileLoad.html +++ b/Specs/Profile/HalfDome.html @@ -8,7 +8,7 @@ Cesium Demo - + + + + + + +
+
+ + + From e65ee54851e8f23302dcc8f2ed07acc0491754cb Mon Sep 17 00:00:00 2001 From: Chris Cooper Date: Tue, 2 Sep 2014 13:47:54 +1000 Subject: [PATCH 07/14] jshint pass --- Source/Core/CesiumTerrainProvider.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Core/CesiumTerrainProvider.js b/Source/Core/CesiumTerrainProvider.js index e68dc57d9475..7220395054f4 100644 --- a/Source/Core/CesiumTerrainProvider.js +++ b/Source/Core/CesiumTerrainProvider.js @@ -650,8 +650,9 @@ define([ if (!available || available.length === 0) { return undefined; } else { - if (level >= available.length) + if (level >= available.length) { return false; + } var levelAvailable = available[level]; return isTileInRange(levelAvailable, x, y); } From 66229aca4a0e17e360ef3e1edf3746ba20278b70 Mon Sep 17 00:00:00 2001 From: Chris Cooper Date: Wed, 3 Sep 2014 10:37:42 +1000 Subject: [PATCH 08/14] move profiling test to sandcastle --- .../Sandcastle/gallery/Profile Half Dome.html | 59 +++++++++++++++++++ Specs/Profile/HalfDome.html | 57 ------------------ Specs/Profile/SanFrancisco.html | 58 ------------------ 3 files changed, 59 insertions(+), 115 deletions(-) create mode 100644 Apps/Sandcastle/gallery/Profile Half Dome.html delete mode 100644 Specs/Profile/HalfDome.html delete mode 100644 Specs/Profile/SanFrancisco.html diff --git a/Apps/Sandcastle/gallery/Profile Half Dome.html b/Apps/Sandcastle/gallery/Profile Half Dome.html new file mode 100644 index 000000000000..309bb6630c69 --- /dev/null +++ b/Apps/Sandcastle/gallery/Profile Half Dome.html @@ -0,0 +1,59 @@ + + + + + + + + + Cesium Demo + + + + + + +
+

Loading...

+
+ + + diff --git a/Specs/Profile/HalfDome.html b/Specs/Profile/HalfDome.html deleted file mode 100644 index 17fc665fc9f1..000000000000 --- a/Specs/Profile/HalfDome.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - -Cesium Demo - - - - - - -
-
- - - diff --git a/Specs/Profile/SanFrancisco.html b/Specs/Profile/SanFrancisco.html deleted file mode 100644 index 0331f7a18a12..000000000000 --- a/Specs/Profile/SanFrancisco.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - -Cesium Demo - - - - - - -
-
- - - From b1c95a0f108065fcce91809e3937d60b79d08729 Mon Sep 17 00:00:00 2001 From: Chris Cooper Date: Wed, 3 Sep 2014 10:47:56 +1000 Subject: [PATCH 09/14] update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index fb1661dc78b0..6e53a0c04fdc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,7 @@ Change Log ### 1.2 - 2014-10-01 * Eliminated imagery artifacts at some zoom levels due to Mercator reprojection. +* Added `TerrainProvider.getTileDataAvailable` to improve tile loading performance when camera starts near globe. ### 1.1 - 2014-09-02 From 0c46ebb2cc7666316209abc6400799a826c1637e Mon Sep 17 00:00:00 2001 From: Chris Cooper Date: Wed, 3 Sep 2014 11:06:38 +1000 Subject: [PATCH 10/14] add specs for getTileDataAvailable() --- Specs/Core/CesiumTerrainProviderSpec.js | 36 ++++++++++++++++++++++ Specs/Core/EllipsoidTerrainProviderSpec.js | 11 +++++++ 2 files changed, 47 insertions(+) diff --git a/Specs/Core/CesiumTerrainProviderSpec.js b/Specs/Core/CesiumTerrainProviderSpec.js index 22f6abf8d2cf..fc953d6f7963 100644 --- a/Specs/Core/CesiumTerrainProviderSpec.js +++ b/Specs/Core/CesiumTerrainProviderSpec.js @@ -596,5 +596,41 @@ defineSuite([ } }); }); + + it('supports getTileDataAvailable()', function() { + var baseUrl = 'made/up/url'; + + loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { + return loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.terrain', responseType, method, data, headers, deferred); + }; + + returnQuantizedMeshTileJson(); + + var terrainProvider = new CesiumTerrainProvider({ + url : baseUrl + }); + + waitsFor(function() { + return terrainProvider.ready; + }); + + var loadedData; + + runs(function() { + var promise = terrainProvider.requestTileGeometry(0, 0, 0); + + when(promise, function(terrainData) { + loadedData = terrainData; + }); + }); + + waitsFor(function() { + return defined(loadedData); + }, 'request to complete'); + + runs(function() { + expect(terrainProvider.getTileDataAvailable(0,0,0)).toBe(true); + }); + }); }); }); diff --git a/Specs/Core/EllipsoidTerrainProviderSpec.js b/Specs/Core/EllipsoidTerrainProviderSpec.js index af62c2f5dfdd..d94002916ae8 100644 --- a/Specs/Core/EllipsoidTerrainProviderSpec.js +++ b/Specs/Core/EllipsoidTerrainProviderSpec.js @@ -1,10 +1,12 @@ /*global defineSuite*/ defineSuite([ 'Core/EllipsoidTerrainProvider', + 'Core/TerrainProvider', 'Specs/createContext', 'Specs/destroyContext' ], function( EllipsoidTerrainProvider, + TerrainProvider, createContext, destroyContext) { "use strict"; @@ -20,6 +22,10 @@ defineSuite([ destroyContext(context); }); + it('conforms to TerrainProvider interface', function() { + expect(EllipsoidTerrainProvider).toConformToInterface(TerrainProvider); + }); + it('requestTileGeometry creates terrain data.', function() { var terrain = new EllipsoidTerrainProvider(); var terrainData = terrain.requestTileGeometry(0, 0, 0); @@ -31,4 +37,9 @@ defineSuite([ expect(provider.errorEvent).toBeDefined(); expect(provider.errorEvent).toBe(provider.errorEvent); }); + + it('returns undefined on getTileDataAvailable()', function() { + var provider = new EllipsoidTerrainProvider(); + expect(provider.getTileDataAvailable()).toBeUndefined(); + }); }, 'WebGL'); \ No newline at end of file From 25d222c5cbba7c5d7d86a567c38bf278a3beafae Mon Sep 17 00:00:00 2001 From: Chris Cooper Date: Wed, 3 Sep 2014 11:12:07 +1000 Subject: [PATCH 11/14] test the getTileDataAvailable() false case as well --- Specs/Core/CesiumTerrainProviderSpec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Specs/Core/CesiumTerrainProviderSpec.js b/Specs/Core/CesiumTerrainProviderSpec.js index fc953d6f7963..0c0538f0377b 100644 --- a/Specs/Core/CesiumTerrainProviderSpec.js +++ b/Specs/Core/CesiumTerrainProviderSpec.js @@ -629,7 +629,8 @@ defineSuite([ }, 'request to complete'); runs(function() { - expect(terrainProvider.getTileDataAvailable(0,0,0)).toBe(true); + expect(terrainProvider.getTileDataAvailable(0, 0, 0)).toBe(true); + expect(terrainProvider.getTileDataAvailable(0, 0, 2)).toBe(false); }); }); }); From 4517047764e26dd566fecffe31a286387ad7e97a Mon Sep 17 00:00:00 2001 From: Chris Cooper Date: Fri, 5 Sep 2014 09:46:09 +1000 Subject: [PATCH 12/14] ammend documentation --- Source/Core/ArcGisImageServerTerrainProvider.js | 2 +- Source/Core/CesiumTerrainProvider.js | 2 +- Source/Core/EllipsoidTerrainProvider.js | 2 +- Source/Core/TerrainProvider.js | 2 +- Source/Core/VRTheWorldTerrainProvider.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Core/ArcGisImageServerTerrainProvider.js b/Source/Core/ArcGisImageServerTerrainProvider.js index c76c060d048f..9a702c36b633 100644 --- a/Source/Core/ArcGisImageServerTerrainProvider.js +++ b/Source/Core/ArcGisImageServerTerrainProvider.js @@ -250,7 +250,7 @@ define([ * @param {Number} x The X coordinate of the tile for which to request geometry. * @param {Number} y The Y coordinate of the tile for which to request geometry. * @param {Number} level The level of the tile for which to request geometry. - * @returns {Number} Undefined if not supported, otherwise true or false. + * @returns {Boolean} Undefined if not supported, otherwise true or false. */ ArcGisImageServerTerrainProvider.prototype.getTileDataAvailable = function(x, y, level) { return undefined; diff --git a/Source/Core/CesiumTerrainProvider.js b/Source/Core/CesiumTerrainProvider.js index 7220395054f4..0d31537f1c47 100644 --- a/Source/Core/CesiumTerrainProvider.js +++ b/Source/Core/CesiumTerrainProvider.js @@ -642,7 +642,7 @@ define([ * @param {Number} x The X coordinate of the tile for which to request geometry. * @param {Number} y The Y coordinate of the tile for which to request geometry. * @param {Number} level The level of the tile for which to request geometry. - * @returns {Number} Undefined if not supported, otherwise true or false. + * @returns {Boolean} Undefined if not supported, otherwise true or false. */ CesiumTerrainProvider.prototype.getTileDataAvailable = function(x, y, level) { var available = this._availableTiles; diff --git a/Source/Core/EllipsoidTerrainProvider.js b/Source/Core/EllipsoidTerrainProvider.js index 637c4439ee4b..810072e0bae8 100644 --- a/Source/Core/EllipsoidTerrainProvider.js +++ b/Source/Core/EllipsoidTerrainProvider.js @@ -172,7 +172,7 @@ define([ * @param {Number} x The X coordinate of the tile for which to request geometry. * @param {Number} y The Y coordinate of the tile for which to request geometry. * @param {Number} level The level of the tile for which to request geometry. - * @returns {Number} Undefined if not supported, otherwise true or false. + * @returns {Boolean} Undefined if not supported, otherwise true or false. */ EllipsoidTerrainProvider.prototype.getTileDataAvailable = function(x, y, level) { return undefined; diff --git a/Source/Core/TerrainProvider.js b/Source/Core/TerrainProvider.js index 3525ed10859a..5843595715c8 100644 --- a/Source/Core/TerrainProvider.js +++ b/Source/Core/TerrainProvider.js @@ -199,7 +199,7 @@ define([ * @param {Number} x The X coordinate of the tile for which to request geometry. * @param {Number} y The Y coordinate of the tile for which to request geometry. * @param {Number} level The level of the tile for which to request geometry. - * @returns {Number} Undefined if not supported by the terrain provider, otherwise true or false. + * @returns {Boolean} Undefined if not supported by the terrain provider, otherwise true or false. */ TerrainProvider.prototype.getTileDataAvailable = DeveloperError.throwInstantiationError; diff --git a/Source/Core/VRTheWorldTerrainProvider.js b/Source/Core/VRTheWorldTerrainProvider.js index c962875e1fcc..e27b416bd03d 100644 --- a/Source/Core/VRTheWorldTerrainProvider.js +++ b/Source/Core/VRTheWorldTerrainProvider.js @@ -341,7 +341,7 @@ define([ * @param {Number} x The X coordinate of the tile for which to request geometry. * @param {Number} y The Y coordinate of the tile for which to request geometry. * @param {Number} level The level of the tile for which to request geometry. - * @returns {Number} Undefined if not supported, otherwise true or false. + * @returns {Boolean} Undefined if not supported, otherwise true or false. */ VRTheWorldTerrainProvider.prototype.getTileDataAvailable = function(x, y, level) { return undefined; From c81545931bc5a39218be025e95974374ac92e5f8 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Wed, 17 Sep 2014 17:25:19 +1000 Subject: [PATCH 13/14] Add a deprecationWarning when getTileDataAvailable is not implemented. --- Source/Scene/GlobeSurfaceTile.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Scene/GlobeSurfaceTile.js b/Source/Scene/GlobeSurfaceTile.js index 2d617fc2a8c6..a9b78624001b 100644 --- a/Source/Scene/GlobeSurfaceTile.js +++ b/Source/Scene/GlobeSurfaceTile.js @@ -7,6 +7,7 @@ define([ '../Core/defaultValue', '../Core/defined', '../Core/defineProperties', + '../Core/deprecationWarning', '../Core/IntersectionTests', '../Core/PixelFormat', '../Core/Rectangle', @@ -27,6 +28,7 @@ define([ defaultValue, defined, defineProperties, + deprecationWarning, IntersectionTests, PixelFormat, Rectangle, @@ -625,6 +627,8 @@ define([ if (defined(tileDataAvailable)) { return tileDataAvailable; } + } else { + deprecationWarning('TerrainProvider.getTileDataAvailable', 'TerrainProviders must now implement the getTileDataAvailable function.'); } var parent = tile.parent; From 3fbdd62ad2df892e9d534b65886ef1b6c671e61b Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Thu, 18 Sep 2014 14:08:45 +1000 Subject: [PATCH 14/14] Add note to Deprecated section. --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 0ea639809892..2a33288d87e0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,8 @@ Change Log ### 1.2 - 2014-10-01 +* Deprecated + * Types implementing the `TerrainProvider` interface should now include the new `getTileDataAvailable` function. The function will be required starting in Cesium 1.04. * Added a constructor option to `Scene`, `CesiumWidget`, and `Viewer` to disable order independent translucency. * Eliminated imagery artifacts at some zoom levels due to Mercator reprojection. * Fixed a bug in `Model` where the wrong animations could be used when the model was created from glTF JSON instead of