Skip to content

Latest commit

 

History

History
94 lines (72 loc) · 3.03 KB

README.md

File metadata and controls

94 lines (72 loc) · 3.03 KB

Google-Maps-Directions

Uma biblioteca open-source para a Google Directions API.

Build Status Bitdeli Badge

Requisitos

Um servidor de aplicações Java EE 6 em virtude da utilização de CDI (preferencialmente JBoss AS 7.x ou superior).

Como usar

@Inject
private DirectionsSearch directionsSearh;

public void example() {
    DirectionsResponse response = directionsSearch.create()
                                                  .from(FLORIANOPOLIS)
                                                  .waypoint(SAO_JOSE)
                                			      .to(PALHOCA)
                            				      .go();
}

Utilizando proxy

@Inject
private DirectionsSearch directionsSearh;

public void example() {
    DirectionsResponse response = directionsSearch.create()
                                                  .from(FLORIANOPOLIS)
                                                  .waypoint(SAO_JOSE)
                                                  .to(PALHOCA)
                                                  .withProxy("your_proxy_host", "your_proxy_port", "your_proxy_user", "your_proxy_pass")
                                                  .go();
}

Definindo locale (default = pt-br)

@Inject
private DirectionsSearch directionsSearh;

public void example() {
    DirectionsResponse response = directionsSearch.create()
                                                  .from(FLORIANOPOLIS)
                            				      .to(PALHOCA)
                                                  .withLocale(Locale.CANADA_FRENCH) // "fr-CA"
                            				      .go();
}

Com rotas alternativas

@Inject
private DirectionsSearch directionsSearh;

public void example() {
    DirectionsResponse response = directionsSearch.create()
                                                  .from(FLORIANOPOLIS)
                                			      .to(PALHOCA)
                                                  .withAlternatives()
                            				      .go();
}

Consultando rotas como cliente Premier

@Inject
private DirectionsSearch directionsSearh;

public void example() {
    DirectionsResponse response = directionsSearch.create()
                                                  .from(FLORIANOPOLIS)
                                			      .to(PALHOCA)
                                                  .asPremierClient("your_client_id", "your_cryptographic_key")
                            				      .go();
}

Autor

Nome: Ricardo Longa
Twitter: @ricardolonga
E-mail: [email protected]
Site: www.ricardolonga.com.br