Closed GoogleCodeExporter closed 8 years ago
A MapView.invalidate() call would repaint the screen, but it would be nice if
happened automatically and we didn't require the user to know they have to call
invalidate.
Original comment by kurtzm...@gmail.com
on 5 Jan 2011 at 3:30
I tried that but it doesn't work because the old tiles are still in the memory
cache so it just draws them again.
What's needed is a way to clear the memory cache, but I couldn't see how to get
there from the point where you're setting the style. That's why I made this
issue to try again later.
Original comment by neilboyd
on 5 Jan 2011 at 4:26
Yes - you are right! I had to do the same when calling setRenderer(). Maybe
it's as simple as adding a clearCache() method to MapTileProviderBase, or maybe
there is a more elegant solution.
Original comment by kurtzm...@gmail.com
on 6 Jan 2011 at 1:52
Also related to issue 111
Original comment by kurtzm...@gmail.com
on 12 Jan 2011 at 5:21
Neil,
This can be accomplished by calling MapView.getTileProvider().clearTileCache()
- I see that a MapView reference is not available (rightly so) in the tile
source. So I can see a few recommended approaches -
* Calling clearTileCache() manually from wherever you call setStyle()
* Calling setStyle() first on the tile source, and then re-passing the tile
source in a call to MapView.setTileSource()
Obviously both require an extra call, and don't come "for free" by just calling
setStyle, but I don't know if there is a way around that. By adding an example
of doing this in the OpenStreetMapViewer activity or one of the samples, that
should be enough for a user to get the idea. Personally, I like the second
method (set the tile style, and then re-call setTileSource) of implementing
this functionality.
Original comment by kurtzm...@gmail.com
on 21 Jan 2011 at 1:51
[deleted comment]
That doesn't really work for me either because I'm using IMapView, not MapView
directly. I would need to keep a reference to the actual MapView or the
ITileSource in order to do that. However, despite that, I think the first
solution would be better because it does less - something like this:
ITileProvider tileProvider = mapView.getTileProvider();
IStyledTileSource<Integer> styledTileSource = (IStyledTileSource<Integer>)
mTileProvider.getTileSource();
styledTileSource.setStyle(style);
tileProvider.clearTileCache();
If this is documented in the IStyledTileSource.styledTileSource javadoc then I
think that's enough to close this issue.
Original comment by neilboyd
on 21 Jan 2011 at 10:49
This has been documented and we can close this ticket.
Original comment by kurtzm...@gmail.com
on 27 Feb 2011 at 5:26
Original issue reported on code.google.com by
neilboyd
on 5 Jan 2011 at 8:57