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

3D tiles - always use version query parameter from tileset.json #6933

Merged
merged 7 commits into from Aug 23, 2018

Conversation

hpinkos
Copy link
Contributor

@hpinkos hpinkos commented Aug 17, 2018

@mramato This is the fix we want, right?

@cesium-concierge
Copy link

Thanks for the pull request @hpinkos!

  • ✔️ 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.

Reviewers, don't forget to make sure that:

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

I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

@mramato
Copy link
Member

mramato commented Aug 20, 2018

Thanks @hpinkos this fix is definitely what I had in mind. I think we'll need to re-evaluate how Cesium handles query parameters for sub requests, but this definitely makes Cesium more spec compliant when it comes to 3D Tiles.

Looks like you have some failing tests. Once they're fixed, I'll merge.

@hpinkos
Copy link
Contributor Author

hpinkos commented Aug 22, 2018

Alright, I think I got everything with tilesetVersion correct now

}
// Always set query parameters to make sure the tilesetVersion matches the current tileset
// Otherwise a child tileset might use the tilesetVersion from the parent
resource.setQueryParameters(versionQuery);
Copy link
Member

Choose a reason for hiding this comment

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

Why not just move this inside of the if block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I literally put an inline comment above this line explaining that

Copy link
Member

Choose a reason for hiding this comment

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

Wait, I'm supposed to read those things? :trollface:

Unfortunately, there is still an issue because the code doesn't actually remove the parameter. setQueryParameters only overwrites values if they are supplied, since versionQuery is an empty object, it's essentially a no-op.

//Assume a query parameter
var url1 = new Cesium.Resource('https://cesium.com?v=1');
console.log(url1.url); // https://cesium.com?v=1

//This is basically a no-op
url1.setQueryParameters({});
console.log(url1.url); // https://cesium.com?v=1

//However, this only clears the value, not the parameter
url1.setQueryParameters({ v: undefined});
console.log(url1.url); // https://cesium.com?v

//To actually delete the query parameter
delete url1.queryParameters.v;
console.log(url1.url); // https://cesium.com

So you need an else that deletes it and you can get rid of the tmp object.

Copy link
Member

Choose a reason for hiding this comment

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

And sorry for not reading your comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, yeah I was looking at how setQueryParamaters works and for some reason I thought that it would remove the value unless you set the useAsDefault argument, but you're right.

@hpinkos
Copy link
Contributor Author

hpinkos commented Aug 23, 2018

@mramato I think this is ready now

@mramato
Copy link
Member

mramato commented Aug 23, 2018

Thanks @hpinkos! I pushed a minor tweak and will merge when this goes green.

@mramato mramato merged commit 4c68791 into master Aug 23, 2018
@mramato mramato deleted the 3dtiles-query branch August 23, 2018 14:19
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.

None yet

3 participants