Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DistanceMatrixApiRequest x = new DistanceMatrixApiRequest(context);
- List<Waypoint> allWaypoints = wpDao.findAllByVehicleId(testVehicle.getId());
- allWaypoints.sort(Comparator.comparingInt(Waypoint::getOrderInRoute));
- LatLng[] waypointLatLngs = new LatLng[allWaypoints.size()];
- for(int j = 0; j< allWaypoints.size(); j++) {
- waypointLatLngs[j] = (new LatLng(allWaypoints.get(j).getLatitude(), allWaypoints.get(j).getLongitude()));
- }
- org.joda.time.DateTime departureTime = new org.joda.time.DateTime(new Date().getTime());
- DirectionsResult routeDirections = DirectionsApi.newRequest(context)
- .origin(new LatLng(testVehicle.getCurrentLatitude(), testVehicle.getCurrentLongitude()))
- .waypoints(waypointLatLngs)
- .destination(new LatLng(waypointLatLngs[waypointLatLngs.length-1].lat, waypointLatLngs[waypointLatLngs.length-1].lng))
- .await();
- EncodedPolyline routePolyline = routeDirections.routes[0].overviewPolyline;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement