Skip to content

Commit

Permalink
Merge pull request #6003 from nrivera-Novetta/master
Browse files Browse the repository at this point in the history
Insert missing namespace declarations for KMZ files
  • Loading branch information
Hannah authored Nov 28, 2017
2 parents cb632d8 + cd6e045 commit eaaadd4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Change Log
* Added ability to support touch event in Imagery Layers Split demo application. [#5948](https://github.com/AnalyticalGraphicsInc/cesium/pull/5948)
* Fixed `Invalid asm.js: Invalid member of stdlib` console error by recompiling crunch.js with latest emscripten toolchain. [#5847](https://github.com/AnalyticalGraphicsInc/cesium/issues/5847)
* Added CZML support for `polyline.depthFailMaterial`, `label.scaleByDistance`, `distanceDisplayCondition`, and `disableDepthTestDistance`. [#5986](https://github.com/AnalyticalGraphicsInc/cesium/pull/5986)
* Fixed handling of KMZ files with missing `xsi` namespace declarations. [#6003](https://github.com/AnalyticalGraphicsInc/cesium/pull/6003)
* Fixed a bug where models with animations of different lengths would cause an error. [#5694](https://github.com/AnalyticalGraphicsInc/cesium/issues/5694)
* Added a `clampAnimations` parameter to `Model` and `Entity.model`. Setting this to `false` allows different length animations to loop asynchronously over the duration of the longest animation.

Expand Down
1 change: 1 addition & 0 deletions Source/DataSources/KmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ define([

function loadXmlFromZip(reader, entry, uriResolver, deferred) {
entry.getData(new zip.TextWriter(), function(text) {
text = insertNamespaces(text);
uriResolver.kml = parser.parseFromString(text, 'application/xml');
deferred.resolve();
});
Expand Down
Binary file added Specs/Data/KML/undeclaredNamespaces.kmz
Binary file not shown.
10 changes: 9 additions & 1 deletion Specs/DataSources/KmlDataSourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,22 @@ defineSuite([
});
});

it('load inserts missing namespace declaration', function() {
it('load inserts missing namespace declaration into kml', function() {
var dataSource = new KmlDataSource(options);
return dataSource.load('Data/KML/undeclaredNamespaces.kml').then(function(source) {
expect(source).toBe(dataSource);
expect(source.entities.values.length).toEqual(1);
});
});

it('load inserts missing namespace declaration into kmz', function() {
var dataSource = new KmlDataSource(options);
return dataSource.load('Data/KML/undeclaredNamespaces.kmz').then(function(source) {
expect(source).toBe(dataSource);
expect(source.entities.values.length).toEqual(1);
});
});

it('load rejects nonexistent URL', function() {
return KmlDataSource.load('test.invalid', options).otherwise(function(e) {
expect(e).toBeInstanceOf(RequestErrorEvent);
Expand Down

0 comments on commit eaaadd4

Please sign in to comment.