diff --git a/vtm-playground/src/org/oscim/test/MapsforgeMultiTest.java b/vtm-playground/src/org/oscim/test/MapsforgeMultiTest.java
deleted file mode 100644
index 886885d5..00000000
--- a/vtm-playground/src/org/oscim/test/MapsforgeMultiTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2016-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
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along with
- * this program. If not, see .
- */
-package org.oscim.test;
-
-import org.oscim.core.MapPosition;
-import org.oscim.core.Tile;
-import org.oscim.gdx.GdxMapApp;
-import org.oscim.layers.tile.buildings.BuildingLayer;
-import org.oscim.layers.tile.vector.VectorTileLayer;
-import org.oscim.layers.tile.vector.labeling.LabelLayer;
-import org.oscim.theme.VtmThemes;
-import org.oscim.tiling.source.mapfile.MapFileTileSource;
-import org.oscim.tiling.source.mapfile.MultiMapFileTileSource;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class MapsforgeMultiTest extends GdxMapApp {
-
- private final List mapFiles;
-
- private MapsforgeMultiTest(List mapFiles) {
- this.mapFiles = mapFiles;
- }
-
- @Override
- public void createLayers() {
- MultiMapFileTileSource tileSource = new MultiMapFileTileSource();
- for (File mapFile : mapFiles) {
- MapFileTileSource mapFileTileSource = new MapFileTileSource();
- mapFileTileSource.setMapFile(mapFile.getAbsolutePath());
- tileSource.add(mapFileTileSource);
- }
- //tileSource.setPreferredLanguage("en");
-
- VectorTileLayer l = mMap.setBaseMap(tileSource);
- mMap.setTheme(VtmThemes.DEFAULT);
-
- mMap.layers().add(new BuildingLayer(mMap, l));
- mMap.layers().add(new LabelLayer(mMap, l));
-
- MapPosition pos = new MapPosition();
- pos.setByBoundingBox(tileSource.getBoundingBox(), Tile.SIZE * 4, Tile.SIZE * 4);
- mMap.setMapPosition(pos);
- }
-
- private static List getMapFiles(String[] args) {
- if (args.length == 0) {
- throw new IllegalArgumentException("missing argument: ");
- }
-
- List result = new ArrayList<>();
- for (String arg : args) {
- File mapFile = new File(arg);
- if (!mapFile.exists()) {
- throw new IllegalArgumentException("file does not exist: " + mapFile);
- } else if (!mapFile.isFile()) {
- throw new IllegalArgumentException("not a file: " + mapFile);
- } else if (!mapFile.canRead()) {
- throw new IllegalArgumentException("cannot read file: " + mapFile);
- }
- result.add(mapFile);
- }
- return result;
- }
-
- public static void main(String[] args) {
- GdxMapApp.init();
- GdxMapApp.run(new MapsforgeMultiTest(getMapFiles(args)));
- }
-}
diff --git a/vtm-playground/src/org/oscim/test/MapsforgePoi3DTest.java b/vtm-playground/src/org/oscim/test/MapsforgePoi3DTest.java
index de6352e0..9b8bc992 100644
--- a/vtm-playground/src/org/oscim/test/MapsforgePoi3DTest.java
+++ b/vtm-playground/src/org/oscim/test/MapsforgePoi3DTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 devemux86
+ * Copyright 2018-2019 devemux86
* Copyright 2018 Gustl22
*
* This program is free software: you can redistribute it and/or modify it under the
@@ -18,15 +18,16 @@ package org.oscim.test;
import org.oscim.gdx.GdxMapApp;
import java.io.File;
+import java.util.List;
public class MapsforgePoi3DTest extends MapsforgeTest {
- private MapsforgePoi3DTest(File mapFile) {
- super(mapFile, false, true);
+ private MapsforgePoi3DTest(List mapFiles) {
+ super(mapFiles, false, true);
}
public static void main(String[] args) {
GdxMapApp.init();
- GdxMapApp.run(new MapsforgePoi3DTest(getMapFile(args)));
+ GdxMapApp.run(new MapsforgePoi3DTest(getMapFiles(args)));
}
}
diff --git a/vtm-playground/src/org/oscim/test/MapsforgeS3DBTest.java b/vtm-playground/src/org/oscim/test/MapsforgeS3DBTest.java
index 32be3f3b..685c89a4 100644
--- a/vtm-playground/src/org/oscim/test/MapsforgeS3DBTest.java
+++ b/vtm-playground/src/org/oscim/test/MapsforgeS3DBTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 devemux86
+ * Copyright 2018-2019 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
@@ -17,15 +17,16 @@ package org.oscim.test;
import org.oscim.gdx.GdxMapApp;
import java.io.File;
+import java.util.List;
public class MapsforgeS3DBTest extends MapsforgeTest {
- private MapsforgeS3DBTest(File mapFile) {
- super(mapFile, true, false);
+ private MapsforgeS3DBTest(List mapFiles) {
+ super(mapFiles, true, false);
}
public static void main(String[] args) {
GdxMapApp.init();
- GdxMapApp.run(new MapsforgeS3DBTest(getMapFile(args)));
+ GdxMapApp.run(new MapsforgeS3DBTest(getMapFiles(args)));
}
}
diff --git a/vtm-playground/src/org/oscim/test/MapsforgeStyleTest.java b/vtm-playground/src/org/oscim/test/MapsforgeStyleTest.java
index 7ffb5752..af7f72e3 100644
--- a/vtm-playground/src/org/oscim/test/MapsforgeStyleTest.java
+++ b/vtm-playground/src/org/oscim/test/MapsforgeStyleTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2017 devemux86
+ * Copyright 2016-2019 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,16 +22,17 @@ import org.oscim.theme.XmlRenderThemeStyleLayer;
import org.oscim.theme.XmlRenderThemeStyleMenu;
import java.io.File;
+import java.util.List;
import java.util.Set;
public class MapsforgeStyleTest extends MapsforgeTest {
- private MapsforgeStyleTest(File mapFile) {
- super(mapFile);
+ private MapsforgeStyleTest(List mapFiles) {
+ super(mapFiles);
}
@Override
- protected void loadTheme(final String styleId) {
+ void loadTheme(final String styleId) {
mMap.setTheme(new StreamRenderTheme("", getClass().getResourceAsStream("/assets/vtm/stylemenu.xml"), new XmlRenderThemeMenuCallback() {
@Override
public Set getCategories(XmlRenderThemeStyleMenu renderThemeStyleMenu) {
@@ -79,6 +80,6 @@ public class MapsforgeStyleTest extends MapsforgeTest {
public static void main(String[] args) {
GdxMapApp.init();
- GdxMapApp.run(new MapsforgeStyleTest(getMapFile(args)));
+ GdxMapApp.run(new MapsforgeStyleTest(getMapFiles(args)));
}
}
diff --git a/vtm-playground/src/org/oscim/test/MapsforgeTest.java b/vtm-playground/src/org/oscim/test/MapsforgeTest.java
index 4b9f8acc..de423dbd 100644
--- a/vtm-playground/src/org/oscim/test/MapsforgeTest.java
+++ b/vtm-playground/src/org/oscim/test/MapsforgeTest.java
@@ -17,6 +17,7 @@
*/
package org.oscim.test;
+import org.oscim.core.BoundingBox;
import org.oscim.core.MapPosition;
import org.oscim.core.Tile;
import org.oscim.event.Event;
@@ -33,33 +34,39 @@ import org.oscim.renderer.GLViewport;
import org.oscim.scalebar.*;
import org.oscim.theme.VtmThemes;
import org.oscim.tiling.source.mapfile.MapFileTileSource;
-import org.oscim.tiling.source.mapfile.MapInfo;
+import org.oscim.tiling.source.mapfile.MultiMapFileTileSource;
import java.io.File;
+import java.util.ArrayList;
import java.util.Calendar;
+import java.util.List;
public class MapsforgeTest extends GdxMapApp {
private static final boolean SHADOWS = false;
- private File mapFile;
- private boolean poi3d;
- private boolean s3db;
+ private final List mapFiles;
+ private final boolean poi3d;
+ private final boolean s3db;
- MapsforgeTest(File mapFile) {
- this(mapFile, false, false);
+ MapsforgeTest(List mapFiles) {
+ this(mapFiles, false, false);
}
- MapsforgeTest(File mapFile, boolean s3db, boolean poi3d) {
- this.mapFile = mapFile;
+ MapsforgeTest(List mapFiles, boolean s3db, boolean poi3d) {
+ this.mapFiles = mapFiles;
this.s3db = s3db;
this.poi3d = poi3d;
}
@Override
public void createLayers() {
- MapFileTileSource tileSource = new MapFileTileSource();
- tileSource.setMapFile(mapFile.getAbsolutePath());
+ MultiMapFileTileSource tileSource = new MultiMapFileTileSource();
+ for (File mapFile : mapFiles) {
+ MapFileTileSource mapFileTileSource = new MapFileTileSource();
+ mapFileTileSource.setMapFile(mapFile.getAbsolutePath());
+ tileSource.add(mapFileTileSource);
+ }
//tileSource.setPreferredLanguage("en");
VectorTileLayer l = mMap.setBaseMap(tileSource);
@@ -86,10 +93,10 @@ public class MapsforgeTest extends GdxMapApp {
mMap.layers().add(mapScaleBarLayer);
MapPosition pos = MapPreferences.getMapPosition();
- MapInfo info = tileSource.getMapInfo();
- if (pos == null || !info.boundingBox.contains(pos.getGeoPoint())) {
+ BoundingBox bbox = tileSource.getBoundingBox();
+ if (pos == null || !bbox.contains(pos.getGeoPoint())) {
pos = new MapPosition();
- pos.setByBoundingBox(info.boundingBox, Tile.SIZE * 4, Tile.SIZE * 4);
+ pos.setByBoundingBox(bbox, Tile.SIZE * 4, Tile.SIZE * 4);
}
mMap.setMapPosition(pos);
@@ -123,28 +130,32 @@ public class MapsforgeTest extends GdxMapApp {
super.dispose();
}
- static File getMapFile(String[] args) {
+ static List getMapFiles(String[] args) {
if (args.length == 0) {
throw new IllegalArgumentException("missing argument: ");
}
- File file = new File(args[0]);
- if (!file.exists()) {
- throw new IllegalArgumentException("file does not exist: " + file);
- } else if (!file.isFile()) {
- throw new IllegalArgumentException("not a file: " + file);
- } else if (!file.canRead()) {
- throw new IllegalArgumentException("cannot read file: " + file);
+ List result = new ArrayList<>();
+ for (String arg : args) {
+ File mapFile = new File(arg);
+ if (!mapFile.exists()) {
+ throw new IllegalArgumentException("file does not exist: " + mapFile);
+ } else if (!mapFile.isFile()) {
+ throw new IllegalArgumentException("not a file: " + mapFile);
+ } else if (!mapFile.canRead()) {
+ throw new IllegalArgumentException("cannot read file: " + mapFile);
+ }
+ result.add(mapFile);
}
- return file;
+ return result;
}
- protected void loadTheme(final String styleId) {
+ void loadTheme(final String styleId) {
mMap.setTheme(VtmThemes.DEFAULT);
}
public static void main(String[] args) {
GdxMapApp.init();
- GdxMapApp.run(new MapsforgeTest(getMapFile(args)));
+ GdxMapApp.run(new MapsforgeTest(getMapFiles(args)));
}
}