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

Fix Cesium ion external asset handling #6140

Merged
merged 4 commits into from
Jan 23, 2018
Merged

Fix Cesium ion external asset handling #6140

merged 4 commits into from
Jan 23, 2018

Conversation

mramato
Copy link
Contributor

@mramato mramato commented Jan 21, 2018

I was so excited about #6136 that I totally glossed over some important details of external assets and for the most part, they didn't work. CesiumIonResource should only be used for ion hosted assets, so create a standard Resource instance for external 3D Tiles and Terrain. This also means that CesiumIonResource.createImageryProvider can't exist and needs to just be on CesiumIon directly instead.

It's probably easier to review this as a whole file again rather than looking at the diff.

I also add Instrumented directory to .eslintignore becuase it was linting the results of instrumentForCoverage

CC @hpinkos @tfili

`CesiumIonResource` should only be used for ion hosted assets, so create
a standard Resource instance for external 3D Tiles and Terrain.  This also
means that `CesiumIonResource.createImageryProvider` can't exist and needs
to just be on `CesiumIon` directly instead.

Also add `Instrumented` directory to .eslintignore becuase it was linting
the results of `instrumentForCoverage`
@cesium-concierge
Copy link

Signed CLA is on file.

@mramato, thanks for the pull request! Maintainers, we have a signed CLA from @mramato, so you can review this at any time.

⚠️ I noticed that CHANGES.md has not been updated. If this change updates the public API in any way, fixes a bug, or makes any non-trivial update, please add a bullet point to CHANGES.md and comment on this pull request so we know it was updated. For more info, see the Pull Request Guidelines.


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

🌍 🌎 🌏

}

//External imagery assets have additional configuration that can't be represented as a Resource
throw new RuntimeError('CesiumIon.createResource does not support external imagery assets.');
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 comment to use CesiumIon.createImageryProvider instead. Or can't we just make a call to that from this function instead of throwing an error?

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 agree on updating the error message, but I think just calling it from here would be confusing since it's a completely different return type. I also expect external assets to change a lot in the future, so they'll remain experimental for longer.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

/**
* @private
*/
CesiumIon.createEndpointResource = function (assetId, options) {
Copy link
Contributor

Choose a reason for hiding this comment

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

createEndpointResource -> _createEndpointResource?

@hpinkos
Copy link
Contributor

hpinkos commented Jan 22, 2018

Just those comments, the rest of the changes look fine to me 👍

1. `CesiumIon.createEndpointResource` -> `CesiumIon._createEndpointResource`
2. Improve `createResource` error message.
@mramato
Copy link
Contributor Author

mramato commented Jan 22, 2018

Thanks @hpinkos, changes made.

* creation and automatic refresh token handling. This object
* should not be created directly, use CesiumIonResource.create
* creation and automatic refresh token handling. This object
* should not be created directly, use CesiumIonResource.create.
*
* @private
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Should CesiumIonResource be in its own file? Usually in Cesium if we have a class with a few functions, we usually split it out.

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 moved it, my main reason for keeping it off is because it ends up on the Cesium object in the combined version, but that's par for the course for us anyway. This should be good to go.

@mramato
Copy link
Contributor Author

mramato commented Jan 23, 2018

@tfili bump

@tfili
Copy link
Contributor

tfili commented Jan 23, 2018

Looks good to me.

@tfili tfili merged commit 71612a3 into master Jan 23, 2018
@tfili tfili deleted the cesium-ion branch January 23, 2018 19:43
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.

4 participants