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

Feature suggestion: tiles loading/downloading finished notification #82

Open
fredkp opened this issue Jan 17, 2020 · 6 comments
Open

Feature suggestion: tiles loading/downloading finished notification #82

fredkp opened this issue Jan 17, 2020 · 6 comments

Comments

@fredkp
Copy link

fredkp commented Jan 17, 2020

It would be very useful to have a notification when tiles cache loading/downloading is finished (with error status).

@kkieffer
Copy link
Contributor

Did you have a look at:

factory.addTileListener(new TileListener() {

       @Override
      public void tileLoaded(Tile tile) {
                   //...do something here
      }
});

@fredkp
Copy link
Author

fredkp commented Jan 17, 2020 via email

@kkieffer
Copy link
Contributor

What about getPendingTiles() in AbstractTileFactory?

@fredkp
Copy link
Author

fredkp commented Jan 18, 2020 via email

@msteiger
Copy link
Owner

Valid request, I will see what can be done here.

@qqilihq
Copy link

qqilihq commented Nov 10, 2022

I came across this ticket as I had the same challenge, and I used a combination of the TileListener and overwriting the startLoading function in the DefaultTileFactory. Something like this:

AtomicInteger numLoadingTiles = new AtomicInteger(0);

DefaultTileFactory tileFactory = new DefaultTileFactory(nodeSettings.getTileFactoryInfo()) {
  @Override
  protected synchronized void startLoading(Tile tile) {
    numLoadingTiles.incrementAndGet();
    super.startLoading(tile);
  }
};

tileFactory.addTileListener(tile -> numLoadingTiles.decrementAndGet());

This seems to work fine for us -- the counter gets incremented when loading starts, and decremented once the loading has finished.

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

No branches or pull requests

4 participants