Skip to content

Commit

Permalink
matrix, optimization, and turf modules added
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Mace committed Sep 15, 2017
1 parent ed4a1ff commit 14065b7
Show file tree
Hide file tree
Showing 95 changed files with 33,785 additions and 64 deletions.
15 changes: 11 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
build/
/captures
.externalNativeBuild

# Idea
.idea
*.iml
classes

obj

#MacOS
.DS_Store
4 changes: 4 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -171,62 +171,4 @@ public final class DirectionsCriteria {
})
public @interface AnnotationCriteria {
}

/**
* Returned route starts at the first provided coordinate in the list. Used specifically for the
* Optimization API.
*
* @since 2.1.0
*/
public static final String SOURCE_FIRST = "first";

/**
* Returned route starts at any of the provided coordinate in the list. Used specifically for the
* Optimization API.
*
* @since 2.1.0
*/
public static final String SOURCE_ANY = "any";

/**
* Retention policy for the source parameter in the Optimization API.
*
* @since 3.0.0
*/
@Retention(RetentionPolicy.SOURCE)
@StringDef( {
SOURCE_ANY,
SOURCE_FIRST,
})
public @interface SourceCriteria {
}

/**
* Returned route ends at any of the provided coordinate in the list. Used specifically for the
* Optimization API.
*
* @since 3.0.0
*/
public static final String DESTINATION_ANY = "any";

/**
* Returned route ends at the last provided coordinate in the list. Used specifically for the
* Optimization API.
*
* @since 3.0.0
*/
public static final String DESTINATION_LAST = "last";

/**
* Retention policy for the destination parameter in the Optimization API.
*
* @since 3.0.0
*/
@Retention(RetentionPolicy.SOURCE)
@StringDef( {
DESTINATION_ANY,
DESTINATION_LAST,
})
public @interface DestinationCriteria {
}
}
29 changes: 29 additions & 0 deletions services-geocoding/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apply plugin: 'java-library'

sourceCompatibility = "1.7"
targetCompatibility = "1.7"

