Quantcast

Cache problems with jxmapviewer2 in NetBeans Platform

Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Cache problems with jxmapviewer2 in NetBeans Platform

Patrik Karlsson
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

and I have sucessfully added caching to MapKit in Sample6

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
Loading...