diff --git a/docs/Changelog.md b/docs/Changelog.md
index 0490dbea5..300455366 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -6,6 +6,7 @@
- MyLocationOverlay implementation [#1035](https://github.com/mapsforge/mapsforge/issues/1035)
- Tile sources with api keys [#1028](https://github.com/mapsforge/mapsforge/issues/1028)
- Render theme fallback internal resources [#1026](https://github.com/mapsforge/mapsforge/issues/1026)
+- MapViewPosition interface [#1044](https://github.com/mapsforge/mapsforge/pull/1044)
- JTS (LocationTech) [#1027](https://github.com/mapsforge/mapsforge/issues/1027)
- Many other minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/mapsforge/issues?q=is%3Aclosed+milestone%3A0.10.0)
diff --git a/mapsforge-core/src/main/java/org/mapsforge/core/util/Parameters.java b/mapsforge-core/src/main/java/org/mapsforge/core/util/Parameters.java
index c05126eeb..676a7523a 100644
--- a/mapsforge-core/src/main/java/org/mapsforge/core/util/Parameters.java
+++ b/mapsforge-core/src/main/java/org/mapsforge/core/util/Parameters.java
@@ -16,6 +16,11 @@
public final class Parameters {
+ /**
+ * If true the MapViewPosition2
will be used instead of default MapViewPosition
.
+ */
+ public static boolean MAP_VIEW_POSITION2 = false;
+
/**
* Maximum buffer size for map files.
*/
diff --git a/mapsforge-map/src/main/java/org/mapsforge/map/model/Model.java b/mapsforge-map/src/main/java/org/mapsforge/map/model/Model.java
index a33d03e4e..1c8eec059 100644
--- a/mapsforge-map/src/main/java/org/mapsforge/map/model/Model.java
+++ b/mapsforge-map/src/main/java/org/mapsforge/map/model/Model.java
@@ -1,6 +1,7 @@
/*
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
* Copyright 2014 Ludwig M Brinckmann
+ * Copyright 2018 devemux86
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
@@ -15,6 +16,7 @@
*/
package org.mapsforge.map.model;
+import org.mapsforge.core.util.Parameters;
import org.mapsforge.map.model.common.Persistable;
import org.mapsforge.map.model.common.PreferencesFacade;
@@ -22,7 +24,15 @@ public class Model implements Persistable {
public final DisplayModel displayModel = new DisplayModel();
public final FrameBufferModel frameBufferModel = new FrameBufferModel();
public final MapViewDimension mapViewDimension = new MapViewDimension();
- public final MapViewPosition mapViewPosition = new MapViewPosition(displayModel);
+ public final IMapViewPosition mapViewPosition;
+
+ public Model() {
+ if (Parameters.MAP_VIEW_POSITION2) {
+ mapViewPosition = new MapViewPosition2(displayModel);
+ } else {
+ mapViewPosition = new MapViewPosition(displayModel);
+ }
+ }
@Override
public void init(PreferencesFacade preferencesFacade) {
diff --git a/mapsforge-samples-android/AndroidManifest.xml b/mapsforge-samples-android/AndroidManifest.xml
index 1c612de9a..fd04c51fc 100644
--- a/mapsforge-samples-android/AndroidManifest.xml
+++ b/mapsforge-samples-android/AndroidManifest.xml
@@ -126,6 +126,9 @@
+
diff --git a/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/MapViewPosition2Viewer.java b/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/MapViewPosition2Viewer.java
new file mode 100644
index 000000000..978fa7cf9
--- /dev/null
+++ b/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/MapViewPosition2Viewer.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2018 devemux86
+ *
+ * This program is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with
+ * this program. If not, see .
+ */
+package org.mapsforge.samples.android;
+
+import android.os.Bundle;
+
+import org.mapsforge.core.util.Parameters;
+
+public class MapViewPosition2Viewer extends DefaultTheme {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ Parameters.MAP_VIEW_POSITION2 = true;
+
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+
+ Parameters.MAP_VIEW_POSITION2 = false;
+ }
+}
diff --git a/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/Samples.java b/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/Samples.java
index 6923648f6..6ff33a3ac 100644
--- a/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/Samples.java
+++ b/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/Samples.java
@@ -186,6 +186,7 @@ public void onClick(DialogInterface dialog, int which) {
linearLayout.addView(createButton(HillshadingCompareMapViewer.class));
linearLayout.addView(createButton(ReverseGeocodeViewer.class));
linearLayout.addView(createButton(NightModeViewer.class));
+ linearLayout.addView(createButton(MapViewPosition2Viewer.class));
linearLayout.addView(createButton(RenderThemeChanger.class));
linearLayout.addView(createButton(TileSizeChanger.class));
linearLayout.addView(createButton(StackedLayersMapViewer.class));