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

Conversation

sanjeetsuhag
Copy link
Contributor

Fixes #8133

@cesium-concierge
Copy link

Thank you so much for the pull request @sanjeetsuhag! I noticed this is your first pull request and I wanted to say welcome to the Cesium community!

The Pull Request Guidelines is a handy reference for making sure your PR gets accepted quickly, so make sure to skim that.

  • ❌ Missing CONTRIBUTORS.md entry.
  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.
  • ❔ Unit tests were not updated.
    • Make sure you've updated tests to reflect your changes, added tests for any new code, and ran the code coverage tool.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

@lilleyse
Copy link
Contributor

@sanjeetsuhag there is an eslint failure caught by CI. You can run eslint locally with npm run eslint

@lilleyse
Copy link
Contributor

Also I believe you started this already, but make sure to add an entry to CHANGES.md.

@@ -595,6 +595,7 @@ import WallGraphics from './WallGraphics.js';

var resource;
if (defined(uriResolver)) {
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.

@lilleyse
Copy link
Contributor

Let's add a simple test for this too. It will look similar to load works with a KMZ URL but the uri in the kml will have backslashes.

@lilleyse
Copy link
Contributor

@sanjeetsuhag can you resolve the merge conflicts?

You can resolve the merge conflicts locally, or for small conflicts like this you can use the Github UI.

CHANGES.md Outdated
* 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

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.

@@ -1,4 +1,4 @@
import { ArcType } from '../../Source/Cesium.js';
import { ArcType, isDataUri } from '../../Source/Cesium.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

Style: put these imports on separate lines and in alphabetical order

@lilleyse
Copy link
Contributor

Thanks @sanjeetsuhag!

@lilleyse lilleyse merged commit 6e63eea into master Jan 14, 2020
@lilleyse lilleyse deleted the kmz-backslash-fix branch January 14, 2020 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KMZ loader doesn't handle paths with back slashes correctly
3 participants