cleanup and formatting
This commit is contained in:
parent
819189b706
commit
e203f2916d
@ -161,29 +161,29 @@ public class BoundingBox {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
stringBuilder.append("BoundingBox [minLat=");
|
sb.append("BoundingBox [minLat=");
|
||||||
stringBuilder.append(minLatitudeE6);
|
sb.append(minLatitudeE6);
|
||||||
stringBuilder.append(", minLon=");
|
sb.append(", minLon=");
|
||||||
stringBuilder.append(minLongitudeE6);
|
sb.append(minLongitudeE6);
|
||||||
stringBuilder.append(", maxLat=");
|
sb.append(", maxLat=");
|
||||||
stringBuilder.append(maxLatitudeE6);
|
sb.append(maxLatitudeE6);
|
||||||
stringBuilder.append(", maxLon=");
|
sb.append(", maxLon=");
|
||||||
stringBuilder.append(maxLongitudeE6);
|
sb.append(maxLongitudeE6);
|
||||||
stringBuilder.append("]");
|
sb.append("]");
|
||||||
return stringBuilder.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String format() {
|
public String format() {
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
stringBuilder.append(minLatitudeE6 / CONVERSION_FACTOR);
|
sb.append(minLatitudeE6 / CONVERSION_FACTOR);
|
||||||
stringBuilder.append(',');
|
sb.append(',');
|
||||||
stringBuilder.append(minLongitudeE6 / CONVERSION_FACTOR);
|
sb.append(minLongitudeE6 / CONVERSION_FACTOR);
|
||||||
stringBuilder.append(',');
|
sb.append(',');
|
||||||
stringBuilder.append(maxLatitudeE6 / CONVERSION_FACTOR);
|
sb.append(maxLatitudeE6 / CONVERSION_FACTOR);
|
||||||
stringBuilder.append(',');
|
sb.append(',');
|
||||||
stringBuilder.append(maxLongitudeE6 / CONVERSION_FACTOR);
|
sb.append(maxLongitudeE6 / CONVERSION_FACTOR);
|
||||||
return stringBuilder.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,13 +127,13 @@ public class GeoPoint implements Comparable<GeoPoint> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
stringBuilder.append("GeoPoint [lat=");
|
sb.append("GeoPoint [lat=");
|
||||||
stringBuilder.append(this.getLatitude());
|
sb.append(this.getLatitude());
|
||||||
stringBuilder.append(", lon=");
|
sb.append(", lon=");
|
||||||
stringBuilder.append(this.getLongitude());
|
sb.append(this.getLongitude());
|
||||||
stringBuilder.append("]");
|
sb.append("]");
|
||||||
return stringBuilder.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,31 +182,4 @@ public class GeoPoint implements Comparable<GeoPoint> {
|
|||||||
|
|
||||||
return (int) (RADIUS_EARTH_METERS * tt);
|
return (int) (RADIUS_EARTH_METERS * tt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================
|
|
||||||
// Parcelable
|
|
||||||
// ===========================================================
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public int describeContents() {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void writeToParcel(final Parcel out, final int flags) {
|
|
||||||
// out.writeInt(latitudeE6);
|
|
||||||
// out.writeInt(longitudeE6);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static final Parcelable.Creator<GeoPoint> CREATOR = new Parcelable.Creator<GeoPoint>() {
|
|
||||||
// @Override
|
|
||||||
// public GeoPoint createFromParcel(final Parcel in) {
|
|
||||||
// return new GeoPoint(in.readInt(), in.readInt());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public GeoPoint[] newArray(final int size) {
|
|
||||||
// return new GeoPoint[size];
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,23 @@
|
|||||||
package org.oscim.core;
|
package org.oscim.core;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
// - getter methods!
|
||||||
|
// - check indexPos < Short.Max
|
||||||
|
// - should make internals private, maybe
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold temporary geometry data for processing. Only One
|
||||||
|
* geometry type can be set at a time. Use 'clear()' to reset the
|
||||||
|
* internal state.
|
||||||
|
* - 'points[]' holds the coordinates
|
||||||
|
* - 'index[]' is used to encode multi-linestrings and (multi-)polygons.
|
||||||
|
*/
|
||||||
public class GeometryBuffer {
|
public class GeometryBuffer {
|
||||||
public enum GeometryType {
|
|
||||||
|
|
||||||
|
private final static int GROW_INDICES = 64;
|
||||||
|
private final static int GROW_POINTS = 512;
|
||||||
|
|
||||||
|
public enum GeometryType {
|
||||||
NONE(0),
|
NONE(0),
|
||||||
POINT(1),
|
POINT(1),
|
||||||
LINE(2),
|
LINE(2),
|
||||||
@ -15,15 +29,8 @@ public class GeometryBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final int nativeInt;
|
public final int nativeInt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
// - check indexPos < Short.Max
|
|
||||||
// - make internals private
|
|
||||||
|
|
||||||
final static boolean CHECK_STATE = true;
|
|
||||||
|
|
||||||
public float[] points;
|
public float[] points;
|
||||||
public short[] index;
|
public short[] index;
|
||||||
public int indexPos;
|
public int indexPos;
|
||||||
@ -33,9 +40,9 @@ public class GeometryBuffer {
|
|||||||
|
|
||||||
public GeometryBuffer(float[] points, short[] index) {
|
public GeometryBuffer(float[] points, short[] index) {
|
||||||
if (points == null)
|
if (points == null)
|
||||||
throw new IllegalArgumentException("GeometryBuffer points is null");
|
points = new float[GROW_POINTS];
|
||||||
if (index == null)
|
if (index == null)
|
||||||
throw new IllegalArgumentException("GeometryBuffer index is null");
|
index = new short[GROW_INDICES];
|
||||||
|
|
||||||
this.points = points;
|
this.points = points;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
@ -45,11 +52,7 @@ public class GeometryBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public GeometryBuffer(int numPoints, int numIndices) {
|
public GeometryBuffer(int numPoints, int numIndices) {
|
||||||
this.points = new float[numPoints * 2];
|
this(new float[numPoints * 2], new short[numIndices]);
|
||||||
this.index = new short[numIndices];
|
|
||||||
this.type = GeometryType.NONE;
|
|
||||||
this.indexPos = 0;
|
|
||||||
this.pointPos = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- API ----
|
// ---- API ----
|
||||||
@ -69,12 +72,15 @@ public class GeometryBuffer {
|
|||||||
|
|
||||||
index[indexPos] += 2;
|
index[indexPos] += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPoly() {
|
public boolean isPoly() {
|
||||||
return type == GeometryType.POLY;
|
return type == GeometryType.POLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLine() {
|
public boolean isLine() {
|
||||||
return type == GeometryType.LINE;
|
return type == GeometryType.LINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPoint() {
|
public boolean isPoint() {
|
||||||
return type == GeometryType.POINT;
|
return type == GeometryType.POINT;
|
||||||
}
|
}
|
||||||
@ -85,12 +91,10 @@ public class GeometryBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void startPoints() {
|
public void startPoints() {
|
||||||
if (CHECK_STATE)
|
|
||||||
setOrCheckMode(GeometryType.POINT);
|
setOrCheckMode(GeometryType.POINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startLine() {
|
public void startLine() {
|
||||||
if (CHECK_STATE)
|
|
||||||
setOrCheckMode(GeometryType.LINE);
|
setOrCheckMode(GeometryType.LINE);
|
||||||
|
|
||||||
// start next
|
// start next
|
||||||
@ -107,7 +111,6 @@ public class GeometryBuffer {
|
|||||||
|
|
||||||
public void startPolygon() {
|
public void startPolygon() {
|
||||||
boolean start = (type == GeometryType.NONE);
|
boolean start = (type == GeometryType.NONE);
|
||||||
if (CHECK_STATE)
|
|
||||||
setOrCheckMode(GeometryType.POLY);
|
setOrCheckMode(GeometryType.POLY);
|
||||||
|
|
||||||
if ((indexPos + 3) > index.length)
|
if ((indexPos + 3) > index.length)
|
||||||
@ -130,7 +133,6 @@ public class GeometryBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void startHole() {
|
public void startHole() {
|
||||||
if (CHECK_STATE)
|
|
||||||
checkMode(GeometryType.POLY);
|
checkMode(GeometryType.POLY);
|
||||||
|
|
||||||
if ((indexPos + 2) > index.length)
|
if ((indexPos + 2) > index.length)
|
||||||
@ -149,7 +151,7 @@ public class GeometryBuffer {
|
|||||||
if (size * 2 < points.length)
|
if (size * 2 < points.length)
|
||||||
return points;
|
return points;
|
||||||
|
|
||||||
float[] tmp = new float[size * 2 + 512];
|
float[] tmp = new float[size * 2 + GROW_POINTS];
|
||||||
if (copy)
|
if (copy)
|
||||||
System.arraycopy(points, 0, tmp, 0, points.length);
|
System.arraycopy(points, 0, tmp, 0, points.length);
|
||||||
|
|
||||||
@ -161,7 +163,7 @@ public class GeometryBuffer {
|
|||||||
if (size < index.length)
|
if (size < index.length)
|
||||||
return index;
|
return index;
|
||||||
|
|
||||||
short[] tmp = new short[size + 64];
|
short[] tmp = new short[size + GROW_INDICES];
|
||||||
if (copy)
|
if (copy)
|
||||||
System.arraycopy(index, 0, tmp, 0, index.length);
|
System.arraycopy(index, 0, tmp, 0, index.length);
|
||||||
|
|
||||||
@ -175,14 +177,14 @@ public class GeometryBuffer {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (type != GeometryType.NONE)
|
if (type != GeometryType.NONE)
|
||||||
throw new IllegalArgumentException("GeometryBuffer not cleared " + m + "<>" + type);
|
throw new IllegalArgumentException("not cleared " + m + "<>" + type);
|
||||||
|
|
||||||
type = m;
|
type = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkMode(GeometryType m) {
|
private void checkMode(GeometryType m) {
|
||||||
if (type != m)
|
if (type != m)
|
||||||
throw new IllegalArgumentException("GeometryBuffer not cleared " + m + "<>" + type);
|
throw new IllegalArgumentException("not cleared " + m + "<>" + type);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,20 +14,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.core;
|
package org.oscim.core;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
// - make this class (and description) more generic or
|
||||||
|
// move it to tilesource package
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MapElement is created by TileDataSource(s) and passed to MapTileLoader
|
* Reusable containter for geometry with tags.
|
||||||
* via ITileDataSink.process() MapTileLoader processes the
|
* MapElement is created by TileDataSource(s) and passed to
|
||||||
* data into MapTile.layers.
|
* MapTileLoader via ITileDataSink.process().
|
||||||
* -----
|
* This is just a buffer that belongs to TileDataSource,
|
||||||
* This is really just a buffer object that belongs to TileDataSource, so
|
* so dont keep a reference to it when passed as parameter.
|
||||||
* dont keep a reference to it when passed as parameter.
|
|
||||||
*/
|
*/
|
||||||
public class MapElement extends GeometryBuffer {
|
public class MapElement extends GeometryBuffer {
|
||||||
|
|
||||||
// osm layer of the way.
|
// OSM layer of the way.
|
||||||
public int layer;
|
public int layer;
|
||||||
// osm tags of the way.
|
|
||||||
//public Tag[] tags;
|
|
||||||
|
|
||||||
public final TagSet tags = new TagSet();
|
public final TagSet tags = new TagSet();
|
||||||
|
|
||||||
@ -41,13 +42,13 @@ public class MapElement extends GeometryBuffer {
|
|||||||
|
|
||||||
public void setLayer(int layer) {
|
public void setLayer(int layer) {
|
||||||
this.layer = layer;
|
this.layer = layer;
|
||||||
//this.tags = tags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
super.clear();
|
super.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- random stuff, to be removed ----
|
// ---- random stuff, to be removed ----
|
||||||
// building tags
|
// building tags
|
||||||
public int height;
|
public int height;
|
||||||
|
@ -35,8 +35,8 @@ public abstract class Layer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public void setEnabled(boolean pEnabled) {
|
public void setEnabled(boolean enabled) {
|
||||||
mEnabled = pEnabled;
|
mEnabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.layers;
|
package org.oscim.layers;
|
||||||
|
|
||||||
import org.oscim.backend.CanvasAdapter;
|
|
||||||
import org.oscim.backend.Log;
|
import org.oscim.backend.Log;
|
||||||
import org.oscim.backend.input.MotionEvent;
|
import org.oscim.backend.input.MotionEvent;
|
||||||
import org.oscim.core.Tile;
|
import org.oscim.core.Tile;
|
||||||
@ -69,7 +68,8 @@ public class MapEventLayer extends InputLayer {
|
|||||||
mMapPosition = map.getViewport();
|
mMapPosition = map.getViewport();
|
||||||
mTracker = new VelocityTracker();
|
mTracker = new VelocityTracker();
|
||||||
}
|
}
|
||||||
private long mPrevTime;
|
|
||||||
|
//private long mPrevTime;
|
||||||
|
|
||||||
private boolean mEnableRotation = true;
|
private boolean mEnableRotation = true;
|
||||||
private boolean mEnableTilt = true;
|
private boolean mEnableTilt = true;
|
||||||
@ -99,7 +99,7 @@ public class MapEventLayer extends InputLayer {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent e) {
|
public boolean onTouchEvent(MotionEvent e) {
|
||||||
|
|
||||||
mPrevTime = e.getTime();
|
//mPrevTime = e.getTime();
|
||||||
|
|
||||||
int action = getAction(e);
|
int action = getAction(e);
|
||||||
|
|
||||||
@ -168,6 +168,8 @@ public class MapEventLayer extends InputLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (e.getPointerCount() < 2) {
|
if (e.getPointerCount() < 2) {
|
||||||
|
if (!mEnableMove)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (mx > 1 || mx < -1 || my > 1 || my < -1) {
|
if (mx > 1 || mx < -1 || my > 1 || my < -1) {
|
||||||
mMapPosition.moveMap(mx, my);
|
mMapPosition.moveMap(mx, my);
|
||||||
@ -200,7 +202,7 @@ public class MapEventLayer extends InputLayer {
|
|||||||
|
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
|
|
||||||
if (!mBeginTilt && (mBeginScale || startScale)) {
|
if (mEnableZoom && !mBeginTilt && (mBeginScale || startScale)) {
|
||||||
mBeginScale = true;
|
mBeginScale = true;
|
||||||
|
|
||||||
float scale = (float) (pinchWidth / mPrevPinchWidth);
|
float scale = (float) (pinchWidth / mPrevPinchWidth);
|
||||||
@ -222,7 +224,7 @@ public class MapEventLayer extends InputLayer {
|
|||||||
changed = mMapPosition.scaleMap(scale, fx, fy);
|
changed = mMapPosition.scaleMap(scale, fx, fy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mBeginRotate && Math.abs(slope) < 1) {
|
if (mEnableTilt && !mBeginRotate && Math.abs(slope) < 1) {
|
||||||
float my2 = y2 - mPrevY2;
|
float my2 = y2 - mPrevY2;
|
||||||
float threshold = PINCH_TILT_THRESHOLD;
|
float threshold = PINCH_TILT_THRESHOLD;
|
||||||
//Log.d(TAG, r + " " + slope + " m1:" + my + " m2:" + my2);
|
//Log.d(TAG, r + " " + slope + " m1:" + my + " m2:" + my2);
|
||||||
@ -233,7 +235,8 @@ public class MapEventLayer extends InputLayer {
|
|||||||
mBeginTilt = true;
|
mBeginTilt = true;
|
||||||
changed = mMapPosition.tiltMap(my / 5);
|
changed = mMapPosition.tiltMap(my / 5);
|
||||||
}
|
}
|
||||||
} else if (!mBeginTilt && (mBeginRotate || Math.abs(r) > PINCH_ROTATE_THRESHOLD)) {
|
} else if (mEnableRotation && !mBeginTilt &&
|
||||||
|
(mBeginRotate || Math.abs(r) > PINCH_ROTATE_THRESHOLD)) {
|
||||||
//Log.d(TAG, "rotate: " + mBeginRotate + " " + Math.toDegrees(rad));
|
//Log.d(TAG, "rotate: " + mBeginRotate + " " + Math.toDegrees(rad));
|
||||||
if (!mBeginRotate) {
|
if (!mBeginRotate) {
|
||||||
mAngle = rad;
|
mAngle = rad;
|
||||||
@ -289,80 +292,64 @@ public class MapEventLayer extends InputLayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onDoubleTap(MotionEvent e) {
|
|
||||||
|
|
||||||
mDoubleTap = true;
|
|
||||||
//mMapPosition.animateZoom(2);
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
printState("onDoubleTap");
|
|
||||||
|
|
||||||
// avoid onLongPress
|
|
||||||
mMap.getLayers().cancelGesture();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onScroll(final MotionEvent e1, final MotionEvent e2, final float distanceX,
|
|
||||||
final float distanceY) {
|
|
||||||
|
|
||||||
if (e2.getPointerCount() == 1) {
|
|
||||||
mMapPosition.moveMap(-distanceX, -distanceY);
|
|
||||||
mMap.updateMap(true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean onFling(float velocityX, float velocityY) {
|
private boolean onFling(float velocityX, float velocityY) {
|
||||||
|
|
||||||
if (mWasMulti)
|
if (mWasMulti)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int w = Tile.SIZE * 3;
|
int w = Tile.SIZE * 3;
|
||||||
int h = Tile.SIZE * 3;
|
int h = Tile.SIZE * 3;
|
||||||
|
|
||||||
//if (mMap.enablePagedFling) {
|
|
||||||
// double a = Math.sqrt(velocityX * velocityX + velocityY * velocityY);
|
|
||||||
//
|
|
||||||
// float vx = (float) (velocityX / a);
|
|
||||||
// float vy = (float) (velocityY / a);
|
|
||||||
//
|
|
||||||
// if (a < 400)
|
|
||||||
// return true;
|
|
||||||
//
|
|
||||||
// float move = Math.min(mMap.getWidth(), mMap.getHeight()) * 2 / 3;
|
|
||||||
// mMapPosition.animateTo(vx * move, vy * move, 250);
|
|
||||||
//} else {
|
|
||||||
float s = 1; //(200 / CanvasAdapter.dpi);
|
|
||||||
|
|
||||||
mMapPosition.animateFling(
|
mMapPosition.animateFling(
|
||||||
Math.round(velocityX * s),
|
Math.round(velocityX),
|
||||||
Math.round(velocityY * s),
|
Math.round(velocityY),
|
||||||
-w, w, -h, h);
|
-w, w, -h, h);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printState(String action) {
|
//@Override
|
||||||
Log.d(TAG, action
|
//public boolean onDoubleTap(MotionEvent e) {
|
||||||
+ " " + mDoubleTap
|
//
|
||||||
+ " " + mBeginScale
|
// mDoubleTap = true;
|
||||||
+ " " + mBeginRotate
|
// //mMapPosition.animateZoom(2);
|
||||||
+ " " + mBeginTilt);
|
//
|
||||||
}
|
// if (debug)
|
||||||
|
// printState("onDoubleTap");
|
||||||
|
//
|
||||||
|
// // avoid onLongPress
|
||||||
|
// mMap.getLayers().cancelGesture();
|
||||||
|
//
|
||||||
|
// return true;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//@Override
|
||||||
|
//public boolean onScroll(final MotionEvent e1, final MotionEvent e2, final float distanceX,
|
||||||
|
// final float distanceY) {
|
||||||
|
//
|
||||||
|
// if (e2.getPointerCount() == 1) {
|
||||||
|
// mMapPosition.moveMap(-distanceX, -distanceY);
|
||||||
|
// mMap.updateMap(true);
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
//private void printState(String action) {
|
||||||
|
// Log.d(TAG, action
|
||||||
|
// + " " + mDoubleTap
|
||||||
|
// + " " + mBeginScale
|
||||||
|
// + " " + mBeginRotate
|
||||||
|
// + " " + mBeginTilt);
|
||||||
|
//}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright 2011 See libgdx AUTHORS file.
|
* Copyright 2011 See libgdx AUTHORS file.
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@ -411,14 +398,16 @@ public class MapEventLayer extends InputLayer {
|
|||||||
public float getVelocityX() {
|
public float getVelocityX() {
|
||||||
float meanX = getAverage(this.meanX, numSamples);
|
float meanX = getAverage(this.meanX, numSamples);
|
||||||
float meanTime = getAverage(this.meanTime, numSamples) / 1000.0f;
|
float meanTime = getAverage(this.meanTime, numSamples) / 1000.0f;
|
||||||
if (meanTime == 0) return 0;
|
if (meanTime == 0)
|
||||||
|
return 0;
|
||||||
return meanX / meanTime;
|
return meanX / meanTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getVelocityY() {
|
public float getVelocityY() {
|
||||||
float meanY = getAverage(this.meanY, numSamples);
|
float meanY = getAverage(this.meanY, numSamples);
|
||||||
float meanTime = getAverage(this.meanTime, numSamples) / 1000.0f;
|
float meanTime = getAverage(this.meanTime, numSamples) / 1000.0f;
|
||||||
if (meanTime == 0) return 0;
|
if (meanTime == 0)
|
||||||
|
return 0;
|
||||||
return meanY / meanTime;
|
return meanY / meanTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,19 +426,20 @@ public class MapEventLayer extends InputLayer {
|
|||||||
for (int i = 0; i < numSamples; i++) {
|
for (int i = 0; i < numSamples; i++) {
|
||||||
sum += values[i];
|
sum += values[i];
|
||||||
}
|
}
|
||||||
if (numSamples == 0) return 0;
|
if (numSamples == 0)
|
||||||
|
return 0;
|
||||||
return sum / numSamples;
|
return sum / numSamples;
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getSum (float[] values, int numSamples) {
|
//private float getSum (float[] values, int numSamples) {
|
||||||
numSamples = Math.min(sampleSize, numSamples);
|
// numSamples = Math.min(sampleSize, numSamples);
|
||||||
float sum = 0;
|
// float sum = 0;
|
||||||
for (int i = 0; i < numSamples; i++) {
|
// for (int i = 0; i < numSamples; i++) {
|
||||||
sum += values[i];
|
// sum += values[i];
|
||||||
}
|
// }
|
||||||
if (numSamples == 0) return 0;
|
// if (numSamples == 0) return 0;
|
||||||
return sum;
|
// return sum;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ import org.oscim.view.Map;
|
|||||||
import org.oscim.view.Viewport;
|
import org.oscim.view.Viewport;
|
||||||
|
|
||||||
class TextRenderLayer extends BasicRenderLayer {
|
class TextRenderLayer extends BasicRenderLayer {
|
||||||
private final static String TAG = TextRenderLayer.class.getName();
|
//private final static String TAG = TextRenderLayer.class.getName();
|
||||||
|
|
||||||
private final static float MIN_CAPTION_DIST = 5;
|
private final static float MIN_CAPTION_DIST = 5;
|
||||||
private final static float MIN_WAY_DIST = 3;
|
private final static float MIN_WAY_DIST = 3;
|
||||||
|
@ -117,28 +117,10 @@ public class MapTileLoader extends TileLoader implements IRenderCallback, ITileD
|
|||||||
debug = debugSettings;
|
debug = debugSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public MapTileLoader(TileManager tileManager) {
|
public MapTileLoader(TileManager tileManager) {
|
||||||
super(tileManager);
|
super(tileManager);
|
||||||
|
|
||||||
mClipper = new LineClipper(0, 0, Tile.SIZE, Tile.SIZE, true);
|
mClipper = new LineClipper(0, 0, Tile.SIZE, Tile.SIZE, true);
|
||||||
|
|
||||||
// MapElement m = mDebugWay = new MapElement();
|
|
||||||
// m.startLine();
|
|
||||||
// int s = Tile.SIZE;
|
|
||||||
// m.addPoint(0, 0);
|
|
||||||
// m.addPoint(0, s);
|
|
||||||
// m.addPoint(s, s);
|
|
||||||
// m.addPoint(s, 0);
|
|
||||||
// m.addPoint(0, 0);
|
|
||||||
// m.tags = new Tag[] { new Tag("debug", "box") };
|
|
||||||
// m.type = GeometryType.LINE;
|
|
||||||
//
|
|
||||||
// m = mDebugPoint = new MapElement();
|
|
||||||
// m.startPoints();
|
|
||||||
// m.addPoint(s >> 1, 10);
|
|
||||||
// m.type = GeometryType.POINT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -79,9 +79,9 @@ public class TestTileSource extends TileSource {
|
|||||||
mElem = new MapElement();
|
mElem = new MapElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final boolean renderWays = true;
|
private boolean renderWays = true;
|
||||||
private final boolean renderBoundary = false;
|
private boolean renderBoundary = true;
|
||||||
private final boolean renderPlace = false;
|
private boolean renderPlace = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryResult executeQuery(MapTile tile,
|
public QueryResult executeQuery(MapTile tile,
|
||||||
@ -171,7 +171,7 @@ public class TestTileSource extends TileSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
e.setLayer(1);
|
e.setLayer(1);
|
||||||
e.tags.set(mTagsWay);
|
e.tags.set(mTagsBoundary);
|
||||||
mapDataSink.process(e);
|
mapDataSink.process(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ public class Layers extends AbstractList<Layer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized Layer get(final int pIndex) {
|
public synchronized Layer get(int index) {
|
||||||
return mLayerList.get(pIndex);
|
return mLayerList.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -50,21 +50,21 @@ public class Layers extends AbstractList<Layer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void add(final int pIndex, final Layer pElement) {
|
public synchronized void add(int index, Layer element) {
|
||||||
mLayerList.add(pIndex, pElement);
|
mLayerList.add(index, element);
|
||||||
mDirtyLayers = true;
|
mDirtyLayers = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized Layer remove(final int pIndex) {
|
public synchronized Layer remove(int index) {
|
||||||
mDirtyLayers = true;
|
mDirtyLayers = true;
|
||||||
return mLayerList.remove(pIndex);
|
return mLayerList.remove(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized Layer set(final int pIndex, final Layer pElement) {
|
public synchronized Layer set(int index, Layer element) {
|
||||||
mDirtyLayers = true;
|
mDirtyLayers = true;
|
||||||
return mLayerList.set(pIndex, pElement);
|
return mLayerList.set(index, element);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean mDirtyLayers;
|
private boolean mDirtyLayers;
|
||||||
@ -114,13 +114,9 @@ public class Layers extends AbstractList<Layer> {
|
|||||||
int numRenderLayers = 0;
|
int numRenderLayers = 0;
|
||||||
int numInputLayers = 0;
|
int numInputLayers = 0;
|
||||||
|
|
||||||
//Log.d(TAG, "update layers:");
|
|
||||||
|
|
||||||
for (int i = 0, n = mLayerList.size(); i < n; i++) {
|
for (int i = 0, n = mLayerList.size(); i < n; i++) {
|
||||||
Layer o = mLayerList.get(i);
|
Layer o = mLayerList.get(i);
|
||||||
|
|
||||||
//Log.d(TAG, "\t" + o.getClass().getName());
|
|
||||||
|
|
||||||
if (o.getLayer() != null)
|
if (o.getLayer() != null)
|
||||||
numRenderLayers++;
|
numRenderLayers++;
|
||||||
|
|
||||||
@ -150,16 +146,16 @@ public class Layers extends AbstractList<Layer> {
|
|||||||
mDirtyLayers = false;
|
mDirtyLayers = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean mCancelGesture;
|
//private boolean mCancelGesture;
|
||||||
|
|
||||||
public boolean handleMotionEvent(MotionEvent e) {
|
public boolean handleMotionEvent(MotionEvent e) {
|
||||||
boolean handleGesture = true;
|
//boolean handleGesture = true;
|
||||||
|
|
||||||
if (mCancelGesture) {
|
//if (mCancelGesture) {
|
||||||
int action = e.getAction();
|
// int action = e.getAction();
|
||||||
handleGesture = (action == MotionEvent.ACTION_CANCEL ||
|
// handleGesture = (action == MotionEvent.ACTION_CANCEL ||
|
||||||
action == MotionEvent.ACTION_UP);
|
// action == MotionEvent.ACTION_UP);
|
||||||
}
|
//}
|
||||||
|
|
||||||
//if (handleGesture) {
|
//if (handleGesture) {
|
||||||
// if (mGestureDetector.onTouchEvent(e))
|
// if (mGestureDetector.onTouchEvent(e))
|
||||||
@ -174,17 +170,17 @@ public class Layers extends AbstractList<Layer> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
///**
|
||||||
* Call this to not foward events to generic GestureDetector until
|
// * Call this to not foward events to generic GestureDetector until
|
||||||
* next ACTION_UP or ACTION_CANCEL event. - Use with care for the
|
// * next ACTION_UP or ACTION_CANCEL event. - Use with care for the
|
||||||
* case that an InputLayer recognized the start of its gesture and
|
// * case that an InputLayer recognized the start of its gesture and
|
||||||
* does further processing in only onTouch callback.
|
// * does further processing in only onTouch callback.
|
||||||
*/
|
// */
|
||||||
public void cancelGesture() {
|
//public void cancelGesture() {
|
||||||
mCancelGesture = true;
|
// mCancelGesture = true;
|
||||||
}
|
//}
|
||||||
|
|
||||||
public boolean onTouchEvent(final MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
if (mDirtyLayers)
|
if (mDirtyLayers)
|
||||||
updateLayers();
|
updateLayers();
|
||||||
|
|
||||||
@ -198,7 +194,7 @@ public class Layers extends AbstractList<Layer> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
if (mDirtyLayers)
|
if (mDirtyLayers)
|
||||||
updateLayers();
|
updateLayers();
|
||||||
|
|
||||||
@ -209,7 +205,7 @@ public class Layers extends AbstractList<Layer> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onKeyUp(final int keyCode, final KeyEvent event) {
|
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||||
if (mDirtyLayers)
|
if (mDirtyLayers)
|
||||||
updateLayers();
|
updateLayers();
|
||||||
|
|
||||||
@ -220,7 +216,7 @@ public class Layers extends AbstractList<Layer> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onTrackballEvent(final MotionEvent event) {
|
public boolean onTrackballEvent(MotionEvent event) {
|
||||||
if (mDirtyLayers)
|
if (mDirtyLayers)
|
||||||
updateLayers();
|
updateLayers();
|
||||||
|
|
||||||
@ -243,254 +239,113 @@ public class Layers extends AbstractList<Layer> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GestureDetector.OnDoubleTapListener */
|
// /* GestureDetector.OnDoubleTapListener */
|
||||||
|
//
|
||||||
public boolean onDoubleTap(final MotionEvent e) {
|
// public boolean onDoubleTap(MotionEvent e) {
|
||||||
|
//
|
||||||
if (mDirtyLayers)
|
|
||||||
updateLayers();
|
|
||||||
|
|
||||||
for (InputLayer o : mInputLayer) {
|
|
||||||
if (o.onDoubleTap(e)) {
|
|
||||||
if (debugInput)
|
|
||||||
Log.d(TAG, "onDoubleTap\t" + o.getClass());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onDoubleTapEvent(final MotionEvent e) {
|
|
||||||
if (mDirtyLayers)
|
|
||||||
updateLayers();
|
|
||||||
|
|
||||||
for (InputLayer o : mInputLayer) {
|
|
||||||
if (o.onDoubleTapEvent(e)) {
|
|
||||||
if (debugInput)
|
|
||||||
Log.d(TAG, "onDoubleTapEvent\t" + o.getClass());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onSingleTapConfirmed(final MotionEvent e) {
|
|
||||||
if (mDirtyLayers)
|
|
||||||
updateLayers();
|
|
||||||
|
|
||||||
for (InputLayer o : mInputLayer) {
|
|
||||||
if (o.onSingleTapConfirmed(e)) {
|
|
||||||
if (debugInput)
|
|
||||||
Log.d(TAG, "onSingleTapConfirmed\tt" + o.getClass());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* OnGestureListener */
|
|
||||||
public boolean onDown(final MotionEvent pEvent) {
|
|
||||||
if (mDirtyLayers)
|
|
||||||
updateLayers();
|
|
||||||
|
|
||||||
for (InputLayer o : mInputLayer) {
|
|
||||||
if (o.onDown(pEvent)) {
|
|
||||||
if (debugInput)
|
|
||||||
Log.d(TAG, "onDown\t" + o.getClass());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
////@Override
|
|
||||||
//public boolean onFling(final MotionEvent pEvent1, final MotionEvent pEvent2,
|
|
||||||
// final float pVelocityX, final float pVelocityY) {
|
|
||||||
// if (mDirtyLayers)
|
// if (mDirtyLayers)
|
||||||
// updateLayers();
|
// updateLayers();
|
||||||
//
|
//
|
||||||
// for (InputLayer o : mInputLayer) {
|
// for (InputLayer o : mInputLayer) {
|
||||||
// if (o.onFling(pEvent1, pEvent2, pVelocityX, pVelocityY)) {
|
// if (o.onDoubleTap(e)) {
|
||||||
// if (debugInput)
|
// if (debugInput)
|
||||||
// Log.d(TAG, "onFling\t" + o.getClass());
|
// Log.d(TAG, "onDoubleTap\t" + o.getClass());
|
||||||
// return true;
|
// return true;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public void onLongPress(final MotionEvent pEvent) {
|
|
||||||
if (mCancelGesture)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (mDirtyLayers)
|
|
||||||
updateLayers();
|
|
||||||
|
|
||||||
for (InputLayer o : mInputLayer)
|
|
||||||
if (o.onLongPress(pEvent))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onScroll(final MotionEvent pEvent1, final MotionEvent pEvent2,
|
|
||||||
final float pDistanceX, final float pDistanceY) {
|
|
||||||
if (mDirtyLayers)
|
|
||||||
updateLayers();
|
|
||||||
|
|
||||||
for (InputLayer o : mInputLayer) {
|
|
||||||
if (o.onScroll(pEvent1, pEvent2, pDistanceX, pDistanceY)) {
|
|
||||||
if (debugInput)
|
|
||||||
Log.d(TAG, "onScroll\t" + o.getClass());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onShowPress(final MotionEvent pEvent) {
|
|
||||||
if (mDirtyLayers)
|
|
||||||
updateLayers();
|
|
||||||
|
|
||||||
for (InputLayer o : mInputLayer)
|
|
||||||
o.onShowPress(pEvent);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onSingleTapUp(final MotionEvent pEvent) {
|
|
||||||
if (mDirtyLayers)
|
|
||||||
updateLayers();
|
|
||||||
|
|
||||||
for (InputLayer o : mInputLayer) {
|
|
||||||
if (o.onSingleTapUp(pEvent)) {
|
|
||||||
if (debugInput)
|
|
||||||
Log.d(TAG, "onSingleTapUp\t" + o.getClass());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Gets the optional TilesLayer class.
|
|
||||||
// *
|
|
||||||
// * @return the tilesLayer
|
|
||||||
// */
|
|
||||||
// public TilesLayer getTilesLayer() {
|
|
||||||
// return mTilesLayer;
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// /**
|
// public boolean onDoubleTapEvent(MotionEvent e) {
|
||||||
// * Sets the optional TilesLayer class. If set, this overlay will be
|
// if (mDirtyLayers)
|
||||||
// drawn before all other
|
// updateLayers();
|
||||||
// * overlays and will not be included in the editable list of overlays and
|
|
||||||
// can't be cleared
|
|
||||||
// * except by a subsequent call to setTilesLayer().
|
|
||||||
// *
|
|
||||||
// * @param tilesLayer
|
|
||||||
// * the tilesLayer to set
|
|
||||||
// */
|
|
||||||
// public void setTilesLayer(final TilesLayer tilesLayer) {
|
|
||||||
// mTilesLayer = tilesLayer;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public void onDraw(final Canvas c, final MapView pMapView) {
|
|
||||||
// // if ((mTilesLayer != null) && mTilesLayer.isEnabled()) {
|
|
||||||
// // mTilesLayer.draw(c, pMapView, true);
|
|
||||||
// // }
|
|
||||||
// //
|
|
||||||
// // if ((mTilesLayer != null) && mTilesLayer.isEnabled()) {
|
|
||||||
// // mTilesLayer.draw(c, pMapView, false);
|
|
||||||
// // }
|
|
||||||
//
|
//
|
||||||
// for (final Layer overlay : mLayerList) {
|
// for (InputLayer o : mInputLayer) {
|
||||||
// if (overlay.isEnabled()) {
|
// if (o.onDoubleTapEvent(e)) {
|
||||||
// overlay.draw(c, pMapView, true);
|
// if (debugInput)
|
||||||
// }
|
// Log.d(TAG, "onDoubleTapEvent\t" + o.getClass());
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for (final Layer overlay : mLayerList) {
|
|
||||||
// if (overlay.isEnabled()) {
|
|
||||||
// overlay.draw(c, pMapView, false);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ** Options Menu **//
|
|
||||||
|
|
||||||
// public void setOptionsMenusEnabled(final boolean pEnabled) {
|
|
||||||
// for (final Layer overlay : mLayerList) {
|
|
||||||
// if ((overlay instanceof ILayerMenuProvider)
|
|
||||||
// && ((ILayerMenuProvider) overlay).isOptionsMenuEnabled()) {
|
|
||||||
// ((ILayerMenuProvider) overlay).setOptionsMenuEnabled(pEnabled);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public boolean onCreateOptionsMenu(final Menu pMenu, final int
|
|
||||||
// menuIdOffset,
|
|
||||||
// final MapView map) {
|
|
||||||
// boolean result = true;
|
|
||||||
// for (final Layer overlay : this.overlaysReversed()) {
|
|
||||||
// if ((overlay instanceof ILayerMenuProvider)
|
|
||||||
// && ((ILayerMenuProvider) overlay).isOptionsMenuEnabled()) {
|
|
||||||
// result &= ((ILayerMenuProvider) overlay).onCreateOptionsMenu(pMenu,
|
|
||||||
// menuIdOffset,
|
|
||||||
// map);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if ((mTilesLayer != null) && (mTilesLayer instanceof
|
|
||||||
// ILayerMenuProvider)
|
|
||||||
// && ((ILayerMenuProvider) mTilesLayer).isOptionsMenuEnabled()) {
|
|
||||||
// result &= mTilesLayer.onCreateOptionsMenu(pMenu, menuIdOffset,
|
|
||||||
// map);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return result;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public boolean onPrepareOptionsMenu(final Menu pMenu, final int
|
|
||||||
// menuIdOffset,
|
|
||||||
// final MapView map) {
|
|
||||||
// for (final Layer overlay : this.overlaysReversed()) {
|
|
||||||
// if ((overlay instanceof ILayerMenuProvider)
|
|
||||||
// && ((ILayerMenuProvider) overlay).isOptionsMenuEnabled()) {
|
|
||||||
// ((ILayerMenuProvider) overlay).onPrepareOptionsMenu(pMenu,
|
|
||||||
// menuIdOffset, map);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if ((mTilesLayer != null) && (mTilesLayer instanceof
|
|
||||||
// ILayerMenuProvider)
|
|
||||||
// && ((ILayerMenuProvider) mTilesLayer).isOptionsMenuEnabled()) {
|
|
||||||
// mTilesLayer.onPrepareOptionsMenu(pMenu, menuIdOffset, map);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public boolean onOptionsItemSelected(final MenuItem item, final int
|
|
||||||
// menuIdOffset,
|
|
||||||
// final MapView map) {
|
|
||||||
// for (final Layer overlay : this.overlaysReversed()) {
|
|
||||||
// if ((overlay instanceof ILayerMenuProvider)
|
|
||||||
// && ((ILayerMenuProvider) overlay).isOptionsMenuEnabled()
|
|
||||||
// && ((ILayerMenuProvider) overlay).onOptionsItemSelected(item,
|
|
||||||
// menuIdOffset,
|
|
||||||
// map)) {
|
|
||||||
// return true;
|
// return true;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
// return false;
|
||||||
// if ((mTilesLayer != null)
|
|
||||||
// && (mTilesLayer instanceof ILayerMenuProvider)
|
|
||||||
// && ((ILayerMenuProvider) mTilesLayer).isOptionsMenuEnabled()
|
|
||||||
// && ((ILayerMenuProvider) mTilesLayer).onOptionsItemSelected(item,
|
|
||||||
// menuIdOffset,
|
|
||||||
// map)) {
|
|
||||||
// return true;
|
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
// public boolean onSingleTapConfirmed(MotionEvent e) {
|
||||||
|
// if (mDirtyLayers)
|
||||||
|
// updateLayers();
|
||||||
|
//
|
||||||
|
// for (InputLayer o : mInputLayer) {
|
||||||
|
// if (o.onSingleTapConfirmed(e)) {
|
||||||
|
// if (debugInput)
|
||||||
|
// Log.d(TAG, "onSingleTapConfirmed\tt" + o.getClass());
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /* OnGestureListener */
|
||||||
|
// public boolean onDown(MotionEvent e) {
|
||||||
|
// if (mDirtyLayers)
|
||||||
|
// updateLayers();
|
||||||
|
//
|
||||||
|
// for (InputLayer o : mInputLayer) {
|
||||||
|
// if (o.onDown(e)) {
|
||||||
|
// if (debugInput)
|
||||||
|
// Log.d(TAG, "onDown\t" + o.getClass());
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void onLongPress(MotionEvent e) {
|
||||||
|
// if (mCancelGesture)
|
||||||
|
// return;
|
||||||
|
//
|
||||||
|
// if (mDirtyLayers)
|
||||||
|
// updateLayers();
|
||||||
|
//
|
||||||
|
// for (InputLayer o : mInputLayer)
|
||||||
|
// if (o.onLongPress(e))
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public boolean onScroll(MotionEvent e1, MotionEvent e2,
|
||||||
|
// float dx, float dy) {
|
||||||
|
// if (mDirtyLayers)
|
||||||
|
// updateLayers();
|
||||||
|
//
|
||||||
|
// for (InputLayer o : mInputLayer) {
|
||||||
|
// if (o.onScroll(e1, e2, dx, dy)) {
|
||||||
|
// if (debugInput)
|
||||||
|
// Log.d(TAG, "onScroll\t" + o.getClass());
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void onShowPress(MotionEvent e) {
|
||||||
|
// if (mDirtyLayers)
|
||||||
|
// updateLayers();
|
||||||
|
//
|
||||||
|
// for (InputLayer o : mInputLayer)
|
||||||
|
// o.onShowPress(e);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public boolean onSingleTapUp(MotionEvent e) {
|
||||||
|
// if (mDirtyLayers)
|
||||||
|
// updateLayers();
|
||||||
|
//
|
||||||
|
// for (InputLayer o : mInputLayer) {
|
||||||
|
// if (o.onSingleTapUp(e)) {
|
||||||
|
// if (debugInput)
|
||||||
|
// Log.d(TAG, "onSingleTapUp\t" + o.getClass());
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user