com.google.android.gms.maps.model.JointType Java Examples

The following examples show how to use com.google.android.gms.maps.model.JointType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DirectionConverter.java    From GoogleDirectionLibrary with Apache License 2.0 6 votes vote down vote up
/**
 * Convert the list of latitude and longitude to the polyline options.
 *
 * @param context      A context.
 * @param locationList A list of latitude and longitude.
 * @param width        Width of the polyline in screen pixels.
 * @param color        Color of the polyline as a 32-bit ARGB color.
 * @return Options for a polyline.
 * @since 1.0.0
 */
public static PolylineOptions createPolyline(
        @NonNull Context context,
        @Nullable ArrayList<LatLng> locationList,
        @Dimension(unit = Dimension.DP) int width,
        @ColorInt int color
) {
    return createPolyline(
            context,
            locationList,
            width,
            color,
            true,
            JointType.DEFAULT,
            null,
            null,
            null
    );
}
 
Example #2
Source File: DirectionConverter.java    From GoogleDirectionLibrary with Apache License 2.0 6 votes vote down vote up
/**
 * Convert the list of latitude and longitude to the polyline options.
 *
 * @param context      A context.
 * @param locationList A list of latitude and longitude.
 * @param width        Width of the polyline in screen pixels.
 * @param color        Color of the polyline as a 32-bit ARGB color.
 * @param clickable    Is polyline clickable.
 * @return Options for a polyline.
 * @since 1.2.0
 */
public static PolylineOptions createPolyline(
        @NonNull Context context,
        @Nullable ArrayList<LatLng> locationList,
        @Dimension(unit = Dimension.DP) int width,
        @ColorInt int color,
        boolean clickable
) {
    return createPolyline(
            context,
            locationList,
            width,
            color,
            clickable,
            JointType.DEFAULT,
            null,
            null,
            null
    );
}
 
Example #3
Source File: DirectionConverter.java    From GoogleDirectionLibrary with Apache License 2.0 6 votes vote down vote up
/**
 * Convert the list of latitude and longitude to the polyline options.
 *
 * @param context      A context.
 * @param locationList A list of latitude and longitude.
 * @param width        Width of the polyline in screen pixels.
 * @param color        Color of the polyline as a 32-bit ARGB color.
 * @param clickable    Is polyline clickable.
 * @param startCap     Cap at the start vertex of the polyline.
 * @param endCap       Cap at the end vertex of the polyline.
 * @return Options for a polyline.
 * @since 1.2.0
 */
public static PolylineOptions createPolyline(
        @NonNull Context context,
        @Nullable ArrayList<LatLng> locationList,
        @Dimension(unit = Dimension.DP) int width,
        @ColorInt int color,
        boolean clickable,
        @Nullable Cap startCap,
        @Nullable Cap endCap
) {
    return createPolyline(
            context,
            locationList,
            width,
            color,
            clickable,
            JointType.DEFAULT,
            startCap,
            endCap,
            null
    );
}
 
Example #4
Source File: DirectionConverter.java    From GoogleDirectionLibrary with Apache License 2.0 6 votes vote down vote up
/**
 * Convert the list of latitude and longitude to the polyline options.
 *
 * @param context         A context.
 * @param locationList    A list of latitude and longitude.
 * @param width           Width of the polyline in screen pixels.
 * @param color           Color of the polyline as a 32-bit ARGB color.
 * @param clickable       Is polyline clickable.
 * @param patternItemList Stroke pattern for the polyline.
 * @return Options for a polyline.
 * @since 1.2.0
 */
public static PolylineOptions createPolyline(
        @NonNull Context context,
        @Nullable ArrayList<LatLng> locationList,
        @Dimension(unit = Dimension.DP) int width,
        @ColorInt int color,
        boolean clickable,
        @Nullable List<PatternItem> patternItemList
) {
    return createPolyline(
            context,
            locationList,
            width,
            color,
            clickable,
            JointType.DEFAULT,
            null,
            null,
            patternItemList
    );
}
 
Example #5
Source File: DirectionConverter.java    From GoogleDirectionLibrary with Apache License 2.0 6 votes vote down vote up
/**
 * Convert the list of latitude and longitude to the polyline options in transit mode.
 *
 * @param context      A context.
 * @param stepList     A list of latitude and longitude for the steps.
 * @param transitWidth Width of the polyline in screen pixels for transit polyline.
 * @param transitColor Color of the polyline as a 32-bit ARGB color for transit polyline.
 * @param walkingWidth Width of the polyline in screen pixels for walking polyline.
 * @param walkingColor Color of the polyline as a 32-bit ARGB color for walking polyline.
 * @return Options for a polyline.
 * @since 1.0.0
 */
