diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2011-09-16 14:36:28 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2011-09-16 14:36:28 +0200 |
| commit | 579ef7a535489d4aa632db11667a3b01deb6cafd (patch) | |
| tree | 55810021c02ac7d80d3a9702ef0b59e4af154b9c /main/src/cgeo/geocaching/mapinterfaces | |
| parent | 96ea21fd50334479c262da692038965d0e4d596a (diff) | |
| download | cgeo-579ef7a535489d4aa632db11667a3b01deb6cafd.zip cgeo-579ef7a535489d4aa632db11667a3b01deb6cafd.tar.gz cgeo-579ef7a535489d4aa632db11667a3b01deb6cafd.tar.bz2 | |
Move sources into the main directory
This prepares the inclusion of tests into the same repository.
Diffstat (limited to 'main/src/cgeo/geocaching/mapinterfaces')
13 files changed, 343 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/mapinterfaces/ActivityImpl.java b/main/src/cgeo/geocaching/mapinterfaces/ActivityImpl.java new file mode 100644 index 0000000..043ca59 --- /dev/null +++ b/main/src/cgeo/geocaching/mapinterfaces/ActivityImpl.java @@ -0,0 +1,43 @@ +package cgeo.geocaching.mapinterfaces; + +import android.app.Activity; +import android.content.res.Resources; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; + +/** + * Defines the common functions of the provider-specific + * MapActivity implementations. + * + * @author rsudev + * + */ +public interface ActivityImpl { + + Resources getResources(); + + Activity getActivity(); + + void superOnCreate(Bundle savedInstanceState); + + void superOnResume(); + + void superOnDestroy(); + + void superOnStop(); + + void superOnPause(); + + boolean superOnCreateOptionsMenu(Menu menu); + + boolean superOnPrepareOptionsMenu(Menu menu); + + boolean superOnOptionsItemSelected(MenuItem item); + + public abstract void goHome(View view); + + public abstract void goManual(View view); + +} diff --git a/main/src/cgeo/geocaching/mapinterfaces/CacheOverlayItemImpl.java b/main/src/cgeo/geocaching/mapinterfaces/CacheOverlayItemImpl.java new file mode 100644 index 0000000..df74a4c --- /dev/null +++ b/main/src/cgeo/geocaching/mapinterfaces/CacheOverlayItemImpl.java @@ -0,0 +1,18 @@ +package cgeo.geocaching.mapinterfaces; + +import cgeo.geocaching.cgCoord; + +/** + * Covers the common functions of the provider-specific + * CacheOverlayItem implementations + * + * @author rsudev + * + */ +public interface CacheOverlayItemImpl extends OverlayItemImpl { + + public cgCoord getCoord(); + + public String getType(); + +} diff --git a/main/src/cgeo/geocaching/mapinterfaces/GeoPointImpl.java b/main/src/cgeo/geocaching/mapinterfaces/GeoPointImpl.java new file mode 100644 index 0000000..4142368 --- /dev/null +++ b/main/src/cgeo/geocaching/mapinterfaces/GeoPointImpl.java @@ -0,0 +1,16 @@ +package cgeo.geocaching.mapinterfaces; + +/** + * Defines the common functions of the provider-specific + * GeoPoint implementations + * + * @author rsudev + * + */ +public interface GeoPointImpl { + + int getLatitudeE6(); + + int getLongitudeE6(); + +} diff --git a/main/src/cgeo/geocaching/mapinterfaces/ItemizedOverlayImpl.java b/main/src/cgeo/geocaching/mapinterfaces/ItemizedOverlayImpl.java new file mode 100644 index 0000000..b738e41 --- /dev/null +++ b/main/src/cgeo/geocaching/mapinterfaces/ItemizedOverlayImpl.java @@ -0,0 +1,35 @@ +package cgeo.geocaching.mapinterfaces; + +import cgeo.geocaching.mapcommon.ItemizedOverlayBase; + +import android.graphics.Canvas; +import android.graphics.Point; +import android.graphics.drawable.Drawable; + +/** + * Defines the common functions to access the provider-specific + * ItemizedOverlay implementation + * + * @author rsudev + * + */ +public interface ItemizedOverlayImpl extends OverlayImpl { + + ItemizedOverlayBase getBase(); + + void superPopulate(); + + void superSetLastFocusedItemIndex(int i); + + Drawable superBoundCenter(Drawable markerIn); + + Drawable superBoundCenterBottom(Drawable marker); + + boolean superOnTap(int index); + + void superDraw(Canvas canvas, MapViewImpl mapView, boolean shadow); + + void superDrawOverlayBitmap(Canvas canvas, Point drawPosition, MapProjectionImpl projection, + byte drawZoomLevel); + +} diff --git a/main/src/cgeo/geocaching/mapinterfaces/MapControllerImpl.java b/main/src/cgeo/geocaching/mapinterfaces/MapControllerImpl.java new file mode 100644 index 0000000..00e31d2 --- /dev/null +++ b/main/src/cgeo/geocaching/mapinterfaces/MapControllerImpl.java @@ -0,0 +1,20 @@ +package cgeo.geocaching.mapinterfaces; + +/** + * Defines the common functions of the provider-specific + * MapController implementations + * + * @author rsudev + * + */ +public interface MapControllerImpl { + + void setZoom(int mapzoom); + + void setCenter(GeoPointImpl geoPoint); + + void animateTo(GeoPointImpl geoPoint); + + void zoomToSpan(int latSpanE6, int lonSpanE6); + +} diff --git a/main/src/cgeo/geocaching/mapinterfaces/MapFactory.java b/main/src/cgeo/geocaching/mapinterfaces/MapFactory.java new file mode 100644 index 0000000..467947d --- /dev/null +++ b/main/src/cgeo/geocaching/mapinterfaces/MapFactory.java @@ -0,0 +1,32 @@ +package cgeo.geocaching.mapinterfaces; + +import cgeo.geocaching.cgCoord; +import cgeo.geocaching.cgUser; +import cgeo.geocaching.geopoint.Geopoint; + +import android.app.Activity; +import android.content.Context; + +/** + * Defines functions of a factory class to get implementation specific objects + * (GeoPoints, OverlayItems, ...) + * + * @author rsudev + * + */ +public interface MapFactory { + + public Class<? extends Activity> getMapClass(); + + public int getMapViewId(); + + public int getMapLayoutId(); + + public GeoPointImpl getGeoPointBase(final Geopoint coords); + + CacheOverlayItemImpl getCacheOverlayItem(cgCoord coordinate, String type); + + public UserOverlayItemImpl getUserOverlayItemBase(Context context, + cgUser userOne); + +} diff --git a/main/src/cgeo/geocaching/mapinterfaces/MapProjectionImpl.java b/main/src/cgeo/geocaching/mapinterfaces/MapProjectionImpl.java new file mode 100644 index 0000000..e3cc1fa --- /dev/null +++ b/main/src/cgeo/geocaching/mapinterfaces/MapProjectionImpl.java @@ -0,0 +1,18 @@ +package cgeo.geocaching.mapinterfaces; + +import android.graphics.Point; + +/** + * Defines common functions of the provider-specific + * MapProjection implementations + * + * @author rsudev + * + */ +public interface MapProjectionImpl { + + Object getImpl(); + + void toPixels(GeoPointImpl leftGeo, Point left); + +} diff --git a/main/src/cgeo/geocaching/mapinterfaces/MapViewImpl.java b/main/src/cgeo/geocaching/mapinterfaces/MapViewImpl.java new file mode 100644 index 0000000..2cd016f --- /dev/null +++ b/main/src/cgeo/geocaching/mapinterfaces/MapViewImpl.java @@ -0,0 +1,72 @@ +package cgeo.geocaching.mapinterfaces; + +import cgeo.geocaching.cgSettings; +import cgeo.geocaching.mapcommon.cgMapMyOverlay; +import cgeo.geocaching.mapcommon.cgMapOverlay; +import cgeo.geocaching.mapcommon.cgOverlayScale; +import cgeo.geocaching.mapcommon.cgUsersOverlay; + +import android.app.Activity; +import android.content.Context; +import android.graphics.drawable.Drawable; + +/** + * Defines common functions of the provider-specific + * MapView implementations + * + * @author rsudev + * + */ +public interface MapViewImpl { + + void invalidate(); + + void setBuiltInZoomControls(boolean b); + + void displayZoomControls(boolean b); + + void preLoad(); + + void clearOverlays(); + + void addOverlay(OverlayImpl ovl); + + MapControllerImpl getMapController(); + + void destroyDrawingCache(); + + GeoPointImpl getMapViewCenter(); + + int getLatitudeSpan(); + + int getLongitudeSpan(); + + int getMapZoomLevel(); + + int getWidth(); + + int getHeight(); + + MapProjectionImpl getMapProjection(); + + Context getContext(); + + cgMapOverlay createAddMapOverlay(cgSettings settings, Context context, + Drawable drawable, boolean fromDetailIntent); + + cgUsersOverlay createAddUsersOverlay(Context context, Drawable markerIn); + + cgOverlayScale createAddScaleOverlay(Activity activity, cgSettings settingsIn); + + cgMapMyOverlay createAddPositionOverlay(Activity activity, cgSettings settingsIn); + + boolean needsScaleOverlay(); + + void setBuiltinScale(boolean b); + + void setMapSource(cgSettings settings); + + void repaintRequired(OverlayBase overlay); + + void setOnDragListener(OnDragListener onDragListener); +} diff --git a/main/src/cgeo/geocaching/mapinterfaces/OnDragListener.java b/main/src/cgeo/geocaching/mapinterfaces/OnDragListener.java new file mode 100644 index 0000000..4ae2d41 --- /dev/null +++ b/main/src/cgeo/geocaching/mapinterfaces/OnDragListener.java @@ -0,0 +1,13 @@ +package cgeo.geocaching.mapinterfaces; + +/** + * Notifies the parent class when a MapView has been dragged + * + * @author cachapa + * + */ +public interface OnDragListener { + + public void onDrag(); + +} diff --git a/main/src/cgeo/geocaching/mapinterfaces/OverlayBase.java b/main/src/cgeo/geocaching/mapinterfaces/OverlayBase.java new file mode 100644 index 0000000..e544f0d --- /dev/null +++ b/main/src/cgeo/geocaching/mapinterfaces/OverlayBase.java @@ -0,0 +1,21 @@ +package cgeo.geocaching.mapinterfaces; + +import android.graphics.Canvas; +import android.graphics.Point; + +/** + * Defines the base functions of the provider-independent + * Overlay implementations + * + * @author rsudev + * + */ +public interface OverlayBase { + + void draw(Canvas canvas, MapViewImpl mapView, boolean shadow); + + void drawOverlayBitmap(Canvas canvas, Point drawPosition, + MapProjectionImpl projection, byte drawZoomLevel); + + OverlayImpl getOverlayImpl(); +} diff --git a/main/src/cgeo/geocaching/mapinterfaces/OverlayImpl.java b/main/src/cgeo/geocaching/mapinterfaces/OverlayImpl.java new file mode 100644 index 0000000..ede6872 --- /dev/null +++ b/main/src/cgeo/geocaching/mapinterfaces/OverlayImpl.java @@ -0,0 +1,21 @@ +package cgeo.geocaching.mapinterfaces; + +/** + * Marker interface of the provider-specific + * Overlay implementations + * + * @author rsudev + * + */ +public interface OverlayImpl { + + public enum overlayType { + PositionOverlay, + ScaleOverlay + } + + void lock(); + + void unlock(); + +} diff --git a/main/src/cgeo/geocaching/mapinterfaces/OverlayItemImpl.java b/main/src/cgeo/geocaching/mapinterfaces/OverlayItemImpl.java new file mode 100644 index 0000000..3cc2061 --- /dev/null +++ b/main/src/cgeo/geocaching/mapinterfaces/OverlayItemImpl.java @@ -0,0 +1,19 @@ +package cgeo.geocaching.mapinterfaces; + +import android.graphics.drawable.Drawable; + +/** + * Common functions of the provider-specific + * OverlayItem implementations + * + * @author rsudev + * + */ +public interface OverlayItemImpl { + + public String getTitle(); + + public Drawable getMarker(int index); + + public void setMarker(Drawable markerIn); +} diff --git a/main/src/cgeo/geocaching/mapinterfaces/UserOverlayItemImpl.java b/main/src/cgeo/geocaching/mapinterfaces/UserOverlayItemImpl.java new file mode 100644 index 0000000..3e552e8 --- /dev/null +++ b/main/src/cgeo/geocaching/mapinterfaces/UserOverlayItemImpl.java @@ -0,0 +1,15 @@ +package cgeo.geocaching.mapinterfaces; + +import cgeo.geocaching.cgUser; + +/** + * Common functions of the provider-specific + * UserOverlayItem implementations + * + * @author rsudev + * + */ +public interface UserOverlayItemImpl extends OverlayItemImpl { + + public cgUser getUser(); +} |
