Skip to content

Commit

Permalink
Merge pull request #5656 from AnalyticalGraphicsInc/geojson-name-setter
Browse files Browse the repository at this point in the history
Add setter for GeoJsonDataSource.name
  • Loading branch information
mramato authored Jul 20, 2017
2 parents d0d4403 + b146e77 commit 96ab483
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Change Log
* Added ability to show tile urls in the 3D Tiles Inspector. [#5592](https://github.com/AnalyticalGraphicsInc/cesium/pull/5592)
* Added behavior to `Cesium3DTilesInspector` that selects the first tileset hovered over if no tilest is specified. [#5139](https://github.com/AnalyticalGraphicsInc/cesium/issues/5139)
* Added ability to provide a `width` and `height` to `scene.pick`. [#5602](https://github.com/AnalyticalGraphicsInc/cesium/pull/5602)
* Added setter for `GeoJsonDataSource.name` to specify a name for the datasource [#5653](https://github.com/AnalyticalGraphicsInc/cesium/issues/5653)
* Fixed issue where scene would blink when labels were added. [#5537](https://github.com/AnalyticalGraphicsInc/cesium/issues/5537)
* Fixed label positioning when height reference changes [#5609](https://github.com/AnalyticalGraphicsInc/cesium/issues/5609)
* Fixed crash when using the `Cesium3DTilesInspectorViewModel` and removing a tileset [#5607](https://github.com/AnalyticalGraphicsInc/cesium/issues/5607)
Expand Down
8 changes: 7 additions & 1 deletion Source/DataSources/GeoJsonDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,13 +683,19 @@ define([

defineProperties(GeoJsonDataSource.prototype, {
/**
* Gets a human-readable name for this instance.
* Gets or sets a human-readable name for this instance.
* @memberof GeoJsonDataSource.prototype
* @type {String}
*/
name : {
get : function() {
return this._name;
},
set : function(value) {
if (this._name !== value) {
this._name = value;
this._changed.raiseEvent(this);
}
}
},
/**
Expand Down
13 changes: 13 additions & 0 deletions Specs/DataSources/GeoJsonDataSourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,19 @@ defineSuite([
expect(dataSource.show).toBe(true);
});

it('setting name raises changed event', function() {
var dataSource = new GeoJsonDataSource();

var spy = jasmine.createSpy('changedEvent');
dataSource.changedEvent.addEventListener(spy);

var newName = 'chester';
dataSource.name = newName;
expect(dataSource.name).toEqual(newName);
expect(spy.calls.count()).toEqual(1);
expect(spy).toHaveBeenCalledWith(dataSource);
});

it('show sets underlying entity collection show.', function() {
var dataSource = new GeoJsonDataSource();

Expand Down

0 comments on commit 96ab483

Please sign in to comment.