Improve code / xml formatting, closes #54
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<module rename-to="VtmWebApp">
|
||||
|
||||
<entry-point class="org.oscim.web.client.GwtLauncher" />
|
||||
<entry-point class="org.oscim.web.client.GwtLauncher" />
|
||||
|
||||
<inherits name="org.oscim.gdx.VtmWeb" />
|
||||
<inherits name="org.oscim.gdx.VtmWeb" />
|
||||
|
||||
<inherits name='org.timepedia.exporter.Exporter' />
|
||||
<set-property name="export" value="yes" />
|
||||
<inherits name='org.timepedia.exporter.Exporter' />
|
||||
<set-property name="export" value="yes" />
|
||||
|
||||
<set-property name='gwt.logging.enabled' value='TRUE' />
|
||||
<set-property name='gwt.logging.consoleHandler' value='ENABLED' />
|
||||
<set-property name='gwt.logging.firebugHandler' value='DISABLED' />
|
||||
<set-property name='gwt.logging.popupHandler' value='DISABLED' />
|
||||
<set-property name="gwt.logging.logLevel" value="FINE" />
|
||||
<set-property name='gwt.logging.enabled' value='TRUE' />
|
||||
<set-property name='gwt.logging.consoleHandler' value='ENABLED' />
|
||||
<set-property name='gwt.logging.firebugHandler' value='DISABLED' />
|
||||
<set-property name='gwt.logging.popupHandler' value='DISABLED' />
|
||||
<set-property name="gwt.logging.logLevel" value="FINE" />
|
||||
|
||||
<!-- super dev mode -->
|
||||
<add-linker name="xsiframe" />
|
||||
<set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE' />
|
||||
<set-configuration-property name="devModeRedirectEnabled" value="true" />
|
||||
<!-- super dev mode -->
|
||||
<add-linker name="xsiframe" />
|
||||
<set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE' />
|
||||
<set-configuration-property name="devModeRedirectEnabled" value="true" />
|
||||
|
||||
<set-configuration-property name="gdx.assetpath" value="assets" />
|
||||
<set-configuration-property name="gdx.assetpath" value="assets" />
|
||||
|
||||
<!-- for gradle build, commend out for eclipse build -->
|
||||
<set-configuration-property name="gdx.assetoutputpath" value="build/gwt/draftOut" />
|
||||
<!-- for gradle build, commend out for eclipse build -->
|
||||
<set-configuration-property name="gdx.assetoutputpath" value="build/gwt/draftOut" />
|
||||
|
||||
<set-property name="user.agent" value="safari" />
|
||||
<set-property name="user.agent" value="safari" />
|
||||
</module>
|
||||
|
||||
@@ -16,69 +16,69 @@
|
||||
*/
|
||||
package org.oscim.web.client;
|
||||
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.gdx.client.MapConfig;
|
||||
import org.timepedia.exporter.client.ExporterUtil;
|
||||
|
||||
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.preloader.Preloader.PreloaderCallback;
|
||||
import com.badlogic.gdx.backends.gwt.preloader.Preloader.PreloaderState;
|
||||
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.gdx.client.MapConfig;
|
||||
import org.timepedia.exporter.client.ExporterUtil;
|
||||
|
||||
public class GwtLauncher extends GwtApplication {
|
||||
|
||||
@Override
|
||||
public void onModuleLoad() {
|
||||
//GWT.create(GwtGdxMap.class);
|
||||
//JsOverlays.init();
|
||||
ExporterUtil.exportAll();
|
||||
@Override
|
||||
public void onModuleLoad() {
|
||||
//GWT.create(GwtGdxMap.class);
|
||||
//JsOverlays.init();
|
||||
ExporterUtil.exportAll();
|
||||
|
||||
super.onModuleLoad();
|
||||
}
|
||||
super.onModuleLoad();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GwtApplicationConfiguration getConfig() {
|
||||
@Override
|
||||
public GwtApplicationConfiguration getConfig() {
|
||||
|
||||
GwtApplicationConfiguration cfg =
|
||||
new GwtApplicationConfiguration(getWindowWidth(),
|
||||
getWindowHeight());
|
||||
GwtApplicationConfiguration cfg =
|
||||
new GwtApplicationConfiguration(getWindowWidth(),
|
||||
getWindowHeight());
|
||||
|
||||
cfg.canvasId = "map-canvas";
|
||||
cfg.stencil = true;
|
||||
cfg.fps = 120;
|
||||
cfg.canvasId = "map-canvas";
|
||||
cfg.stencil = true;
|
||||
cfg.fps = 120;
|
||||
|
||||
return cfg;
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationListener getApplicationListener() {
|
||||
Tile.SIZE = MapConfig.get().getTileSize();
|
||||
@Override
|
||||
public ApplicationListener getApplicationListener() {
|
||||
Tile.SIZE = MapConfig.get().getTileSize();
|
||||
|
||||
return new GwtMap();
|
||||
}
|
||||
return new GwtMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreloaderCallback getPreloaderCallback() {
|
||||
return new PreloaderCallback() {
|
||||
@Override
|
||||
public PreloaderCallback getPreloaderCallback() {
|
||||
return new PreloaderCallback() {
|
||||
|
||||
@Override
|
||||
public void update(PreloaderState state) {
|
||||
}
|
||||
@Override
|
||||
public void update(PreloaderState state) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(String file) {
|
||||
//log.debug("error loading " + file);
|
||||
}
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public void error(String file) {
|
||||
//log.debug("error loading " + file);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static native int getWindowWidth() /*-{
|
||||
return $wnd.innerWidth;
|
||||
private static native int getWindowWidth() /*-{
|
||||
return $wnd.innerWidth;
|
||||
}-*/;
|
||||
|
||||
private static native int getWindowHeight() /*-{
|
||||
return $wnd.innerHeight;
|
||||
private static native int getWindowHeight() /*-{
|
||||
return $wnd.innerHeight;
|
||||
}-*/;
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
*/
|
||||
package org.oscim.web.client;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.backends.gwt.GwtApplication;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
@@ -30,47 +33,44 @@ import org.oscim.web.js.JsMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.backends.gwt.GwtApplication;
|
||||
|
||||
public class GwtMap extends GdxMap {
|
||||
static final Logger log = LoggerFactory.getLogger(GwtMap.class);
|
||||
static final Logger log = LoggerFactory.getLogger(GwtMap.class);
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
@Override
|
||||
public void create() {
|
||||
|
||||
GwtGdxGraphics.init();
|
||||
GdxAssets.init("");
|
||||
CanvasAdapter.textScale = 0.7f;
|
||||
GLAdapter.init((GL) Gdx.graphics.getGL20());
|
||||
GLAdapter.GDX_WEBGL_QUIRKS = true;
|
||||
MapRenderer.setBackgroundColor(0xffffff);
|
||||
GwtGdxGraphics.init();
|
||||
GdxAssets.init("");
|
||||
CanvasAdapter.textScale = 0.7f;
|
||||
GLAdapter.init((GL) Gdx.graphics.getGL20());
|
||||
GLAdapter.GDX_WEBGL_QUIRKS = true;
|
||||
MapRenderer.setBackgroundColor(0xffffff);
|
||||
|
||||
JsMap.init(mMap);
|
||||
JsMap.init(mMap);
|
||||
|
||||
if (GwtApplication.agentInfo().isLinux() &&
|
||||
GwtApplication.agentInfo().isFirefox())
|
||||
GwtGdxGraphics.NO_STROKE_TEXT = true;
|
||||
if (GwtApplication.agentInfo().isLinux() &&
|
||||
GwtApplication.agentInfo().isFirefox())
|
||||
GwtGdxGraphics.NO_STROKE_TEXT = true;
|
||||
|
||||
MapConfig c = MapConfig.get();
|
||||
super.create();
|
||||
MapConfig c = MapConfig.get();
|
||||
super.create();
|
||||
|
||||
MapPosition p = new MapPosition();
|
||||
p.setZoomLevel(c.getZoom());
|
||||
p.setPosition(c.getLatitude(), c.getLongitude());
|
||||
MapPosition p = new MapPosition();
|
||||
p.setZoomLevel(c.getZoom());
|
||||
p.setPosition(c.getLatitude(), c.getLongitude());
|
||||
|
||||
MapUrl mapUrl = new MapUrl(mMap);
|
||||
mapUrl.parseUrl(p);
|
||||
mapUrl.scheduleRepeating(5000);
|
||||
}
|
||||
MapUrl mapUrl = new MapUrl(mMap);
|
||||
mapUrl.parseUrl(p);
|
||||
mapUrl.scheduleRepeating(5000);
|
||||
}
|
||||
|
||||
private final native void createLayersN()/*-{
|
||||
$wnd.createLayers();
|
||||
private final native void createLayersN()/*-{
|
||||
$wnd.createLayers();
|
||||
}-*/;
|
||||
|
||||
@Override
|
||||
protected void createLayers() {
|
||||
log.debug("<<< create layers >>>");
|
||||
createLayersN();
|
||||
}
|
||||
@Override
|
||||
protected void createLayers() {
|
||||
log.debug("<<< create layers >>>");
|
||||
createLayersN();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@ import org.timepedia.exporter.client.ExportPackage;
|
||||
@Export("BitmapTileLayer")
|
||||
public class JsBitmapTileLayer extends BitmapTileLayer implements ExportOverlay<BitmapTileLayer> {
|
||||
|
||||
public JsBitmapTileLayer(Map map, TileSource tileSource) {
|
||||
super(map, tileSource);
|
||||
}
|
||||
public JsBitmapTileLayer(Map map, TileSource tileSource) {
|
||||
super(map, tileSource);
|
||||
}
|
||||
|
||||
// @ExportConstructor
|
||||
// public static BitmapTileLayer constructor(Map map, TileSource tileSource) {
|
||||
// return new JsBitmapTileLayer(map, tileSource);
|
||||
// }
|
||||
// @ExportConstructor
|
||||
// public static BitmapTileLayer constructor(Map map, TileSource tileSource) {
|
||||
// return new JsBitmapTileLayer(map, tileSource);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -11,17 +11,17 @@ import org.timepedia.exporter.client.ExportPackage;
|
||||
public class JsBitmapTileSource extends BitmapTileSource implements
|
||||
ExportOverlay<BitmapTileSource> {
|
||||
|
||||
public JsBitmapTileSource(String url, int zoomMin, int zoomMax) {
|
||||
super(url, zoomMin, zoomMax);
|
||||
}
|
||||
public JsBitmapTileSource(String url, int zoomMin, int zoomMax) {
|
||||
super(url, zoomMin, zoomMax);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
return null;
|
||||
}
|
||||
// @ExportConstructor
|
||||
// public static BitmapTileSource constructor(String url, int zoomMin, int zoomMax) {
|
||||
// return new JsBitmapTileSource(url, zoomMin, zoomMax);
|
||||
// }
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
return null;
|
||||
}
|
||||
// @ExportConstructor
|
||||
// public static BitmapTileSource constructor(String url, int zoomMin, int zoomMax) {
|
||||
// return new JsBitmapTileSource(url, zoomMin, zoomMax);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -16,45 +16,45 @@ import org.timepedia.exporter.client.NoExport;
|
||||
@Export("map")
|
||||
public class JsMap implements Exportable {
|
||||
|
||||
static Map mMap;
|
||||
static Map mMap;
|
||||
|
||||
@Export
|
||||
public static Map map() {
|
||||
return mMap;
|
||||
}
|
||||
@Export
|
||||
public static Map map() {
|
||||
return mMap;
|
||||
}
|
||||
|
||||
@Export
|
||||
public static Layers layers() {
|
||||
return mMap.layers();
|
||||
}
|
||||
@Export
|
||||
public static Layers layers() {
|
||||
return mMap.layers();
|
||||
}
|
||||
|
||||
@Export
|
||||
public static boolean addLayer(Layer l) {
|
||||
return mMap.layers().add(l);
|
||||
}
|
||||
@Export
|
||||
public static boolean addLayer(Layer l) {
|
||||
return mMap.layers().add(l);
|
||||
}
|
||||
|
||||
@Export
|
||||
public static boolean getPosition(MapPosition pos) {
|
||||
return mMap.getMapPosition(pos);
|
||||
}
|
||||
@Export
|
||||
public static boolean getPosition(MapPosition pos) {
|
||||
return mMap.getMapPosition(pos);
|
||||
}
|
||||
|
||||
@Export
|
||||
public static void setPosition(MapPosition pos) {
|
||||
mMap.setMapPosition(pos);
|
||||
}
|
||||
@Export
|
||||
public static void setPosition(MapPosition pos) {
|
||||
mMap.setMapPosition(pos);
|
||||
}
|
||||
|
||||
@Export
|
||||
public static IRenderTheme loadTheme(String theme) {
|
||||
return ThemeLoader.load(VtmThemes.valueOf(theme));
|
||||
}
|
||||
@Export
|
||||
public static IRenderTheme loadTheme(String theme) {
|
||||
return ThemeLoader.load(VtmThemes.valueOf(theme));
|
||||
}
|
||||
|
||||
@NoExport
|
||||
public static void init(Map map) {
|
||||
mMap = map;
|
||||
}
|
||||
@NoExport
|
||||
public static void init(Map map) {
|
||||
mMap = map;
|
||||
}
|
||||
|
||||
// @ExportInstanceMethod("foo")
|
||||
// public static String instanceMethod(Map instance, String surname) {
|
||||
// return instance.getName() + "-" + surname;
|
||||
// }
|
||||
// @ExportInstanceMethod("foo")
|
||||
// public static String instanceMethod(Map instance, String surname) {
|
||||
// return instance.getName() + "-" + surname;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ import org.timepedia.exporter.client.ExportPackage;
|
||||
|
||||
@ExportPackage("vtm")
|
||||
public class JsOsmLanduseJsonTileSource implements ExportOverlay<OsmLanduseJsonTileSource> {
|
||||
public JsOsmLanduseJsonTileSource() {
|
||||
}
|
||||
public JsOsmLanduseJsonTileSource() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,104 +22,108 @@ import org.timepedia.exporter.client.Exportable;
|
||||
|
||||
@ExportPackage("")
|
||||
public class JsOverlays implements Exportable {
|
||||
@ExportPackage("vtm")
|
||||
@Export("Layers")
|
||||
public interface XLayers extends ExportOverlay<Layers> {
|
||||
void add(Layer layer);
|
||||
}
|
||||
@ExportPackage("vtm")
|
||||
@Export("Layers")
|
||||
public interface XLayers extends ExportOverlay<Layers> {
|
||||
void add(Layer layer);
|
||||
}
|
||||
|
||||
@ExportPackage("vtm")
|
||||
@Export("Map")
|
||||
public interface XMap extends ExportOverlay<Map> {
|
||||
public abstract Layers layers();
|
||||
@ExportPackage("vtm")
|
||||
@Export("Map")
|
||||
public interface XMap extends ExportOverlay<Map> {
|
||||
public abstract Layers layers();
|
||||
|
||||
public abstract void setMapPosition(MapPosition pos);
|
||||
public abstract void setMapPosition(MapPosition pos);
|
||||
|
||||
public abstract MapPosition getMapPosition();
|
||||
public abstract MapPosition getMapPosition();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ExportPackage("vtm")
|
||||
@Export("MapPosition")
|
||||
public static class XMapPosition implements ExportOverlay<MapPosition> {
|
||||
public XMapPosition(double latitude, double longitude, double scale) {
|
||||
};
|
||||
@ExportPackage("vtm")
|
||||
@Export("MapPosition")
|
||||
public static class XMapPosition implements ExportOverlay<MapPosition> {
|
||||
public XMapPosition(double latitude, double longitude, double scale) {
|
||||
}
|
||||
|
||||
public XMapPosition() {
|
||||
};
|
||||
;
|
||||
|
||||
public void setPosition(double latitude, double longitude) {
|
||||
}
|
||||
public XMapPosition() {
|
||||
}
|
||||
|
||||
public void setScale(double scale) {
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
@ExportPackage("vtm")
|
||||
@Export("GenericLayer")
|
||||
public abstract class XGenericLayer implements ExportOverlay<GenericLayer> {
|
||||
public XGenericLayer(Map map, LayerRenderer renderer) {
|
||||
}
|
||||
}
|
||||
public void setPosition(double latitude, double longitude) {
|
||||
}
|
||||
|
||||
@ExportPackage("vtm")
|
||||
@Export("TileGridLayer")
|
||||
public static class XTileGridLayer implements ExportOverlay<TileGridLayer> {
|
||||
public XTileGridLayer(Map map) {
|
||||
}
|
||||
}
|
||||
public void setScale(double scale) {
|
||||
}
|
||||
}
|
||||
|
||||
@ExportPackage("vtm")
|
||||
@Export("OsmTileLayer")
|
||||
public static class XOsmTileLayer implements ExportOverlay<OsmTileLayer> {
|
||||
public XOsmTileLayer(Map map) {
|
||||
}
|
||||
@ExportPackage("vtm")
|
||||
@Export("GenericLayer")
|
||||
public abstract class XGenericLayer implements ExportOverlay<GenericLayer> {
|
||||
public XGenericLayer(Map map, LayerRenderer renderer) {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setTileSource(TileSource tileSource) {
|
||||
return false;
|
||||
}
|
||||
@ExportPackage("vtm")
|
||||
@Export("TileGridLayer")
|
||||
public static class XTileGridLayer implements ExportOverlay<TileGridLayer> {
|
||||
public XTileGridLayer(Map map) {
|
||||
}
|
||||
}
|
||||
|
||||
public void setRenderTheme(IRenderTheme theme) {
|
||||
}
|
||||
}
|
||||
@ExportPackage("vtm")
|
||||
@Export("OsmTileLayer")
|
||||
public static class XOsmTileLayer implements ExportOverlay<OsmTileLayer> {
|
||||
public XOsmTileLayer(Map map) {
|
||||
}
|
||||
|
||||
@ExportPackage("vtm")
|
||||
@Export("HighroadJsonTileSource")
|
||||
public static class XHighroadJsonTileSource implements
|
||||
ExportOverlay<HighroadJsonTileSource> {
|
||||
public XHighroadJsonTileSource() {
|
||||
}
|
||||
}
|
||||
public boolean setTileSource(TileSource tileSource) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ExportPackage("vtm")
|
||||
@Export("OSciMap4TileSource")
|
||||
public static class XOSciMap4TileSource implements
|
||||
ExportOverlay<OSciMap4TileSource> {
|
||||
public XOSciMap4TileSource(String url) {
|
||||
}
|
||||
public void setRenderTheme(IRenderTheme theme) {
|
||||
}
|
||||
}
|
||||
|
||||
public XOSciMap4TileSource() {
|
||||
}
|
||||
}
|
||||
@ExportPackage("vtm")
|
||||
@Export("HighroadJsonTileSource")
|
||||
public static class XHighroadJsonTileSource implements
|
||||
ExportOverlay<HighroadJsonTileSource> {
|
||||
public XHighroadJsonTileSource() {
|
||||
}
|
||||
}
|
||||
|
||||
@ExportPackage("vtm")
|
||||
@Export("LabelLayer")
|
||||
public static class XLabelLayer implements
|
||||
ExportOverlay<LabelLayer> {
|
||||
public XLabelLayer(Map map, VectorTileLayer l) {
|
||||
}
|
||||
}
|
||||
@ExportPackage("vtm")
|
||||
@Export("OSciMap4TileSource")
|
||||
public static class XOSciMap4TileSource implements
|
||||
ExportOverlay<OSciMap4TileSource> {
|
||||
public XOSciMap4TileSource(String url) {
|
||||
}
|
||||
|
||||
@ExportPackage("vtm")
|
||||
@Export("BuildingLayer")
|
||||
public static class XBuildingLayer implements
|
||||
ExportOverlay<BuildingLayer> {
|
||||
public XBuildingLayer(Map map, VectorTileLayer l) {
|
||||
}
|
||||
}
|
||||
public XOSciMap4TileSource() {
|
||||
}
|
||||
}
|
||||
|
||||
// @ExportPackage("vtm")
|
||||
// @Export("Viewport")
|
||||
// public interface XViewport extends ExportOverlay
|
||||
//
|
||||
@ExportPackage("vtm")
|
||||
@Export("LabelLayer")
|
||||
public static class XLabelLayer implements
|
||||
ExportOverlay<LabelLayer> {
|
||||
public XLabelLayer(Map map, VectorTileLayer l) {
|
||||
}
|
||||
}
|
||||
|
||||
@ExportPackage("vtm")
|
||||
@Export("BuildingLayer")
|
||||
public static class XBuildingLayer implements
|
||||
ExportOverlay<BuildingLayer> {
|
||||
public XBuildingLayer(Map map, VectorTileLayer l) {
|
||||
}
|
||||
}
|
||||
|
||||
// @ExportPackage("vtm")
|
||||
// @Export("Viewport")
|
||||
// public interface XViewport extends ExportOverlay
|
||||
//
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@ import org.timepedia.exporter.client.ExportPackage;
|
||||
|
||||
@ExportPackage("vtm")
|
||||
public class JsVectorTileLayer implements ExportOverlay<VectorTileLayer> {
|
||||
public JsVectorTileLayer(Map map, TileSource tileSource) {
|
||||
}
|
||||
public JsVectorTileLayer(Map map, TileSource tileSource) {
|
||||
}
|
||||
|
||||
public boolean setTileSource(TileSource tileSource) {
|
||||
return false;
|
||||
}
|
||||
public boolean setTileSource(TileSource tileSource) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setRenderTheme(IRenderTheme theme) {
|
||||
}
|
||||
public void setRenderTheme(IRenderTheme theme) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user