diff options
Diffstat (limited to 'src/cgeo/geocaching/googlemaps/googleOverlay.java')
| -rw-r--r-- | src/cgeo/geocaching/googlemaps/googleOverlay.java | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/src/cgeo/geocaching/googlemaps/googleOverlay.java b/src/cgeo/geocaching/googlemaps/googleOverlay.java index 3847d9f..8473faa 100644 --- a/src/cgeo/geocaching/googlemaps/googleOverlay.java +++ b/src/cgeo/geocaching/googlemaps/googleOverlay.java @@ -1,6 +1,13 @@ package cgeo.geocaching.googlemaps; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +import android.app.Activity; import android.graphics.Canvas; +import cgeo.geocaching.cgSettings; +import cgeo.geocaching.mapcommon.cgMapMyOverlay; +import cgeo.geocaching.mapcommon.cgOverlayScale; import cgeo.geocaching.mapinterfaces.MapViewImpl; import cgeo.geocaching.mapinterfaces.OverlayBase; import cgeo.geocaching.mapinterfaces.OverlayImpl; @@ -10,17 +17,39 @@ import com.google.android.maps.Overlay; public class googleOverlay extends Overlay implements OverlayImpl { - private OverlayBase overlayBase; + private OverlayBase overlayBase = null; + private Lock lock = new ReentrantLock(); - public googleOverlay(OverlayBase overlayBaseIn) { - overlayBase = overlayBaseIn; + public googleOverlay(Activity activityIn, cgSettings settingsIn, overlayType ovlType) { + switch (ovlType) { + case PositionOverlay: + overlayBase = new cgMapMyOverlay(settingsIn, activityIn, this); + break; + case ScaleOverlay: + overlayBase = new cgOverlayScale(activityIn, settingsIn, this); + } } @Override public void draw(Canvas canvas, MapView mapView, boolean shadow) { super.draw(canvas, mapView, shadow); - overlayBase.draw(canvas, (MapViewImpl) mapView, shadow); + if (overlayBase != null) { + overlayBase.draw(canvas, (MapViewImpl) mapView, shadow); + } + } + + public OverlayBase getBase() { + return overlayBase; + } + + @Override + public void lock() { + lock.lock(); } + @Override + public void unlock() { + lock.unlock(); + } } |
