fix: show markers that are partially on screen

this is more appropriate. closes #26
This commit is contained in:
Hannes Janetzek 2014-01-29 03:49:20 +01:00
parent f5c162330a
commit 3ad98603a4

View File

@ -55,7 +55,9 @@ public abstract class ItemizedLayer<Item extends MarkerItem> extends MarkerLayer
//static final Logger log = LoggerFactory.getLogger(ItemizedOverlay.class); //static final Logger log = LoggerFactory.getLogger(ItemizedOverlay.class);
protected final MarkerSymbol mDefaultMarker; protected final MarkerSymbol mDefaultMarker;
protected boolean mDrawFocusedItem = true;
/** increase view to show items that are partially visible */
protected int mExtents = 100;
class InternalItem { class InternalItem {
InternalItem next; InternalItem next;
@ -101,11 +103,13 @@ public abstract class ItemizedLayer<Item extends MarkerItem> extends MarkerLayer
int numVisible = 0; int numVisible = 0;
mMap.getViewport().getMapViewProjection(mBox); mMap.getViewport().getMapViewProjection(mBox);
for (int i = 0; i < 8; i += 2) {
/** increase view to show items that are partially visible */ float x = mBox[i];
for (int i = 0; i < 8; i++) float y = mBox[i + 1];
// should suffice for reasonable large items float len = (float) Math.sqrt(x * x + y * y);
mBox[i] += mBox[i] > 0 ? 100 : -100; mBox[i + 0] += x / len * mExtents;
mBox[i + 1] += y / len * mExtents;
}
long flip = (long) (Tile.SIZE * pos.scale) >> 1; long flip = (long) (Tile.SIZE * pos.scale) >> 1;