WorldWindEarth / WorldWindJava

A community supported fork of the NASA WorldWind Java SDK (WWJ) is for building cross-platform 3D geospatial desktop applications in Java.
https://worldwind.earth/WorldWindJava/
47 stars 12 forks source link

Unable to Refresh Map Layer Cache with "setExpiryTime" #73

Open robmilton opened 5 years ago

robmilton commented 5 years ago

Description

The method "setExpiryTime" in the Layer class has the following description: /**

And reading through the WorldWind Java Forum there are several posts claiming that using "setExpiryTime(System.currentTimeMillis())" will invalidate a layer's tile cache both in memory and on disc causing new tiles to be retrieved from the source.

However, when I use this method as described nothing seems to happen. Even though the "setExpiryTime" seemed to execute without issue the return value for "tile.getLevel().getExpiryTime()" is the default value of 0 (zero).

Expected behavior: The documentation says that setting "setExpiryTime(System.currentTimeMillis())" should invalidate the tiles for the specified layer both in memory and on disc and force new tiles to be retrieved from their source.

Actual behavior: The cached tiles are used instead of fetching the tiles from the source.

Steps to Reproduce

  1. Call layer.setExpiryTime(System.currentTimeMillis()); for the desired map layer

Reproduces how often: Always

Operating System and Version

Windows 10 version 1903

Additional Information

Maybe I'm missing something. Are there other flags that need to be set or other calls that need to be made to mark a layer's current cache as expired and force tiles to be downloaded from their source?

Edit Per Patrick's request I've submitted this issue at the NASA WWJ repo: https://github.com/NASAWorldWind/WorldWindJava/issues/174

PJHogan commented 5 years ago

Oooh! I like this one! Good stuff!

robmilton commented 5 years ago

I decided to take another approach to the problem I was trying to resolve: providing a method for a client to delete local tile cache for a selected map.

But the issue described above still exists, and I would consider it to be a "bug" (at least based on the documentation).

However, I wonder if the "setExpiryTime" method only works if a layer's XML config file contains a "LastUpdate" node? Our layers do not contain this node. I suppose it might be possible that the "setExpiryTime" method requires the existence of this node.

I'm pretty swamped at the moment, but I hope to be able to test this before too long.

PJHogan commented 5 years ago

[I hear from others] This is not straightforward, to coerce a WorldWind image layer to refresh itself. And I say “coerce” quite intentionally as WorldWind’s image layer was originally designed around the use case of viewing imagery that never changes. Would be a big help if you would raise this issue at the NASA repo, so that team might provide some guidance. And you could always bring it back wherever needed. https://github.com/NASAWorldWind/WorldWindJava

wcmatthysen commented 5 years ago

@robmilton, maybe this can be tackled in a 2.3.0 release.

wcmatthysen commented 5 years ago

@PJHogan, I saw the recent notice on the WorldWind site. Are the upstream guys going to start development again? Do you have any info on how this might affect us here?