I'm working with a SingleTileImageProvider to render an image within a specified Rectangle, and I'd like to have the Scene update the rendering if the Rectangle changes.
At the moment, I see I can effect this by toggling the ImageryLayer's show property, which as far as I can tell is only causing the ImageryLayerCollection's layerShownOrHidden Event to be raised. Subsequently, the GlobeSurfaceTileProvider (private class of Globe, used in conjunction with the QuadtreePrimitive for rendering by the engine) is listening to this event and either removes or adds tiles accordingly.
Manually raising the layerShownOrHidden Event for the layer in question doesn't quite work; it appears the Globe (GlobeSurfaceTileProvider) expects a layer's visibility to always toggle from this event (not stay the same) and produces strange behavior otherwise.
Manually raising the Event twice (toggling forth and then back) does work, and is the solution I'm moving forward with for the time being. I've attached a Sandcastle export of a simple demo of this (forgive any Knockout abuse; I'm not familiar with the framework specifics) if anyone wants to play.
Is this approach kosher (manually raising these events at "random" during a render loop)? Further, does it make sense for an ImageryProvider to be "dynamic" in this sense (its content)? I see no API supporting this idea, which makes me believe it's going "against the grain" so to speak. The idea seems reasonable for the SingleTileImageryProvider (where the entire provider is "defined by the client"); thinking about e.g. WMS/ArcGIS ImageryProviders (or other providers that adapt a web/remote service), this may make sense if they support HTTP caching headers. I'm unsure of a good approach to signal this automatically without much network overhead. Maybe a periodic level 0 request, depending on what type of HTTP caching support is in use?
Image Overlay.html (4.03 KB)