diff --git a/res/.gitignore b/res/.gitignore
deleted file mode 100644
index f935021a..00000000
--- a/res/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-!.gitignore
diff --git a/src/org/oscim/overlay/marker_default.png b/res/drawable/marker_default.png
similarity index 100%
rename from src/org/oscim/overlay/marker_default.png
rename to res/drawable/marker_default.png
diff --git a/src/org/oscim/overlay/marker_default_focused_base.png b/res/drawable/marker_default_focused_base.png
similarity index 100%
rename from src/org/oscim/overlay/marker_default_focused_base.png
rename to res/drawable/marker_default_focused_base.png
diff --git a/res/drawable/pin.png b/res/drawable/pin.png
new file mode 100644
index 00000000..46c70185
Binary files /dev/null and b/res/drawable/pin.png differ
diff --git a/src/org/oscim/overlay/DefaultResourceProxyImpl.java b/src/org/oscim/overlay/DefaultResourceProxyImpl.java
deleted file mode 100644
index a8da571e..00000000
--- a/src/org/oscim/overlay/DefaultResourceProxyImpl.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright 2012 osmdroid
- * Copyright 2013 Hannes Janetzek
- *
- * This program is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along with
- * this program. If not, see .
- */
-package org.oscim.overlay;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Field;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.util.DisplayMetrics;
-
-public class DefaultResourceProxyImpl implements ResourceProxy, MapViewConstants {
- // private static final String TAG = DefaultResourceProxyImpl.class.getSimpleName();
-
- private DisplayMetrics mDisplayMetrics;
-
- /**
- * Constructor.
- *
- * @param pContext
- * Used to get the display metrics that are used for scaling the
- * bitmaps returned by {@@link getBitmap}. Can be null,
- * in which case the bitmaps are not scaled.
- */
- public DefaultResourceProxyImpl(final Context pContext) {
- if (pContext != null) {
- mDisplayMetrics = pContext.getResources().getDisplayMetrics();
- // if (DEBUGMODE) {
- // logger.debug("mDisplayMetrics=" + mDisplayMetrics);
- // }
- }
- }
-
- @Override
- public String getString(final string pResId) {
- switch (pResId) {
- case mapnik:
- return "Mapnik";
- case cyclemap:
- return "Cycle Map";
- case public_transport:
- return "Public transport";
- case base:
- return "OSM base layer";
- case topo:
- return "Topographic";
- case hills:
- return "Hills";
- case cloudmade_standard:
- return "CloudMade (Standard tiles)";
- case cloudmade_small:
- return "CloudMade (small tiles)";
- case mapquest_osm:
- return "Mapquest";
- case mapquest_aerial:
- return "Mapquest Aerial";
- case bing:
- return "Bing";
- case fiets_nl:
- return "OpenFietsKaart overlay";
- case base_nl:
- return "Netherlands base overlay";
- case roads_nl:
- return "Netherlands roads overlay";
- case unknown:
- return "Unknown";
- case format_distance_meters:
- return "%s m";
- case format_distance_kilometers:
- return "%s km";
- case format_distance_miles:
- return "%s mi";
- case format_distance_nautical_miles:
- return "%s nm";
- case format_distance_feet:
- return "%s ft";
- case online_mode:
- return "Online mode";
- case offline_mode:
- return "Offline mode";
- case my_location:
- return "My location";
- case compass:
- return "Compass";
- case map_mode:
- return "Map mode";
- default:
- throw new IllegalArgumentException();
- }
- }
-
- @Override
- public String getString(final string pResId, final Object... formatArgs) {
- return String.format(getString(pResId), formatArgs);
- }
-
- @Override
- public Bitmap getBitmap(final bitmap pResId) {
- InputStream is = null;
- try {
- final String resName = pResId.name() + ".png";
- is = getClass().getResourceAsStream(resName);
- if (is == null) {
- throw new IllegalArgumentException("Resource not found: " + resName);
- }
- BitmapFactory.Options options = null;
- if (mDisplayMetrics != null) {
- options = getBitmapOptions();
- }
- return BitmapFactory.decodeStream(is, null, options);
- } catch (final OutOfMemoryError e) {
- // logger.error("OutOfMemoryError getting bitmap resource: " +
- // pResId);
- System.gc();
- // there's not much we can do here
- // - when we load a bitmap from resources we expect it to be found
- throw e;
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (final IOException ignore) {
- }
- }
- }
- }
-
- private BitmapFactory.Options getBitmapOptions() {
- try {
- final Field density = DisplayMetrics.class.getDeclaredField("DENSITY_DEFAULT");
- final Field inDensity = BitmapFactory.Options.class.getDeclaredField("inDensity");
- final Field inTargetDensity = BitmapFactory.Options.class
- .getDeclaredField("inTargetDensity");
- final Field targetDensity = DisplayMetrics.class.getDeclaredField("densityDpi");
- final BitmapFactory.Options options = new BitmapFactory.Options();
- inDensity.setInt(options, density.getInt(null));
- inTargetDensity.setInt(options, targetDensity.getInt(mDisplayMetrics));
- return options;
- } catch (final IllegalAccessException ex) {
- // ignore
- } catch (final NoSuchFieldException ex) {
- // ignore
- }
- return null;
- }
-
- @Override
- public Drawable getDrawable(final bitmap pResId) {
- return new BitmapDrawable(getBitmap(pResId));
- }
-
- @Override
- public float getDisplayMetricsDensity() {
- return mDisplayMetrics.density;
- }
-
-}
diff --git a/src/org/oscim/overlay/ItemizedIconOverlay.java b/src/org/oscim/overlay/ItemizedIconOverlay.java
index 98649f35..0a45e45d 100644
--- a/src/org/oscim/overlay/ItemizedIconOverlay.java
+++ b/src/org/oscim/overlay/ItemizedIconOverlay.java
@@ -17,8 +17,8 @@ package org.oscim.overlay;
import java.util.List;
+import org.oscim.app.R;
import org.oscim.core.MercatorProjection;
-import org.oscim.overlay.ResourceProxy.bitmap;
import org.oscim.view.MapView;
import org.oscim.view.MapViewPosition;
@@ -42,35 +42,22 @@ public class ItemizedIconOverlay- extends ItemizedOverl
final MapView mapView,
final List
- pList,
final Drawable pDefaultMarker,
- final ItemizedIconOverlay.OnItemGestureListener
- pOnItemGestureListener,
- final ResourceProxy pResourceProxy) {
+ final ItemizedIconOverlay.OnItemGestureListener
- pOnItemGestureListener) {
- super(mapView, pDefaultMarker, pResourceProxy);
+ super(mapView, pDefaultMarker);
this.mItemList = pList;
this.mOnItemGestureListener = pOnItemGestureListener;
populate();
}
- public ItemizedIconOverlay(
- final MapView mapView,
- final List
- pList,
- final ItemizedIconOverlay.OnItemGestureListener
- pOnItemGestureListener,
- final ResourceProxy pResourceProxy) {
-
- this(mapView, pList, pResourceProxy.getDrawable(bitmap.marker_default),
- pOnItemGestureListener,
- pResourceProxy);
- }
-
public ItemizedIconOverlay(
final MapView mapView,
final Context pContext,
final List
- pList,
final ItemizedIconOverlay.OnItemGestureListener
- pOnItemGestureListener) {
- this(mapView, pList, new DefaultResourceProxyImpl(pContext)
- .getDrawable(bitmap.marker_default),
- pOnItemGestureListener, new DefaultResourceProxyImpl(pContext));
+ this(mapView, pList, pContext.getResources().getDrawable(R.drawable.marker_default),
+ pOnItemGestureListener);
}
@Override
diff --git a/src/org/oscim/overlay/ItemizedOverlay.java b/src/org/oscim/overlay/ItemizedOverlay.java
index 46b79f5d..1054d2db 100644
--- a/src/org/oscim/overlay/ItemizedOverlay.java
+++ b/src/org/oscim/overlay/ItemizedOverlay.java
@@ -84,7 +84,7 @@ public abstract class ItemizedOverlay
- extends Overlay
// note: this is called from GL-Thread. so check your syncs!
@Override
- public synchronized void update(MapPosition curPos,
+ public synchronized void update(MapPosition curPos,
boolean positionChanged,
boolean tilesChanged) {
@@ -236,10 +236,9 @@ public abstract class ItemizedOverlay
- extends Overlay
*/
public abstract int size();
- public ItemizedOverlay(MapView mapView, final Drawable pDefaultMarker, final ResourceProxy
- pResourceProxy) {
+ public ItemizedOverlay(MapView mapView, final Drawable pDefaultMarker) {
- super(pResourceProxy);
+ super();
if (pDefaultMarker == null) {
throw new IllegalArgumentException("You must pass a default marker to ItemizedOverlay.");
@@ -247,8 +246,6 @@ public abstract class ItemizedOverlay
- extends Overlay
this.mDefaultMarker = pDefaultMarker;
- // mInternalItemList = new ArrayList
- ();
-
mMapView = mapView;
mLayer = new ItemOverlay(mapView);
diff --git a/src/org/oscim/overlay/MapViewConstants.java b/src/org/oscim/overlay/MapViewConstants.java
deleted file mode 100644
index abdd77fe..00000000
--- a/src/org/oscim/overlay/MapViewConstants.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2012 osmdroid
- * Copyright 2013 Hannes Janetzek
- *
- * This program is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along with
- * this program. If not, see .
- */
-
-// Created by plusminus on 18:00:24 - 25.09.2008
-package org.oscim.overlay;
-
-/**
- * This class contains constants used by the map view.
- *
- * @author Nicolas Gramlich
- */
-public interface MapViewConstants {
- // ===========================================================
- // Final Fields
- // ===========================================================
-
- public static final boolean DEBUGMODE = false;
-
- public static final int NOT_SET = Integer.MIN_VALUE;
-
- public static final int ANIMATION_SMOOTHNESS_LOW = 4;
- public static final int ANIMATION_SMOOTHNESS_DEFAULT = 10;
- public static final int ANIMATION_SMOOTHNESS_HIGH = 20;
-
- public static final int ANIMATION_DURATION_SHORT = 500;
- public static final int ANIMATION_DURATION_DEFAULT = 1000;
- public static final int ANIMATION_DURATION_LONG = 2000;
-
- /** Minimum Zoom Level */
- public static final int MINIMUM_ZOOMLEVEL = 0;
-
- /**
- * Maximum Zoom Level - we use Integers to store zoom levels so overflow
- * happens at 2^32 - 1,
- * but we also have a tile size that is typically 2^8, so (32-1)-8-1 = 22
- */
- public static final int MAXIMUM_ZOOMLEVEL = 22;
-}
diff --git a/src/org/oscim/overlay/Overlay.java b/src/org/oscim/overlay/Overlay.java
index 658c6f04..a42ccf8c 100644
--- a/src/org/oscim/overlay/Overlay.java
+++ b/src/org/oscim/overlay/Overlay.java
@@ -23,7 +23,6 @@ import org.oscim.core.MapPosition;
import org.oscim.renderer.overlays.RenderOverlay;
import org.oscim.view.MapView;
-import android.content.Context;
import android.graphics.Point;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -39,7 +38,7 @@ import android.view.MotionEvent;
*
* @author Nicolas Gramlich
*/
-public abstract class Overlay implements OverlayConstants {
+public abstract class Overlay {
// ===========================================================
// Constants
@@ -55,8 +54,8 @@ public abstract class Overlay implements OverlayConstants {
// Fields
// ===========================================================
- protected final ResourceProxy mResourceProxy;
- protected final float mScale;
+ //protected final ResourceProxy mResourceProxy;
+ //protected final float mScale;
// private static final Rect mRect = new Rect();
private boolean mEnabled = true;
@@ -72,20 +71,6 @@ public abstract class Overlay implements OverlayConstants {
// ===========================================================
public Overlay() {
- mResourceProxy = null;
- mScale = 1;
- // mResourceProxy = new DefaultResourceProxyImpl(ctx);
- // mScale = ctx.getResources().getDisplayMetrics().density;
- }
-
- public Overlay(final Context ctx) {
- mResourceProxy = new DefaultResourceProxyImpl(ctx);
- mScale = ctx.getResources().getDisplayMetrics().density;
- }
-
- public Overlay(final ResourceProxy pResourceProxy) {
- mResourceProxy = pResourceProxy;
- mScale = mResourceProxy.getDisplayMetricsDensity();
}
// ===========================================================
diff --git a/src/org/oscim/overlay/OverlayConstants.java b/src/org/oscim/overlay/OverlayConstants.java
deleted file mode 100644
index 4d119d87..00000000
--- a/src/org/oscim/overlay/OverlayConstants.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2012 osmdroid
- * Copyright 2013 Hannes Janetzek
- *
- * This program is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along with
- * this program. If not, see .
- */
-package org.oscim.overlay;
-
-/**
- * This class contains constants used by the overlays.
- */
-public interface OverlayConstants {
- // ===========================================================
- // Final Fields
- // ===========================================================
-
- public static final boolean DEBUGMODE = false;
-
- public static final int NOT_SET = Integer.MIN_VALUE;
-
- public static final int DEFAULT_ZOOMLEVEL_MINIMAP_DIFFERENCE = 3;
-}
diff --git a/src/org/oscim/overlay/PathOverlay.java b/src/org/oscim/overlay/PathOverlay.java
index 7723b1c7..f6573acf 100644
--- a/src/org/oscim/overlay/PathOverlay.java
+++ b/src/org/oscim/overlay/PathOverlay.java
@@ -163,7 +163,7 @@ public class PathOverlay extends Overlay {
}
public PathOverlay(MapView mapView, final int color, final Context ctx) {
- super(ctx);
+ super();
this.mPaint.setColor(color);
this.mPaint.setStrokeWidth(2.0f);
this.mPaint.setStyle(Paint.Style.STROKE);
diff --git a/src/org/oscim/overlay/ResourceProxy.java b/src/org/oscim/overlay/ResourceProxy.java
deleted file mode 100644
index 8439334d..00000000
--- a/src/org/oscim/overlay/ResourceProxy.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2012 osmdroid
- * Copyright 2013 Hannes Janetzek
- *
- * This program is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along with
- * this program. If not, see .
- */
-package org.oscim.overlay;
-
-import android.graphics.Bitmap;
-import android.graphics.drawable.Drawable;
-
-public interface ResourceProxy {
-
- public static enum string {
-
- // tile sources
- mapnik, cyclemap, public_transport, base, topo, hills, cloudmade_small, cloudmade_standard, mapquest_osm, mapquest_aerial, bing,
-
- // overlays
- fiets_nl, base_nl, roads_nl,
-
- // other stuff
- unknown, format_distance_meters, format_distance_kilometers, format_distance_miles, format_distance_nautical_miles, format_distance_feet, online_mode, offline_mode, my_location, compass, map_mode,
-
- }
-
- public static enum bitmap {
-
- /**
- * For testing - the image doesn't exist.
- */
- unknown,
-
- center, direction_arrow, marker_default, marker_default_focused_base, navto_small, next, previous, person,
-
- /**
- * Menu icons
- */
- ic_menu_offline, ic_menu_mylocation, ic_menu_compass, ic_menu_mapmode
- }
-
- String getString(string pResId);
-
- /**
- * Use a string resource as a format definition, and format using the
- * supplied format arguments.
- *
- * @param pResId
- * ...
- * @param formatArgs
- * ...
- * @return ...
- */
- String getString(string pResId, Object... formatArgs);
-
- Bitmap getBitmap(bitmap pResId);
-
- /**
- * Get a bitmap as a {@link Drawable}
- *
- * @param pResId
- * ...
- * @return ...
- */
- Drawable getDrawable(bitmap pResId);
-
- /**
- * Gets the density from the current screen's DisplayMetrics
- *
- * @return the screen's density
- */
- float getDisplayMetricsDensity();
-}