aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-09-01 18:48:30 +0200
committerBananeweizen <bananeweizen@gmx.de>2013-09-01 18:48:30 +0200
commit0247f00ee994932aa7da1a6a023eeedbe5a882a1 (patch)
treec1fd60823e78134b559786a1b3a12a815edf37fa
parentf49e0258af7ad5a20a52d134ced6cd749279a0b2 (diff)
downloadcgeo-0247f00ee994932aa7da1a6a023eeedbe5a882a1.zip
cgeo-0247f00ee994932aa7da1a6a023eeedbe5a882a1.tar.gz
cgeo-0247f00ee994932aa7da1a6a023eeedbe5a882a1.tar.bz2
fix #1945: Show Circles only for shown caches
-rw-r--r--main/src/cgeo/geocaching/maps/CachesOverlay.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/main/src/cgeo/geocaching/maps/CachesOverlay.java b/main/src/cgeo/geocaching/maps/CachesOverlay.java
index ad455b5..8fbb3db 100644
--- a/main/src/cgeo/geocaching/maps/CachesOverlay.java
+++ b/main/src/cgeo/geocaching/maps/CachesOverlay.java
@@ -122,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();
@@ -131,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);