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

Add readyPromise to ImageryProviders #3175

Merged
merged 4 commits into from
Nov 9, 2015
Merged

Conversation

klim705
Copy link
Contributor

@klim705 klim705 commented Nov 6, 2015

Added promise property (similar to Model and Primitive's readyPromise) to each imagery provider that resolves to true when the provider is ready for use.

@hpinkos
Copy link
Contributor

hpinkos commented Nov 6, 2015

@klim705 this looks good to me! Are you going to add a readyPromise to the terrain providers as well?

@klim705
Copy link
Contributor Author

klim705 commented Nov 6, 2015

@hpinkos It's not necessary at the moment, so I can add it to the terrain providers once we get there, if needed. Thank you!

@mramato
Copy link
Contributor

mramato commented Nov 6, 2015

Actually, @hpinkos makes a good point, for completeness we should have readyPromises for terrain as well, I think this will take care of everywhere in Cesium we currently have a ready boolean.

@klim705
Copy link
Contributor Author

klim705 commented Nov 6, 2015

Okay, I'll just add it to terrain as well and add to this PR then.

@hpinkos
Copy link
Contributor

hpinkos commented Nov 6, 2015

Great! Let me know when it's ready and I'll take a look.

@klim705
Copy link
Contributor Author

klim705 commented Nov 6, 2015

Added to terrain providers. I found the ready property without a readyPromise in QuadtreeTileProvider, GlobeSurfaceTileProvider, and Billboard as well. Should a readyPromise also be added to those three?

@hpinkos
Copy link
Contributor

hpinkos commented Nov 6, 2015

Lots of people have asked for a readyPromise for Billboard. I think that is out of the scope of this PR though, so I wouldn't worry about it for here.

@mramato
Copy link
Contributor

mramato commented Nov 6, 2015

Billboard is a different beast, so I wouldn't worry about it. The other ones are private, so no need to worry about them either.

*/
readyPromise : {
get : function() {
return when.resolve(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

You should define this._readyPromise = when.resolve(true); in the constructor and then simply return it here. The code as it is now returns a different promise every time.

@mramato
Copy link
Contributor

mramato commented Nov 6, 2015

One last thing, in providers that aren't always ready, I'm pretty sure there is an error handler somewhere that spits out a console message on failure. We should reject the promise with the same error in these situations (as a RuntimeError with the same message).

@mramato
Copy link
Contributor

mramato commented Nov 6, 2015

Other than that, this looks great. Thanks @klim705! and congrats on your first Cesium PR.

@klim705
Copy link
Contributor Author

klim705 commented Nov 6, 2015

Finished with review changes. Thanks @hpinkos and @mramato!

@mramato
Copy link
Contributor

mramato commented Nov 9, 2015

@klim705 can you add some tests to make sure the promise gets rejected for providers where that can happen? Other than that this looks great and I'll merge as soon as those changes are in.

@klim705
Copy link
Contributor Author

klim705 commented Nov 9, 2015

@mramato Added rejection tests.

@mramato
Copy link
Contributor

mramato commented Nov 9, 2015

Thanks again @klim705.

mramato added a commit that referenced this pull request Nov 9, 2015
Add readyPromise to ImageryProviders
@mramato mramato merged commit 7b25c60 into CesiumGS:master Nov 9, 2015
@mramato
Copy link
Contributor

mramato commented Nov 9, 2015

I updated CHANGES in master.

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.

3 participants