Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1343] Android: Add Route support to MapView

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-05-04T17:00:14.000+0000
Affected Version/sRelease 1.7.0
Fix Version/sRelease 2.1.0, Sprint 2012-09 API
ComponentsAndroid
Labelsapi, parity, qe-testadded
ReporterDon Thorp
AssigneeHieu Pham
Created2011-04-15T02:49:56.000+0000
Updated2012-07-26T11:01:07.000+0000

Description

Attachments

FileDateSize
2.1 route fix screenshot.png2012-06-06T12:59:33.000+0000341004

Comments

  1. Dasher 2011-04-15

    todo:
    - integrate pending android map enhancements - add a proxy method (ala iPhone style) for the simplified routing - document, enhanced demo for KS, screencast

  2. Don Thorp 2011-04-15

    Please scope this effort early in the milestone to see if it will fit. If not please record your findings so we'll have them for the next sprint.

  3. Dawson Toth 2011-04-15

    Accidentally duplicated, so I'll post my sample code here to make this easier to test when we get to it.

    Sample Code

       var win = Ti.UI.createWindow({ backgroundColor: '#00f' });
       var map = Titanium.Map.createView({
           mapType: Titanium.Map.STANDARD_TYPE,
           region: {
               latitude: 42.3366, longitude: -71.1689,
               latitudeDelta: 0.001, longitudeDelta: 0.004
           }
       });
       map.addRoute({
           name: '1',
           points: [
               {latitude: 42.3353, longitude: -71.1705 },
               {latitude: 42.3383, longitude: -71.1690 },
               {latitude: 42.3358, longitude: -71.1670 },
               {latitude: 42.3353, longitude: -71.1705 }
           ],
           color: 'red',
           width: 4
       });
       map.addRoute({
           name: '2',
           points: [
               {latitude: 42.3363, longitude: -71.1682 },
               {latitude: 42.3370, longitude: -71.1686 },
               {latitude: 42.3369, longitude: -71.1692 },
               {latitude: 42.3366, longitude: -71.1695 },
               {latitude: 42.3361, longitude: -71.1690 },
               {latitude: 42.3368, longitude: -71.1685 }
           ],
           color: 'red',
           width: 4
       });
       win.add(map);
       win.open();
       

    Associated Helpdesk Ticket

    http://developer.appcelerator.com/helpdesk/view/76235">http://developer.appcelerator.com/helpdesk/view/76235

  4. Davide Bertola 2012-01-22

    can you estimante when this will be available ?
  5. Neeraj Gupta 2012-02-02

    We will try to add it in our next feature release.
  6. Arthur Evans 2012-02-02

    Note related ticket for multiple route support. iOS already supports adding multiple routes. For parity, Android should do likewise.
  7. Shannon Hicks 2012-03-23

    Community seems to have already done this, let's get a patch in place! http://boydlee.com/appcelerator-titanium/addroute-support-in-android-for-titanium-1.8.0.html
  8. Mark Ruys 2012-04-03

    Adding routes to a map is so basic. We need this on Android too!
  9. Hieu Pham 2012-05-04

    Test case:
       var win = Ti.UI.createWindow({ backgroundColor: '#00f' });
       var map = Titanium.Map.createView({
           mapType: Titanium.Map.STANDARD_TYPE,
           region: {
               latitude: 42.3366, longitude: -71.1689,
               latitudeDelta: 0.001, longitudeDelta: 0.004
           }
       });
       map.addRoute({
           name: '1',
           points: [
               {latitude: 42.3353, longitude: -71.1705 },
               {latitude: 42.3383, longitude: -71.1690 },
               {latitude: 42.3358, longitude: -71.1670 },
               {latitude: 42.3353, longitude: -71.1705 }
           ],
           color: 'red',
           width: 4
       });
       map.addRoute({
           name: '2',
           points: [
               {latitude: 42.3363, longitude: -71.1682 },
               {latitude: 42.3370, longitude: -71.1686 },
               {latitude: 42.3369, longitude: -71.1692 },
               {latitude: 42.3366, longitude: -71.1695 },
               {latitude: 42.3361, longitude: -71.1690 },
               {latitude: 42.3368, longitude: -71.1685 }
           ],
           color: 'red',
           width: 4
       });
       
       map.removeRoute({
           name: '2',
           points: [
               {latitude: 42.3363, longitude: -71.1682 },
               {latitude: 42.3370, longitude: -71.1686 },
               {latitude: 42.3369, longitude: -71.1692 },
               {latitude: 42.3366, longitude: -71.1695 },
               {latitude: 42.3361, longitude: -71.1690 },
               {latitude: 42.3368, longitude: -71.1685 }
           ],
           color: 'red',
           width: 4
       });
       
       win.add(map);
       win.open();
       
  10. Dustin Hyde 2012-06-06

    Closing as Fixed. Verified via Hieu's test code. SDK: 2.1.0.v20120606105255 Studio: 2.1.0.201206051612 Android: V8 Devices Tested: Nexus One 2.2.2, Revolution 2.3.6, Xoom 4.0.3
  11. Andrew Royce 2012-07-26

    What is the proper technique for updating a route? Say I am tracking a user as they are walking and showing a route on a map. I have tried the following but keep getting errors: * Remove route if already added * Add points to route * Re add route to map Is it possible to add a UpdateRoute method or possibly something like this map.routes[0].points.push(lat,long)? The problem with the above is I get the following error in logcat after a lot of points are added: W/dalvikvm(12413): threadid=1: thread exiting with uncaught exception (group=0x4001d560) E/TiApplication(12413): (main) [169428,177873] Sending event: exception on thread: main msg:java.util.ConcurrentModificationException; Titanium 2.1.0,2012/06/28 12:16,6e3cab6 E/TiApplication(12413): java.util.ConcurrentModificationException E/TiApplication(12413): at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:576) E/TiApplication(12413): at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:41) E/TiApplication(12413): at com.google.android.maps.MapView.onDraw(MapView.java:530) E/TiApplication(12413): at android.view.View.draw(View.java:6902) E/TiApplication(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1646) E/TiApplication(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/TiApplication(12413): at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:655) E/TiApplication(12413): at android.view.View.draw(View.java:6905) E/TiApplication(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1646) E/TiApplication(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/TiApplication(12413): at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:655) E/TiApplication(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) E/TiApplication(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/TiApplication(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) E/TiApplication(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/TiApplication(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) E/TiApplication(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/TiApplication(12413): at android.view.View.draw(View.java:6905) E/TiApplication(12413): at android.widget.FrameLayout.draw(FrameLayout.java:357) E/TiApplication(12413): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1957) E/TiApplication(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1646) E/TiApplication(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/TiApplication(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) E/TiApplication(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/TiApplication(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) E/TiApplication(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/TiApplication(12413): at android.view.View.draw(View.java:6905) E/TiApplication(12413): at android.widget.FrameLayout.draw(FrameLayout.java:357) E/TiApplication(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1646) E/TiApplication(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/TiApplication(12413): at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:655) E/TiApplication(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) E/TiApplication(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/TiApplication(12413): at android.view.View.draw(View.java:6905) E/TiApplication(12413): at android.widget.FrameLayout.draw(FrameLayout.java:357) E/TiApplication(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1646) E/TiApplication(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/TiApplication(12413): at android.view.View.draw(View.java:6905) E/TiApplication(12413): at android.widget.FrameLayout.draw(FrameLayout.java:357) E/TiApplication(12413): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1957) E/TiApplication(12413): at android.view.ViewRoot.draw(ViewRoot.java:1554) E/TiApplication(12413): at android.view.ViewRoot.performTraversals(ViewRoot.java:1263) E/TiApplication(12413): at android.view.ViewRoot.handleMessage(ViewRoot.java:1892) E/TiApplication(12413): at android.os.Handler.dispatchMessage(Handler.java:99) E/TiApplication(12413): at android.os.Looper.loop(Looper.java:130) E/TiApplication(12413): at android.app.ActivityThread.main(ActivityThread.java:3835) E/TiApplication(12413): at java.lang.reflect.Method.invokeNative(Native Method) E/TiApplication(12413): at java.lang.reflect.Method.invoke(Method.java:507) E/TiApplication(12413): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864) E/TiApplication(12413): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622) E/TiApplication(12413): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime(12413): FATAL EXCEPTION: main E/AndroidRuntime(12413): java.util.ConcurrentModificationException E/AndroidRuntime(12413): at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:576) E/AndroidRuntime(12413): at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:41) E/AndroidRuntime(12413): at com.google.android.maps.MapView.onDraw(MapView.java:530) E/AndroidRuntime(12413): at android.view.View.draw(View.java:6902) E/AndroidRuntime(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1646) E/AndroidRuntime(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/AndroidRuntime(12413): at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:655) E/AndroidRuntime(12413): at android.view.View.draw(View.java:6905) E/AndroidRuntime(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1646) E/AndroidRuntime(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/AndroidRuntime(12413): at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:655) E/AndroidRuntime(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) E/AndroidRuntime(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/AndroidRuntime(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) E/AndroidRuntime(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/AndroidRuntime(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) E/AndroidRuntime(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/AndroidRuntime(12413): at android.view.View.draw(View.java:6905) E/AndroidRuntime(12413): at android.widget.FrameLayout.draw(FrameLayout.java:357) E/AndroidRuntime(12413): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1957) E/AndroidRuntime(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1646) E/AndroidRuntime(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/AndroidRuntime(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) E/AndroidRuntime(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/AndroidRuntime(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) E/AndroidRuntime(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/AndroidRuntime(12413): at android.view.View.draw(View.java:6905) E/AndroidRuntime(12413): at android.widget.FrameLayout.draw(FrameLayout.java:357) E/AndroidRuntime(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1646) E/AndroidRuntime(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/AndroidRuntime(12413): at org.appcelerator.titanium.view.TiCompositeLayout.dispatchDraw(TiCompositeLayout.java:655) E/AndroidRuntime(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1644) E/AndroidRuntime(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/AndroidRuntime(12413): at android.view.View.draw(View.java:6905) E/AndroidRuntime(12413): at android.widget.FrameLayout.draw(FrameLayout.java:357) E/AndroidRuntime(12413): at android.view.ViewGroup.drawChild(ViewGroup.java:1646) E/AndroidRuntime(12413): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) E/AndroidRuntime(12413): at android.view.View.draw(View.java:6905) E/AndroidRuntime(12413): at android.widget.FrameLayout.draw(FrameLayout.java:357) E/AndroidRuntime(12413): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1957) E/AndroidRuntime(12413): at android.view.ViewRoot.draw(ViewRoot.java:1554) E/AndroidRuntime(12413): at android.view.ViewRoot.performTraversals(ViewRoot.java:1263) E/AndroidRuntime(12413): at android.view.ViewRoot.handleMessage(ViewRoot.java:1892) E/AndroidRuntime(12413): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(12413): at android.os.Looper.loop(Looper.java:130) E/AndroidRuntime(12413): at android.app.ActivityThread.main(ActivityThread.java:3835) E/AndroidRuntime(12413): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(12413): at java.lang.reflect.Method.invoke(Method.java:507) E/AndroidRuntime(12413): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864) E/AndroidRuntime(12413): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622) E/AndroidRuntime(12413): at dalvik.system.NativeStart.main(Native Method) W/ActivityManager( 1646): Force finishing activity com.libertastechnologies.stelizabeth/ti.modules.titanium.ui.TiTabActivity
  12. Hieu Pham 2012-07-26

    Your approach seems fine to me. The crash you're seeing looks like a platform bug to me. So if you can file a JIRA ticket for it with a simple test case, we'll investigate further. You can also request a new feature for "updateRoute" via another JIRA ticket.

JSON Source