lint changed its opinion on whether FloatMath is faster than Math. need to do some benchmarks..
http://code.google.com/p/android/issues/detail?id=36199
This commit is contained in:
parent
4c458d9d1f
commit
d5b480cf22
@ -10,7 +10,6 @@ import org.oscim.view.MapViewPosition;
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.FloatMath;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
@ -174,7 +173,6 @@ public class ItemizedIconOverlay<Item extends OverlayItem> extends ItemizedOverl
|
||||
* When a content sensitive action is performed the content item needs to be
|
||||
* identified. This method does that and then performs the assigned task on
|
||||
* that item.
|
||||
*
|
||||
* @param event
|
||||
* ...
|
||||
* @param mapView
|
||||
@ -202,7 +200,7 @@ public class ItemizedIconOverlay<Item extends OverlayItem> extends ItemizedOverl
|
||||
mapViewPosition.getScreenPointOnMap(eventX, eventY, mTouchScreenPoint);
|
||||
|
||||
int nearest = -1;
|
||||
float dist = Float.MAX_VALUE;
|
||||
double dist = Double.MAX_VALUE;
|
||||
|
||||
// TODO use intermediate projection and bounding box test
|
||||
|
||||
@ -221,7 +219,7 @@ public class ItemizedIconOverlay<Item extends OverlayItem> extends ItemizedOverl
|
||||
|
||||
float dx = mItemPoint.x - mTouchScreenPoint.x;
|
||||
float dy = mItemPoint.y - mTouchScreenPoint.y;
|
||||
float d = FloatMath.sqrt(dx * dx + dy * dy);
|
||||
double d = Math.sqrt(dx * dx + dy * dy);
|
||||
|
||||
if (d < 50) {
|
||||
// Log.d("...", "HIT! " + (x - mTouchScreenPoint.x) + " " + (y - mTouchScreenPoint.y));
|
||||
@ -262,7 +260,6 @@ public class ItemizedIconOverlay<Item extends OverlayItem> extends ItemizedOverl
|
||||
* When the item is touched one of these methods may be invoked depending on
|
||||
* the type of touch. Each of them returns true if the event was completely
|
||||
* handled.
|
||||
*
|
||||
* @param <T>
|
||||
* ....
|
||||
*/
|
||||
|
@ -18,8 +18,6 @@ import org.oscim.renderer.layer.TextItem;
|
||||
import org.oscim.theme.renderinstruction.Text;
|
||||
import org.oscim.utils.GeometryUtils;
|
||||
|
||||
import android.util.FloatMath;
|
||||
|
||||
public final class WayDecorator {
|
||||
// /**
|
||||
// * Minimum distance in pixels before the symbol is repeated.
|
||||
@ -168,7 +166,7 @@ public final class WayDecorator {
|
||||
continue;
|
||||
}
|
||||
|
||||
float segmentLengthInPixel = FloatMath.sqrt(diffX * diffX + diffY * diffY);
|
||||
double segmentLengthInPixel = Math.sqrt(diffX * diffX + diffY * diffY);
|
||||
|
||||
if (skipPixels > 0) {
|
||||
skipPixels -= segmentLengthInPixel;
|
||||
@ -181,7 +179,7 @@ public final class WayDecorator {
|
||||
|
||||
if (segmentLengthInPixel > wayNameWidth * 0.80) {
|
||||
|
||||
float s = (wayNameWidth + 25) / segmentLengthInPixel;
|
||||
float s = (wayNameWidth + 25) / (float) segmentLengthInPixel;
|
||||
int width, height;
|
||||
int x1, y1, x2, y2;
|
||||
|
||||
@ -241,21 +239,6 @@ public final class WayDecorator {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Log.d("mapsforge", "add " + text + " " + first + " " +
|
||||
// last);
|
||||
|
||||
// if (previousX < currentX) {
|
||||
// x1 = previousX;
|
||||
// y1 = previousY;
|
||||
// x2 = currentX;
|
||||
// y2 = currentY;
|
||||
// } else {
|
||||
// x1 = currentX;
|
||||
// y1 = currentY;
|
||||
// x2 = previousX;
|
||||
// y2 = previousY;
|
||||
// }
|
||||
|
||||
// if (t == null)
|
||||
t = TextItem.get();
|
||||
// t = new TextItem(x1 + (x2 - x1) / 2, y1 + (y2 - y1) / 2,
|
||||
|
@ -19,7 +19,6 @@ import org.oscim.renderer.GLRenderer;
|
||||
import org.oscim.theme.renderinstruction.Line;
|
||||
|
||||
import android.graphics.Paint.Cap;
|
||||
import android.util.FloatMath;
|
||||
|
||||
public final class LineLayer extends Layer {
|
||||
|
||||
@ -122,7 +121,7 @@ public final class LineLayer extends Layer {
|
||||
vx = nextX - x;
|
||||
vy = nextY - y;
|
||||
|
||||
a = FloatMath.sqrt(vx * vx + vy * vy);
|
||||
a = (float) Math.sqrt(vx * vx + vy * vy);
|
||||
|
||||
vx = (vx / a);
|
||||
vy = (vy / a);
|
||||
@ -289,14 +288,14 @@ public final class LineLayer extends Layer {
|
||||
// Unit vector pointing back to previous node
|
||||
vx = prevX - x;
|
||||
vy = prevY - y;
|
||||
a = FloatMath.sqrt(vx * vx + vy * vy);
|
||||
a = (float) Math.sqrt(vx * vx + vy * vy);
|
||||
vx = (vx / a);
|
||||
vy = (vy / a);
|
||||
|
||||
// Unit vector pointing forward to next node
|
||||
wx = nextX - x;
|
||||
wy = nextY - y;
|
||||
a = FloatMath.sqrt(wx * wx + wy * wy);
|
||||
a = (float) Math.sqrt(wx * wx + wy * wy);
|
||||
wx = (wx / a);
|
||||
wy = (wy / a);
|
||||
|
||||
@ -369,7 +368,7 @@ public final class LineLayer extends Layer {
|
||||
vx = prevX - x;
|
||||
vy = prevY - y;
|
||||
|
||||
a = FloatMath.sqrt(vx * vx + vy * vy);
|
||||
a = (float) Math.sqrt(vx * vx + vy * vy);
|
||||
|
||||
vx = (vx / a);
|
||||
vy = (vy / a);
|
||||
|
Loading…
x
Reference in New Issue
Block a user