Skip to content
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

Add setter for KmlDataSource.name #5660

Merged
merged 5 commits into from
Jul 24, 2017
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -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 `KkmlDataSource.name` to specify a name for the datasource.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo Kkml

* 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/KmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -2344,14 +2344,20 @@ define([

defineProperties(KmlDataSource.prototype, {
/**
* Gets a human-readable name for this instance.
* Gets or sets a human-readable name for this instance.
* This will be automatically be set to the KML document name on load.
* @memberof KmlDataSource.prototype
* @type {String}
*/
name : {
get : function() {
return this._name;
},
set : function(value) {
if(this._name !== value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a space after if: if(this -> if (this

this._name = value;
this._changed.raiseEvent(this);
}
}
},
/**
Expand Down
14 changes: 14 additions & 0 deletions Specs/DataSources/KmlDataSourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,20 @@ defineSuite([
expect(dataSource.show).toBe(true);
});


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

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

var newName = 'garfield';
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 KmlDataSource(options);

Expand Down