public static ArrayList<PolylineOptions> createTransitPolyline(
        @NonNull Context context,
        @Nullable List<Step> stepList,
        @Dimension(unit = Dimension.DP) int transitWidth,
        @ColorInt int transitColor,
        @Dimension(unit = Dimension.DP) int walkingWidth,
        @ColorInt int walkingColor) {
    return createTransitPolyline(
            context,
            stepList,
            transitWidth,
            transitColor,
            null,
            walkingWidth,
            walkingColor,
            null,
            true,
            JointType.DEFAULT,
            null,
            null
    );
}
 
Example #6
Source File: DirectionConverter.java    From GoogleDirectionLibrary with Apache License 2.0 6 votes vote down vote up
/**
 * Convert the list of latitude and longitude to the polyline options in transit mode.
 *
 * @param context                A context.
 * @param stepList               A list of latitude and longitude for the steps.
 * @param transitWidth           Width of the polyline in screen pixels for transit polyline.
 * @param transitColor           Color of the polyline as a 32-bit ARGB color for transit polyline.
 * @param transitPatternItemList Stroke pattern for the polyline for transit polyline.
 * @param walkingWidth           Width of the polyline in screen pixels for walking polyline.
 * @param walkingColor           Color of the polyline as a 32-bit ARGB color for walking polyline.
 * @param walkingPatternItemList Stroke pattern for the polyline for walking polyline.
 * @return Options for a polyline.
 * @since 1.2.0
 */
public static ArrayList<PolylineOptions> createTransitPolyline(
        @NonNull Context context,
        @Nullable List<Step> stepList,
        @Dimension(unit = Dimension.DP) int transitWidth,
        @Nullable List<PatternItem> transitPatternItemList,
        @ColorInt int transitColor,
        @Dimension(unit = Dimension.DP) int walkingWidth,
        @ColorInt int walkingColor,
        @Nullable List<PatternItem> walkingPatternItemList) {
    return createTransitPolyline(
            context,
            stepList,
            transitWidth,
            transitColor,
            transitPatternItemList,
            walkingWidth,
            walkingColor,
            walkingPatternItemList,
            true,
            JointType.DEFAULT,
            null,
            null
    );
}
 
Example #7
Source File: DirectionConverter.java    From GoogleDirectionLibrary with Apache License 2.0 6 votes vote down vote up
/**
 * Convert the list of latitude and longitude to the polyline options in transit mode.
 *
 * @param context      A context.
 * @param stepList     A list of latitude and longitude for the steps.
 * @param transitWidth Width of the polyline in screen pixels for transit polyline.
 * @param transitColor Color of the polyline as a 32-bit ARGB color for transit polyline.
 * @param walkingWidth Width of the polyline in screen pixels for walking polyline.
 * @param walkingColor Color of the polyline as a 32-bit ARGB color for walking polyline.
 * @param clickable    Is polyline clickable.
 * @return Options for a polyline.
 * @since 1.2.0
 */
public static ArrayList<PolylineOptions> createTransitPolyline(
        @NonNull Context context,
        @Nullable List<Step> stepList,
        @Dimension(unit = Dimension.DP) int transitWidth,
        @ColorInt int transitColor,
        @Dimension(unit = Dimension.DP) int walkingWidth,
        @ColorInt int walkingColor,
        boolean clickable) {
    return createTransitPolyline(
            context,
            stepList,
            transitWidth,
            transitColor,
            null,
            walkingWidth,
            walkingColor,
            null,
            clickable,
            JointType.DEFAULT,
            null,
            null
    );
}
 
Example #8
Source File: DirectionConverter.java    From GoogleDirectionLibrary with Apache License 2.0 6 votes vote down vote up
/**
 * Convert the list of latitude and longitude to the polyline options in transit mode.
 *
 * @param context      A context.
 * @param stepList     A list of latitude and longitude for the steps.
 * @param transitWidth Width of the polyline in screen pixels for transit polyline.
 * @param transitColor Color of the polyline as a 32-bit ARGB color for transit polyline.
 * @param walkingWidth Width of the polyline in screen pixels for walking polyline.
 * @param walkingColor Color of the polyline as a 32-bit ARGB color for walking polyline.
 * @param clickable    Is polyline clickable.
 * @param startCap     Cap at the start vertex of the polyline.
 * @param endCap       Cap at the end vertex of the polyline.
 * @return Options for a polyline.
 * @since 1.2.0
 */
