add PointF

This commit is contained in:
Hannes Janetzek 2013-09-28 21:07:25 +02:00
parent 1226e6c292
commit 9653c02b46
3 changed files with 24 additions and 10 deletions

View File

@ -14,13 +14,29 @@
*/
package org.oscim.core;
/**
* The Class PointF represents a point in 2D.
*/
public class PointF {
/** The x ordinate */
public float x;
/** The y ordinate */
public float y;
/**
* Instantiates a new Point.
*/
public PointF() {
}
/**
* Instantiates a new Point with coordinates x and y.
*
* @param x the x
* @param y the y
*/
public PointF(float x, float y) {
this.x = x;
this.y = y;

View File

@ -1,19 +1,18 @@
package org.oscim.layers.marker;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.core.Point;
import org.oscim.core.PointF;
import org.oscim.layers.marker.MarkerItem.HotspotPlace;
public class MarkerSymbol {
final Bitmap[] mBitmap;
// Hotspot offset
final Point[] mOffset;
final PointF mOffset;
public MarkerSymbol(Bitmap bitmap, float relX, float relY) {
mBitmap = new Bitmap[1];
mBitmap[0] = bitmap;
mOffset = new Point[1];
mOffset[0] = new Point(relX, relY);
mOffset = new PointF(relX, relY);
}
public MarkerSymbol(Bitmap bitmap, HotspotPlace hotspot) {
@ -62,12 +61,11 @@ public class MarkerSymbol {
mBitmap = new Bitmap[1];
mBitmap[0] = bitmap;
mOffset = new Point[1];
mOffset[0] = new Point(x, y);
mOffset = new PointF(x, y);
}
public Point getHotspot() {
return mOffset[0];
public PointF getHotspot() {
return mOffset;
}
public Bitmap getBitmap() {

View File

@ -15,7 +15,7 @@
package org.oscim.renderer.elements;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.core.Point;
import org.oscim.core.PointF;
import org.oscim.renderer.atlas.TextureRegion;
import org.oscim.utils.pool.Inlist;
import org.oscim.utils.pool.SyncPool;
@ -45,7 +45,7 @@ public class SymbolItem extends Inlist<SymbolItem> {
public TextureRegion texRegion;
public Bitmap bitmap;
public Point offset;
public PointF offset;
public void set(float x, float y, TextureRegion texture, boolean billboard) {
this.x = x;