Improve code / xml formatting, closes #54

This commit is contained in:
Emux
2016-07-09 19:45:22 +03:00
parent 7919d0ab9c
commit e793e8851b
458 changed files with 58405 additions and 63062 deletions

View File

@@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<!-- TODO: Add <servlet> tags for each servlet here. -->
<!-- TODO: Add <servlet-mapping> tags for each <servlet> here. -->
<!-- TODO: Optionally add a <welcome-file-list> tag to display a welcome file. -->
<!-- TODO: Add <servlet> tags for each servlet here. -->
<!-- TODO: Add <servlet-mapping> tags for each <servlet> here. -->
<!-- TODO: Optionally add a <welcome-file-list> tag to display a welcome file. -->
</web-app>

View File

@@ -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>

View File

@@ -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;
}-*/;
}

View File

@@ -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();
}
}

View File

@@ -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);
// }
}

View File

@@ -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);
// }
}

View File

@@ -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;
// }
}

View File

@@ -6,6 +6,6 @@ import org.timepedia.exporter.client.ExportPackage;
@ExportPackage("vtm")
public class JsOsmLanduseJsonTileSource implements ExportOverlay<OsmLanduseJsonTileSource> {
public JsOsmLanduseJsonTileSource() {
}
public JsOsmLanduseJsonTileSource() {
}
}

View File

@@ -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
//
}

View File

@@ -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) {
}
}

View File

@@ -1,33 +1,33 @@
<!doctype html>
<html>
<head>
<title>vtm-web-js</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>vtm-web-js</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="viewport"
content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="stylesheet" type="text/css" href="default.css">
<link rel="stylesheet" type="text/css" href="default.css">
</head>
<body oncontextmenu="return false;">
<div id="canvas-area"
style="position: fixed; left: 0px; top: 0px; width: 100%; height: 100%;">
<canvas id="map-canvas">
Your browser does not support the HTML5 canvas tag.
</canvas>
</div>
<div id="canvas-area"
style="position: fixed; left: 0px; top: 0px; width: 100%; height: 100%;">
<canvas id="map-canvas">
Your browser does not support the HTML5 canvas tag.
</canvas>
</div>
<script type="text/javascript" src="map.js"></script>
<script type="text/javascript" src="map.js"></script>
<script type="text/javascript" src="VtmWebApp/js/_tessellate.js"></script>
<script type="text/javascript" src="VtmWebApp/js/tessellate.js"></script>
<script type="text/javascript" src="VtmWebApp/VtmWebApp.nocache.js"></script>
<script type="text/javascript" src="VtmWebApp/js/_tessellate.js"></script>
<script type="text/javascript" src="VtmWebApp/js/tessellate.js"></script>
<script type="text/javascript" src="VtmWebApp/VtmWebApp.nocache.js"></script>
<div id="credits">
<a href="https://github.com/hjanetzek/vtm">Source</a> | map data © <a
href="http://www.openstreemap.org">OpenStreetMap</a> contributors | <a
href="http://www.opensciencemap.org">OpenScienceMap</a>
</div>
<div id="credits">
<a href="https://github.com/hjanetzek/vtm">Source</a> | map data © <a
href="http://www.openstreemap.org">OpenStreetMap</a> contributors | <a
href="http://www.opensciencemap.org">OpenScienceMap</a>
</div>
</body>
</html>