From e965175c4435ea8138949a189fc8b90f431a62d8 Mon Sep 17 00:00:00 2001 From: Ben Kuster Date: Fri, 18 Jan 2019 14:36:41 +0100 Subject: [PATCH 1/3] PrimitiveCollection.removeAll removes guid --- Source/Scene/PrimitiveCollection.js | 9 +++++---- Specs/Scene/PrimitiveCollectionSpec.js | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Source/Scene/PrimitiveCollection.js b/Source/Scene/PrimitiveCollection.js index 3141f95079dd..5e7a9289960f 100644 --- a/Source/Scene/PrimitiveCollection.js +++ b/Source/Scene/PrimitiveCollection.js @@ -181,10 +181,11 @@ define([ * @see PrimitiveCollection#destroyPrimitives */ PrimitiveCollection.prototype.removeAll = function() { - if (this.destroyPrimitives) { - var primitives = this._primitives; - var length = primitives.length; - for ( var i = 0; i < length; ++i) { + var primitives = this._primitives; + var length = primitives.length; + for ( var i = 0; i < length; ++i) { + delete primitives[i]._external._composites[this._guid]; + if (this.destroyPrimitives) { primitives[i].destroy(); } } diff --git a/Specs/Scene/PrimitiveCollectionSpec.js b/Specs/Scene/PrimitiveCollectionSpec.js index 9923d91726d0..004c06b9e24b 100644 --- a/Specs/Scene/PrimitiveCollectionSpec.js +++ b/Specs/Scene/PrimitiveCollectionSpec.js @@ -202,6 +202,22 @@ defineSuite([ expect(primitives.contains(labels1)).toEqual(false); }); + it('does not contain removed primitive', function() { + var labels0 = createLabels(); + primitives.add(labels0); + primitives.remove(labels0); + + expect(primitives.contains(labels0)).toEqual(false); + }); + + it('does not contain all removed primitives', function() { + var labels0 = createLabels(); + primitives.add(labels0); + primitives.removeAll(); + + expect(primitives.contains(labels0)).toEqual(false); + }); + it('does not contain undefined', function() { expect(primitives.contains()).toEqual(false); }); From 69485729b9e41f6cd5c2366a13e2ddef3c6017ec Mon Sep 17 00:00:00 2001 From: Ben Kuster Date: Fri, 18 Jan 2019 14:43:06 +0100 Subject: [PATCH 2/3] updated CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 21639ecac8ab..2ff7edf84a28 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -26,6 +26,7 @@ Change Log * 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) +* Fixed `PrimitiveCollection.removeAll` to no longer `contain` removed primitives. ### 1.53 - 2019-01-02 From 7e476d25df2da4e5c98e3c777468d632b7e99dba Mon Sep 17 00:00:00 2001 From: Ben Kuster Date: Fri, 18 Jan 2019 17:03:14 +0100 Subject: [PATCH 3/3] CHANGES.md link update --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 2ff7edf84a28..536228f09c91 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -26,7 +26,7 @@ Change Log * 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) -* Fixed `PrimitiveCollection.removeAll` to no longer `contain` removed primitives. +* Fixed `PrimitiveCollection.removeAll` to no longer `contain` removed primitives. [#7491](https://github.com/AnalyticalGraphicsInc/cesium/pull/7491) ### 1.53 - 2019-01-02