Cache problems with jxmapviewer2 in NetBeans Platform
Patrik Karlsson <[email protected]> Mon, 15 May 2017 13:06:41 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <CANiFHSHXGpkvRwkMV3xQNUJ4cQT=+xr4BuNbHJmVhUhaUbnLOg@mail.gmail.com> |
Hi,
I'm building a platform application using jxmapviewer2
https://github.com/msteiger/jxmapviewer2 and can't get the caching to work.
The map renders just fine but the tiles are not cached.
Caching works in the example
https://github.com/msteiger/jxmapviewer2/blob/master/examples/src/sample3_interaction/Sample3.java
and I have sucessfully added caching to MapKit in Sample6
https://github.com/msteiger/jxmapviewer2/blob/master/examples/src/sample6_mapkit/Sample6.java
However, it fails when I try to do it in NB 8.2 platform using Windows 7
and Java 8u131.
The cache directory gets created but is always empty.
Could this be related to the platform and the usage of
java.net.ResponseCache?
I have created the following repo
https://github.com/trixon/netbeans-jxmapviewer2.git
The map related code is in https://github.com/trixon/netbeans-
jxmapviewer2/blob/master/maptest/src/main/java/se/trixon/jxmapviewer2/maptest/MapKitTopComponent.java
private void init() {
setLayout(new java.awt.GridLayout());
final JXMapKit jXMapKit = new JXMapKit();
TileFactoryInfo info = new OSMTileFactoryInfo();
DefaultTileFactory tileFactory = new DefaultTileFactory(info);
// Setup local file cache
File cacheDir = new File(System.getProperty("user.home") +
File.separator + ".jxmapviewer2");
LocalResponseCache.installResponseCache(info.getBaseURL(),
cacheDir, false);
jXMapKit.setTileFactory(tileFactory);
jXMapKit.setZoom(16);
add(jXMapKit);
}
/Patrik