本文整理汇总了Java中com.sothawo.mapjfx.offline.OfflineCache类的典型用法代码示例。如果您正苦于以下问题:Java OfflineCache类的具体用法?Java OfflineCache怎么用?Java OfflineCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OfflineCache类属于com.sothawo.mapjfx.offline包,在下文中一共展示了OfflineCache类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: getOfflineCache
import com.sothawo.mapjfx.offline.OfflineCache; //导入依赖的package包/类
public OfflineCache getOfflineCache() {
return offlineCache;
}