diff options
Diffstat (limited to 'main/src/cgeo/geocaching/maps/CachesOverlay.java')
| -rw-r--r-- | main/src/cgeo/geocaching/maps/CachesOverlay.java | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/main/src/cgeo/geocaching/maps/CachesOverlay.java b/main/src/cgeo/geocaching/maps/CachesOverlay.java index 8e117eb..8fbb3db 100644 --- a/main/src/cgeo/geocaching/maps/CachesOverlay.java +++ b/main/src/cgeo/geocaching/maps/CachesOverlay.java @@ -4,7 +4,6 @@ import cgeo.geocaching.CachePopup; import cgeo.geocaching.Geocache; import cgeo.geocaching.IWaypoint; import cgeo.geocaching.R; -import cgeo.geocaching.settings.Settings; import cgeo.geocaching.WaypointPopup; import cgeo.geocaching.cgData; import cgeo.geocaching.activity.Progress; @@ -19,11 +18,13 @@ import cgeo.geocaching.maps.interfaces.MapItemFactory; import cgeo.geocaching.maps.interfaces.MapProjectionImpl; import cgeo.geocaching.maps.interfaces.MapProvider; import cgeo.geocaching.maps.interfaces.MapViewImpl; +import cgeo.geocaching.settings.Settings; import cgeo.geocaching.utils.Log; import org.apache.commons.lang3.StringUtils; import android.content.Context; +import android.content.res.Resources.NotFoundException; import android.graphics.Canvas; import android.graphics.DashPathEffect; import android.graphics.Paint; @@ -121,6 +122,8 @@ public class CachesOverlay extends AbstractItemizedOverlay { try { lazyInitializeDrawingObjects(); canvas.setDrawFilter(setFilter); + final int height = canvas.getHeight(); + final int width = canvas.getWidth(); final int radius = calculateDrawingRadius(projection); final Point center = new Point(); @@ -130,16 +133,17 @@ public class CachesOverlay extends AbstractItemizedOverlay { final Geopoint itemCoord = item.getCoord().getCoords(); final GeoPointImpl itemGeo = mapItemFactory.getGeoPointBase(itemCoord); projection.toPixels(itemGeo, center); - - // dashed circle around the waypoint - blockedCircle.setColor(0x66BB0000); - blockedCircle.setStyle(Style.STROKE); - canvas.drawCircle(center.x, center.y, radius, blockedCircle); - - // filling the circle area with a transparent color - blockedCircle.setColor(0x44BB0000); - blockedCircle.setStyle(Style.FILL); - canvas.drawCircle(center.x, center.y, radius, blockedCircle); + if (center.x > -radius && center.y > -radius && center.x < width + radius && center.y < height + radius) { + // dashed circle around the waypoint + blockedCircle.setColor(0x66BB0000); + blockedCircle.setStyle(Style.STROKE); + canvas.drawCircle(center.x, center.y, radius, blockedCircle); + + // filling the circle area with a transparent color + blockedCircle.setColor(0x44BB0000); + blockedCircle.setStyle(Style.FILL); + canvas.drawCircle(center.x, center.y, radius, blockedCircle); + } } } canvas.setDrawFilter(removeFilter); @@ -243,7 +247,7 @@ public class CachesOverlay extends AbstractItemizedOverlay { } progress.dismiss(); - } catch (Exception e) { + } catch (NotFoundException e) { Log.e("CachesOverlay.onTap", e); if (progress != null) { progress.dismiss(); |
