Skip to content

Commit

Permalink
Merge pull request #7491 from virtualcitySYSTEMS/fix-primitiveCollect…
Browse files Browse the repository at this point in the history
…ionRemoveAll

PrimitiveCollection.removeAll removes guid
  • Loading branch information
Hannah authored Jan 18, 2019
2 parents c430e8f + 7e476d2 commit 8da54fb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,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. [#7491](https://github.com/AnalyticalGraphicsInc/cesium/pull/7491)

### 1.53 - 2019-01-02

Expand Down
9 changes: 5 additions & 4 deletions Source/Scene/PrimitiveCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
16 changes: 16 additions & 0 deletions Specs/Scene/PrimitiveCollectionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down

0 comments on commit 8da54fb

Please sign in to comment.