aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/maps/AbstractItemizedOverlay.java
blob: 747618b97d0bdc9ac2105975e356f0690a2634c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package cgeo.geocaching.maps;

import cgeo.geocaching.maps.interfaces.GeneralOverlay;
import cgeo.geocaching.maps.interfaces.ItemizedOverlayImpl;
import cgeo.geocaching.maps.interfaces.MapProjectionImpl;
import cgeo.geocaching.maps.interfaces.MapViewImpl;
import cgeo.geocaching.maps.interfaces.OverlayImpl;
import cgeo.geocaching.maps.interfaces.OverlayItemImpl;

import android.graphics.Canvas;
import android.graphics.Point;
import android.graphics.drawable.Drawable;

/**
 * Base class for itemized overlays. Delegates calls from deriving classes to the contained
 * provider-specific implementation.
 */
public abstract class AbstractItemizedOverlay implements GeneralOverlay {

    private ItemizedOverlayImpl ovlImpl;

    protected AbstractItemizedOverlay(ItemizedOverlayImpl ovlImplIn) {
        ovlImpl = ovlImplIn;
    }

    void populate() {
        ovlImpl.superPopulate();
    }

    public boolean onTap(int index) {
        return ovlImpl.superOnTap(index);
    }

    Drawable boundCenterBottom(Drawable markerIn) {
        return ovlImpl.superBoundCenterBottom(markerIn);
    }

    void setLastFocusedItemIndex(int index) {
        ovlImpl.superSetLastFocusedItemIndex(index);
    }

    @Override
    public void draw(Canvas canvas, MapViewImpl mapView, boolean shadow) {
        ovlImpl.superDraw(canvas, mapView, shadow);
    }

    @Override
    public void drawOverlayBitmap(Canvas canvas, Point drawPosition,
            MapProjectionImpl projection, byte drawZoomLevel) {
        ovlImpl.superDrawOverlayBitmap(canvas, drawPosition, projection, drawZoomLevel);
    }

    @Override
    public OverlayImpl getOverlayImpl() {
        return ovlImpl;
    }

    public abstract OverlayItemImpl createItem(int index);

    public abstract int size();
}