diff --git a/vtm-android-example/AndroidManifest.xml b/vtm-android-example/AndroidManifest.xml
index 3b860301..32a63d47 100644
--- a/vtm-android-example/AndroidManifest.xml
+++ b/vtm-android-example/AndroidManifest.xml
@@ -35,9 +35,6 @@
-
diff --git a/vtm-android-example/src/org/oscim/android/test/AtlasThemeMapActivity.java b/vtm-android-example/src/org/oscim/android/test/AtlasThemeMapActivity.java
index 8391f94e..6f9e794d 100644
--- a/vtm-android-example/src/org/oscim/android/test/AtlasThemeMapActivity.java
+++ b/vtm-android-example/src/org/oscim/android/test/AtlasThemeMapActivity.java
@@ -15,159 +15,22 @@
*/
package org.oscim.android.test;
-import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
-import android.view.MenuItem;
-import org.oscim.android.filepicker.FilePicker;
-import org.oscim.android.filepicker.FilterByFileExtension;
-import org.oscim.android.filepicker.ValidMapFile;
-import org.oscim.core.MapPosition;
-import org.oscim.core.Tile;
-import org.oscim.layers.TileGridLayer;
-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.renderer.BitmapRenderer;
-import org.oscim.renderer.GLViewport;
-import org.oscim.scalebar.DefaultMapScaleBar;
-import org.oscim.scalebar.ImperialUnitAdapter;
-import org.oscim.scalebar.MapScaleBar;
-import org.oscim.scalebar.MapScaleBarLayer;
-import org.oscim.scalebar.MetricUnitAdapter;
import org.oscim.theme.ThemeLoader;
-import org.oscim.theme.VtmThemes;
-import org.oscim.tiling.source.mapfile.MapFileTileSource;
-import org.oscim.tiling.source.mapfile.MapInfo;
-public class AtlasThemeMapActivity extends MapActivity {
- private static final int SELECT_MAP_FILE = 0;
-
- private TileGridLayer mGridLayer;
- private DefaultMapScaleBar mMapScaleBar;
+public class AtlasThemeMapActivity extends SimpleMapActivity {
@Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- // set flag to use TextureAtlas for Theme-Symbol's!
+ public void onCreate(Bundle savedInstanceState) {
ThemeLoader.USE_ATLAS = true;
- startActivityForResult(new Intent(this, MapFilePicker.class),
- SELECT_MAP_FILE);
- }
-
- @Override
- protected void onDestroy() {
- mMapScaleBar.destroy();
-
- super.onDestroy();
- }
-
- public static class MapFilePicker extends FilePicker {
- public MapFilePicker() {
- setFileDisplayFilter(new FilterByFileExtension(".map"));
- setFileSelectFilter(new ValidMapFile());
- }
+ super.onCreate(savedInstanceState);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.theme_menu, menu);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
-
- switch (item.getItemId()) {
- case R.id.theme_default:
- mMap.setTheme(VtmThemes.DEFAULT);
- item.setChecked(true);
- return true;
-
- case R.id.theme_osmarender:
- mMap.setTheme(VtmThemes.OSMARENDER);
- item.setChecked(true);
- return true;
-
- case R.id.theme_osmagray:
- mMap.setTheme(VtmThemes.OSMAGRAY);
- item.setChecked(true);
- return true;
-
- case R.id.theme_tubes:
- mMap.setTheme(VtmThemes.TRONRENDER);
- item.setChecked(true);
- return true;
-
- case R.id.theme_newtron:
- mMap.setTheme(VtmThemes.NEWTRON);
- item.setChecked(true);
- return true;
-
- case R.id.gridlayer:
- if (item.isChecked()) {
- item.setChecked(false);
- mMap.layers().remove(mGridLayer);
- } else {
- item.setChecked(true);
- if (mGridLayer == null)
- mGridLayer = new TileGridLayer(mMap, getResources().getDisplayMetrics().density);
-
- mMap.layers().add(mGridLayer);
- }
- mMap.updateMap(true);
- return true;
- }
-
return false;
}
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
-
- if (requestCode == SELECT_MAP_FILE) {
- if (resultCode != RESULT_OK || intent == null || intent.getStringExtra(FilePicker.SELECTED_FILE) == null) {
- finish();
- return;
- }
-
- MapFileTileSource tileSource = new MapFileTileSource();
- tileSource.setPreferredLanguage("en");
- String file = intent.getStringExtra(FilePicker.SELECTED_FILE);
- if (tileSource.setMapFile(file)) {
-
- VectorTileLayer l = mMap.setBaseMap(tileSource);
- loadTheme(null);
-
- mMap.layers().add(new BuildingLayer(mMap, l));
- mMap.layers().add(new LabelLayer(mMap, l));
-
- mMapScaleBar = new DefaultMapScaleBar(mMap);
- mMapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
- mMapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
- mMapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
- mMapScaleBar.setScaleBarPosition(MapScaleBar.ScaleBarPosition.BOTTOM_LEFT);
-
- MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mMapScaleBar);
- BitmapRenderer renderer = mapScaleBarLayer.getRenderer();
- renderer.setPosition(GLViewport.Position.BOTTOM_LEFT);
- renderer.setOffset(5 * getResources().getDisplayMetrics().density, 0);
- mMap.layers().add(mapScaleBarLayer);
-
- MapInfo info = tileSource.getMapInfo();
- MapPosition pos = new MapPosition();
- pos.setByBoundingBox(info.boundingBox, Tile.SIZE * 4, Tile.SIZE * 4);
- mMap.setMapPosition(pos);
-
- mPrefs.clear();
- }
- }
- }
-
- protected void loadTheme(final String styleId) {
- mMap.setTheme(VtmThemes.DEFAULT);
- }
}
diff --git a/vtm-playground/src/org/oscim/test/AtlasThemeMapTest.java b/vtm-playground/src/org/oscim/test/AtlasThemeMapTest.java
new file mode 100644
index 00000000..3e5597cf
--- /dev/null
+++ b/vtm-playground/src/org/oscim/test/AtlasThemeMapTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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
+ * 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.gdx.GdxMapApp;
+import org.oscim.theme.ThemeLoader;
+
+public class AtlasThemeMapTest extends MapTest {
+
+ private AtlasThemeMapTest() {
+ ThemeLoader.USE_ATLAS = true;
+ }
+
+ public static void main(String[] args) {
+ GdxMapApp.init();
+ GdxMapApp.run(new AtlasThemeMapTest());
+ }
+}
diff --git a/vtm-playground/src/org/oscim/test/AtlasThemeTest.java b/vtm-playground/src/org/oscim/test/AtlasThemeTest.java
deleted file mode 100644
index 70ad0200..00000000
--- a/vtm-playground/src/org/oscim/test/AtlasThemeTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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
- * 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.gdx.GdxMapApp;
-import org.oscim.layers.GroupLayer;
-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.map.Map;
-import org.oscim.renderer.BitmapRenderer;
-import org.oscim.renderer.GLViewport;
-import org.oscim.scalebar.DefaultMapScaleBar;
-import org.oscim.scalebar.ImperialUnitAdapter;
-import org.oscim.scalebar.MapScaleBar;
-import org.oscim.scalebar.MapScaleBarLayer;
-import org.oscim.scalebar.MetricUnitAdapter;
-import org.oscim.theme.ThemeLoader;
-import org.oscim.theme.VtmThemes;
-import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
-
-public class AtlasThemeTest extends GdxMapApp {
-
- public AtlasThemeTest() {
- // set flag to use TextureAtlas for Theme symbols
- ThemeLoader.USE_ATLAS = true;
- }
-
- @Override
- public void createLayers() {
- Map map = getMap();
-
- VectorTileLayer l = map.setBaseMap(new OSciMap4TileSource());
-
- GroupLayer groupLayer = new GroupLayer(mMap);
- groupLayer.layers.add(new BuildingLayer(map, l));
- groupLayer.layers.add(new LabelLayer(map, l));
- map.layers().add(groupLayer);
-
- DefaultMapScaleBar mapScaleBar = new DefaultMapScaleBar(mMap);
- mapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
- mapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
- mapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
- mapScaleBar.setScaleBarPosition(MapScaleBar.ScaleBarPosition.BOTTOM_LEFT);
-
- MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mapScaleBar);
- BitmapRenderer renderer = mapScaleBarLayer.getRenderer();
- renderer.setPosition(GLViewport.Position.BOTTOM_LEFT);
- renderer.setOffset(5, 0);
- map.layers().add(mapScaleBarLayer);
-
- map.setTheme(VtmThemes.DEFAULT);
- map.setMapPosition(53.075, 8.808, 1 << 17);
- }
-
- public static void main(String[] args) {
- GdxMapApp.init();
- GdxMapApp.run(new AtlasThemeTest());
- }
-}
diff --git a/vtm/src/org/oscim/backend/CanvasAdapter.java b/vtm/src/org/oscim/backend/CanvasAdapter.java
index e19e6f84..cb737224 100644
--- a/vtm/src/org/oscim/backend/CanvasAdapter.java
+++ b/vtm/src/org/oscim/backend/CanvasAdapter.java
@@ -1,6 +1,6 @@
/*
* Copyright 2013 Hannes Janetzek
- * Copyright 2016 devemux86
+ * Copyright 2016-2017 devemux86
* Copyright 2017 Longri
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
@@ -186,10 +186,10 @@ public abstract class CanvasAdapter {
}
private static InputStream inputStreamFromFile(String relativePathPrefix, String src) throws IOException {
- File file = getFile(relativePathPrefix, src);
+ File file = getAbsoluteFile(relativePathPrefix, src);
if (!file.exists()) {
if (src.length() > 0 && src.charAt(0) == File.separatorChar) {
- file = getFile(relativePathPrefix, src.substring(1));
+ file = getAbsoluteFile(relativePathPrefix, src.substring(1));
}
if (!file.exists()) {
file = null;
@@ -203,7 +203,7 @@ public abstract class CanvasAdapter {
return null;
}
- private static File getFile(String parentPath, String pathName) {
+ public static File getAbsoluteFile(String parentPath, String pathName) {
if (pathName.charAt(0) == File.separatorChar) {
return new File(pathName);
}
diff --git a/vtm/src/org/oscim/theme/XmlAtlasThemeBuilder.java b/vtm/src/org/oscim/theme/XmlAtlasThemeBuilder.java
index e443622e..a32b5b33 100644
--- a/vtm/src/org/oscim/theme/XmlAtlasThemeBuilder.java
+++ b/vtm/src/org/oscim/theme/XmlAtlasThemeBuilder.java
@@ -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
@@ -20,42 +21,36 @@ import org.oscim.backend.XMLReaderAdapter;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.renderer.atlas.TextureAtlas;
import org.oscim.renderer.atlas.TextureRegion;
+import org.oscim.theme.IRenderTheme.ThemeException;
import org.oscim.theme.rule.Rule;
import org.oscim.theme.styles.RenderStyle;
import org.oscim.theme.styles.SymbolStyle;
+import org.oscim.theme.styles.SymbolStyle.SymbolBuilder;
import org.oscim.utils.TextureAtlasUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xml.sax.Attributes;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
public class XmlAtlasThemeBuilder extends XmlThemeBuilder {
- private static final Logger log = LoggerFactory.getLogger(XmlAtlasThemeBuilder.class);
-
- private final Map