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

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

Introduction

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

Prototype

public final native void setRegion(String region) ;

Source Link

Document

Region code used as a bias for geocoding requests.

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);/*from w  w w  .  ja  v  a 2s  .com*/
    rq.setAvoidTolls(true);
    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);
        }
    });
}