cleanup: marker layer

This commit is contained in:
Hannes Janetzek 2014-01-29 00:59:24 +01:00
parent aaf250dca4
commit 246d692dd7
3 changed files with 7 additions and 8 deletions

View File

@ -192,8 +192,8 @@ public class ItemizedIconLayer<Item extends MarkerItem> extends ItemizedLayer<It
float dx = (float) (mTmpPoint.x - eventX); float dx = (float) (mTmpPoint.x - eventX);
float dy = (float) (mTmpPoint.y - eventY); float dy = (float) (mTmpPoint.y - eventY);
double d = dx * dx + dy * dy;
// squared dist: 50*50 pixel // squared dist: 50*50 pixel
double d = dx * dx + dy * dy;
if (d < 2500) { if (d < 2500) {
if (d < dist) { if (d < dist) {
dist = d; dist = d;

View File

@ -102,12 +102,12 @@ public abstract class ItemizedLayer<Item extends MarkerItem> extends MarkerLayer
mMap.getViewport().getMapViewProjection(mBox); mMap.getViewport().getMapViewProjection(mBox);
float flipMax = (float) (Tile.SIZE * pos.scale) / 2;
/** increase view to show items that are partially visible */ /** increase view to show items that are partially visible */
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
// should suffice for reasonable large items // should suffice for reasonable large items
mBox[i] += mBox[i] > 0 ? 100 : -100; mBox[i] += mBox[i] > 0 ? 100 : -100;
long flip = (long) (Tile.SIZE * pos.scale) >> 1;
synchronized (lock) { synchronized (lock) {
if (mItems == null) { if (mItems == null) {
@ -124,10 +124,10 @@ public abstract class ItemizedLayer<Item extends MarkerItem> extends MarkerLayer
it.x = (float) ((it.px - mx) * scale); it.x = (float) ((it.px - mx) * scale);
it.y = (float) ((it.py - my) * scale); it.y = (float) ((it.py - my) * scale);
if (it.x > flipMax) if (it.x > flip)
it.x -= (flipMax * 2); it.x -= (flip << 1);
else if (it.x < -flipMax) else if (it.x < -flip)
it.x += (flipMax * 2); it.x += (flip << 1);
if (!GeometryUtils.pointInPoly(it.x, it.y, mBox, 8, 0)) { if (!GeometryUtils.pointInPoly(it.x, it.y, mBox, 8, 0)) {
if (it.visible) { if (it.visible) {

View File

@ -65,8 +65,7 @@ public class MarkerItem {
this(null, title, description, geoPoint); this(null, title, description, geoPoint);
} }
public MarkerItem(String uid, String title, String description, public MarkerItem(String uid, String title, String description, GeoPoint geoPoint) {
GeoPoint geoPoint) {
mTitle = title; mTitle = title;
mDescription = description; mDescription = description;
mGeoPoint = geoPoint; mGeoPoint = geoPoint;