use MapPosition.copy(other)
This commit is contained in:
parent
72741ced7f
commit
a818e2f062
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.core;
|
package org.oscim.core;
|
||||||
|
|
||||||
|
|
||||||
/** A MapPosition Container. */
|
/** A MapPosition Container. */
|
||||||
public class MapPosition {
|
public class MapPosition {
|
||||||
|
|
||||||
@ -70,6 +69,16 @@ public class MapPosition {
|
|||||||
this.y = MercatorProjection.latitudeToPixelY(latitude, zoomLevel);
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|||||||
@ -109,7 +109,7 @@ public class PathOverlay extends Overlay {
|
|||||||
int size = mSize;
|
int size = mSize;
|
||||||
|
|
||||||
// keep position to render relative to current state
|
// keep position to render relative to current state
|
||||||
updateMapPosition();
|
mMapPosition.copy(curPos);
|
||||||
|
|
||||||
// items are placed relative to scale == 1
|
// items are placed relative to scale == 1
|
||||||
mMapPosition.scale = 1;
|
mMapPosition.scale = 1;
|
||||||
|
|||||||
@ -65,7 +65,7 @@ public class CustomOverlay extends RenderOverlay {
|
|||||||
newData = true;
|
newData = true;
|
||||||
|
|
||||||
// fix current MapPosition
|
// fix current MapPosition
|
||||||
updateMapPosition();
|
mMapPosition.copy(curPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -108,7 +108,7 @@ public class GridOverlay extends BasicOverlay {
|
|||||||
public synchronized void update(MapPosition curPos, boolean positionChanged,
|
public synchronized void update(MapPosition curPos, boolean positionChanged,
|
||||||
boolean tilesChanged, Matrices matrices) {
|
boolean tilesChanged, Matrices matrices) {
|
||||||
|
|
||||||
updateMapPosition();
|
mMapPosition.copy(curPos);
|
||||||
|
|
||||||
// fix map position to tile coordinates
|
// fix map position to tile coordinates
|
||||||
float size = Tile.TILE_SIZE;
|
float size = Tile.TILE_SIZE;
|
||||||
|
|||||||
@ -117,12 +117,12 @@ public abstract class RenderOverlay {
|
|||||||
setMatrix(curPos, m, true);
|
setMatrix(curPos, m, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Utility: update mMapPosition
|
// * Utility: update mMapPosition
|
||||||
*
|
// *
|
||||||
* @return true if position has changed
|
// * @return true if position has changed
|
||||||
*/
|
// */
|
||||||
protected boolean updateMapPosition() {
|
// protected boolean updateMapPosition() {
|
||||||
return mMapView.getMapViewPosition().getMapPosition(mMapPosition);
|
// return mMapView.getMapViewPosition().getMapPosition(mMapPosition);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -125,11 +125,11 @@ public class TestOverlay extends BasicOverlay {
|
|||||||
public synchronized void update(MapPosition curPos, boolean positionChanged,
|
public synchronized void update(MapPosition curPos, boolean positionChanged,
|
||||||
boolean tilesChanged, Matrices matrices) {
|
boolean tilesChanged, Matrices matrices) {
|
||||||
// keep position constant (or update layer relative to new position)
|
// keep position constant (or update layer relative to new position)
|
||||||
//mMapView.getMapViewPosition().getMapPosition(mMapPosition, null);
|
//mMapPosition.copy(curPos);
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
// fix at initial position
|
// fix at initial position
|
||||||
updateMapPosition();
|
mMapPosition.copy(curPos);
|
||||||
|
|
||||||
first = false;
|
first = false;
|
||||||
//((SymbolLayer) (layers.textureLayers)).prepare();
|
//((SymbolLayer) (layers.textureLayers)).prepare();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user