From 596337dd179f0bdb634627f67d57694ed718b665 Mon Sep 17 00:00:00 2001 From: Emux Date: Fri, 19 Jul 2024 13:54:14 +0300 Subject: [PATCH] Disable vtm-jeo again as its dependencies do not work --- docs/Changelog.md | 2 - settings.gradle | 2 +- vtm-android-example/AndroidManifest.xml | 4 +- vtm-android-example/build.gradle | 2 +- .../oscim/android/test/JeoIndoorActivity.java | 336 +++++++++--------- .../src/org/oscim/android/test/Samples.java | 2 +- vtm-playground/build.gradle | 2 +- .../src/org/oscim/test/jeo/LayerTest.java | 150 ++++---- .../src/org/oscim/test/jeo/ThemeTest.java | 68 ++-- 9 files changed, 283 insertions(+), 285 deletions(-) diff --git a/docs/Changelog.md b/docs/Changelog.md index 44cb26bdd..664bfcb31 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -3,8 +3,6 @@ ## New since 0.21.0 - `vtm-themes` change package [#1130](https://github.com/mapsforge/vtm/issues/1130) -- Enable `vtm-jeo` -- Disable `vtm-theme-comparator` - Minor improvements and bug fixes - [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.22.0) diff --git a/settings.gradle b/settings.gradle index 8b78e5078..fae53d518 100644 --- a/settings.gradle +++ b/settings.gradle @@ -29,7 +29,7 @@ include ':vtm-gdx-poi3d' include ':vtm-http' include ':vtm-ios' include ':vtm-ios-example' -include ':vtm-jeo' +//include ':vtm-jeo' include ':vtm-json' include ':vtm-jts' include ':vtm-models' diff --git a/vtm-android-example/AndroidManifest.xml b/vtm-android-example/AndroidManifest.xml index 6ed4e9f92..95fb8e66b 100644 --- a/vtm-android-example/AndroidManifest.xml +++ b/vtm-android-example/AndroidManifest.xml @@ -50,9 +50,9 @@ - + android:configChanges="keyboardHidden|orientation|screenSize" />--> diff --git a/vtm-android-example/build.gradle b/vtm-android-example/build.gradle index 4662f2fd8..43aaa8f94 100644 --- a/vtm-android-example/build.gradle +++ b/vtm-android-example/build.gradle @@ -5,7 +5,7 @@ dependencies { implementation project(':vtm-android-mvt') implementation project(':vtm-extras') implementation project(':vtm-http') - implementation project(':vtm-jeo') + //implementation project(':vtm-jeo') implementation project(':vtm-json') implementation project(':vtm-jts') implementation project(':vtm-mvt') diff --git a/vtm-android-example/src/org/oscim/android/test/JeoIndoorActivity.java b/vtm-android-example/src/org/oscim/android/test/JeoIndoorActivity.java index c28abc57f..61538119b 100644 --- a/vtm-android-example/src/org/oscim/android/test/JeoIndoorActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/JeoIndoorActivity.java @@ -15,171 +15,171 @@ * You should have received a copy of the GNU Lesser General Public License along with * this program. If not, see . */ -package org.oscim.android.test; - -import android.content.Context; -import android.os.Bundle; -import android.view.View; -import android.widget.Toast; -import android.widget.ToggleButton; -import io.jeo.map.Style; -import io.jeo.vector.VectorDataset; -import org.oscim.backend.CanvasAdapter; -import org.oscim.backend.canvas.Color; -import org.oscim.layers.OSMIndoorLayer; -import org.oscim.layers.tile.buildings.BuildingLayer; -import org.oscim.layers.tile.vector.labeling.LabelLayer; -import org.oscim.test.JeoTest; -import org.oscim.theme.internal.VtmThemes; -import org.oscim.theme.styles.TextStyle; -import org.oscim.utils.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; -import java.util.Arrays; - -public class JeoIndoorActivity extends BaseMapActivity { - public static final Logger log = LoggerFactory.getLogger(JeoIndoorActivity.class); - - // from http://overpass-turbo.eu/s/2vp - String PATH = "https://gist.githubusercontent.com/anonymous/09062103a66844a96048f25626078c8d/raw/1d3af6a5a55e9ea4adc9551fa633a051a44a5a9c/overpass.geojson"; - - private OSMIndoorLayer mIndoorLayer; - - public JeoIndoorActivity() { - super(R.layout.jeo_indoor_map); - } - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - mMap.addTask(new Runnable() { - @Override - public void run() { - showToast("load data"); - InputStream is = null; - try { - // File file = new File(Environment.getExternalStorageDirectory() - // .getAbsolutePath(), "osmindoor.json"); - // is = new FileInputStream(file); - - URL url = new URL(PATH); - URLConnection conn = url.openConnection(); - is = conn.getInputStream(); - loadJson(is); - } catch (IOException e) { - e.printStackTrace(); - } finally { - IOUtils.closeQuietly(is); - } - } - }); - - mMap.setTheme(VtmThemes.DEFAULT); - - mMap.layers().add(new BuildingLayer(mMap, mBaseLayer)); - mMap.layers().add(new LabelLayer(mMap, mBaseLayer)); - - // String file = Environment.getExternalStorageDirectory().getAbsolutePath(); - // VectorDataset data = (VectorDataset) JeoTest.getJsonData(file + "/states.json", true); - // Style style = JeoTest.getStyle(); - // mMap.layers().add(new JeoVectorLayer(mMap, data, style)); - } - - void loadJson(InputStream is) { - showToast("got data"); - - VectorDataset data = JeoTest.readGeoJson(is); - Style style = JeoTest.getStyle(); - TextStyle textStyle = TextStyle.builder() - .isCaption(true) - .fontSize(16 * CanvasAdapter.getScale()).color(Color.BLACK) - .strokeWidth(2.2f * CanvasAdapter.getScale()).strokeColor(Color.WHITE) - .build(); - mIndoorLayer = new OSMIndoorLayer(mMap, data, style, textStyle); - mMap.layers().add(mIndoorLayer); - - showToast("data ready"); - mMap.updateMap(true); - - mIndoorLayer.activeLevels[0] = true; - shift(); - } - - public void showToast(final String text) { - final Context ctx = this; - runOnUiThread(new Runnable() { - @Override - public void run() { - Toast toast = Toast.makeText(ctx, text, Toast.LENGTH_SHORT); - toast.show(); - } - }); - } - - boolean mShift = true; - - public void shift() { - if (!mShift) - return; - - mMap.postDelayed(new Runnable() { - - @Override - public void run() { - for (int i = 0; i < 10; i++) { - if (mIndoorLayer.activeLevels[i]) { - mIndoorLayer.activeLevels[i] = false; - mIndoorLayer.activeLevels[(i + 1) % 9] = true; - mIndoorLayer.update(); - break; - } - } - shift(); - } - }, 200); - - } - - public void onClick(View v) { - mShift = false; - - if (mIndoorLayer == null) - return; - - int i = 0; - - if (v instanceof ToggleButton) { - ToggleButton b = (ToggleButton) v; - i = (b.getTextOn().charAt(0) - '0') + 1; - } - - if (i < 0 || i > 9) - i = 0; - - mIndoorLayer.activeLevels[i] ^= true; - if (v instanceof ToggleButton) - ((ToggleButton) v).setChecked(mIndoorLayer.activeLevels[i]); - log.debug(Arrays.toString(mIndoorLayer.activeLevels)); - mIndoorLayer.update(); - } - - @Override - protected void onStop() { - super.onStop(); - } - - @Override - protected void onResume() { - super.onResume(); - - /* ignore saved position */ - //mMap.setMapPosition(49.417, 8.673, 1 << 17); - mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16); - } -} +//package org.oscim.android.test; +// +//import android.content.Context; +//import android.os.Bundle; +//import android.view.View; +//import android.widget.Toast; +//import android.widget.ToggleButton; +//import io.jeo.map.Style; +//import io.jeo.vector.VectorDataset; +//import org.oscim.backend.CanvasAdapter; +//import org.oscim.backend.canvas.Color; +//import org.oscim.layers.OSMIndoorLayer; +//import org.oscim.layers.tile.buildings.BuildingLayer; +//import org.oscim.layers.tile.vector.labeling.LabelLayer; +//import org.oscim.test.JeoTest; +//import org.oscim.theme.internal.VtmThemes; +//import org.oscim.theme.styles.TextStyle; +//import org.oscim.utils.IOUtils; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +// +//import java.io.IOException; +//import java.io.InputStream; +//import java.net.URL; +//import java.net.URLConnection; +//import java.util.Arrays; +// +//public class JeoIndoorActivity extends BaseMapActivity { +// public static final Logger log = LoggerFactory.getLogger(JeoIndoorActivity.class); +// +// // from http://overpass-turbo.eu/s/2vp +// String PATH = "https://gist.githubusercontent.com/anonymous/09062103a66844a96048f25626078c8d/raw/1d3af6a5a55e9ea4adc9551fa633a051a44a5a9c/overpass.geojson"; +// +// private OSMIndoorLayer mIndoorLayer; +// +// public JeoIndoorActivity() { +// super(R.layout.jeo_indoor_map); +// } +// +// @Override +// public void onCreate(Bundle savedInstanceState) { +// super.onCreate(savedInstanceState); +// +// mMap.addTask(new Runnable() { +// @Override +// public void run() { +// showToast("load data"); +// InputStream is = null; +// try { +// // File file = new File(Environment.getExternalStorageDirectory() +// // .getAbsolutePath(), "osmindoor.json"); +// // is = new FileInputStream(file); +// +// URL url = new URL(PATH); +// URLConnection conn = url.openConnection(); +// is = conn.getInputStream(); +// loadJson(is); +// } catch (IOException e) { +// e.printStackTrace(); +// } finally { +// IOUtils.closeQuietly(is); +// } +// } +// }); +// +// mMap.setTheme(VtmThemes.DEFAULT); +// +// mMap.layers().add(new BuildingLayer(mMap, mBaseLayer)); +// mMap.layers().add(new LabelLayer(mMap, mBaseLayer)); +// +// // String file = Environment.getExternalStorageDirectory().getAbsolutePath(); +// // VectorDataset data = (VectorDataset) JeoTest.getJsonData(file + "/states.json", true); +// // Style style = JeoTest.getStyle(); +// // mMap.layers().add(new JeoVectorLayer(mMap, data, style)); +// } +// +// void loadJson(InputStream is) { +// showToast("got data"); +// +// VectorDataset data = JeoTest.readGeoJson(is); +// Style style = JeoTest.getStyle(); +// TextStyle textStyle = TextStyle.builder() +// .isCaption(true) +// .fontSize(16 * CanvasAdapter.getScale()).color(Color.BLACK) +// .strokeWidth(2.2f * CanvasAdapter.getScale()).strokeColor(Color.WHITE) +// .build(); +// mIndoorLayer = new OSMIndoorLayer(mMap, data, style, textStyle); +// mMap.layers().add(mIndoorLayer); +// +// showToast("data ready"); +// mMap.updateMap(true); +// +// mIndoorLayer.activeLevels[0] = true; +// shift(); +// } +// +// public void showToast(final String text) { +// final Context ctx = this; +// runOnUiThread(new Runnable() { +// @Override +// public void run() { +// Toast toast = Toast.makeText(ctx, text, Toast.LENGTH_SHORT); +// toast.show(); +// } +// }); +// } +// +// boolean mShift = true; +// +// public void shift() { +// if (!mShift) +// return; +// +// mMap.postDelayed(new Runnable() { +// +// @Override +// public void run() { +// for (int i = 0; i < 10; i++) { +// if (mIndoorLayer.activeLevels[i]) { +// mIndoorLayer.activeLevels[i] = false; +// mIndoorLayer.activeLevels[(i + 1) % 9] = true; +// mIndoorLayer.update(); +// break; +// } +// } +// shift(); +// } +// }, 200); +// +// } +// +// public void onClick(View v) { +// mShift = false; +// +// if (mIndoorLayer == null) +// return; +// +// int i = 0; +// +// if (v instanceof ToggleButton) { +// ToggleButton b = (ToggleButton) v; +// i = (b.getTextOn().charAt(0) - '0') + 1; +// } +// +// if (i < 0 || i > 9) +// i = 0; +// +// mIndoorLayer.activeLevels[i] ^= true; +// if (v instanceof ToggleButton) +// ((ToggleButton) v).setChecked(mIndoorLayer.activeLevels[i]); +// log.debug(Arrays.toString(mIndoorLayer.activeLevels)); +// mIndoorLayer.update(); +// } +// +// @Override +// protected void onStop() { +// super.onStop(); +// } +// +// @Override +// protected void onResume() { +// super.onResume(); +// +// /* ignore saved position */ +// //mMap.setMapPosition(49.417, 8.673, 1 << 17); +// mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16); +// } +//} diff --git a/vtm-android-example/src/org/oscim/android/test/Samples.java b/vtm-android-example/src/org/oscim/android/test/Samples.java index 32cd113a0..800a2544f 100644 --- a/vtm-android-example/src/org/oscim/android/test/Samples.java +++ b/vtm-android-example/src/org/oscim/android/test/Samples.java @@ -121,7 +121,7 @@ protected void onCreate(Bundle savedInstanceState) { linearLayout.addView(createLabel("Experiments")); linearLayout.addView(createButton(ReverseGeocodeActivity.class)); linearLayout.addView(createButton(ThemeStylerActivity.class)); - linearLayout.addView(createButton(JeoIndoorActivity.class)); + //linearLayout.addView(createButton(JeoIndoorActivity.class)); linearLayout.addView(createButton(GdxPoi3DActivity.class)); linearLayout.addView(createButton(OverpassActivity.class)); linearLayout.addView(createButton(DraggableMarkerOverlayActivity.class)); diff --git a/vtm-playground/build.gradle b/vtm-playground/build.gradle index 5dd8b4405..015c38420 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 380b1532a..84613275e 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 2bf05db83..adf0380bf 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)); +// } +//}