@Test public void getRouteMapIsNotEmpty() { String geometry = "}jllF~_euMm@C?xC}B@?l@e@FItAaAhCaAH?ZqD`BaH@CpCe@f@ye@zTDZ_Bv@"; Position whiteHouse = Position.fromCoordinates(-77.0365, 38.8977); Position dupontCircle = Position.fromCoordinates(-77.04341, 38.90962); assertTrue(ImageComponent.getRouteMap(whiteHouse, dupontCircle, geometry, true).startsWith(BASE_URL)); assertTrue(ImageComponent.getRouteMap(whiteHouse, dupontCircle, geometry, false).startsWith(BASE_URL)); }
public static String getRouteMap(Position origin, Position destination, String geometry, boolean isSmall) { StaticMarkerAnnotation markerOrigin = new StaticMarkerAnnotation.Builder() .setName(com.mapbox.services.Constants.PIN_LARGE) .setPosition(origin) .setColor(COLOR_GREEN) .build(); StaticMarkerAnnotation markerDestination = new StaticMarkerAnnotation.Builder() .setName(com.mapbox.services.Constants.PIN_LARGE) .setPosition(destination) .setColor(COLOR_RED) .build(); StaticPolylineAnnotation route = new StaticPolylineAnnotation.Builder() .setPolyline(geometry) .setStrokeColor(COLOR_BLUE) .setStrokeOpacity(1) .setStrokeWidth(5) .build(); MapboxStaticImage client = new MapboxStaticImage.Builder() .setAccessToken(Constants.MAPBOX_ACCESS_TOKEN) .setWidth(isSmall ? smallWidth : largeWidth) .setHeight(isSmall ? smallHeight : largeHeight) .setStyleId(com.mapbox.services.Constants.MAPBOX_STYLE_TRAFFIC_DAY) .setAuto(true) .setStaticMarkerAnnotations(markerOrigin, markerDestination) .setStaticPolylineAnnotations(route) .setZoom(15) .build(); return client.getUrl().toString(); }
ImageComponent { public static String getRouteMap(Position origin, Position destination, String geometry, boolean isSmall) { StaticMarkerAnnotation markerOrigin = new StaticMarkerAnnotation.Builder() .setName(com.mapbox.services.Constants.PIN_LARGE) .setPosition(origin) .setColor(COLOR_GREEN) .build(); StaticMarkerAnnotation markerDestination = new StaticMarkerAnnotation.Builder() .setName(com.mapbox.services.Constants.PIN_LARGE) .setPosition(destination) .setColor(COLOR_RED) .build(); StaticPolylineAnnotation route = new StaticPolylineAnnotation.Builder() .setPolyline(geometry) .setStrokeColor(COLOR_BLUE) .setStrokeOpacity(1) .setStrokeWidth(5) .build(); MapboxStaticImage client = new MapboxStaticImage.Builder() .setAccessToken(Constants.MAPBOX_ACCESS_TOKEN) .setWidth(isSmall ? smallWidth : largeWidth) .setHeight(isSmall ? smallHeight : largeHeight) .setStyleId(com.mapbox.services.Constants.MAPBOX_STYLE_TRAFFIC_DAY) .setAuto(true) .setStaticMarkerAnnotations(markerOrigin, markerDestination) .setStaticPolylineAnnotations(route) .setZoom(15) .build(); return client.getUrl().toString(); } }
ImageComponent { public static String getRouteMap(Position origin, Position destination, String geometry, boolean isSmall) { StaticMarkerAnnotation markerOrigin = new StaticMarkerAnnotation.Builder() .setName(com.mapbox.services.Constants.PIN_LARGE) .setPosition(origin) .setColor(COLOR_GREEN) .build(); StaticMarkerAnnotation markerDestination = new StaticMarkerAnnotation.Builder() .setName(com.mapbox.services.Constants.PIN_LARGE) .setPosition(destination) .setColor(COLOR_RED) .build(); StaticPolylineAnnotation route = new StaticPolylineAnnotation.Builder() .setPolyline(geometry) .setStrokeColor(COLOR_BLUE) .setStrokeOpacity(1) .setStrokeWidth(5) .build(); MapboxStaticImage client = new MapboxStaticImage.Builder() .setAccessToken(Constants.MAPBOX_ACCESS_TOKEN) .setWidth(isSmall ? smallWidth : largeWidth) .setHeight(isSmall ? smallHeight : largeHeight) .setStyleId(com.mapbox.services.Constants.MAPBOX_STYLE_TRAFFIC_DAY) .setAuto(true) .setStaticMarkerAnnotations(markerOrigin, markerDestination) .setStaticPolylineAnnotations(route) .setZoom(15) .build(); return client.getUrl().toString(); }  }
ImageComponent { public static String getRouteMap(Position origin, Position destination, String geometry, boolean isSmall) { StaticMarkerAnnotation markerOrigin = new StaticMarkerAnnotation.Builder() .setName(com.mapbox.services.Constants.PIN_LARGE) .setPosition(origin) .setColor(COLOR_GREEN) .build(); StaticMarkerAnnotation markerDestination = new StaticMarkerAnnotation.Builder() .setName(com.mapbox.services.Constants.PIN_LARGE) .setPosition(destination) .setColor(COLOR_RED) .build(); StaticPolylineAnnotation route = new StaticPolylineAnnotation.Builder() .setPolyline(geometry) .setStrokeColor(COLOR_BLUE) .setStrokeOpacity(1) .setStrokeWidth(5) .build(); MapboxStaticImage client = new MapboxStaticImage.Builder() .setAccessToken(Constants.MAPBOX_ACCESS_TOKEN) .setWidth(isSmall ? smallWidth : largeWidth) .setHeight(isSmall ? smallHeight : largeHeight) .setStyleId(com.mapbox.services.Constants.MAPBOX_STYLE_TRAFFIC_DAY) .setAuto(true) .setStaticMarkerAnnotations(markerOrigin, markerDestination) .setStaticPolylineAnnotations(route) .setZoom(15) .build(); return client.getUrl().toString(); }  static String getWelcomeMap(boolean isSmall); static String getLocationMap(Position position, boolean isSmall); static String getRouteMap(Position origin, Position destination, String geometry, boolean isSmall); }
ImageComponent { public static String getRouteMap(Position origin, Position destination, String geometry, boolean isSmall) { StaticMarkerAnnotation markerOrigin = new StaticMarkerAnnotation.Builder() .setName(com.mapbox.services.Constants.PIN_LARGE) .setPosition(origin) .setColor(COLOR_GREEN) .build(); StaticMarkerAnnotation markerDestination = new StaticMarkerAnnotation.Builder() .setName(com.mapbox.services.Constants.PIN_LARGE) .setPosition(destination) .setColor(COLOR_RED) .build(); StaticPolylineAnnotation route = new StaticPolylineAnnotation.Builder() .setPolyline(geometry) .setStrokeColor(COLOR_BLUE) .setStrokeOpacity(1) .setStrokeWidth(5) .build(); MapboxStaticImage client = new MapboxStaticImage.Builder() .setAccessToken(Constants.MAPBOX_ACCESS_TOKEN) .setWidth(isSmall ? smallWidth : largeWidth) .setHeight(isSmall ? smallHeight : largeHeight) .setStyleId(com.mapbox.services.Constants.MAPBOX_STYLE_TRAFFIC_DAY) .setAuto(true) .setStaticMarkerAnnotations(markerOrigin, markerDestination) .setStaticPolylineAnnotations(route) .setZoom(15) .build(); return client.getUrl().toString(); }  static String getWelcomeMap(boolean isSmall); static String getLocationMap(Position position, boolean isSmall); static String getRouteMap(Position origin, Position destination, String geometry, boolean isSmall);  }