Skip to content

Commit

Permalink
MapViewPosition2 parameter and sample mapsforge#1044
Browse files Browse the repository at this point in the history
  • Loading branch information
devemux86 committed Mar 16, 2018
1 parent cd50e01 commit 70c2778
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

public final class Parameters {

/**
* If true the <code>MapViewPosition2</code> will be used instead of default <code>MapViewPosition</code>.
*/
public static boolean MAP_VIEW_POSITION2 = false;

/**
* Maximum buffer size for map files.
*/
Expand Down
12 changes: 11 additions & 1 deletion mapsforge-map/src/main/java/org/mapsforge/map/model/Model.java
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,14 +16,23 @@
*/
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;

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) {
Expand Down
3 changes: 3 additions & 0 deletions mapsforge-samples-android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<activity
android:name=".LongPressAction"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".MapViewPosition2Viewer"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".MoveAnimation"
android:configChanges="keyboardHidden|orientation|screenSize" />
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 70c2778

Please sign in to comment.