use MapPosition.copy(other)

This commit is contained in:
Hannes Janetzek
2013-10-09 01:55:57 +02:00
parent 72741ced7f
commit a818e2f062
6 changed files with 23 additions and 14 deletions
+10 -1
View File
@@ -15,7 +15,6 @@
*/
package org.oscim.core;
/** A MapPosition Container. */
public class MapPosition {
@@ -70,6 +69,16 @@ public class MapPosition {
this.y = MercatorProjection.latitudeToPixelY(latitude, zoomLevel);
}
public void copy(MapPosition other) {
this.zoomLevel = other.zoomLevel;
this.scale = other.scale;
this.lat = other.lat;
this.lon = other.lon;
this.angle = other.angle;
this.x = other.x;
this.y = other.y;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
+1 -1
View File
@@ -109,7 +109,7 @@ public class PathOverlay extends Overlay {
int size = mSize;
// keep position to render relative to current state
updateMapPosition();
mMapPosition.copy(curPos);
// items are placed relative to scale == 1
mMapPosition.scale = 1;
@@ -65,7 +65,7 @@ public class CustomOverlay extends RenderOverlay {
newData = true;
// fix current MapPosition
updateMapPosition();
mMapPosition.copy(curPos);
}
}
@@ -108,7 +108,7 @@ public class GridOverlay extends BasicOverlay {
public synchronized void update(MapPosition curPos, boolean positionChanged,
boolean tilesChanged, Matrices matrices) {
updateMapPosition();
mMapPosition.copy(curPos);
// fix map position to tile coordinates
float size = Tile.TILE_SIZE;
@@ -117,12 +117,12 @@ public abstract class RenderOverlay {
setMatrix(curPos, m, true);
}
/**
* Utility: update mMapPosition
*
* @return true if position has changed
*/
protected boolean updateMapPosition() {
return mMapView.getMapViewPosition().getMapPosition(mMapPosition);
}
// /**
// * Utility: update mMapPosition
// *
// * @return true if position has changed
// */
// protected boolean updateMapPosition() {
// return mMapView.getMapViewPosition().getMapPosition(mMapPosition);
// }
}
@@ -125,11 +125,11 @@ public class TestOverlay extends BasicOverlay {
public synchronized void update(MapPosition curPos, boolean positionChanged,
boolean tilesChanged, Matrices matrices) {
// keep position constant (or update layer relative to new position)
//mMapView.getMapViewPosition().getMapPosition(mMapPosition, null);
//mMapPosition.copy(curPos);
if (first) {
// fix at initial position
updateMapPosition();
mMapPosition.copy(curPos);
first = false;
//((SymbolLayer) (layers.textureLayers)).prepare();