Skip to content

Fix merging of composite availability #7718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Change Log

##### Fixes :wrench:
* Fixed an error where `clampToHeightMostDetailed` or `sampleHeightMostDetailed` would crash if entities were created when the promise resolved. [#7690](https://github.com/AnalyticalGraphicsInc/cesium/pull/7690)
* Fixed an issue with compositing merged entity availability. [#7717](https://github.com/AnalyticalGraphicsInc/cesium/issues/7717)
* Fixed an error where many imagery layers within a single tile would cause parts of the tile to render as black on some platforms. [#7649](https://github.com/AnalyticalGraphicsInc/cesium/issues/7649)

### 1.56.1 - 2019-04-02
Expand Down
2 changes: 2 additions & 0 deletions Source/DataSources/CompositeEntityCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ define([
for (var i = 0; i < propertyNamesLength; i++) {
entity[propertyNames[i]] = undefined;
}
entity._name = undefined;
entity._availability = undefined;
}

function subscribeToEntity(that, eventHash, collectionId, entity) {
Expand Down
2 changes: 1 addition & 1 deletion Source/DataSources/Entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ define([
//Name, show, and availability are not Property objects and are currently handled differently.
//source.show is intentionally ignored because this.show always has a value.
this.name = defaultValue(this.name, source.name);
this.availability = defaultValue(source.availability, this.availability);
this.availability = defaultValue(this.availability, source.availability);

var propertyNames = this._propertyNames;
var sourcePropertyNames = defined(source._propertyNames) ? source._propertyNames : Object.keys(source);
Expand Down
51 changes: 51 additions & 0 deletions Specs/DataSources/CompositeEntityCollectionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,57 @@ defineSuite([
expect(compositeObject.billboard.show).toBeUndefined();
});

it('per-entity availability works', function() {
var id = 'test';
var collection1 = new EntityCollection();
var availability1 = new TimeIntervalCollection();
availability1.addInterval(TimeInterval.fromIso8601({
iso8601 : '2019-01-01/2019-01-04'
}));
var entity1 = new Entity({
id : id,
availability : availability1
});
collection1.add(entity1);

var collection2 = new EntityCollection();
var availability2 = new TimeIntervalCollection();
availability2.addInterval(TimeInterval.fromIso8601({
iso8601 : '2019-01-02/2019-01-05'
}));
var entity2 = new Entity({
id : id,
availability : availability2
});
collection2.add(entity2);

var collection3 = new EntityCollection();
var availability3 = new TimeIntervalCollection();
availability3.addInterval(TimeInterval.fromIso8601({
iso8601 : '2019-01-03/2019-01-06'
}));
var entity3 = new Entity({
id : id,
availability : availability3
});
collection3.add(entity3);

//Add collections in reverse order to lower numbers of priority
var composite = new CompositeEntityCollection();
composite.addCollection(collection3);
composite.addCollection(collection2);
composite.addCollection(collection1);

var compositeObject = composite.getById(id);
expect(compositeObject.availability.start).toEqual(JulianDate.fromIso8601('2019-01-01'));

composite.removeCollection(collection1);
expect(compositeObject.availability.start).toEqual(JulianDate.fromIso8601('2019-01-02'));

composite.removeCollection(collection2);
expect(compositeObject.availability.start).toEqual(JulianDate.fromIso8601('2019-01-03'));
});

it('works when collection being composited suspends updates', function() {
var collection = new EntityCollection();
var composite = new CompositeEntityCollection([collection]);
Expand Down
4 changes: 2 additions & 2 deletions Specs/DataSources/EntitySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ defineSuite([
}
});

it('merge always overwrites availability', function() {
it('merge does not overwrite availability', function() {
var entity = new Entity();
var interval = TimeInterval.fromIso8601({
iso8601 : '2000-01-01/2001-01-01'
Expand All @@ -214,7 +214,7 @@ defineSuite([
entity2.availability = interval2;

entity.merge(entity2);
expect(entity.availability).toBe(interval2);
expect(entity.availability).toBe(interval);
});

it('merge works with custom properties.', function() {
Expand Down