vtm-theme-comparator improvements #387
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2017 Longri
|
||||
* Copyright 2017 devemux86
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
@@ -85,7 +86,7 @@ public class Main {
|
||||
|
||||
new SharedLibraryLoader().load("vtm-jni");
|
||||
AwtGraphics.init();
|
||||
GdxAssets.init("");
|
||||
GdxAssets.init("assets/");
|
||||
GLAdapter.init(new LwjglGL20());
|
||||
GLAdapter.GDX_DESKTOP_QUIRKS = true;
|
||||
window = new MainWindow();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2017 Longri
|
||||
* Copyright 2017 devemux86
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
@@ -22,9 +23,12 @@ import org.oscim.theme.comparator.vtm.VtmPanel;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JSplitPane;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
class MainWindow extends JFrame {
|
||||
|
||||
@@ -78,6 +82,16 @@ class MainWindow extends JFrame {
|
||||
splitPane.setResizeWeight(0.5);
|
||||
|
||||
this.add(splitPane);
|
||||
|
||||
addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
mapsforgeMapPanel.destroy();
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
dispose();
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2017 Longri
|
||||
* Copyright 2017 devemux86
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
@@ -43,6 +44,7 @@ import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.UUID;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
@@ -92,7 +94,7 @@ public class MapsforgeMapPanel extends JPanel {
|
||||
|
||||
private Layer createTileRendererLayer(TileCache tileCache, MapViewPosition mapViewPosition, File mapFile, File themeFile) {
|
||||
|
||||
TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache, new MapFile(mapFile), mapViewPosition, false, true, true, GRAPHIC_FACTORY);
|
||||
TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache, new MapFile(mapFile), mapViewPosition, false, true, false, GRAPHIC_FACTORY);
|
||||
|
||||
if (themeFile != null) {
|
||||
|
||||
@@ -120,11 +122,16 @@ public class MapsforgeMapPanel extends JPanel {
|
||||
|
||||
private TileCache createTileCache() {
|
||||
TileCache firstLevelTileCache = new InMemoryTileCache(64);
|
||||
File cacheDirectory = new File(System.getProperty("java.io.tmpdir"), "mapsforge");
|
||||
File cacheDirectory = new File(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
|
||||
TileCache secondLevelTileCache = new FileSystemTileCache(1024, cacheDirectory, GRAPHIC_FACTORY);
|
||||
return new TwoLevelTileCache(firstLevelTileCache, secondLevelTileCache);
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
mapView.destroyAll();
|
||||
AwtGraphicFactory.clearResourceMemoryCache();
|
||||
}
|
||||
|
||||
public void loadMap(File mapFile, File themeFile) {
|
||||
log.debug("reload MAP:{} THEME:{}", mapFile, themeFile);
|
||||
this.mapFile = mapFile;
|
||||
|
||||
Reference in New Issue
Block a user