diff --git a/vtm/src/org/oscim/core/Box.java b/vtm/src/org/oscim/core/Box.java index 822db4a6..6eddd4eb 100644 --- a/vtm/src/org/oscim/core/Box.java +++ b/vtm/src/org/oscim/core/Box.java @@ -34,7 +34,7 @@ public class Box { return (x >= minX && x <= maxY && y >= minY && y <= maxY); } - public boolean contains(PointD p){ + public boolean contains(Point p){ return (p.x >= minX && p.x <= maxY && p.y >= minY && p.y <= maxY); } } diff --git a/vtm/src/org/oscim/core/GeoPoint.java b/vtm/src/org/oscim/core/GeoPoint.java index b5898e2d..7eaced36 100644 --- a/vtm/src/org/oscim/core/GeoPoint.java +++ b/vtm/src/org/oscim/core/GeoPoint.java @@ -68,7 +68,7 @@ public class GeoPoint implements Comparable { this(latitudeE6 / CONVERSION_FACTOR, longitudeE6 / CONVERSION_FACTOR); } - public void project(PointD out) { + public void project(Point out) { out.x = MercatorProjection.longitudeToX(this.longitudeE6 / CONVERSION_FACTOR); out.y = MercatorProjection.latitudeToY(this.latitudeE6 / CONVERSION_FACTOR); } diff --git a/vtm/src/org/oscim/core/MercatorProjection.java b/vtm/src/org/oscim/core/MercatorProjection.java index a72d4743..4b62b138 100644 --- a/vtm/src/org/oscim/core/MercatorProjection.java +++ b/vtm/src/org/oscim/core/MercatorProjection.java @@ -91,9 +91,9 @@ public final class MercatorProjection { return 360.0 * (x - 0.5); } - public static PointD project(GeoPoint p, PointD reuse) { + public static Point project(GeoPoint p, Point reuse) { if (reuse == null) - reuse = new PointD(); + reuse = new Point(); reuse.x = ((p.longitudeE6 / 1E6) + 180.0) / 360.0; diff --git a/vtm/src/org/oscim/core/PointD.java b/vtm/src/org/oscim/core/Point.java similarity index 92% rename from vtm/src/org/oscim/core/PointD.java rename to vtm/src/org/oscim/core/Point.java index 8ff24c0f..5e8c01ed 100644 --- a/vtm/src/org/oscim/core/PointD.java +++ b/vtm/src/org/oscim/core/Point.java @@ -14,12 +14,12 @@ */ package org.oscim.core; -public class PointD { +public class Point { public double x; public double y; - public PointD() { + public Point() { } - PointD(double x, double y){ + public Point(double x, double y){ this.x = x; this.y = y; } diff --git a/vtm/src/org/oscim/core/PointF.java b/vtm/src/org/oscim/core/PointF.java deleted file mode 100644 index c6eadf48..00000000 --- a/vtm/src/org/oscim/core/PointF.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2012 Hannes Janetzek - * - * This program is free software: you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License along with - * this program. If not, see . - */ -package org.oscim.core; - -/** - * without further ado: This class represents a 2D Point using float coordinates - */ -public class PointF { - public float x; - public float y; - - public PointF() { - } - - public PointF(float x, float y) { - this.x = x; - this.y = y; - } - - public void set(float x, float y) { - this.x = x; - this.y = y; - - } - -} diff --git a/vtm/src/org/oscim/layers/overlay/ItemizedIconOverlay.java b/vtm/src/org/oscim/layers/overlay/ItemizedIconOverlay.java index 67f13101..e1e6c594 100644 --- a/vtm/src/org/oscim/layers/overlay/ItemizedIconOverlay.java +++ b/vtm/src/org/oscim/layers/overlay/ItemizedIconOverlay.java @@ -19,8 +19,7 @@ import java.util.List; import org.oscim.backend.input.MotionEvent; import org.oscim.core.BoundingBox; -import org.oscim.core.PointD; -import org.oscim.core.PointF; +import org.oscim.core.Point; import org.oscim.view.Map; import org.oscim.view.Viewport; @@ -31,7 +30,7 @@ public class ItemizedIconOverlay extends ItemizedOverl protected OnItemGestureListener mOnItemGestureListener; private int mDrawnItemsLimit = Integer.MAX_VALUE; - private final PointD mTmpPoint = new PointD(); + private final Point mTmpPoint = new Point(); public ItemizedIconOverlay( final Map map, @@ -57,7 +56,7 @@ public class ItemizedIconOverlay extends ItemizedOverl // } @Override - public boolean onSnapToItem(final int pX, final int pY, final PointF pSnapPoint) { + public boolean onSnapToItem(final int pX, final int pY, final Point pSnapPoint) { // TODO Implement this! return false; } diff --git a/vtm/src/org/oscim/layers/overlay/ItemizedOverlay.java b/vtm/src/org/oscim/layers/overlay/ItemizedOverlay.java index 556cf082..4c75b4fb 100644 --- a/vtm/src/org/oscim/layers/overlay/ItemizedOverlay.java +++ b/vtm/src/org/oscim/layers/overlay/ItemizedOverlay.java @@ -23,7 +23,7 @@ package org.oscim.layers.overlay; import org.oscim.core.MapPosition; import org.oscim.core.MercatorProjection; -import org.oscim.core.PointD; +import org.oscim.core.Point; import org.oscim.core.Tile; import org.oscim.renderer.GLRenderer.Matrices; import org.oscim.renderer.layers.BasicRenderLayer; @@ -152,9 +152,9 @@ public abstract class ItemizedOverlay extends Overlay continue; } - int state = 0; - if (mDrawFocusedItem && (mFocusedItem == it.item)) - state = OverlayItem.ITEM_STATE_FOCUSED_MASK; + //int state = 0; + //if (mDrawFocusedItem && (mFocusedItem == it.item)) + // state = OverlayItem.ITEM_STATE_FOCUSED_MASK; //Drawable marker = it.item.getDrawable(); OverlayMarker marker = it.item.getMarker(); @@ -223,7 +223,7 @@ public abstract class ItemizedOverlay extends Overlay mLayer = new ItemOverlay(); } - private final PointD mMapPoint = new PointD(); + private final Point mMapPoint = new Point(); /** * Utility method to perform all processing on a new ItemizedOverlay. diff --git a/vtm/src/org/oscim/layers/overlay/Overlay.java b/vtm/src/org/oscim/layers/overlay/Overlay.java index 638a37a7..1b4faebf 100644 --- a/vtm/src/org/oscim/layers/overlay/Overlay.java +++ b/vtm/src/org/oscim/layers/overlay/Overlay.java @@ -16,9 +16,9 @@ package org.oscim.layers.overlay; -import org.oscim.view.Map; -import org.oscim.core.PointF; +import org.oscim.core.Point; import org.oscim.layers.InputLayer; +import org.oscim.view.Map; /** * Base class representing an overlay which may be displayed on top of a @@ -60,7 +60,7 @@ public abstract class Overlay extends InputLayer { * untouched if not snapping. * @return Whether or not to snap to the interesting point. */ - boolean onSnapToItem(int x, int y, PointF snapPoint); + boolean onSnapToItem(int x, int y, Point snapPoint); } ///** diff --git a/vtm/src/org/oscim/layers/overlay/OverlayMarker.java b/vtm/src/org/oscim/layers/overlay/OverlayMarker.java index 2070893c..4e7de0ad 100644 --- a/vtm/src/org/oscim/layers/overlay/OverlayMarker.java +++ b/vtm/src/org/oscim/layers/overlay/OverlayMarker.java @@ -15,19 +15,19 @@ package org.oscim.layers.overlay; import org.oscim.backend.canvas.Bitmap; -import org.oscim.core.PointF; +import org.oscim.core.Point; import org.oscim.layers.overlay.OverlayItem.HotspotPlace; public class OverlayMarker { final Bitmap[] mBitmap; // Hotspot offset - final PointF[] mOffset; + final Point[] mOffset; public OverlayMarker(Bitmap bitmap, float relX, float relY) { mBitmap = new Bitmap[1]; mBitmap[0] = bitmap; - mOffset = new PointF[1]; - mOffset[0] = new PointF(relX, relY); + mOffset = new Point[1]; + mOffset[0] = new Point(relX, relY); } public OverlayMarker(Bitmap bitmap, HotspotPlace hotspot) { @@ -76,11 +76,11 @@ public class OverlayMarker { mBitmap = new Bitmap[1]; mBitmap[0] = bitmap; - mOffset = new PointF[1]; - mOffset[0] = new PointF(x, y); + mOffset = new Point[1]; + mOffset[0] = new Point(x, y); } - public PointF getHotspot() { + public Point getHotspot() { return mOffset[0]; } diff --git a/vtm/src/org/oscim/renderer/sublayers/SymbolItem.java b/vtm/src/org/oscim/renderer/sublayers/SymbolItem.java index 96e559c2..16a1e4bf 100644 --- a/vtm/src/org/oscim/renderer/sublayers/SymbolItem.java +++ b/vtm/src/org/oscim/renderer/sublayers/SymbolItem.java @@ -15,7 +15,7 @@ package org.oscim.renderer.sublayers; import org.oscim.backend.canvas.Bitmap; -import org.oscim.core.PointF; +import org.oscim.core.Point; import org.oscim.renderer.atlas.TextureRegion; import org.oscim.utils.pool.Inlist; import org.oscim.utils.pool.SyncPool; @@ -46,6 +46,6 @@ public class SymbolItem extends Inlist { public TextureRegion symbol; public Bitmap bitmap; - public PointF offset; + public Point offset; } diff --git a/vtm/src/org/oscim/renderer/sublayers/SymbolLayer.java b/vtm/src/org/oscim/renderer/sublayers/SymbolLayer.java index 42e8ab94..7dc81933 100644 --- a/vtm/src/org/oscim/renderer/sublayers/SymbolLayer.java +++ b/vtm/src/org/oscim/renderer/sublayers/SymbolLayer.java @@ -129,8 +129,8 @@ public final class SymbolLayer extends TextureLayer { y1 = (short) (SCALE * (hh)); y2 = (short) (SCALE * (-hh)); } else { - float hw = it.offset.x * width; - float hh = it.offset.y * height; + float hw = (float)(it.offset.x * width); + float hh = (float)(it.offset.y * height); x1 = (short) (SCALE * (-hw)); x2 = (short) (SCALE * (width - hw)); y1 = (short) (SCALE * (height - hh)); diff --git a/vtm/src/org/oscim/utils/GeometryUtils.java b/vtm/src/org/oscim/utils/GeometryUtils.java index 3c1c009b..ab6c9f49 100644 --- a/vtm/src/org/oscim/utils/GeometryUtils.java +++ b/vtm/src/org/oscim/utils/GeometryUtils.java @@ -14,7 +14,7 @@ */ package org.oscim.utils; -import org.oscim.core.PointD; +import org.oscim.core.Point; /** @@ -176,7 +176,7 @@ public final class GeometryUtils { double ax2, double ay2, double bx1, double by1, double bx2, double by2, - PointD point) + Point point) { double ua_numr = (bx2 - bx1) * (ay1 - by1) - (by2 - by1) * (ax1 - bx1); double ub_numr = (ax2 - ax1) * (ay1 - by1) - (ay2 - ay1) * (ax1 - bx1); diff --git a/vtm/src/org/oscim/view/Layers.java b/vtm/src/org/oscim/view/Layers.java index c29dfaa1..c5577a7e 100644 --- a/vtm/src/org/oscim/view/Layers.java +++ b/vtm/src/org/oscim/view/Layers.java @@ -23,7 +23,7 @@ import org.oscim.backend.Log; import org.oscim.backend.input.KeyEvent; import org.oscim.backend.input.MotionEvent; import org.oscim.core.MapPosition; -import org.oscim.core.PointF; +import org.oscim.core.Point; import org.oscim.layers.InputLayer; import org.oscim.layers.Layer; import org.oscim.layers.overlay.Overlay.Snappable; @@ -227,7 +227,7 @@ public class Layers extends AbstractList { return false; } - public boolean onSnapToItem(final int x, final int y, final PointF snapPoint) { + public boolean onSnapToItem(int x, int y, Point snapPoint) { if (mDirtyLayers) updateLayers(); diff --git a/vtm/src/org/oscim/view/Viewport.java b/vtm/src/org/oscim/view/Viewport.java index 98c03125..554adee7 100644 --- a/vtm/src/org/oscim/view/Viewport.java +++ b/vtm/src/org/oscim/view/Viewport.java @@ -20,8 +20,7 @@ import org.oscim.core.Box; import org.oscim.core.GeoPoint; import org.oscim.core.MapPosition; import org.oscim.core.MercatorProjection; -import org.oscim.core.PointD; -import org.oscim.core.PointF; +import org.oscim.core.Point; import org.oscim.core.Tile; import org.oscim.utils.FastMath; import org.oscim.utils.Matrix4; @@ -66,7 +65,7 @@ public class Viewport { private final Matrix4 mTmpMatrix = new Matrix4(); // temporary vars: only use in synchronized functions! - private final PointD mMovePoint = new PointD(); + private final Point mMovePoint = new Point(); private final float[] mv = new float[4]; private final float[] mu = new float[4]; private final float[] mViewCoords = new float[8]; @@ -300,7 +299,7 @@ public class Viewport { * @param y screen coordinate * @param out Point coords will be set */ - public synchronized void getScreenPointOnMap(float x, float y, double scale, PointD out) { + public synchronized void getScreenPointOnMap(float x, float y, double scale, Point out) { // scale to -1..1 float mx = 1 - (x / mWidth * 2); @@ -338,7 +337,7 @@ public class Viewport { * @param x screen coordinate * @param y screen coordinate */ - public synchronized void fromScreenPixels(double x, double y, PointD out) { + public synchronized void fromScreenPixels(double x, double y, Point out) { // scale to -1..1 float mx = (float) (1 - (x / mWidth * 2)); float my = (float) (1 - (y / mHeight * 2)); @@ -375,7 +374,7 @@ public class Viewport { * @param geoPoint the GeoPoint * @param out Point projected to screen pixel relative to center */ - public synchronized void project(GeoPoint geoPoint, PointD out) { + public synchronized void project(GeoPoint geoPoint, Point out) { MercatorProjection.project(geoPoint, out); project(out.x, out.y, out); } @@ -385,7 +384,7 @@ public class Viewport { * * @param out Point projected to screen pixel */ - public synchronized void project(double x, double y, PointD out) { + public synchronized void project(double x, double y, Point out) { mv[0] = (float) (x * mCurScale - mCurX); mv[1] = (float) (y * mCurScale - mCurY); @@ -454,7 +453,7 @@ public class Viewport { // stop animation animCancel(); - PointD p = applyRotation(mx, my); + Point p = applyRotation(mx, my); move(p.x, p.y); } @@ -474,7 +473,7 @@ public class Viewport { updatePosition(); } - private PointD applyRotation(float mx, float my) { + private Point applyRotation(float mx, float my) { double rad = Math.toRadians(mRotation); double rcos = Math.cos(rad); double rsin = Math.sin(rad); @@ -720,7 +719,7 @@ public class Viewport { float dy = mVelocityY * adv; if (dx != 0 || dy != 0) { - PointD p = applyRotation((float) (dx - mScrollX), (float) (dy - mScrollY)); + Point p = applyRotation((float) (dx - mScrollX), (float) (dy - mScrollY)); move(p.x, p.y); mScrollX = dx; @@ -835,7 +834,7 @@ public class Viewport { if (mAnimPivot) { scale = mAbsScale / scale; - PointD p = applyRotation( + Point p = applyRotation( (float) (mScrollX * (1.0 - scale)), (float) (mScrollY * (1.0 - scale))); move(p.x, p.y);