begin integrating of area zoom interaction

This commit is contained in:
Hannes Janetzek 2013-03-11 16:11:50 +01:00
parent b0c1f122fe
commit cd54f0dfe6
3 changed files with 22 additions and 19 deletions

View File

@ -37,7 +37,7 @@ import android.graphics.Paint.Cap;
public class PathOverlay extends Overlay { public class PathOverlay extends Overlay {
/** Stores points, converted to the map projection. */ /** Stores points, converted to the map projection. */
/* package */final ArrayList<GeoPoint> mPoints; /* package */protected final ArrayList<GeoPoint> mPoints;
/* package */boolean mUpdatePoints; /* package */boolean mUpdatePoints;
/** Paint settings. */ /** Paint settings. */

View File

@ -15,9 +15,6 @@
*/ */
package org.oscim.view; package org.oscim.view;
// TODO:
// - fix ray intersection for unproject, see getZ()
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import org.oscim.core.BoundingBox; import org.oscim.core.BoundingBox;
@ -149,6 +146,7 @@ public class MapViewPosition {
/** /**
* get a copy of current matrices * get a copy of current matrices
*
* @param view ... * @param view ...
* @param proj ... * @param proj ...
* @param vp view and projection * @param vp view and projection
@ -157,7 +155,7 @@ public class MapViewPosition {
if (view != null) if (view != null)
System.arraycopy(mViewMatrix, 0, view, 0, 16); System.arraycopy(mViewMatrix, 0, view, 0, 16);
if (proj!= null) if (proj != null)
System.arraycopy(mProjMatrix, 0, proj, 0, 16); System.arraycopy(mProjMatrix, 0, proj, 0, 16);
if (vp != null) if (vp != null)
@ -639,21 +637,23 @@ public class MapViewPosition {
// global scale // global scale
mMapScale = (1 << mZoomLevel) * mScale; mMapScale = (1 << mZoomLevel) * mScale;
//Log.d(TAG, "zoom: " + bbox + " " + zx + " " + zy + " / " + mScale + " " + mZoomLevel); //Log.d(TAG, "zoom: " + bbox + " " + zx + " " + zy + " / " + mScale + " " + mZoomLevel);
updatePosition(); setMapCenter(bbox.getCenterPoint());
// reset rotation/tilt // updatePosition();
mTilt = 0; //
mRotation = 0; // // reset rotation/tilt
updateMatrix(); // mTilt = 0;
// mRotation = 0;
GeoPoint geoPoint = bbox.getCenterPoint(); // updateMatrix();
mEndX = MercatorProjection.longitudeToPixelX(geoPoint.getLongitude(), mZoomLevel); //
mEndY = MercatorProjection.latitudeToPixelY(geoPoint.getLatitude(), mZoomLevel); // GeoPoint geoPoint = bbox.getCenterPoint();
mStartX = mPosX; // mEndX = MercatorProjection.longitudeToPixelX(geoPoint.getLongitude(), mZoomLevel);
mStartY = mPosY; // mEndY = MercatorProjection.latitudeToPixelY(geoPoint.getLatitude(), mZoomLevel);
// mStartX = mPosX;
mDuration = 300; // mStartY = mPosY;
mHandler.start((int) mDuration); //
// mDuration = 300;
// mHandler.start((int) mDuration);
} }
public synchronized void animateTo(GeoPoint geoPoint) { public synchronized void animateTo(GeoPoint geoPoint) {

View File

@ -157,6 +157,9 @@ final class TouchHandler implements OnGestureListener, OnDoubleTapListener {
if (Math.abs(mx) > JUMP_THRESHOLD || Math.abs(my) > JUMP_THRESHOLD) if (Math.abs(mx) > JUMP_THRESHOLD || Math.abs(my) > JUMP_THRESHOLD)
return true; return true;
if (e.getPointerCount() < 2)
return true;
if (mMulti == 0) if (mMulti == 0)
return true; return true;