Mobile application issues

61 views
Skip to first unread message

Hongda Zhao

unread,
Jun 20, 2013, 7:29:35 AM6/20/13
to opentripp...@googlegroups.com
Dear all, 
    I want to save the trip and when i want to see this old trip, i can click a listview and show different old trip on the map. i want to ask which code on opentripplanner-android is used to get the information which used to draw trip path on maps(maybe is a jackson Config information but i am not sure). so anyone can help me if you know how to solve this issue.Thank you very much. 

Sean Barbeau

unread,
Jun 21, 2013, 11:37:47 AM6/21/13
to opentripp...@googlegroups.com
Hongda,
The exact line of code that executes the request to the OTP server (using Jackson for data binding) is here:
https://github.com/CUTR-at-USF/OpenTripPlanner-for-Android/blob/master/src/edu/usf/cutr/opentripplanner/android/tasks/TripRequest.java#L200

The Response object that is returned by this method holds all of the planned itinerary information.  Note that this Response object is derived from the main OTP project code, and we keep it in a library project to cleanly separate the Android app code from the Java objects used in the Jackson data binding.  Here's a link to the most recent version of the Response object we're using:
https://github.com/CUTR-at-USF/opentripplanner-pojos/blob/master/src/org/opentripplanner/v092snapshot/api/ws/Response.java

In the Android app execution, after we get a Response from the server we extract a list of Itineraries from the Response, and make a callback to the MainFragment that holds the map:
https://github.com/CUTR-at-USF/OpenTripPlanner-for-Android/blob/master/src/edu/usf/cutr/opentripplanner/android/tasks/TripRequest.java#L91

In MainFragment, this line then shows the route on the map:
https://github.com/CUTR-at-USF/OpenTripPlanner-for-Android/blob/master/src/edu/usf/cutr/opentripplanner/android/fragments/MainFragment.java#L915

...via a call to this method "showRouteOnMap()":
https://github.com/CUTR-at-USF/OpenTripPlanner-for-Android/blob/master/src/edu/usf/cutr/opentripplanner/android/fragments/MainFragment.java#L850

For saving old trips, you should just be able to save a reference to the TripPlan object, which is contained in the Response object:
https://github.com/CUTR-at-USF/opentripplanner-pojos/blob/master/src/org/opentripplanner/v092snapshot/api/model/TripPlan.java

Note that a TripPlan contains multiple Itinerary objects for the different possible trip plans shown to the user (and saving the list of Itineraries may be enough), so if you want to save a specific Itinerary you'd need a reference to this as well.

Sean

Hongda Zhao

unread,
Jun 23, 2013, 12:33:13 PM6/23/13
to opentripp...@googlegroups.com
thank you very much for your help.

在 2013年6月20日星期四UTC+2下午1时29分35秒,Hongda Zhao写道:
Reply all
Reply to author
Forward
0 new messages