diff --git a/vtm-playground/build.gradle b/vtm-playground/build.gradle index 015c38420..5dd8b4405 100644 --- a/vtm-playground/build.gradle +++ b/vtm-playground/build.gradle @@ -8,7 +8,7 @@ dependencies { implementation project(':vtm-extras') implementation project(':vtm-gdx-poi3d') implementation project(':vtm-http') - //implementation project(':vtm-jeo') + implementation project(':vtm-jeo') implementation project(':vtm-json') implementation project(':vtm-jts') implementation project(':vtm-models') diff --git a/vtm-playground/src/org/oscim/test/jeo/LayerTest.java b/vtm-playground/src/org/oscim/test/jeo/LayerTest.java index 84613275e..380b1532a 100644 --- a/vtm-playground/src/org/oscim/test/jeo/LayerTest.java +++ b/vtm-playground/src/org/oscim/test/jeo/LayerTest.java @@ -15,78 +15,78 @@ * You should have received a copy of the GNU Lesser General Public License along with * this program. If not, see . */ -//package org.oscim.test.jeo; -// -//import io.jeo.map.Style; -//import io.jeo.vector.VectorDataset; -//import org.oscim.backend.canvas.Color; -//import org.oscim.gdx.GdxMapApp; -//import org.oscim.layers.JeoVectorLayer; -//import org.oscim.layers.OSMIndoorLayer; -//import org.oscim.layers.tile.bitmap.BitmapTileLayer; -//import org.oscim.test.JeoTest; -//import org.oscim.theme.styles.TextStyle; -// -//import java.io.IOException; -//import java.io.InputStream; -//import java.net.URL; -//import java.net.URLConnection; -// -//import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER; -// -//public class LayerTest extends GdxMapApp { -// -// // from http://overpass-turbo.eu/s/2vp -// String PATH = "https://gist.githubusercontent.com/anonymous/09062103a66844a96048f25626078c8d/raw/1d3af6a5a55e9ea4adc9551fa633a051a44a5a9c/overpass.geojson"; -// -// private OSMIndoorLayer mIndoorLayer; -// -// @Override -// public void createLayers() { -// mMap.setBaseMap(new BitmapTileLayer(mMap, STAMEN_TONER.build())); -// -// mMap.addTask(new Runnable() { -// @Override -// public void run() { -// try { -// URL url = new URL(PATH); -// URLConnection conn = url.openConnection(); -// InputStream is = conn.getInputStream(); -// -// VectorDataset data = JeoTest.readGeoJson(is); -// Style style = JeoTest.getStyle(); -// TextStyle textStyle = TextStyle.builder() -// .isCaption(true) -// .fontSize(16).color(Color.BLACK) -// .strokeWidth(2.2f).strokeColor(Color.WHITE) -// .build(); -// mIndoorLayer = new OSMIndoorLayer(mMap, data, style, textStyle); -// mIndoorLayer.activeLevels[0] = true; -// mIndoorLayer.activeLevels[1] = true; -// mIndoorLayer.activeLevels[2] = true; -// mIndoorLayer.activeLevels[3] = true; -// -// mMap.layers().add(new JeoVectorLayer(mMap, data, style)); -// mMap.layers().add(mIndoorLayer); -// -// mMap.updateMap(true); -// -// } catch (IOException e) { -// e.printStackTrace(); -// } -// } -// }); -// -// mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16); -// -// //VectorDataset data = (VectorDataset) JeoTest.getJsonData("states.json", true); -// //Style style = JeoTest.getStyle(); -// //mMap.layers().add(new JeoVectorLayer(mMap, data, style)); -// -// } -// -// public static void main(String[] args) { -// GdxMapApp.init(); -// GdxMapApp.run(new LayerTest(), null, 256); -// } -//} +package org.oscim.test.jeo; + +import io.jeo.map.Style; +import io.jeo.vector.VectorDataset; +import org.oscim.backend.canvas.Color; +import org.oscim.gdx.GdxMapApp; +import org.oscim.layers.JeoVectorLayer; +import org.oscim.layers.OSMIndoorLayer; +import org.oscim.layers.tile.bitmap.BitmapTileLayer; +import org.oscim.test.JeoTest; +import org.oscim.theme.styles.TextStyle; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; + +import static org.oscim.tiling.source.bitmap.DefaultSources.STAMEN_TONER; + +public class LayerTest extends GdxMapApp { + + // from http://overpass-turbo.eu/s/2vp + String PATH = "https://gist.githubusercontent.com/anonymous/09062103a66844a96048f25626078c8d/raw/1d3af6a5a55e9ea4adc9551fa633a051a44a5a9c/overpass.geojson"; + + private OSMIndoorLayer mIndoorLayer; + + @Override + public void createLayers() { + mMap.setBaseMap(new BitmapTileLayer(mMap, STAMEN_TONER.build())); + + mMap.addTask(new Runnable() { + @Override + public void run() { + try { + URL url = new URL(PATH); + URLConnection conn = url.openConnection(); + InputStream is = conn.getInputStream(); + + VectorDataset data = JeoTest.readGeoJson(is); + Style style = JeoTest.getStyle(); + TextStyle textStyle = TextStyle.builder() + .isCaption(true) + .fontSize(16).color(Color.BLACK) + .strokeWidth(2.2f).strokeColor(Color.WHITE) + .build(); + mIndoorLayer = new OSMIndoorLayer(mMap, data, style, textStyle); + mIndoorLayer.activeLevels[0] = true; + mIndoorLayer.activeLevels[1] = true; + mIndoorLayer.activeLevels[2] = true; + mIndoorLayer.activeLevels[3] = true; + + mMap.layers().add(new JeoVectorLayer(mMap, data, style)); + mMap.layers().add(mIndoorLayer); + + mMap.updateMap(true); + + } catch (IOException e) { + e.printStackTrace(); + } + } + }); + + mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16); + + //VectorDataset data = (VectorDataset) JeoTest.getJsonData("states.json", true); + //Style style = JeoTest.getStyle(); + //mMap.layers().add(new JeoVectorLayer(mMap, data, style)); + + } + + public static void main(String[] args) { + GdxMapApp.init(); + GdxMapApp.run(new LayerTest(), null, 256); + } +} diff --git a/vtm-playground/src/org/oscim/test/jeo/ThemeTest.java b/vtm-playground/src/org/oscim/test/jeo/ThemeTest.java index adf0380bf..2bf05db83 100644 --- a/vtm-playground/src/org/oscim/test/jeo/ThemeTest.java +++ b/vtm-playground/src/org/oscim/test/jeo/ThemeTest.java @@ -14,37 +14,37 @@ * You should have received a copy of the GNU Lesser General Public License along with * this program. If not, see . */ -//package org.oscim.test.jeo; -// -//import org.oscim.gdx.GdxMapApp; -//import org.oscim.layers.tile.vector.VectorTileLayer; -//import org.oscim.renderer.MapRenderer; -//import org.oscim.theme.carto.RenderTheme; -//import org.oscim.tiling.source.OkHttpEngine; -//import org.oscim.tiling.source.UrlTileSource; -//import org.oscim.tiling.source.oscimap4.OSciMap4TileSource; -// -//public class ThemeTest extends GdxMapApp { -// -// public static void main(String[] args) { -// GdxMapApp.init(); -// GdxMapApp.run(new ThemeTest(), null, 256); -// } -// -// @Override -// public void createLayers() { -// UrlTileSource ts = OSciMap4TileSource.builder() -// .httpFactory(new OkHttpEngine.OkHttpFactory()) -// .build(); -// -// VectorTileLayer l = mMap.setBaseMap(ts); -// -// l.setTheme(new RenderTheme()); -// -// MapRenderer.setBackgroundColor(0xffcccccc); -// -// // mMap.getLayers().add(new LabelLayer(mMap, -// // mMapLayer.getTileLayer())); -// // mMap.getLayers().add(new JeoMapLayer(mMap)); -// } -//} +package org.oscim.test.jeo; + +import org.oscim.gdx.GdxMapApp; +import org.oscim.layers.tile.vector.VectorTileLayer; +import org.oscim.renderer.MapRenderer; +import org.oscim.theme.carto.RenderTheme; +import org.oscim.tiling.source.OkHttpEngine; +import org.oscim.tiling.source.UrlTileSource; +import org.oscim.tiling.source.oscimap4.OSciMap4TileSource; + +public class ThemeTest extends GdxMapApp { + + public static void main(String[] args) { + GdxMapApp.init(); + GdxMapApp.run(new ThemeTest(), null, 256); + } + + @Override + public void createLayers() { + UrlTileSource ts = OSciMap4TileSource.builder() + .httpFactory(new OkHttpEngine.OkHttpFactory()) + .build(); + + VectorTileLayer l = mMap.setBaseMap(ts); + + l.setTheme(new RenderTheme()); + + MapRenderer.setBackgroundColor(0xffcccccc); + + // mMap.getLayers().add(new LabelLayer(mMap, + // mMapLayer.getTileLayer())); + // mMap.getLayers().add(new JeoMapLayer(mMap)); + } +}