dependencies {

compile project(":services-geojson")

// Retrofit
compile dependenciesList.retrofit
compile dependenciesList.retrofit2Gson

// OkHttp
compile dependenciesList.okhttp3Logging

// Annotations
compileOnly dependenciesList.supportAnnotation

// AutoValue
compileOnly dependenciesList.autoValue
compileOnly dependenciesList.autoValueGson

// Test Dependencies
testCompile dependenciesList.junit
testCompile dependenciesList.hamcrestJunit
testCompile dependenciesList.okhttp3Mockwebserver
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
package com.mapbox.geocoding.v5;

import android.support.annotation.StringDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
* Constants that should be used when requesting geocoding.
*
* @since 1.0.0
*/
public final class GeocodingCriteria {

/**
* Default geocoding mode.
*
* @since 1.0.0
*/
public static final String MODE_PLACES = "mapbox.places";

/**
* Geocoding mode for enterprise/batch geocoding.
*
* @since 1.0.0
*/
public static final String MODE_PLACES_PERMANENT = "mapbox.places-permanent";

/**
* Retention policy for the various geocoding modes.
*
* @since 3.0.0
*/
@Retention(RetentionPolicy.SOURCE)
@StringDef( {
MODE_PLACES,
MODE_PLACES_PERMANENT
})
public @interface GeocodingModeCriteria {
}

/**
* Filter results by country.
*
* @since 1.0.0
*/
public static final String TYPE_COUNTRY = "country";

/**
* Filter results by region.
*
* @since 1.0.0
*/
public static final String TYPE_REGION = "region";

/**
* Filter results by postcode.
*
* @since 1.0.0
*/
public static final String TYPE_POSTCODE = "postcode";

/**
* Filter results by district.
*
* @since 2.2.0
*/
public static final String TYPE_DISTRICT = "district";

/**
* Filter results by place.
*
* @since 1.0.0
*/
public static final String TYPE_PLACE = "place";

/**
* Filter results by locality.
*
* @since 2.2.0
*/
public static final String TYPE_LOCALITY = "locality";

/**
* Filter results by neighborhood.
*
* @since 1.0.0
*/
public static final String TYPE_NEIGHBORHOOD = "neighborhood";

/**
* Filter results by address.
*
* @since 1.0.0
*/
public static final String TYPE_ADDRESS = "address";

/**
* Filter results by POI.
*
* @since 1.0.0
*/
public static final String TYPE_POI = "poi";

/**
* Filter results by POI landmark subtype.
*
* @since 1.3.2
*/
public static final String TYPE_POI_LANDMARK = "poi.landmark";

/**
* Retention policy for the various filter result types.
*
* @since 3.0.0
*/
@Retention(RetentionPolicy.SOURCE)
@StringDef( {
TYPE_COUNTRY,
TYPE_REGION,
TYPE_POSTCODE,
TYPE_DISTRICT,
TYPE_PLACE,
TYPE_LOCALITY,
TYPE_NEIGHBORHOOD,
TYPE_ADDRESS,
TYPE_POI,
TYPE_POI_LANDMARK
})
public @interface GeocodingTypeCriteria {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package com.mapbox.geocoding.v5;

import com.mapbox.geocoding.v5.MapboxGeocoding.Builder;
import com.mapbox.geocoding.v5.models.GeocodingResponse;

import java.util.List;

import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
* Interface that defines the geocoding service.
*
* @since 1.0.0
*/
public interface GeocodingService {

/**
* Constructs the html call using the information passed in through the {@link Builder}.
*
* @param userAgent The user
* @param mode mapbox.places or mapbox.places-permanent for enterprise geocoding.
* @param query a location; a place name for forward geocoding or a coordinate pair
* (longitude, latitude location) for reverse geocoding
* @param accessToken Mapbox access token.
* @param country ISO 3166 alpha 2 country codes, separated by commas.
* @param proximity Location around which to bias results.
* @param types Filter results by one or more type.
* @param autocomplete True if you want auto complete.
* @param bbox Optionally pass in a bounding box to limit results in.
* @param limit Optionally pass in a limit the amount of returning results.
* @param language The locale in which results should be returned.
* @return A retrofit Call object
* @since 1.0.0
*/
@GET("/geocoding/v5/{mode}/{query}.json")
Call<GeocodingResponse> getCall(
@Header("User-Agent") String userAgent,
@Path("mode") String mode,
@Path("query") String query,
@Query("access_token") String accessToken,
@Query("country") String country,
@Query("proximity") String proximity,
@Query("types") String types,
@Query("autocomplete") Boolean autocomplete,
@Query("bbox") String bbox,
@Query("limit") String limit,
@Query("language") String language);

/**
* Constructs the html call using the information passed in through the {@link Builder}.
*
* @param userAgent The user
* @param mode mapbox.places-permanent for batch geocoding.
* @param query a location; a place name for forward geocoding or a coordinate pair
* (longitude, latitude location) for reverse geocoding
* @param accessToken Mapbox access token.
* @param country ISO 3166 alpha 2 country codes, separated by commas.
* @param proximity Location around which to bias results.
* @param types Filter results by one or more type.
* @param autocomplete True if you want auto complete.
* @param bbox Optionally pass in a bounding box to limit results in.
* @param limit Optionally pass in a limit the amount of returning results.
* @param language The locale in which results should be returned.
* @return A retrofit Call object
* @since 1.0.0
*/
@GET("/geocoding/v5/{mode}/{query}.json")
Call<List<GeocodingResponse>> getBatchCall(
@Header("User-Agent") String userAgent,
@Path("mode") String mode,
@Path("query") String query,
@Query("access_token") String accessToken,
@Query("country") String country,
@Query("proximity") String proximity,
@Query("types") String types,
@Query("autocomplete") Boolean autocomplete,
@Query("bbox") String bbox,
@Query("limit") String limit,
@Query("language") String language);
}
Loading

0 comments on commit 14065b7

Please sign in to comment.