From 46b7f77da83a5ad48e7eed0a5a9d0c6535784c3e Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Thu, 6 Jul 2017 10:29:59 -0400 Subject: [PATCH 1/3] Added debug label for url --- Source/Scene/Cesium3DTileset.js | 134 +++--------------- .../Cesium3DTilesInspector.js | 1 + .../Cesium3DTilesInspectorViewModel.js | 25 +++- Specs/Scene/Cesium3DTilesetSpec.js | 9 +- .../Cesium3DTilesInspectorViewModelSpec.js | 7 + 5 files changed, 61 insertions(+), 115 deletions(-) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index b1187b4af987..1f649a04fd32 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -114,6 +114,7 @@ define([ * @param {Boolean} [options.debugShowGeometricError=false] For debugging only. When true, draws labels to indicate the geometric error of each tile. * @param {Boolean} [options.debugShowRenderingStatistics=false] For debugging only. When true, draws labels to indicate the number of commands, points, triangles and features for each tile. * @param {Boolean} [options.debugShowMemoryUsage=false] For debugging only. When true, draws labels to indicate the texture and geometry memory in megabytes used by each tile. + * @param {Boolean} [options.debugShowUrl=false] For debugging only. When true, draws labels to indicate the url of each tile. * * @exception {DeveloperError} The tileset must be 3D Tiles version 0.0 or 1.0. See {@link https://github.com/AnalyticalGraphicsInc/3d-tiles#spec-status} * @@ -319,116 +320,6 @@ define([ */ this.colorBlendAmount = 0.5; - /** - * This property is for debugging only; it is not optimized for production use. - *

- * Determines if only the tiles from last frame should be used for rendering. This - * effectively "freezes" the tileset to the previous frame so it is possible to zoom - * out and see what was rendered. - *

- * - * @type {Boolean} - * @default false - */ - this.debugFreezeFrame = defaultValue(options.debugFreezeFrame, false); - - /** - * This property is for debugging only; it is not optimized for production use. - *

- * When true, assigns a random color to each tile. This is useful for visualizing - * what models belong to what tiles, especially with additive refinement where models - * from parent tiles may be interleaved with models from child tiles. - *

- * - * @type {Boolean} - * @default false - */ - this.debugColorizeTiles = defaultValue(options.debugColorizeTiles, false); - - /** - * This property is for debugging only; it is not optimized for production use. - *

- * When true, renders each tile's content as a wireframe. - *

- * - * @type {Boolean} - * @default false - */ - this.debugWireframe = defaultValue(options.debugWireframe, false); - - /** - * This property is for debugging only; it is not optimized for production use. - *

- * When true, renders the bounding volume for each visible tile. The bounding volume is - * white if the tile's content has an explicit bounding volume; otherwise, it - * is red. Tiles that are not at final resolution are yellow. - *

- * - * @type {Boolean} - * @default false - */ - this.debugShowBoundingVolume = defaultValue(options.debugShowBoundingVolume, false); - - /** - * This property is for debugging only; it is not optimized for production use. - *

- * When true, renders a blue bounding volume for each tile's content. - *

- * - * @type {Boolean} - * @default false - */ - this.debugShowContentBoundingVolume = defaultValue(options.debugShowContentBoundingVolume, false); - - /** - * This property is for debugging only; it is not optimized for production use. - *

- * When true, renders the viewer request volume for each tile. - *

- * - * @type {Boolean} - * @default false - */ - this.debugShowViewerRequestVolume = defaultValue(options.debugShowViewerRequestVolume, false); - - /** - * This property is for debugging only; it is not optimized for production use. - *

- * When true, draws labels to indicate the geometric error of each tile. - *

- * - * @type {Boolean} - * @default false - */ - this.debugShowGeometricError = defaultValue(options.debugShowGeometricError, false); - - this._tileDebugLabels = undefined; - this.debugPickedTileLabelOnly = false; - this.debugPickedTile = undefined; - this.debugPickPosition = undefined; - - /** - * This property is for debugging only; it is not optimized for production use. - *

- * When true, draws labels to indicate the number of commands, points, triangles and features of each tile. - *

- * - * @type {Boolean} - * @default false - */ - this.debugShowRenderingStatistics = defaultValue(options.debugShowRenderingStatistics, false); - - /** - * This property is for debugging only; it is not optimized for production use. - *

- * When true, draws labels to indicate the geometry and texture memory usage of each tile. - *

- * - * @type {Boolean} - * @default false - */ - this.debugShowMemoryUsage = defaultValue(options.debugShowMemoryUsage, false); - /** * The event fired to indicate progress of loading new tiles. This event is fired when a new tile * is requested, when a requested tile is finished downloading, and when a downloaded tile has been @@ -683,6 +574,11 @@ define([ */ this.debugShowViewerRequestVolume = defaultValue(options.debugShowViewerRequestVolume, false); + this._tileDebugLabels = undefined; + this.debugPickedTileLabelOnly = false; + this.debugPickedTile = undefined; + this.debugPickPosition = undefined; + /** * This property is for debugging only; it is not optimized for production use. *

@@ -716,6 +612,17 @@ define([ */ this.debugShowMemoryUsage = defaultValue(options.debugShowMemoryUsage, false); + /** + * This property is for debugging only; it is not optimized for production use. + *

+ * When true, draws labels to indicate the url of each tile. + *

+ * + * @type {Boolean} + * @default false + */ + this.debugShowUrl = defaultValue(options.debugShowUrl, false); + var that = this; // We don't know the distance of the tileset until tileset.json is loaded, so use the default distance for now @@ -1448,6 +1355,11 @@ define([ attributes += 2; } + if (tileset.debugShowUrl) { + labelString += '\nUrl: ' + tile._header.content.url; + attributes++; + } + var newLabel = { text : labelString.substring(1), position : position, @@ -1565,7 +1477,7 @@ define([ // Number of commands added by each update above statistics.numberOfCommands = (commandList.length - numberOfInitialCommands); - if (tileset.debugShowGeometricError || tileset.debugShowRenderingStatistics || tileset.debugShowMemoryUsage) { + if (tileset.debugShowGeometricError || tileset.debugShowRenderingStatistics || tileset.debugShowMemoryUsage || tileset.debugShowUrl) { if (!defined(tileset._tileDebugLabels)) { tileset._tileDebugLabels = new LabelCollection(); } diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js index faa7d1228d6d..8407d7ea8918 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js @@ -126,6 +126,7 @@ define([ tileDebugLabelsPanelContents.appendChild(makeCheckbox('showGeometricError', 'Geometric Error')); tileDebugLabelsPanelContents.appendChild(makeCheckbox('showRenderingStatistics', 'Rendering Statistics')); tileDebugLabelsPanelContents.appendChild(makeCheckbox('showMemoryUsage', 'Memory Usage (MB)')); + tileDebugLabelsPanelContents.appendChild(makeCheckbox('showUrl', 'Url')); optimizationPanelContents.appendChild(makeCheckbox('skipLevelOfDetail', 'Skip Tile LODs')); var skipScreenSpaceErrorFactorContainer = document.createElement('div'); diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js index 087e97918e5f..b4ffc5ca8297 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js @@ -576,6 +576,26 @@ define([ */ this.showMemoryUsage = false; + var showUrl = knockout.observable(); + knockout.defineProperty(this, 'showUrl', { + get : function() { + return showUrl(); + }, + set : function(value) { + showUrl(value); + if (defined(that._tileset)) { + that._tileset.debugShowUrl = value; + } + } + }); + /** + * Gets or sets the flag to show tile url. This property is observable. + * + * @type {Boolean} + * @default false + */ + this.showUrl = false; + var maximumScreenSpaceError = knockout.observable(); knockout.defineProperty(this, 'maximumScreenSpaceError', { get : function() { @@ -817,7 +837,7 @@ define([ this._definedProperties = ['properties', 'dynamicScreenSpaceError', 'colorBlendMode', 'picking', 'colorize', 'wireframe', 'showBoundingVolumes', 'showContentBoundingVolumes', 'showRequestVolumes', 'freezeFrame', 'maximumScreenSpaceError', 'dynamicScreenSpaceErrorDensity', 'baseScreenSpaceError', 'skipScreenSpaceErrorFactor', 'skipLevelOfDetail', 'skipLevels', 'immediatelyLoadDesiredLevelOfDetail', 'loadSiblings', 'dynamicScreenSpaceErrorDensitySliderValue', - 'dynamicScreenSpaceErrorFactor', 'pickActive', 'showOnlyPickedTileDebugLabel', 'showGeometricError', 'showRenderingStatistics', 'showMemoryUsage']; + 'dynamicScreenSpaceErrorFactor', 'pickActive', 'showOnlyPickedTileDebugLabel', 'showGeometricError', 'showRenderingStatistics', 'showMemoryUsage', 'showUrl']; this._removePostRenderEvent = scene.postRender.addEventListener(function() { that._update(); }); @@ -928,7 +948,8 @@ define([ 'showOnlyPickedTileDebugLabel', 'showGeometricError', 'showRenderingStatistics', - 'showMemoryUsage']; + 'showMemoryUsage', + 'showUrl']; var length = settings.length; for (var i = 0; i < length; ++i) { var setting = settings[i]; diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js index b1decb667030..1f21d699218c 100644 --- a/Specs/Scene/Cesium3DTilesetSpec.js +++ b/Specs/Scene/Cesium3DTilesetSpec.js @@ -1442,6 +1442,7 @@ defineSuite([ tileset.debugShowGeometricError = true; tileset.debugShowRenderingStatistics = true; tileset.debugShowMemoryUsage = true; + tileset.debugShowUrl = true; viewRootOnly(); scene.renderForSpecs(); expect(tileset._tileDebugLabels).toBeDefined(); @@ -1451,12 +1452,14 @@ defineSuite([ 'Triangles: 120\n' + 'Features: 10\n' + 'Texture Memory: 0\n' + - 'Geometry Memory: 0.008'; + 'Geometry Memory: 0.008\n' + + 'Url: parent.b3dm'; expect(tileset._tileDebugLabels._labels[0].text).toEqual(expected); tileset.debugShowGeometricError = false; tileset.debugShowRenderingStatistics = false; tileset.debugShowMemoryUsage = false; + tileset.debugShowUrl = false; scene.renderForSpecs(); expect(tileset._tileDebugLabels).not.toBeDefined(); }); @@ -1468,6 +1471,7 @@ defineSuite([ tileset.debugShowGeometricError = true; tileset.debugShowRenderingStatistics = true; tileset.debugShowMemoryUsage = true; + tileset.debugShowUrl = true; tileset.debugPickedTileLabelOnly = true; var scratchPosition = new Cartesian3(1.0, 1.0, 1.0); @@ -1482,7 +1486,8 @@ defineSuite([ 'Triangles: 120\n' + 'Features: 10\n' + 'Texture Memory: 0\n' + - 'Geometry Memory: 0.008'; + 'Geometry Memory: 0.008\n' + + 'Url: parent.b3dm'; expect(tileset._tileDebugLabels.get(0).text).toEqual(expected); expect(tileset._tileDebugLabels.get(0).position).toEqual(scratchPosition); diff --git a/Specs/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModelSpec.js b/Specs/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModelSpec.js index 8e2aaece0e91..478dc5ba9bc9 100644 --- a/Specs/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModelSpec.js +++ b/Specs/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModelSpec.js @@ -158,6 +158,13 @@ defineSuite([ viewModel.showMemoryUsage = false; expect(viewModel.tileset.debugShowMemoryUsage).toBe(false); }); + + it('showUrl', function() { + viewModel.showUrl = true; + expect(viewModel.tileset.debugShowUrl).toBe(true); + viewModel.showUrl = false; + expect(viewModel.tileset.debugShowUrl).toBe(false); + }); }); describe('update options', function() { From 50f695877ba75eb160dec396f67404eed24ce01e Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Tue, 11 Jul 2017 10:38:16 -0400 Subject: [PATCH 2/3] Remove unneeded memberof --- .../Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js index b4ffc5ca8297..db5634813005 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js @@ -548,7 +548,6 @@ define([ }); /** * Displays the number of commands, points, triangles and features used per tile. This property is observable. - * @memberof Cesium3DTilesInspectorViewModel.prototype * * @type {Boolean} * @default false @@ -569,7 +568,6 @@ define([ }); /** * Displays the memory used per tile. This property is observable. - * @memberof Cesium3DTilesInspectorViewModel.prototype * * @type {Boolean} * @default false @@ -589,7 +587,7 @@ define([ } }); /** - * Gets or sets the flag to show tile url. This property is observable. + * Gets or sets the flag to show the tile url. This property is observable. * * @type {Boolean} * @default false From edff9dbc4ca74ca775f92c40144428ed1e20edb9 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Tue, 11 Jul 2017 10:40:18 -0400 Subject: [PATCH 3/3] Updated CHANGES.md --- CHANGES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index aac667db1e74..28ac687b486d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,10 @@ Change Log ========== +### 1.36 - 2017-08-01 + +* Added ability to show tile urls in the 3D Tiles Inspector. [#5592](https://github.com/AnalyticalGraphicsInc/cesium/pull/5592) + ### 1.35.2 - 2017-07-11 * This is an npm-only release to fix an issue with using Cesium in Node.js.