From e567cf0d9de530de492c018757e6b96475f8fc38 Mon Sep 17 00:00:00 2001 From: Kangning Li Date: Fri, 11 Jan 2019 12:15:34 -0500 Subject: [PATCH] fix cartographicLimitRectangle default and doc --- .../gallery/Cartographic Limit Rectangle.html | 2 +- CHANGES.md | 1 + Source/Scene/Globe.js | 11 +++++++++++ Specs/Scene/GlobeSurfaceTileProviderSpec.js | 5 +++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.html b/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.html index ac4ee5e13c43..142f4b7df295 100644 --- a/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.html +++ b/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.html @@ -59,7 +59,7 @@ if (checked) { viewer.scene.globe.cartographicLimitRectangle = coffeeBeltRectangle; } else { - viewer.scene.globe.cartographicLimitRectangle = Cesium.Rectangle.MAX_VALUE; + viewer.scene.globe.cartographicLimitRectangle = undefined; } }); diff --git a/CHANGES.md b/CHANGES.md index b3cb3c5d5e02..d83761531d1e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -23,6 +23,7 @@ Change Log * Fix rectangle positions at the north and south poles. [#7451](https://github.com/AnalyticalGraphicsInc/cesium/pull/7451) * Fixed image size issue when using multiple particle systems. [#7412](https://github.com/AnalyticalGraphicsInc/cesium/pull/7412) * Fixed Sandcastle's "Open in New Window" button not displaying imagery due to blob URI limitations. [#7250](https://github.com/AnalyticalGraphicsInc/cesium/pull/7250) +* Fixed an issue where setting `scene.globe.cartographicLimitRectangle` to `undefined` would cause a crash. [#7477](https://github.com/AnalyticalGraphicsInc/cesium/issues/7477) ### 1.53 - 2019-01-02 diff --git a/Source/Scene/Globe.js b/Source/Scene/Globe.js index 0a9ccfce2954..8ed9ef7cf8a2 100644 --- a/Source/Scene/Globe.js +++ b/Source/Scene/Globe.js @@ -329,11 +329,22 @@ define([ this._surface.tileProvider.clippingPlanes = value; } }, + /** + * A property specifying a {@link Rectangle} used to limit globe rendering to a cartographic area. + * Defaults to the maximum extent of cartographic coordinates. + * + * @member Globe.prototype + * @type {Rectangle} + * @default Rectangle.MAX_VALUE + */ cartographicLimitRectangle : { get : function() { return this._surface.tileProvider.cartographicLimitRectangle; }, set : function(value) { + if (!defined(value)) { + value = Rectangle.clone(Rectangle.MAX_VALUE); + } this._surface.tileProvider.cartographicLimitRectangle = value; } }, diff --git a/Specs/Scene/GlobeSurfaceTileProviderSpec.js b/Specs/Scene/GlobeSurfaceTileProviderSpec.js index f398050cfb1b..efbb23c32290 100644 --- a/Specs/Scene/GlobeSurfaceTileProviderSpec.js +++ b/Specs/Scene/GlobeSurfaceTileProviderSpec.js @@ -989,6 +989,11 @@ defineSuite([ }); }); + it('cartographicLimitRectangle defaults to Rectangle.MAX_VALUE', function() { + scene.globe.cartographicLimitRectangle = undefined; + expect(scene.globe.cartographicLimitRectangle.equals(Rectangle.MAX_VALUE)).toBe(true); + }); + it('cartographicLimitRectangle culls tiles outside the region', function() { switchViewMode(SceneMode.COLUMBUS_VIEW, new GeographicProjection(Ellipsoid.WGS84)); var unculledCommandCount;