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; package org.oscim.core;
/**
* The Class PointF represents a point in 2D.
*/
public class PointF { public class PointF {
/** The x ordinate */
public float x; public float x;
/** The y ordinate */
public float y; public float y;
/**
* Instantiates a new Point.
*/
public PointF() { 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) { public PointF(float x, float y) {
this.x = x; this.x = x;
this.y = y; this.y = y;

View File

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

View File

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