diff --git a/settings.gradle b/settings.gradle
index b14ea7a8..234a3334 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -8,6 +8,7 @@ include ':vtm-gdx'
include ':vtm-desktop'
include ':vtm-android-gdx'
include ':vtm-web'
+include ':vtm-web-app'
include ':vtm-ios'
include ':vtm-jeo'
include ':vtm-jeo-desktop'
diff --git a/vtm-gdx/src/GdxMap.gwt.xml b/vtm-gdx/src/VtmGdx.gwt.xml
similarity index 100%
rename from vtm-gdx/src/GdxMap.gwt.xml
rename to vtm-gdx/src/VtmGdx.gwt.xml
diff --git a/vtm-web-app/.gitignore b/vtm-web-app/.gitignore
new file mode 100644
index 00000000..04c790a6
--- /dev/null
+++ b/vtm-web-app/.gitignore
@@ -0,0 +1,4 @@
+war/
+assets/
+gwt-unitCache/
+build/
diff --git a/vtm-web-app/build.gradle b/vtm-web-app/build.gradle
new file mode 100644
index 00000000..edf67e82
--- /dev/null
+++ b/vtm-web-app/build.gradle
@@ -0,0 +1,98 @@
+buildscript {
+ repositories {
+ mavenLocal()
+ mavenCentral()
+ maven { url 'https://github.com/steffenschaefer/gwt-gradle-plugin/raw/maven-repo/' }
+ }
+ dependencies {
+ classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.3'
+ }
+}
+
+repositories {
+ maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
+}
+
+apply plugin: 'war'
+apply plugin: 'jetty'
+apply plugin: 'gwt'
+apply plugin: 'eclipse'
+
+sourceSets {
+ //main.java.srcDirs = ['src', 'src/org/oscim/gdx/emu']
+ main.java.srcDirs = ['src']
+}
+
+dependencies {
+ providedCompile project(':vtm-web')
+ providedCompile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
+ providedCompile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
+ providedCompile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
+ providedCompile 'ru.finam:slf4j-gwt:1.2.1'
+ providedCompile 'org.slf4j:slf4j-api:1.7.5'
+}
+
+// explicit dependencies for org.gradle.configureondemand=true
+evaluationDependsOn(':vtm')
+evaluationDependsOn(':vtm-themes')
+evaluationDependsOn(':vtm-gdx')
+evaluationDependsOn(':vtm-web')
+
+
+gwt {
+ gwtVersion='2.6.0'
+ modules 'org.oscim.web.VtmWebApp'
+
+ superDev {
+ noPrecompile=true
+ }
+ compiler {
+ enableClosureCompiler = false; // activates -XenableClosureCompiler
+ disableClassMetadata = true; // activates -XdisableClassMetadata
+ disableCastChecking = true; // activates -XdisableCastChecking
+ }
+
+ src += files(sourceSets.main.java.srcDirs)
+ src += files(project(':vtm').sourceSets.main.allJava.srcDirs)
+ src += files(project(':vtm-themes').sourceSets.main.allJava.srcDirs)
+ src += files(project(':vtm-themes').sourceSets.main.resources.srcDirs)
+ src += files(project(':vtm-gdx').sourceSets.main.allJava.srcDirs)
+ src += files(project(':vtm-web').sourceSets.main.allJava.srcDirs)
+}
+
+// Run jetty with draft compiled war
+task jettyDraftWar(type: JettyRunWar) {
+ dependsOn draftWar
+ dependsOn.remove('war')
+ webApp=draftWar.archivePath
+}
+
+task copyThemeAssets(type: Copy) {
+ from "$rootDir/vtm-themes/resources/assets"
+ into "assets"
+ include '**/*'
+}
+
+task copyVtmAssets(type: Copy) {
+ from "$rootDir/vtm/resources/assets"
+ into "assets"
+ include '**/*'
+}
+
+tasks.withType(JavaCompile) { compileTask ->
+ compileTask.dependsOn copyThemeAssets
+ compileTask.dependsOn copyVtmAssets
+}
+
+// Configuring Eclipse classpath
+eclipse.classpath {
+
+ defaultOutputDir = file('war/WEB-INF/classes')
+
+ //file {
+ // whenMerged { classpath ->
+ // classpath.entries.findAll { entry ->
+ // entry.path == 'src' }*.excludes = ['main','org/oscim/gdx/emu/']
+ // }
+ //}
+}
diff --git a/vtm-web/src/main/webapp/WEB-INF/web.xml b/vtm-web-app/src/main/webapp/WEB-INF/web.xml
similarity index 100%
rename from vtm-web/src/main/webapp/WEB-INF/web.xml
rename to vtm-web-app/src/main/webapp/WEB-INF/web.xml
diff --git a/vtm-web/src/main/webapp/index.html b/vtm-web-app/src/main/webapp/index.html
similarity index 90%
rename from vtm-web/src/main/webapp/index.html
rename to vtm-web-app/src/main/webapp/index.html
index c1e914cd..ecc97c05 100644
--- a/vtm-web/src/main/webapp/index.html
+++ b/vtm-web-app/src/main/webapp/index.html
@@ -137,11 +137,9 @@
-
-
-
-
+-
+
+
Source
diff --git a/vtm-web/src/org/oscim/gdx/GwtDefinition.gwt.xml b/vtm-web-app/src/org/oscim/web/VtmWebApp.gwt.xml
similarity index 62%
rename from vtm-web/src/org/oscim/gdx/GwtDefinition.gwt.xml
rename to vtm-web-app/src/org/oscim/web/VtmWebApp.gwt.xml
index 949bc9e6..9b776abf 100644
--- a/vtm-web/src/org/oscim/gdx/GwtDefinition.gwt.xml
+++ b/vtm-web-app/src/org/oscim/web/VtmWebApp.gwt.xml
@@ -1,27 +1,24 @@
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
-
-
-
+
diff --git a/vtm-web/src/org/oscim/gdx/client/GwtGdxMap.java b/vtm-web-app/src/org/oscim/web/client/GwtGdxMap.java
similarity index 94%
rename from vtm-web/src/org/oscim/gdx/client/GwtGdxMap.java
rename to vtm-web-app/src/org/oscim/web/client/GwtGdxMap.java
index 6ff76635..2ed7e7b2 100644
--- a/vtm-web/src/org/oscim/gdx/client/GwtGdxMap.java
+++ b/vtm-web-app/src/org/oscim/web/client/GwtGdxMap.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see .
*/
-package org.oscim.gdx.client;
+package org.oscim.web.client;
import java.util.HashMap;
@@ -23,8 +23,11 @@ import org.oscim.backend.GL20;
import org.oscim.backend.GLAdapter;
import org.oscim.core.MapPosition;
import org.oscim.core.MercatorProjection;
+import org.oscim.gdx.GdxAssets;
import org.oscim.gdx.GdxMap;
+import org.oscim.gdx.client.GwtGdxGraphics;
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
+import org.oscim.layers.tile.vector.BuildingLayer;
import org.oscim.layers.tile.vector.VectorTileLayer;
import org.oscim.layers.tile.vector.labeling.LabelLayer;
import org.oscim.renderer.MapRenderer;
@@ -56,11 +59,13 @@ class GwtGdxMap extends GdxMap {
// <- circle/stroke test 800ms firefox, 80ms chromium..
// TODO use texture atlas to avoid drawing text-textures
if (GwtApplication.agentInfo().isLinux() && GwtApplication.agentInfo().isFirefox())
- GwtCanvasAdapter.NO_STROKE_TEXT = true;
+ GwtGdxGraphics.NO_STROKE_TEXT = true;
- CanvasAdapter.g = GwtCanvasAdapter.INSTANCE;
+ GwtGdxGraphics.init();
+ GdxAssets.init("");
CanvasAdapter.textScale = 0.7f;
- GLAdapter.g = (GL20) Gdx.graphics.getGL20();
+
+ GLAdapter.init((GL20) Gdx.graphics.getGL20());
GLAdapter.GDX_WEBGL_QUIRKS = true;
MapRenderer.setBackgroundColor(0xffffff);
//Gdx.app.setLogLevel(Application.LOG_DEBUG);
@@ -173,6 +178,9 @@ class GwtGdxMap extends GdxMap {
if (l != null) {
if (!params.containsKey("nolabel"))
mMap.layers().add(new LabelLayer(mMap, l));
+
+ if (!params.containsKey("nobuildings"))
+ mMap.layers().add(new BuildingLayer(mMap, l));
}
mSearchBox = new SearchBox(mMap);
diff --git a/vtm-web/src/org/oscim/gdx/client/GwtLauncher.java b/vtm-web-app/src/org/oscim/web/client/GwtLauncher.java
similarity index 81%
rename from vtm-web/src/org/oscim/gdx/client/GwtLauncher.java
rename to vtm-web-app/src/org/oscim/web/client/GwtLauncher.java
index d2c2d78a..643cd095 100644
--- a/vtm-web/src/org/oscim/gdx/client/GwtLauncher.java
+++ b/vtm-web-app/src/org/oscim/web/client/GwtLauncher.java
@@ -14,15 +14,12 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see .
*/
-package org.oscim.gdx.client;
+package org.oscim.web.client;
// -draftCompile -localWorkers 2
-import org.oscim.core.Tile;
-
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.gwt.GwtApplication;
import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration;
-import com.badlogic.gdx.backends.gwt.GwtGraphics;
import com.badlogic.gdx.backends.gwt.preloader.Preloader.PreloaderCallback;
import com.badlogic.gdx.backends.gwt.preloader.Preloader.PreloaderState;
import com.google.gwt.dom.client.Style.Unit;
@@ -35,8 +32,8 @@ public class GwtLauncher extends GwtApplication {
@Override
public GwtApplicationConfiguration getConfig() {
GwtApplicationConfiguration cfg =
- new GwtApplicationConfiguration(GwtGraphics.getWindowWidthJSNI(),
- GwtGraphics.getWindowHeightJSNI());
+ new GwtApplicationConfiguration(getWindowWidthJSNI(),
+ getWindowHeightJSNI());
DockLayoutPanel p = new DockLayoutPanel(Unit.EM);
p.setHeight("100%");
@@ -64,10 +61,10 @@ public class GwtLauncher extends GwtApplication {
@Override
public ApplicationListener getApplicationListener() {
- if (GwtGraphics.getDevicePixelRatioJSNI() > 1)
- Tile.SIZE = 400;
- else
- Tile.SIZE = 360;
+ // if (GwtGraphics.getDevicePixelRatioJSNI() > 1)
+ // Tile.SIZE = 400;
+ // else
+ // Tile.SIZE = 360;
return new GwtGdxMap();
}
@@ -86,4 +83,13 @@ public class GwtLauncher extends GwtApplication {
}
};
}
+
+ public static native int getWindowWidthJSNI() /*-{
+ return $wnd.innerWidth;
+ }-*/;
+
+ public static native int getWindowHeightJSNI() /*-{
+ return $wnd.innerHeight;
+ }-*/;
+
}
diff --git a/vtm-web/src/org/oscim/gdx/client/MapConfig.java b/vtm-web-app/src/org/oscim/web/client/MapConfig.java
similarity index 97%
rename from vtm-web/src/org/oscim/gdx/client/MapConfig.java
rename to vtm-web-app/src/org/oscim/web/client/MapConfig.java
index 47008482..82092e75 100644
--- a/vtm-web/src/org/oscim/gdx/client/MapConfig.java
+++ b/vtm-web-app/src/org/oscim/web/client/MapConfig.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see .
*/
-package org.oscim.gdx.client;
+package org.oscim.web.client;
import com.google.gwt.core.client.JavaScriptObject;
diff --git a/vtm-web/src/org/oscim/gdx/client/SearchBox.java b/vtm-web-app/src/org/oscim/web/client/SearchBox.java
similarity index 99%
rename from vtm-web/src/org/oscim/gdx/client/SearchBox.java
rename to vtm-web-app/src/org/oscim/web/client/SearchBox.java
index b1f4985f..9acd9c5d 100644
--- a/vtm-web/src/org/oscim/gdx/client/SearchBox.java
+++ b/vtm-web-app/src/org/oscim/web/client/SearchBox.java
@@ -14,18 +14,18 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see .
*/
-package org.oscim.gdx.client;
+package org.oscim.web.client;
import java.util.ArrayList;
import java.util.List;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.oscim.core.BoundingBox;
import org.oscim.core.GeometryBuffer;
import org.oscim.core.MapPosition;
import org.oscim.layers.PathLayer;
import org.oscim.map.Map;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.core.client.JavaScriptObject;
diff --git a/vtm-web/src/org/oscim/gdx/client/WKTReader.java b/vtm-web-app/src/org/oscim/web/client/WKTReader.java
similarity index 99%
rename from vtm-web/src/org/oscim/gdx/client/WKTReader.java
rename to vtm-web-app/src/org/oscim/web/client/WKTReader.java
index 154f8cc8..a7bd01de 100644
--- a/vtm-web/src/org/oscim/gdx/client/WKTReader.java
+++ b/vtm-web-app/src/org/oscim/web/client/WKTReader.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see .
*/
-package org.oscim.gdx.client;
+package org.oscim.web.client;
import org.oscim.core.GeometryBuffer;
diff --git a/vtm-web/build.gradle b/vtm-web/build.gradle
index 1b5b68e5..c3d2bf2f 100644
--- a/vtm-web/build.gradle
+++ b/vtm-web/build.gradle
@@ -13,9 +13,10 @@ repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
-apply plugin: 'war'
-apply plugin: 'jetty'
-apply plugin: 'gwt'
+//apply plugin: 'war'
+//apply plugin: 'jetty'
+apply plugin: 'java'
+apply plugin: 'gwt-base'
apply plugin: 'eclipse'
sourceSets {
@@ -23,12 +24,12 @@ sourceSets {
}
dependencies {
- providedCompile project(':vtm-gdx')
- providedCompile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
- providedCompile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
- providedCompile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
- providedCompile 'ru.finam:slf4j-gwt:1.2.1'
- providedCompile 'org.slf4j:slf4j-api:1.7.5'
+ compile project(':vtm-gdx')
+ compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
+ compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
+ compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
+ compile 'ru.finam:slf4j-gwt:1.2.1'
+ compile 'org.slf4j:slf4j-api:1.7.5'
}
// explicit dependencies for org.gradle.configureondemand=true
@@ -38,7 +39,7 @@ evaluationDependsOn(':vtm-gdx')
gwt {
gwtVersion='2.6.0'
- modules 'org.oscim.gdx.GwtDefinition'
+ modules 'org.oscim.gdx.VtmWeb'
superDev {
noPrecompile=true
@@ -57,28 +58,28 @@ gwt {
}
// Run jetty with draft compiled war
-task jettyDraftWar(type: JettyRunWar) {
- dependsOn draftWar
- dependsOn.remove('war')
- webApp=draftWar.archivePath
-}
+//task jettyDraftWar(type: JettyRunWar) {
+// dependsOn draftWar
+// dependsOn.remove('war')
+// webApp=draftWar.archivePath
+//}
-task copyThemeAssets(type: Copy) {
- from "$rootDir/vtm-themes/resources/assets"
- into "assets"
- include '**/*'
-}
+//task copyThemeAssets(type: Copy) {
+// from "$rootDir/vtm-themes/resources/assets"
+// into "assets"
+// include '**/*'
+//}
-task copyVtmAssets(type: Copy) {
- from "$rootDir/vtm/resources/assets"
- into "assets"
- include '**/*'
-}
+//task copyVtmAssets(type: Copy) {
+// from "$rootDir/vtm/resources/assets"
+// into "assets"
+// include '**/*'
+//}
-tasks.withType(JavaCompile) { compileTask ->
- compileTask.dependsOn copyThemeAssets
- compileTask.dependsOn copyVtmAssets
-}
+//tasks.withType(JavaCompile) { compileTask ->
+// compileTask.dependsOn copyThemeAssets
+// compileTask.dependsOn copyVtmAssets
+//}
// Configuring Eclipse classpath
eclipse.classpath {
diff --git a/vtm-web/src/com/badlogic/gdx/backends/Gdx.gwt.xml b/vtm-web/src/com/badlogic/gdx/backends/Gdx.gwt.xml
new file mode 100644
index 00000000..f406c9d9
--- /dev/null
+++ b/vtm-web/src/com/badlogic/gdx/backends/Gdx.gwt.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/vtm-web/src/org/oscim/gdx/VtmWeb.gwt.xml b/vtm-web/src/org/oscim/gdx/VtmWeb.gwt.xml
new file mode 100644
index 00000000..7d700825
--- /dev/null
+++ b/vtm-web/src/org/oscim/gdx/VtmWeb.gwt.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/vtm-web/src/org/oscim/gdx/client/GwtCanvas.java b/vtm-web/src/org/oscim/gdx/client/GwtCanvas.java
index 235c657f..5a58a19e 100644
--- a/vtm-web/src/org/oscim/gdx/client/GwtCanvas.java
+++ b/vtm-web/src/org/oscim/gdx/client/GwtCanvas.java
@@ -47,7 +47,7 @@ public class GwtCanvas implements org.oscim.backend.canvas.Canvas {
GwtPaint p = (GwtPaint) paint;
- if (p.stroke && GwtCanvasAdapter.NO_STROKE_TEXT)
+ if (p.stroke && GwtGdxGraphics.NO_STROKE_TEXT)
return;
Context2d ctx = bitmap.pixmap.getContext();
diff --git a/vtm-web/src/org/oscim/gdx/client/GwtCanvasAdapter.java b/vtm-web/src/org/oscim/gdx/client/GwtGdxGraphics.java
similarity index 88%
rename from vtm-web/src/org/oscim/gdx/client/GwtCanvasAdapter.java
rename to vtm-web/src/org/oscim/gdx/client/GwtGdxGraphics.java
index 813be86b..f6940eb8 100644
--- a/vtm-web/src/org/oscim/gdx/client/GwtCanvasAdapter.java
+++ b/vtm-web/src/org/oscim/gdx/client/GwtGdxGraphics.java
@@ -26,11 +26,11 @@ import com.google.gwt.canvas.client.Canvas;
import com.google.gwt.canvas.dom.client.Context2d;
import com.google.gwt.canvas.dom.client.TextMetrics;
-public class GwtCanvasAdapter extends CanvasAdapter {
+public class GwtGdxGraphics extends CanvasAdapter {
public static boolean NO_STROKE_TEXT = false;
- public static final GwtCanvasAdapter INSTANCE = new GwtCanvasAdapter();
+ public static final GwtGdxGraphics INSTANCE = new GwtGdxGraphics();
static final Context2d ctx;
static {
@@ -40,7 +40,7 @@ public class GwtCanvasAdapter extends CanvasAdapter {
ctx = canvas.getContext2d();
}
- static synchronized float getTextWidth(String text, String font) {
+ public static synchronized float getTextWidth(String text, String font) {
ctx.setFont(font);
TextMetrics tm = ctx.measureText(text);
return (float) tm.getWidth();
@@ -72,4 +72,8 @@ public class GwtCanvasAdapter extends CanvasAdapter {
return new GwtCanvas();
}
+ public static void init() {
+ g = INSTANCE;
+ }
+
}
diff --git a/vtm-web/src/org/oscim/gdx/client/GwtPaint.java b/vtm-web/src/org/oscim/gdx/client/GwtPaint.java
index 0bc58e3a..20bf2d6c 100644
--- a/vtm-web/src/org/oscim/gdx/client/GwtPaint.java
+++ b/vtm-web/src/org/oscim/gdx/client/GwtPaint.java
@@ -107,7 +107,7 @@ public class GwtPaint implements Paint {
@Override
public float measureText(String text) {
- return GwtCanvasAdapter.getTextWidth(text, font);
+ return GwtGdxGraphics.getTextWidth(text, font);
}
// FIXME all estimates. no idea how to properly measure canvas text..
diff --git a/vtm-web/src/main/webapp/js/LICENSE b/vtm-web/src/org/oscim/gdx/resources/js/LICENSE
similarity index 100%
rename from vtm-web/src/main/webapp/js/LICENSE
rename to vtm-web/src/org/oscim/gdx/resources/js/LICENSE
diff --git a/vtm-web/src/main/webapp/js/README.md b/vtm-web/src/org/oscim/gdx/resources/js/README.md
similarity index 100%
rename from vtm-web/src/main/webapp/js/README.md
rename to vtm-web/src/org/oscim/gdx/resources/js/README.md
diff --git a/vtm-web/src/main/webapp/js/_tessellate.js b/vtm-web/src/org/oscim/gdx/resources/js/_tessellate.js
similarity index 100%
rename from vtm-web/src/main/webapp/js/_tessellate.js
rename to vtm-web/src/org/oscim/gdx/resources/js/_tessellate.js
diff --git a/vtm-web/src/main/webapp/js/tessellate.js b/vtm-web/src/org/oscim/gdx/resources/js/tessellate.js
similarity index 100%
rename from vtm-web/src/main/webapp/js/tessellate.js
rename to vtm-web/src/org/oscim/gdx/resources/js/tessellate.js