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

Replaces backslashes with forward slashes in KML files #8533

Merged
merged 11 commits into from
Jan 14, 2020
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ Change Log

##### Fixes :wrench:
* Fixed a bug where the camera could go underground during mouse navigation. [#8504](https://github.com/AnalyticalGraphicsInc/cesium/pull/8504)
* Fixed a bug where files with backslashes were not loaded in KMZ files. [#8533](https://github.com/AnalyticalGraphicsInc/cesium/pull/8533)
* Reduced Cesium bundle size by avoiding unnecessarily importing `Cesium3DTileset` in `Picking.js` [#8532](https://github.com/AnalyticalGraphicsInc/cesium/pull/8532)
* Fixed WebGL warning message about `EXT_float_blend` being implicitly enabled. [#8534](https://github.com/AnalyticalGraphicsInc/cesium/pull/8534)


Copy link
Contributor

Choose a reason for hiding this comment

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

Remove empty line

### 1.65.0 - 2020-01-06

##### Breaking Changes :mega:
Expand Down
2 changes: 2 additions & 0 deletions Source/DataSources/KmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,8 @@ import WallGraphics from './WallGraphics.js';

var resource;
if (defined(uriResolver)) {
// To resolve issues with KML sources defined in Windows style paths.
href = href.replace(/\\/g, '/');
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's worth adding a short inline comment explaining why backslashes need to be converted here.

var blob = uriResolver[href];
if (defined(blob)) {
resource = new Resource({
Expand Down
Binary file added Specs/Data/KML/backslash.kmz
Binary file not shown.
8 changes: 8 additions & 0 deletions Specs/DataSources/KmlDataSourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ describe('DataSources/KmlDataSource', function() {
});
});

it('load works with a KMZ URL with Windows-style paths', function() {
var dataSource = new KmlDataSource(options);
return dataSource.load('Data/KML/backslash.kmz').then(function(source) {
expect(source).toBe(dataSource);
expect(source.entities.values[0]._billboard._image._value).toBeDefined();
Copy link
Contributor

Choose a reason for hiding this comment

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

This test also passes on master so it will need to be tweaked.

I noticed that source.entities.values[0]._billboard._image._value.url is a data uri if it successfully loads the image. You can use isDataUri to check that url is in fact a data uri.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This issue was resolved by using isDataUri. The test fails on master, but passes on this branch.

});
});

it('load works with a KMZ Resource', function() {
var dataSource = new KmlDataSource(options);
var resource = new Resource({
Expand Down