Comments (3)
Sound cool! Thanks for your request.
I will add
and(List<LatLng> waypoints)
for unspecified amount of waypoints for the next version.
For now, you can implement unspecific amount of waypoints like this.
String serverKey = ...
LatLng origin = ...
LatLng destination = ...
List<LatLng> waypoints = ...
DirectionDestinationRequest destinationRequest = GoogleDirection.withServerKey(serverKey)
.from(origin);
for (int index = 0; index < waypoints.size(); index++) {
destinationRequest.and(waypoints.get(index));
}
destinationRequest.to(destination)
.transportMode(TransportMode.DRIVING)
.execute(new DirectionCallback() {
@Override
public void onDirectionSuccess(Direction direction, String rawBody) {
// TODO Do something
}
@Override
public void onDirectionFailure(Throwable t) {
// TODO Do something
}
});
But the code looks ugly.
from googledirectionlibrary.
Thanks for the help :)
from googledirectionlibrary.
I just updated my library to 1.1.1 with unspecified amount of waypoints supported
You can write the code like this
String serverKey = ...
LatLng origin = ...
LatLng destination = ...
List<LatLng> waypoints = ...
DirectionDestinationRequest destinationRequest = GoogleDirection.withServerKey(serverKey)
.from(origin)
.and(waypoints)
.to(destination)
.transportMode(TransportMode.DRIVING)
.execute(new DirectionCallback() {
@Override
public void onDirectionSuccess(Direction direction, String rawBody) {
// TODO Do something
}
@Override
public void onDirectionFailure(Throwable t) {
// TODO Do something
}
});
from googledirectionlibrary.
Related Issues (20)
- Does this lib caches API calls? HOT 1
- This API project is not authorized to use this API. HOT 1
- Directions rawBody is created on main thread HOT 1
- how to change marker icon place A and place B HOT 2
- OVER_QUERY_LIMIT Error HOT 1
- How can I get total distance?
- java.lang.NumberFormatException: Expected an int but was ...
- How to show marker text HOT 1
- KEEP GETING REQUEST DENIED HOT 9
- com.google.maps.android.BuildConfig is defined multiple times
- GOOGLE DIRECTION :: ISSUE WHEN ADD DEPARTURE TIME TO REQUEST HOT 1
- Support for parameter "traffic_model" HOT 1
- dptopx got nulled exception in v1.1.1 HOT 2
- After add waypoint with .and, it stop draw polyline after 1st waypoint in route HOT 5
- HIGH USAGE
- Production release with pro guard enabled NPE HOT 1
- How to update polyline according to the user current location? HOT 5
- how to turn-by-turn navigation in app? HOT 2
- how to calculate speed for TransportMode.DRIVING?
- How we use header for you SDK
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from googledirectionlibrary.