This commit is contained in:
parent
acde5d565d
commit
829e45224f
@ -10,6 +10,7 @@
|
||||
- House numbers (nodes) fix visibility [#168](https://github.com/mapsforge/vtm/issues/168)
|
||||
- Use baseline 160dpi in scaling [#236](https://github.com/mapsforge/vtm/issues/236)
|
||||
- MapFileTileSource zoom level API enhancements [#219](https://github.com/mapsforge/vtm/issues/219)
|
||||
- Animator enhancements with easing functions [#246](https://github.com/mapsforge/vtm/issues/246)
|
||||
- Tile grid layer scaling [#238](https://github.com/mapsforge/vtm/issues/238)
|
||||
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
|
||||
- Many other minor improvements and bug fixes
|
||||
|
@ -25,7 +25,6 @@ import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.tiling.source.bitmap.BitmapTileSource;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
import org.oscim.utils.Easing;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -95,7 +94,7 @@ public class BitmapTileMapActivity extends MapActivity {
|
||||
if (i == 1) {
|
||||
mMapView.map().getMapPosition(p);
|
||||
p.setScale(4);
|
||||
mMapView.map().animator().animateTo(time, p, Easing.Type.LINEAR);
|
||||
mMapView.map().animator().animateTo(time, p);
|
||||
} else {
|
||||
//mMapView.map().setMapPosition(p);
|
||||
p.setScale(2 + (1 << (int) (Math.random() * 13)));
|
||||
@ -108,7 +107,7 @@ public class BitmapTileMapActivity extends MapActivity {
|
||||
p.setBearing((float) (Math.random() * 360));
|
||||
//mMapView.map().setMapPosition(p);
|
||||
|
||||
mMapView.map().animator().animateTo(time, p, Easing.Type.LINEAR);
|
||||
mMapView.map().animator().animateTo(time, p);
|
||||
}
|
||||
loooop((i + 1) % 2);
|
||||
|
||||
|
@ -34,7 +34,6 @@ import org.oscim.scalebar.MetricUnitAdapter;
|
||||
import org.oscim.theme.IRenderTheme;
|
||||
import org.oscim.theme.ThemeLoader;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.utils.Easing;
|
||||
|
||||
public class SimpleMapActivity extends BaseMapActivity {
|
||||
private DefaultMapScaleBar mapScaleBar;
|
||||
@ -92,7 +91,7 @@ public class SimpleMapActivity extends BaseMapActivity {
|
||||
if (i == 1) {
|
||||
mMapView.map().getMapPosition(p);
|
||||
p.setScale(4);
|
||||
mMapView.map().animator().animateTo(time, p, Easing.Type.LINEAR);
|
||||
mMapView.map().animator().animateTo(time, p);
|
||||
} else {
|
||||
//mMapView.map().setMapPosition(p);
|
||||
|
||||
@ -106,7 +105,7 @@ public class SimpleMapActivity extends BaseMapActivity {
|
||||
p.setBearing((float) (Math.random() * 360));
|
||||
//mMapView.map().setMapPosition(p);
|
||||
|
||||
mMapView.map().animator().animateTo(time, p, Easing.Type.LINEAR);
|
||||
mMapView.map().animator().animateTo(time, p);
|
||||
}
|
||||
loooop((i + 1) % 2);
|
||||
|
||||
|
@ -96,11 +96,11 @@ public class InputHandler implements InputProcessor {
|
||||
mMap.updateMap(true);
|
||||
break;
|
||||
case Input.Keys.NUM_1:
|
||||
mMap.animator().animateZoom(500, 0.5, 0, 0, Easing.Type.LINEAR);
|
||||
mMap.animator().animateZoom(500, 0.5, 0, 0);
|
||||
mMap.updateMap(false);
|
||||
break;
|
||||
case Input.Keys.NUM_2:
|
||||
mMap.animator().animateZoom(500, 2, 0, 0, Easing.Type.LINEAR);
|
||||
mMap.animator().animateZoom(500, 2, 0, 0);
|
||||
mMap.updateMap(false);
|
||||
break;
|
||||
|
||||
|
@ -27,7 +27,6 @@ import org.oscim.event.MotionEvent;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.map.Map.InputListener;
|
||||
import org.oscim.map.ViewController;
|
||||
import org.oscim.utils.Easing;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -178,7 +177,7 @@ public class MapEventLayer extends Layer implements InputListener, GestureListen
|
||||
}
|
||||
|
||||
/* handle double tap zoom */
|
||||
mMap.animator().animateZoom(300, 2, pivotX, pivotY, Easing.Type.LINEAR);
|
||||
mMap.animator().animateZoom(300, 2, pivotX, pivotY);
|
||||
|
||||
} else if (mStartMove > 0) {
|
||||
/* handle fling gesture */
|
||||
|
@ -66,6 +66,10 @@ public class Animator {
|
||||
mMap = map;
|
||||
}
|
||||
|
||||
public synchronized void animateTo(long duration, BoundingBox bbox) {
|
||||
animateTo(duration, bbox, Easing.Type.LINEAR);
|
||||
}
|
||||
|
||||
public synchronized void animateTo(long duration, BoundingBox bbox, Easing.Type easingType) {
|
||||
ThreadUtils.assertMainThread();
|
||||
|
||||
@ -100,6 +104,14 @@ public class Animator {
|
||||
animateTo(1000, bbox, Easing.Type.LINEAR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Animate to GeoPoint
|
||||
*
|
||||
* @param duration in ms
|
||||
* @param geoPoint
|
||||
* @param scale
|
||||
* @param relative alter scale relative to current scale
|
||||
*/
|
||||
public void animateTo(long duration, GeoPoint geoPoint,
|
||||
double scale, boolean relative) {
|
||||
animateTo(duration, geoPoint, scale, relative, Easing.Type.LINEAR);
|
||||
@ -112,6 +124,7 @@ public class Animator {
|
||||
* @param geoPoint
|
||||
* @param scale
|
||||
* @param relative alter scale relative to current scale
|
||||
* @param easingType easing function
|
||||
*/
|
||||
public void animateTo(long duration, GeoPoint geoPoint,
|
||||
double scale, boolean relative, Easing.Type easingType) {
|
||||
@ -136,6 +149,10 @@ public class Animator {
|
||||
animateTo(500, p, 1, true, Easing.Type.LINEAR);
|
||||
}
|
||||
|
||||
public void animateTo(long duration, MapPosition pos) {
|
||||
animateTo(duration, pos, Easing.Type.LINEAR);
|
||||
}
|
||||
|
||||
public void animateTo(long duration, MapPosition pos, Easing.Type easingType) {
|
||||
ThreadUtils.assertMainThread();
|
||||
|
||||
@ -238,7 +255,11 @@ public class Animator {
|
||||
}
|
||||
|
||||
float adv = clamp(1.0f - millisLeft / mDuration, 0, 1);
|
||||
// Avoid redundant calculations in case of linear easing
|
||||
if (mEasingType != Easing.Type.LINEAR) {
|
||||
adv = Easing.ease(0, (long) (adv * Long.MAX_VALUE), Long.MAX_VALUE, mEasingType);
|
||||
adv = clamp(adv, 0, 1);
|
||||
}
|
||||
|
||||
double scaleAdv = 1;
|
||||
if ((mState & ANIM_SCALE) != 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user