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

Refresh imagery provider #5536

Closed
wants to merge 13 commits into from
Closed

Refresh imagery provider #5536

wants to merge 13 commits into from

Conversation

tfili
Copy link
Contributor

@tfili tfili commented Jun 26, 2017

Adds some plumbing that allows for an imagery provider to be reloaded.

Also adds the ability for SingleTileImageryProvider to take an Image or Canvas, along with tests.

@tfili
Copy link
Contributor Author

tfili commented Jun 26, 2017

@bagnell Can you take a look at this an make sure I'm not doing anything inherently bad at the imagery provider layer? I'll probably need to do a little cleanup with the callbacks once you give the ok.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 26, 2017

@kring any chance you are available to also review this?

Copy link
Contributor

@pjcozzi pjcozzi left a comment

Choose a reason for hiding this comment

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

Just trivial comments, I don't have any unique insights here.

viewer.imageryLayers.addImageryProvider(videoProvider);

viewer.scene.preRender.addEventListener(function() {
videoProvider.reload();
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that the video element is "dynamic", could this be implicit so the user doesn't need to call it when the input is a video element?

I dunno if it will be common enough and if the lack of symmetry with the less frequent dynamic update does more harm than good to the API. Just, in general, whenever the user needs to "make something dirty", it is error prone as we've also ran into this with 3D Tiles styling.

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 think it would be a little weird requiring the the SingleTileImageryProvider to take the scene for this purpose. Not sure how else I would do it.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could work it into the render loop, but don't worry about it; I doubt it is important enough.

}

// Insert immediately after existing TileImageries
var insertionPoint = startIndex+tileImageriesToFree;
Copy link
Contributor

Choose a reason for hiding this comment

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

Whitespace, sorry.


this._url = url;
if (defined(url)) {
deprecationWarning('SingleTileImageryProvider.url', 'SingleTileImageryProvider url parameter was deprecated in Cesium 1.35. It now takes an image parameter that can contain a url, a Canvas or an Image. It will be removed in Cesium 1.37.');
Copy link
Contributor

Choose a reason for hiding this comment

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

Update CHANGES.md.

Seems like this should make 1.35.

expect(provider._ready).toBe(true);
});

it('reload calls the _reload function', function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like we would need more unit tests to cover all the cases in the new code, right?

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 28, 2017

@bagnell would you be able to do a quick review of this and #5542?

@@ -1,92 +1,92 @@
/*global define*/
define([
'../Core/BoundingSphere',
Copy link
Contributor

Choose a reason for hiding this comment

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

Whitespace.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can run npm run sortRequires to fix this. I would merge master in first.

@bagnell
Copy link
Contributor

bagnell commented Jun 29, 2017

Zoom in and out for a bit with a tilted view and you'll see this:
dynamic_imagery

@bagnell
Copy link
Contributor

bagnell commented Jun 29, 2017

If you move colorProvider.reload() to the pre-render event, this can happen:
dynamic_imagery2
It should be all green. When you zoom out, the green image is replaced by blue. When you zoom in, all images are green.

@@ -611,11 +611,98 @@ define([
return destroyObject(this);
};

function getTileReadyCallback(tileImageriesToFree, layer, terrainProvider) {
return function(tile) {
var tileImagery, imagery;
Copy link
Contributor

Choose a reason for hiding this comment

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

Declare on two separate lines.

@bagnell
Copy link
Contributor

bagnell commented Jun 29, 2017

Just, in general, whenever the user needs to "make something dirty", it is error prone as we've also ran into this with 3D Tiles styling.

I agree. Could you add something like a dynamic property? In the render loop, loop over the imagery providers and call _reload when it is dynamic. Can you detect when it is a HTMLVideoElement and default it to true; otherwise, default to false?

@cesium-concierge
Copy link

Thanks again for your contribution @tfili!

No one has commented on this pull request in 30 days. Maintainers, can you review, merge or close to keep things tidy?

I'm going to re-bump this in 30 days. If you'd like me to stop, just comment with @cesium-concierge stop. If you want me to start again, just delete the comment.


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

🌍 🌎 🌏

@hpinkos
Copy link
Contributor

hpinkos commented Dec 12, 2018

@tfili what do we want to do with this PR?

@cesium-concierge
Copy link

Thanks again for your contribution @tfili!

No one has commented on this pull request in 30 days. Maintainers, can you review, merge or close to keep things tidy?

I'm going to re-bump this in 30 days. If you'd like me to stop, just comment with @cesium-concierge stop. If you want me to start again, just delete the comment.


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

🌍 🌎 🌏

@tfili
Copy link
Contributor Author

tfili commented Jan 14, 2019

@hpinkos I don't have time to look at it. A bunch of it was plumbing that was needed for time dynamic WMTS. That has already been merged. What is left is some changes to the interface of SingleTileImageryProvider to take a canvas or image, so it can be used for video. You can close it. There are probably better ways to do it, that we can look at later if need be.

@tfili tfili closed this Jan 14, 2019
@tfili tfili deleted the refresh-imagery-provider branch January 14, 2019 21:21
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.

5 participants