Example usage for com.google.gwt.maps.client.services DirectionsRequest setAvoidHighways

List of usage examples for com.google.gwt.maps.client.services DirectionsRequest setAvoidHighways

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.services DirectionsRequest setAvoidHighways.

Prototype

public final native void setAvoidHighways(boolean avoidHighways) ;

Source Link

Document

If true, instructs the Directions service to avoid highways where possible.

Usage

From source file:net.cbtltd.client.field.RouteField.java

public void setValue(String value) {
    String args[] = value.split("-");
    DirectionsRequest rq = DirectionsRequest.newInstance();
    rq.setAvoidHighways(false);
    rq.setAvoidTolls(true);/* w  w w  .  j  av  a2  s .co m*/
    rq.setOrigin(args[0]);
    rq.setDestination(args[1]);
    if (args.length > 2) {
        rq.setRegion(args[2]);
    }
    rq.setOptimizeWaypoints(true);
    rq.setProvideRouteAlternatives(false);
    rq.setTravelMode(TravelMode.DRIVING);
    rq.setUnitSystem(UnitSystem.METRIC);

    DirectionsService directions = DirectionsService.newInstance();
    directions.route(rq, new DirectionsResultHandler() {
        public void onCallback(DirectionsResult rs, DirectionsStatus status) {
            setResult(rs);
        }
    });
}