diff --git a/settings.gradle b/settings.gradle index 09d5f4c6..4f439899 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,3 +7,4 @@ include ':vtm-gdx-desktop' include ':vtm-gdx-html' include ':vtm-gdx-android' include ':vtm-android-app' +include ':vtm-themes' diff --git a/vtm-android-app b/vtm-android-app index da1e3b8a..2fc23ee2 160000 --- a/vtm-android-app +++ b/vtm-android-app @@ -1 +1 @@ -Subproject commit da1e3b8aa8c523e5e374d8e7329def769edb3c0a +Subproject commit 2fc23ee26b0eb99e13fba3c65177c761f3b6cdf1 diff --git a/vtm-android-example/build.gradle b/vtm-android-example/build.gradle index 67e58dcf..d01fa468 100644 --- a/vtm-android-example/build.gradle +++ b/vtm-android-example/build.gradle @@ -10,18 +10,19 @@ buildscript { apply plugin: 'android' dependencies { + //compile fileTree(dir: 'libs', include: '*.jar') compile project(':vtm-android') - compile fileTree(dir: 'libs', include: '*.jar') + compile project(':vtm-themes') } -task copyAssets(type: Copy) { - from "$rootDir/vtm/assets" - into "assets" - include '**/*' -} +// task copyAssets(type: Copy) { +// from "$rootDir/vtm/assets" +// into "assets" +// include '**/*' +// } -tasks.withType(JavaCompile) { compileTask -> - compileTask.dependsOn copyAssets } +// tasks.withType(JavaCompile) { compileTask -> +// compileTask.dependsOn copyAssets } android { compileSdkVersion 19 @@ -60,12 +61,12 @@ eclipse.classpath { // Manipulation of the classpath XML before merging local // and generated copies - beforeMerged { classpath -> - // Remove all source entries to avoid overlap - classpath.entries.removeAll() { c -> - c.kind == 'src' - } - } + // beforeMerged { classpath -> + // // Remove all source entries to avoid overlap + // classpath.entries.removeAll() { c -> + // c.kind == 'src' + // } + // } // Direct manipulation of the generated classpath XML withXml { @@ -82,14 +83,13 @@ eclipse.classpath { } eclipse.project { - natures = ['com.android.ide.eclipse.adt.AndroidNature', + natures = ['com.android.ide.eclipse.adt.AndroidNature', 'org.eclipse.jdt.core.javanature'] buildCommand 'com.android.ide.eclipse.adt.ResourceManagerBuilder' buildCommand 'com.android.ide.eclipse.adt.PreCompilerBuilder' buildCommand 'com.android.ide.eclipse.adt.ApkBuilder' - linkedResource name: 'assets', type: '2', - locationUri: 'PARENT-1-PROJECT_LOC/vtm/assets' + linkedResource name: 'assets', type: '2', + locationUri: 'PARENT-1-PROJECT_LOC/vtm-themes/resources/assets' } - diff --git a/vtm-android-example/src/org/oscim/android/test/MapsforgeMapActivity.java b/vtm-android-example/src/org/oscim/android/test/MapsforgeMapActivity.java index 2c805ea4..71d8ed66 100644 --- a/vtm-android-example/src/org/oscim/android/test/MapsforgeMapActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/MapsforgeMapActivity.java @@ -23,7 +23,7 @@ import org.oscim.core.MapPosition; import org.oscim.core.Tile; import org.oscim.layers.tile.vector.VectorTileLayer; import org.oscim.layers.tile.vector.labeling.LabelLayer; -import org.oscim.theme.InternalRenderTheme; +import org.oscim.theme.VtmThemes; import org.oscim.tiling.source.mapfile.MapFileTileSource; import org.oscim.tiling.source.mapfile.MapInfo; @@ -68,17 +68,17 @@ public class MapsforgeMapActivity extends MapActivity { switch (item.getItemId()) { case R.id.theme_default: - mMap.setTheme(InternalRenderTheme.DEFAULT); + mMap.setTheme(VtmThemes.DEFAULT); item.setChecked(true); return true; case R.id.theme_tubes: - mMap.setTheme(InternalRenderTheme.TRONRENDER); + mMap.setTheme(VtmThemes.TRONRENDER); item.setChecked(true); return true; case R.id.theme_osmarender: - mMap.setTheme(InternalRenderTheme.OSMARENDER); + mMap.setTheme(VtmThemes.OSMARENDER); item.setChecked(true); return true; } @@ -100,17 +100,17 @@ public class MapsforgeMapActivity extends MapActivity { if (mTileSource.setMapFile(file)) { VectorTileLayer l = mMap.setBaseMap(mTileSource); - mMap.setTheme(InternalRenderTheme.DEFAULT); + mMap.setTheme(VtmThemes.DEFAULT); mMap.layers().add(new LabelLayer(mMap, l)); MapInfo info = mTileSource.getMapInfo(); if (info.boundingBox != null) { MapPosition pos = new MapPosition(); pos.setByBoundingBox(info.boundingBox, - Tile.SIZE * 4, - Tile.SIZE * 4); + Tile.SIZE * 4, + Tile.SIZE * 4); mMap.setMapPosition(pos); - Samples.log.debug("set position {}",pos); + Samples.log.debug("set position {}", pos); } else if (info.mapCenter != null) { double scale = 1 << 8; diff --git a/vtm-android-example/src/org/oscim/android/test/SimpleMapActivity.java b/vtm-android-example/src/org/oscim/android/test/SimpleMapActivity.java index 2c6853b3..b1e53520 100644 --- a/vtm-android-example/src/org/oscim/android/test/SimpleMapActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/SimpleMapActivity.java @@ -18,7 +18,7 @@ import org.oscim.layers.tile.vector.BuildingLayer; import org.oscim.layers.tile.vector.labeling.LabelLayer; import org.oscim.map.Layers; -import org.oscim.theme.InternalRenderTheme; +import org.oscim.theme.VtmThemes; import android.os.Bundle; import android.view.Menu; @@ -36,9 +36,10 @@ public class SimpleMapActivity extends BaseMapActivity { //layers.add(new TileGridLayer(mMap)); - mMap.setTheme(InternalRenderTheme.DEFAULT); - //mMap.setTheme(InternalRenderTheme.TRONRENDER); - //mMap.setTheme(InternalRenderTheme.OSMARENDER); + mMap.setTheme(VtmThemes.DEFAULT); + //mMap.setTheme(VtmThemes.TRONRENDER); + //mMap.setTheme(VtmThemes.TRON2); + //mMap.setTheme(VtmThemes.OSMARENDER); mMap.setMapPosition(53.08, 8.83, Math.pow(2, 10)); } @@ -54,17 +55,17 @@ public class SimpleMapActivity extends BaseMapActivity { switch (item.getItemId()) { case R.id.theme_default: - mMap.setTheme(InternalRenderTheme.DEFAULT); + mMap.setTheme(VtmThemes.DEFAULT); item.setChecked(true); return true; case R.id.theme_tubes: - mMap.setTheme(InternalRenderTheme.TRONRENDER); + mMap.setTheme(VtmThemes.TRONRENDER); item.setChecked(true); return true; case R.id.theme_osmarender: - mMap.setTheme(InternalRenderTheme.OSMARENDER); + mMap.setTheme(VtmThemes.OSMARENDER); item.setChecked(true); return true; } @@ -77,18 +78,18 @@ public class SimpleMapActivity extends BaseMapActivity { mMapView.postDelayed(new Runnable() { @Override public void run() { - InternalRenderTheme t; + VtmThemes t; if (i == 0) - t = InternalRenderTheme.DEFAULT; + t = VtmThemes.DEFAULT; else if (i == 1) - t = InternalRenderTheme.TRONRENDER; + t = VtmThemes.TRONRENDER; else - t = InternalRenderTheme.OSMARENDER; + t = VtmThemes.OSMARENDER; mMapView.getMap().setTheme(t); loooop((i + 1) % 3); } - }, 300 + (int)(Math.random() * 200)); + }, 300 + (int) (Math.random() * 200)); } } diff --git a/vtm-ext-libs b/vtm-ext-libs index cc278b23..416f8e79 160000 --- a/vtm-ext-libs +++ b/vtm-ext-libs @@ -1 +1 @@ -Subproject commit cc278b239cea8bfc16f1915fb23f5e3ad93b2c7a +Subproject commit 416f8e79e2128394575d3b302d5178cb56fd1d25 diff --git a/vtm-gdx-android/build.gradle b/vtm-gdx-android/build.gradle index effa3abc..83be1cc1 100644 --- a/vtm-gdx-android/build.gradle +++ b/vtm-gdx-android/build.gradle @@ -9,20 +9,25 @@ buildscript { apply plugin: 'android' +ext.gdxVersion = "1.0-SNAPSHOT" + dependencies { compile project(':vtm-gdx') + compile project(':vtm-themes') compile files('../vtm-ext-libs/gdx/gdx-backend-android.jar') - compile fileTree(dir: 'libs', include: '*.jar') + //natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi" + //natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a" + //compile fileTree(dir: 'libs', include: '*.jar') } -task copyAssets(type: Copy) { - from "$rootDir/vtm/assets" - into "assets" - include '**/*' -} +// task copyAssets(type: Copy) { +// from "$rootDir/vtm/assets" +// into "assets" +// include '**/*' +// } -tasks.withType(JavaCompile) { compileTask -> - compileTask.dependsOn copyAssets } +// tasks.withType(JavaCompile) { compileTask -> +// compileTask.dependsOn copyAssets } android { compileSdkVersion 19 @@ -83,14 +88,14 @@ eclipse.classpath { } eclipse.project { - natures = ['com.android.ide.eclipse.adt.AndroidNature', + natures = ['com.android.ide.eclipse.adt.AndroidNature', 'org.eclipse.jdt.core.javanature'] buildCommand 'com.android.ide.eclipse.adt.ResourceManagerBuilder' buildCommand 'com.android.ide.eclipse.adt.PreCompilerBuilder' buildCommand 'com.android.ide.eclipse.adt.ApkBuilder' - linkedResource name: 'assets', type: '2', + linkedResource name: 'assets', type: '2', locationUri: 'PARENT-1-PROJECT_LOC/vtm/assets' // use extracted jni .so in eclipse diff --git a/vtm-gdx-desktop/build.gradle b/vtm-gdx-desktop/build.gradle index 94325074..f3f25f2b 100644 --- a/vtm-gdx-desktop/build.gradle +++ b/vtm-gdx-desktop/build.gradle @@ -5,14 +5,14 @@ apply plugin: 'application' mainClassName = 'org.oscim.gdx.GdxMapApp' -task copyAssets(type: Copy) { - from "$rootDir/vtm/assets" - into "assets" - include '**/*' -} +// task copyAssets(type: Copy) { +// from "$rootDir/vtm/assets" +// into "assets" +// include '**/*' +// } -tasks.withType(JavaCompile) { compileTask -> - compileTask.dependsOn copyAssets } +// tasks.withType(JavaCompile) { compileTask -> +// compileTask.dependsOn copyAssets } sourceSets { main.java.srcDirs = ['src'] @@ -25,15 +25,15 @@ run { ignoreExitValue = true } dependencies { compile project(':vtm-gdx') + compile project(':vtm-themes') compile files('../vtm-ext-libs/gdx/gdx-backend-lwjgl.jar') compile files('../vtm-ext-libs/gdx/gdx-backend-lwjgl-natives.jar') compile files('../vtm-ext-libs/gdx/gdx-natives.jar') compile files('../vtm-ext-libs/gdx/vtm-jni-natives.jar') - //compile 'org.slf4j:slf4j-api:1.7.5' compile 'org.slf4j:slf4j-simple:1.7.5' } eclipse.project { linkedResource name: 'assets', type: '2', - locationUri: 'PARENT-1-PROJECT_LOC/vtm/assets' + locationUri: 'PARENT-1-PROJECT_LOC/vtm-themes/resources/assets' } \ No newline at end of file diff --git a/vtm-gdx/build.gradle b/vtm-gdx/build.gradle index 00722a5f..98c581b4 100644 --- a/vtm-gdx/build.gradle +++ b/vtm-gdx/build.gradle @@ -8,6 +8,7 @@ sourceSets { dependencies { compile project(':vtm') + compile project(':vtm-themes') compile files('../vtm-ext-libs/gdx/gdx.jar') //compile "com.badlogicgames.gdx:gdx:$gdxVersion" } \ No newline at end of file diff --git a/vtm-gdx/src/org/oscim/gdx/GdxMap.java b/vtm-gdx/src/org/oscim/gdx/GdxMap.java index 264a5361..dad565d8 100644 --- a/vtm-gdx/src/org/oscim/gdx/GdxMap.java +++ b/vtm-gdx/src/org/oscim/gdx/GdxMap.java @@ -27,7 +27,7 @@ import org.oscim.map.Layers; import org.oscim.map.Map; import org.oscim.map.ViewController; import org.oscim.renderer.MapRenderer; -import org.oscim.theme.InternalRenderTheme; +import org.oscim.theme.VtmThemes; import org.oscim.tiling.TileSource; import com.badlogic.gdx.Application; @@ -133,7 +133,7 @@ public abstract class GdxMap implements ApplicationListener { if (tileSource != null) { mMapLayer = mMap.setBaseMap(tileSource); - mMap.setTheme(InternalRenderTheme.DEFAULT); + mMap.setTheme(VtmThemes.DEFAULT); if (buildings) layers.add(new BuildingLayer(mMap, mMapLayer)); @@ -292,17 +292,17 @@ public abstract class GdxMap implements ApplicationListener { break; case Input.Keys.D: - mMap.setTheme(InternalRenderTheme.DEFAULT); + mMap.setTheme(VtmThemes.DEFAULT); mMap.updateMap(false); break; case Input.Keys.T: - mMap.setTheme(InternalRenderTheme.TRONRENDER); + mMap.setTheme(VtmThemes.TRONRENDER); mMap.updateMap(false); break; case Input.Keys.R: - mMap.setTheme(InternalRenderTheme.OSMARENDER); + mMap.setTheme(VtmThemes.OSMARENDER); mMap.updateMap(false); break; diff --git a/vtm-themes/build.gradle b/vtm-themes/build.gradle new file mode 100644 index 00000000..8db1ceb4 --- /dev/null +++ b/vtm-themes/build.gradle @@ -0,0 +1,12 @@ +apply plugin: 'java' +apply plugin: 'maven' + + +dependencies { + compile project(':vtm') +} + +sourceSets { + main.java.srcDirs = ['src'] + main.resources.srcDirs = ['resources'] +} diff --git a/vtm/icons/maki/atlas.xml b/vtm-themes/icons/maki/atlas.xml similarity index 100% rename from vtm/icons/maki/atlas.xml rename to vtm-themes/icons/maki/atlas.xml diff --git a/vtm/icons/osm/osm.xml b/vtm-themes/icons/osm/osm.xml similarity index 100% rename from vtm/icons/osm/osm.xml rename to vtm-themes/icons/osm/osm.xml diff --git a/vtm/assets/patterns/access-destination.png b/vtm-themes/resources/assets/patterns/access-destination.png similarity index 100% rename from vtm/assets/patterns/access-destination.png rename to vtm-themes/resources/assets/patterns/access-destination.png diff --git a/vtm/assets/patterns/access-private.png b/vtm-themes/resources/assets/patterns/access-private.png similarity index 100% rename from vtm/assets/patterns/access-private.png rename to vtm-themes/resources/assets/patterns/access-private.png diff --git a/vtm/assets/patterns/cemetery.png b/vtm-themes/resources/assets/patterns/cemetery.png similarity index 100% rename from vtm/assets/patterns/cemetery.png rename to vtm-themes/resources/assets/patterns/cemetery.png diff --git a/vtm/assets/patterns/marsh.png b/vtm-themes/resources/assets/patterns/marsh.png similarity index 100% rename from vtm/assets/patterns/marsh.png rename to vtm-themes/resources/assets/patterns/marsh.png diff --git a/vtm/assets/patterns/military.png b/vtm-themes/resources/assets/patterns/military.png similarity index 100% rename from vtm/assets/patterns/military.png rename to vtm-themes/resources/assets/patterns/military.png diff --git a/vtm/assets/patterns/nature-reserve.png b/vtm-themes/resources/assets/patterns/nature-reserve.png similarity index 100% rename from vtm/assets/patterns/nature-reserve.png rename to vtm-themes/resources/assets/patterns/nature-reserve.png diff --git a/vtm/assets/patterns/wood-coniferous.png b/vtm-themes/resources/assets/patterns/wood-coniferous.png similarity index 100% rename from vtm/assets/patterns/wood-coniferous.png rename to vtm-themes/resources/assets/patterns/wood-coniferous.png diff --git a/vtm/assets/patterns/wood-deciduous.png b/vtm-themes/resources/assets/patterns/wood-deciduous.png similarity index 100% rename from vtm/assets/patterns/wood-deciduous.png rename to vtm-themes/resources/assets/patterns/wood-deciduous.png diff --git a/vtm/assets/patterns/wood-mixed.png b/vtm-themes/resources/assets/patterns/wood-mixed.png similarity index 100% rename from vtm/assets/patterns/wood-mixed.png rename to vtm-themes/resources/assets/patterns/wood-mixed.png diff --git a/vtm/assets/styles/carto.xml b/vtm-themes/resources/assets/styles/carto.xml similarity index 100% rename from vtm/assets/styles/carto.xml rename to vtm-themes/resources/assets/styles/carto.xml diff --git a/vtm/assets/styles/default.xml b/vtm-themes/resources/assets/styles/default.xml similarity index 100% rename from vtm/assets/styles/default.xml rename to vtm-themes/resources/assets/styles/default.xml diff --git a/vtm/assets/styles/maki.png b/vtm-themes/resources/assets/styles/maki.png similarity index 100% rename from vtm/assets/styles/maki.png rename to vtm-themes/resources/assets/styles/maki.png diff --git a/vtm/assets/styles/newtron.xml b/vtm-themes/resources/assets/styles/newtron.xml similarity index 100% rename from vtm/assets/styles/newtron.xml rename to vtm-themes/resources/assets/styles/newtron.xml diff --git a/vtm/assets/styles/osm.png b/vtm-themes/resources/assets/styles/osm.png similarity index 100% rename from vtm/assets/styles/osm.png rename to vtm-themes/resources/assets/styles/osm.png diff --git a/vtm/assets/styles/osmarender.png b/vtm-themes/resources/assets/styles/osmarender.png similarity index 100% rename from vtm/assets/styles/osmarender.png rename to vtm-themes/resources/assets/styles/osmarender.png diff --git a/vtm/assets/styles/osmarender.xml b/vtm-themes/resources/assets/styles/osmarender.xml similarity index 100% rename from vtm/assets/styles/osmarender.xml rename to vtm-themes/resources/assets/styles/osmarender.xml diff --git a/vtm/assets/styles/tronrender.xml b/vtm-themes/resources/assets/styles/tronrender.xml similarity index 100% rename from vtm/assets/styles/tronrender.xml rename to vtm-themes/resources/assets/styles/tronrender.xml diff --git a/vtm/assets/textures/grass.png b/vtm-themes/resources/assets/textures/grass.png similarity index 100% rename from vtm/assets/textures/grass.png rename to vtm-themes/resources/assets/textures/grass.png diff --git a/vtm/assets/textures/water.png b/vtm-themes/resources/assets/textures/water.png similarity index 100% rename from vtm/assets/textures/water.png rename to vtm-themes/resources/assets/textures/water.png diff --git a/vtm/assets/textures/wood.png b/vtm-themes/resources/assets/textures/wood.png similarity index 100% rename from vtm/assets/textures/wood.png rename to vtm-themes/resources/assets/textures/wood.png diff --git a/vtm/src/org/oscim/theme/InternalRenderTheme.java b/vtm-themes/src/org/oscim/theme/VtmThemes.java similarity index 93% rename from vtm/src/org/oscim/theme/InternalRenderTheme.java rename to vtm-themes/src/org/oscim/theme/VtmThemes.java index fa62e214..53998ddf 100644 --- a/vtm/src/org/oscim/theme/InternalRenderTheme.java +++ b/vtm-themes/src/org/oscim/theme/VtmThemes.java @@ -24,7 +24,7 @@ import org.oscim.backend.AssetAdapter; /** * Enumeration of all internal rendering themes. */ -public enum InternalRenderTheme implements Theme { +public enum VtmThemes implements ThemeFile { DEFAULT("styles/default.xml"), TRONRENDER("styles/tronrender.xml"), @@ -34,7 +34,7 @@ public enum InternalRenderTheme implements Theme { private final String mPath; - private InternalRenderTheme(String path) { + private VtmThemes(String path) { mPath = path; } diff --git a/vtm/build.gradle b/vtm/build.gradle index 2ffa8b2c..fc977d56 100644 --- a/vtm/build.gradle +++ b/vtm/build.gradle @@ -1,8 +1,6 @@ apply plugin: 'java' apply plugin: 'maven' - - dependencies { compile 'org.slf4j:slf4j-api:1.7.6' compile 'com.google.code.findbugs:annotations:2.0.1' diff --git a/vtm/src/org/oscim/map/Map.java b/vtm/src/org/oscim/map/Map.java index d8c2a49c..a713379f 100644 --- a/vtm/src/org/oscim/map/Map.java +++ b/vtm/src/org/oscim/map/Map.java @@ -29,7 +29,7 @@ import org.oscim.layers.tile.vector.OsmTileLayer; import org.oscim.layers.tile.vector.VectorTileLayer; import org.oscim.renderer.MapRenderer; import org.oscim.theme.IRenderTheme; -import org.oscim.theme.InternalRenderTheme; +import org.oscim.theme.ThemeFile; import org.oscim.theme.ThemeLoader; import org.oscim.tiling.TileSource; import org.oscim.utils.async.AsyncExecutor; @@ -146,7 +146,7 @@ public abstract class Map { * Utility function to set theme of base vector-layer and * use map background color from theme. */ - public void setTheme(InternalRenderTheme theme) { + public void setTheme(ThemeFile theme) { if (mBaseLayer == null) { log.error("No base layer set"); throw new IllegalStateException(); diff --git a/vtm/src/org/oscim/theme/ExternalRenderTheme.java b/vtm/src/org/oscim/theme/ExternalRenderTheme.java index 4bb6811d..e45f426b 100644 --- a/vtm/src/org/oscim/theme/ExternalRenderTheme.java +++ b/vtm/src/org/oscim/theme/ExternalRenderTheme.java @@ -30,7 +30,7 @@ import org.oscim.backend.AssetAdapter; * An ExternalRenderTheme allows for customizing the rendering style of the map * via an XML file. */ -public class ExternalRenderTheme implements Theme { +public class ExternalRenderTheme implements ThemeFile { private static final long serialVersionUID = 1L; private final long mFileModificationDate; diff --git a/vtm/src/org/oscim/theme/Theme.java b/vtm/src/org/oscim/theme/ThemeFile.java similarity index 95% rename from vtm/src/org/oscim/theme/Theme.java rename to vtm/src/org/oscim/theme/ThemeFile.java index 3a2f2291..9b86b5e8 100644 --- a/vtm/src/org/oscim/theme/Theme.java +++ b/vtm/src/org/oscim/theme/ThemeFile.java @@ -21,7 +21,7 @@ import java.io.FileNotFoundException; import java.io.InputStream; import java.io.Serializable; -public interface Theme extends Serializable { +public interface ThemeFile extends Serializable { /** * @return an InputStream to read the render theme data from. * @throws FileNotFoundException diff --git a/vtm/src/org/oscim/theme/ThemeLoader.java b/vtm/src/org/oscim/theme/ThemeLoader.java index 271b3e49..c49a9213 100644 --- a/vtm/src/org/oscim/theme/ThemeLoader.java +++ b/vtm/src/org/oscim/theme/ThemeLoader.java @@ -29,16 +29,6 @@ import org.slf4j.LoggerFactory; public class ThemeLoader { static final Logger log = LoggerFactory.getLogger(ThemeLoader.class); - /** - * Load internal theme, see {@link InternalRenderTheme}. - * - * @param internalRenderTheme ... - * @return ... - */ - public static IRenderTheme load(InternalRenderTheme internalRenderTheme) { - return load((Theme) internalRenderTheme); - } - /** * Load theme from XML file. * @@ -50,7 +40,7 @@ public class ThemeLoader { return load(new ExternalRenderTheme(renderThemePath)); } - public static IRenderTheme load(Theme theme) { + public static IRenderTheme load(ThemeFile theme) { InputStream inputStream = null; try {