本文整理汇总了Java中com.sothawo.mapjfx.offline.OfflineCache.setActive方法的典型用法代码示例。如果您正苦于以下问题:Java OfflineCache.setActive方法的具体用法?Java OfflineCache.setActive怎么用?Java OfflineCache.setActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sothawo.mapjfx.offline.OfflineCache
的用法示例。
在下文中一共展示了OfflineCache.setActive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMapView
import com.sothawo.mapjfx.offline.OfflineCache; //导入方法依赖的package包/类
/**
* sets up and initializes the map view. the MapView object is stored in a field as it is needed in different places
* of the application.
*/
private void createMapView() {
mapView = new MapView();
mapView.setCustomMapviewCssURL(getClass().getResource("/custom_mapview.css"));
mapView.setBingMapsApiKey(config.getString(CONFIG_BING_MAPS_API_KEY));
mapView.initializedProperty().addListener((observable, oldValue, newValue) -> {
if (newValue) {
logger.trace(I18N.get(I18N.LOG_MAP_INITIALIZED));
mapView.setAnimationDuration(1000);
// show Europe
mapView.setCenter(new Coordinate(46.67959446564012, 5.537109374999998));
mapView.setZoom(5);
}
});
// init MapView-Cache
final OfflineCache offlineCache = mapView.getOfflineCache();
final String cacheDir = System.getProperty("java.io.tmpdir") + "/trakxmap/mapjfx-cache";
logger.info("using dir for cache: " + cacheDir);
try {
Files.createDirectories(Paths.get(cacheDir));
offlineCache.setCacheDirectory(cacheDir);
offlineCache.setActive(true);
} catch (IOException e) {
logger.warn("could not activate offline cache", e);
}
mapView.initialize();
}