Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. DistanceMatrixApiRequest x = new DistanceMatrixApiRequest(context);
  2.  
  3. List<Waypoint> allWaypoints = wpDao.findAllByVehicleId(testVehicle.getId());
  4. allWaypoints.sort(Comparator.comparingInt(Waypoint::getOrderInRoute));
  5.  
  6. LatLng[] waypointLatLngs = new LatLng[allWaypoints.size()];
  7. for(int j = 0; j< allWaypoints.size(); j++) {
  8. waypointLatLngs[j] = (new LatLng(allWaypoints.get(j).getLatitude(), allWaypoints.get(j).getLongitude()));
  9. }
  10.  
  11. org.joda.time.DateTime departureTime = new org.joda.time.DateTime(new Date().getTime());
  12.  
  13. DirectionsResult routeDirections = DirectionsApi.newRequest(context)
  14. .origin(new LatLng(testVehicle.getCurrentLatitude(), testVehicle.getCurrentLongitude()))
  15. .waypoints(waypointLatLngs)
  16. .destination(new LatLng(waypointLatLngs[waypointLatLngs.length-1].lat, waypointLatLngs[waypointLatLngs.length-1].lng))
  17. .await();
  18. EncodedPolyline routePolyline = routeDirections.routes[0].overviewPolyline;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement