Permalink
Browse files

MapViewPosition interface (#1044)

  • Loading branch information...
mikes222 authored and devemux86 committed Mar 15, 2018
1 parent 1effa33 commit cd50e018c5f1d829e49d612a6e9d8480f6f92f29
Showing with 407 additions and 54 deletions.
  1. +6 −0 mapsforge-core/src/main/java/org/mapsforge/core/graphics/Matrix.java
  2. +3 −3 mapsforge-map-android/src/main/java/org/mapsforge/map/android/input/TouchGestureHandler.java
  3. +4 −4 mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java
  4. +4 −4 mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/MapViewPositionObserver.java
  5. +2 −2 mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/MapViewerTemplate.java
  6. +3 −3 mapsforge-map/src/main/java/org/mapsforge/map/layer/LayerManager.java
  7. +4 −4 mapsforge-map/src/main/java/org/mapsforge/map/layer/TileLayer.java
  8. +2 −2 mapsforge-map/src/main/java/org/mapsforge/map/layer/download/TileDownloadLayer.java
  9. +3 −3 mapsforge-map/src/main/java/org/mapsforge/map/layer/queue/JobQueue.java
  10. +4 −4 mapsforge-map/src/main/java/org/mapsforge/map/layer/renderer/TileRendererLayer.java
  11. +2 −2 mapsforge-map/src/main/java/org/mapsforge/map/layer/tilestore/TileStoreLayer.java
  12. +282 −0 mapsforge-map/src/main/java/org/mapsforge/map/model/IMapViewPosition.java
  13. +28 −2 mapsforge-map/src/main/java/org/mapsforge/map/model/MapViewPosition.java
  14. +29 −0 mapsforge-map/src/main/java/org/mapsforge/map/model/MapViewPosition2.java
  15. +3 −3 mapsforge-map/src/main/java/org/mapsforge/map/scalebar/DefaultMapScaleBar.java
  16. +3 −3 mapsforge-map/src/main/java/org/mapsforge/map/scalebar/MapScaleBar.java
  17. +10 −0 mapsforge-map/src/main/java/org/mapsforge/map/view/FrameBuffer.java
  18. +2 −2 mapsforge-samples-android/src/androidTest/org/mapsforge/samples/android/test/BubbleOverlayTest.java
  19. +4 −4 mapsforge-samples-android/src/androidTest/org/mapsforge/samples/android/test/TestUtils.java
  20. +2 −2 mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/SamplesBaseActivity.java
  21. +2 −2 mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/cluster/ClusterManager.java
  22. +2 −2 mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/scalebar/MapScaleBarImpl.java
  23. +3 −3 mapsforge-samples-awt/src/main/java/org/mapsforge/samples/awt/Samples.java
@@ -27,6 +27,12 @@
*/
void rotate(float theta, float pivotX, float pivotY);
/**
* Scale around center.
*
* @param scaleX the scale factor in x-direction
* @param scaleY the scale factor in y-direction
*/
void scale(float scaleX, float scaleY);
void scale(float scaleX, float scaleY, float pivotX, float pivotY);
@@ -28,7 +28,7 @@
import org.mapsforge.core.model.Point;
import org.mapsforge.map.android.view.MapView;
import org.mapsforge.map.layer.Layer;
import org.mapsforge.map.model.MapViewPosition;
import org.mapsforge.map.model.IMapViewPosition;
/**
* Central handling of touch gestures.
@@ -84,7 +84,7 @@ public boolean onDoubleTapEvent(MotionEvent e) {
case MotionEvent.ACTION_UP:
// Quick scale in between (cancel double tap)
if (this.isInDoubleTap) {
MapViewPosition mapViewPosition = this.mapView.getModel().mapViewPosition;
IMapViewPosition mapViewPosition = this.mapView.getModel().mapViewPosition;
if (mapViewPosition.getZoomLevel() < mapViewPosition.getZoomLevelMax()) {
Point center = this.mapView.getModel().mapViewDimension.getDimension().getCenter();
byte zoomLevelDiff = 1;
@@ -181,7 +181,7 @@ public void onScaleEnd(ScaleGestureDetector detector) {
zoomLevelDiff = (byte) Math.round(zoomLevelOffset);
}
MapViewPosition mapViewPosition = this.mapView.getModel().mapViewPosition;
IMapViewPosition mapViewPosition = this.mapView.getModel().mapViewPosition;
if (zoomLevelDiff != 0 && pivot != null) {
// Zoom with focus
double moveHorizontal = 0, moveVertical = 0;
@@ -39,7 +39,7 @@
import org.mapsforge.map.layer.cache.TwoLevelTileCache;
import org.mapsforge.map.layer.hills.HillsRenderConfig;
import org.mapsforge.map.layer.renderer.TileRendererLayer;
import org.mapsforge.map.model.MapViewPosition;
import org.mapsforge.map.model.IMapViewPosition;
import org.mapsforge.map.rendertheme.XmlRenderTheme;
import org.mapsforge.map.scalebar.DefaultMapScaleBar;
import org.mapsforge.map.scalebar.DistanceUnitAdapter;
@@ -233,7 +233,7 @@ public static TileCache createTileCache(Context c, String id, int tileSize, int
* @return the layer
*/
public static TileRendererLayer createTileRendererLayer(
TileCache tileCache, MapViewPosition mapViewPosition,
TileCache tileCache, IMapViewPosition mapViewPosition,
MapDataStore mapFile, XmlRenderTheme renderTheme) {
TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache, mapFile,
mapViewPosition, AndroidGraphicFactory.INSTANCE);
@@ -254,7 +254,7 @@ public static TileRendererLayer createTileRendererLayer(
* @return the layer
*/
public static TileRendererLayer createTileRendererLayer(
TileCache tileCache, MapViewPosition mapViewPosition,
TileCache tileCache, IMapViewPosition mapViewPosition,
MapDataStore mapFile, XmlRenderTheme renderTheme, boolean hasAlpha,
boolean renderLabels, boolean cacheLabels) {
TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache, mapFile,
@@ -277,7 +277,7 @@ public static TileRendererLayer createTileRendererLayer(
* @return the layer
*/
public static TileRendererLayer createTileRendererLayer(
TileCache tileCache, MapViewPosition mapViewPosition,
TileCache tileCache, IMapViewPosition mapViewPosition,
MapDataStore mapFile, XmlRenderTheme renderTheme, boolean hasAlpha,
boolean renderLabels, boolean cacheLabels, HillsRenderConfig hillsRenderConfig) {
TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache, mapFile,
@@ -15,7 +15,7 @@
*/
package org.mapsforge.map.android.util;
import org.mapsforge.map.model.MapViewPosition;
import org.mapsforge.map.model.IMapViewPosition;
import org.mapsforge.map.model.common.Observer;
/**
@@ -24,10 +24,10 @@
* map views where one is supposed to follow the other.
*/
public class MapViewPositionObserver implements Observer {
private final MapViewPosition observable;
private final MapViewPosition observer;
private final IMapViewPosition observable;
private final IMapViewPosition observer;
public MapViewPositionObserver(MapViewPosition observable, MapViewPosition observer) {
public MapViewPositionObserver(IMapViewPosition observable, IMapViewPosition observer) {
this.observable = observable;
this.observer = observer;
observable.addObserver(this);
@@ -28,7 +28,7 @@
import org.mapsforge.map.datastore.MapDataStore;
import org.mapsforge.map.layer.cache.TileCache;
import org.mapsforge.map.layer.hills.HillsRenderConfig;
import org.mapsforge.map.model.MapViewPosition;
import org.mapsforge.map.model.IMapViewPosition;
import org.mapsforge.map.model.common.PreferencesFacade;
import org.mapsforge.map.reader.MapFile;
import org.mapsforge.map.rendertheme.XmlRenderTheme;
@@ -249,7 +249,7 @@ protected boolean isZoomControlsAutoHide() {
* @param mvp the map view position to be set
* @return the mapviewposition set
*/
protected MapViewPosition initializePosition(MapViewPosition mvp) {
protected IMapViewPosition initializePosition(IMapViewPosition mvp) {
LatLong center = mvp.getCenter();
if (center.equals(new LatLong(0, 0))) {
@@ -24,7 +24,7 @@
import org.mapsforge.core.model.Dimension;
import org.mapsforge.core.model.MapPosition;
import org.mapsforge.core.model.Point;
import org.mapsforge.map.model.MapViewPosition;
import org.mapsforge.map.model.IMapViewPosition;
import org.mapsforge.map.util.MapPositionUtil;
import org.mapsforge.map.util.PausableThread;
import org.mapsforge.map.view.FrameBuffer;
@@ -36,11 +36,11 @@
private final Canvas drawingCanvas;
private final Layers layers;
private final MapView mapView;
private final MapViewPosition mapViewPosition;
private final IMapViewPosition mapViewPosition;
private boolean redrawNeeded;
public LayerManager(MapView mapView, MapViewPosition mapViewPosition, GraphicFactory graphicFactory) {
public LayerManager(MapView mapView, IMapViewPosition mapViewPosition, GraphicFactory graphicFactory) {
super();
this.mapView = mapView;
@@ -27,7 +27,7 @@
import org.mapsforge.map.layer.queue.Job;
import org.mapsforge.map.layer.queue.JobQueue;
import org.mapsforge.map.model.DisplayModel;
import org.mapsforge.map.model.MapViewPosition;
import org.mapsforge.map.model.IMapViewPosition;
import org.mapsforge.map.util.LayerUtil;
import java.util.HashSet;
@@ -39,14 +39,14 @@
protected final boolean isTransparent;
protected JobQueue<T> jobQueue;
protected final TileCache tileCache;
private final MapViewPosition mapViewPosition;
private final IMapViewPosition mapViewPosition;
private final Matrix matrix;
public TileLayer(TileCache tileCache, MapViewPosition mapViewPosition, Matrix matrix, boolean isTransparent) {
public TileLayer(TileCache tileCache, IMapViewPosition mapViewPosition, Matrix matrix, boolean isTransparent) {
this(tileCache, mapViewPosition, matrix, isTransparent, true);
}
public TileLayer(TileCache tileCache, MapViewPosition mapViewPosition, Matrix matrix, boolean isTransparent, boolean hasJobQueue) {
public TileLayer(TileCache tileCache, IMapViewPosition mapViewPosition, Matrix matrix, boolean isTransparent, boolean hasJobQueue) {
super();
if (tileCache == null) {
@@ -25,7 +25,7 @@
import org.mapsforge.map.layer.cache.TileCache;
import org.mapsforge.map.layer.download.tilesource.TileSource;
import org.mapsforge.map.model.DisplayModel;
import org.mapsforge.map.model.MapViewPosition;
import org.mapsforge.map.model.IMapViewPosition;
import org.mapsforge.map.model.common.Observer;
public class TileDownloadLayer extends TileLayer<DownloadJob> implements Observer {
@@ -38,7 +38,7 @@
private TileDownloadThread[] tileDownloadThreads;
private final TileSource tileSource;
public TileDownloadLayer(TileCache tileCache, MapViewPosition mapViewPosition, TileSource tileSource,
public TileDownloadLayer(TileCache tileCache, IMapViewPosition mapViewPosition, TileSource tileSource,
GraphicFactory graphicFactory) {
super(tileCache, mapViewPosition, graphicFactory.createMatrix(), tileSource.hasAlpha());
@@ -17,7 +17,7 @@
package org.mapsforge.map.layer.queue;
import org.mapsforge.map.model.DisplayModel;
import org.mapsforge.map.model.MapViewPosition;
import org.mapsforge.map.model.IMapViewPosition;
import java.util.Collections;
import java.util.LinkedList;
@@ -29,11 +29,11 @@
private final List<T> assignedJobs = new LinkedList<>();
private final DisplayModel displayModel;
private boolean isInterrupted;
private final MapViewPosition mapViewPosition;
private final IMapViewPosition mapViewPosition;
private final List<QueueItem<T>> queueItems = new LinkedList<>();
private boolean scheduleNeeded;
public JobQueue(MapViewPosition mapViewPosition, DisplayModel displayModel) {
public JobQueue(IMapViewPosition mapViewPosition, DisplayModel displayModel) {
this.mapViewPosition = mapViewPosition;
this.displayModel = displayModel;
}
@@ -29,7 +29,7 @@
import org.mapsforge.map.layer.labels.LabelStore;
import org.mapsforge.map.layer.labels.TileBasedLabelStore;
import org.mapsforge.map.model.DisplayModel;
import org.mapsforge.map.model.MapViewPosition;
import org.mapsforge.map.model.IMapViewPosition;
import org.mapsforge.map.model.common.Observer;
import org.mapsforge.map.rendertheme.XmlRenderTheme;
import org.mapsforge.map.rendertheme.rule.RenderThemeFuture;
@@ -55,7 +55,7 @@
* @param mapViewPosition the mapViewPosition to know which tiles to render
* @param graphicFactory the graphicFactory to carry out platform specific operations
*/
public TileRendererLayer(TileCache tileCache, MapDataStore mapDataStore, MapViewPosition mapViewPosition,
public TileRendererLayer(TileCache tileCache, MapDataStore mapDataStore, IMapViewPosition mapViewPosition,
GraphicFactory graphicFactory) {
this(tileCache, mapDataStore, mapViewPosition, false, true, false, graphicFactory);
}
@@ -71,7 +71,7 @@ public TileRendererLayer(TileCache tileCache, MapDataStore mapDataStore, MapView
* @param cacheLabels true if labels should be cached in a LabelStore
* @param graphicFactory the graphicFactory to carry out platform specific operations
*/
public TileRendererLayer(TileCache tileCache, MapDataStore mapDataStore, MapViewPosition mapViewPosition,
public TileRendererLayer(TileCache tileCache, MapDataStore mapDataStore, IMapViewPosition mapViewPosition,
boolean isTransparent, boolean renderLabels, boolean cacheLabels,
GraphicFactory graphicFactory) {
this(tileCache, mapDataStore, mapViewPosition, isTransparent, renderLabels, cacheLabels, graphicFactory, null);
@@ -89,7 +89,7 @@ public TileRendererLayer(TileCache tileCache, MapDataStore mapDataStore, MapView
* @param graphicFactory the graphicFactory to carry out platform specific operations
* @param hillsRenderConfig the hillshading setup to be used (can be null)
*/
public TileRendererLayer(TileCache tileCache, MapDataStore mapDataStore, MapViewPosition mapViewPosition,
public TileRendererLayer(TileCache tileCache, MapDataStore mapDataStore, IMapViewPosition mapViewPosition,
boolean isTransparent, boolean renderLabels, boolean cacheLabels,
GraphicFactory graphicFactory, HillsRenderConfig hillsRenderConfig) {
super(tileCache, mapViewPosition, graphicFactory.createMatrix(), isTransparent);
@@ -20,12 +20,12 @@
import org.mapsforge.map.layer.TileLayer;
import org.mapsforge.map.layer.cache.TileCache;
import org.mapsforge.map.layer.queue.Job;
import org.mapsforge.map.model.MapViewPosition;
import org.mapsforge.map.model.IMapViewPosition;
public class TileStoreLayer extends TileLayer<Job> {
public TileStoreLayer(TileCache tileCache, MapViewPosition mapViewPosition, GraphicFactory graphicFactory, boolean isTransparent) {
public TileStoreLayer(TileCache tileCache, IMapViewPosition mapViewPosition, GraphicFactory graphicFactory, boolean isTransparent) {
super(tileCache, mapViewPosition, graphicFactory.createMatrix(), isTransparent, false);
}
Oops, something went wrong.

0 comments on commit cd50e01

Please sign in to comment.