public static ArrayList<PolylineOptions> createTransitPolyline(
        @NonNull Context context,
        @Nullable List<Step> stepList,
        @Dimension(unit = Dimension.DP) int transitWidth,
        @ColorInt int transitColor,
        @Dimension(unit = Dimension.DP) int walkingWidth,
        @ColorInt int walkingColor,
        boolean clickable,
        @Nullable Cap startCap,
        @Nullable Cap endCap) {
    return createTransitPolyline(
            context,
            stepList,
            transitWidth,
            transitColor,
            null,
            walkingWidth,
            walkingColor,
            null,
            clickable,
            JointType.DEFAULT,
            startCap,
            endCap
    );
}
 
Example #9
Source File: PolyActivity.java    From android-samples with Apache License 2.0 5 votes vote down vote up
/**
 * Styles the polyline, based on type.
 * @param polyline The polyline object that needs styling.
 */
private void stylePolyline(Polyline polyline) {
    String type = "";
    // Get the data object stored with the polyline.
    if (polyline.getTag() != null) {
        type = polyline.getTag().toString();
    }

    switch (type) {
        // If no type is given, allow the API to use the default.
        case "A":
            // Use a custom bitmap as the cap at the start of the line.
            polyline.setStartCap(
                    new CustomCap(
                            BitmapDescriptorFactory.fromResource(R.drawable.ic_arrow), 10));
            break;
        case "B":
            // Use a round cap at the start of the line.
            polyline.setStartCap(new RoundCap());
            break;
    }

    polyline.setEndCap(new RoundCap());
    polyline.setWidth(POLYLINE_STROKE_WIDTH_PX);
    polyline.setColor(COLOR_BLACK_ARGB);
    polyline.setJointType(JointType.ROUND);
}
 
Example #10
Source File: PolylineDemoActivity.java    From android-samples with Apache License 2.0 5 votes vote down vote up
private int getSelectedJointType(int pos) {
    switch (JOINT_TYPE_NAME_RESOURCE_IDS[pos]) {
        case R.string.joint_type_bevel:
            return JointType.BEVEL;
        case R.string.joint_type_round:
            return JointType.ROUND;
        case R.string.joint_type_default:
            return JointType.DEFAULT;
    }
    return 0;
}
 
Example #11
Source File: PolygonDemoActivity.java    From android-samples with Apache License 2.0 5 votes vote down vote up
private int getSelectedJointType(int pos) {
    switch (JOINT_TYPE_NAME_RESOURCE_IDS[pos]) {
        case R.string.joint_type_bevel:
            return JointType.BEVEL;
        case R.string.joint_type_round:
            return JointType.ROUND;
        case R.string.joint_type_default:
            return JointType.DEFAULT;
    }
    return 0;
}
 
Example #12
Source File: GeoJsonPolygonStyleTest.java    From android-maps-utils with Apache License 2.0 5 votes vote down vote up
@Test
public void testDefaultPolygonStyle() {
    assertEquals(Color.TRANSPARENT, polygonStyle.getFillColor());
    assertFalse(polygonStyle.isGeodesic());
    assertEquals(Color.BLACK, polygonStyle.getStrokeColor());
    assertEquals(JointType.DEFAULT, polygonStyle.getStrokeJointType());
    assertNull(polygonStyle.getStrokePattern());
    assertEquals(10.0f, polygonStyle.getStrokeWidth(), 0);
    assertTrue(polygonStyle.isVisible());
    assertEquals(0.0f, polygonStyle.getZIndex(), 0);
    assertTrue(polygonStyle.isClickable());
}
 
Example #13
Source File: GeoJsonPolygonStyleTest.java    From android-maps-utils with Apache License 2.0 5 votes vote down vote up
@Test
public void testDefaultGetPolygonOptions() {
    assertEquals(Color.TRANSPARENT, polygonStyle.toPolygonOptions().getFillColor());
    assertFalse(polygonStyle.toPolygonOptions().isGeodesic());
    assertEquals(Color.BLACK, polygonStyle.toPolygonOptions().getStrokeColor());
    assertEquals(JointType.DEFAULT, polygonStyle.toPolygonOptions().getStrokeJointType());
    assertNull(polygonStyle.toPolygonOptions().getStrokePattern());
    assertEquals(10.0f, polygonStyle.toPolygonOptions().getStrokeWidth(), 0);
    assertTrue(polygonStyle.toPolygonOptions().isVisible());
    assertEquals(0.0f, polygonStyle.toPolygonOptions().getZIndex(), 0);
    assertTrue(polygonStyle.toPolygonOptions().isClickable());
}
 
Example #14
Source File: GeoJsonPolygonStyleTest.java    From android-maps-utils with Apache License 2.0 4 votes vote down vote up
@Test
public void testStrokeJointType() {
    polygonStyle.setStrokeJointType(JointType.ROUND);
    assertEquals(JointType.ROUND, polygonStyle.getStrokeJointType());
    assertEquals(JointType.ROUND, polygonStyle.toPolygonOptions().getStrokeJointType());
}