Skip to content

Instantly share code, notes, and snippets.

@billdawson
Created May 4, 2012 13:57
Show Gist options
  • Save billdawson/2594952 to your computer and use it in GitHub Desktop.
Save billdawson/2594952 to your computer and use it in GitHub Desktop.
diff --git a/android/modules/map/src/java/ti/modules/titanium/map/ViewProxy.java b/android/modules/map/src/java/ti/modules/titanium/map/ViewProxy.java
index 181debc..540f04a 100644
--- a/android/modules/map/src/java/ti/modules/titanium/map/ViewProxy.java
+++ b/android/modules/map/src/java/ti/modules/titanium/map/ViewProxy.java
@@ -185,33 +185,29 @@ public class ViewProxy extends TiViewProxy
}
@Kroll.method
- @SuppressWarnings({"rawtypes", "unchecked"})
- public void addRoute(Object route)
+ public void addRoute(KrollDict routeMap)
{
- if (route instanceof HashMap) {
- HashMap routeMap = ((HashMap)route);
- Object routeArray = routeMap.get("points");
- if (routeArray instanceof Object[]) {
- Object[] routes = (Object[]) routeArray;
- MapPoint[] pointsType = new MapPoint[routes.length];
- for (int i = 0; i < routes.length; i++) {
-
- if (routes[i] instanceof HashMap) {
- HashMap tempRoute = (HashMap)routes[i];
- MapPoint mp = new MapPoint(TiConvert.toDouble(tempRoute, "latitude"), TiConvert.toDouble(tempRoute, "longitude"));
- pointsType[i] = mp;
- }
- }
-
- MapRoute mr = new MapRoute(pointsType, TiConvert.toColor(routeMap, "color"), TiConvert.toInt(routeMap, "width"), TiConvert.toString(routeMap, "name"));
+ Object routeArray = routeMap.get("points");
+ if (routeArray instanceof Object[]) {
+ Object[] routes = (Object[]) routeArray;
+ MapPoint[] pointsType = new MapPoint[routes.length];
+ for (int i = 0; i < routes.length; i++) {
- if (mapView == null) {
- this.routes.add(mr);
- } else {
- mapView.addRoute(mr);
+ if (routes[i] instanceof HashMap) {
+ HashMap tempRoute = (HashMap)routes[i];
+ MapPoint mp = new MapPoint(TiConvert.toDouble(tempRoute, "latitude"), TiConvert.toDouble(tempRoute, "longitude"));
+ pointsType[i] = mp;
}
- }
- }
+ }
+
+ MapRoute mr = new MapRoute(pointsType, TiConvert.toColor(routeMap, "color"), TiConvert.toInt(routeMap, "width"), TiConvert.toString(routeMap, "name"));
+
+ if (mapView == null) {
+ this.routes.add(mr);
+ } else {
+ mapView.addRoute(mr);
+ }
+ }
if (mapView != null) {
mapView.updateRoute();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment