类com.google.android.gms.maps.model.JointType源码实例Demo

下面列出了怎么用com.google.android.gms.maps.model.JointType的API类实例代码及写法,或者点击链接到github查看源代码。

/**
 * 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
    );
}
 
/**
 * 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
    );
}
 
/**
 * 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
    );
}
 
/**
 * 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
    );
}
 
/**
 * 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
    );
}
 
/**
 * 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
    );
}
 
/**
 * 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
    );
}
 
/**
 * 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
    );
}
 
源代码9 项目: android-samples   文件: PolyActivity.java
/**
 * 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);
}
 
源代码10 项目: android-samples   文件: PolylineDemoActivity.java
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;
}
 
源代码11 项目: android-samples   文件: PolygonDemoActivity.java
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;
}
 
@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());
}
 
@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());
}
 
@Test
public void testStrokeJointType() {
    polygonStyle.setStrokeJointType(JointType.ROUND);
    assertEquals(JointType.ROUND, polygonStyle.getStrokeJointType());
    assertEquals(JointType.ROUND, polygonStyle.toPolygonOptions().getStrokeJointType());
}
 
 类方法
 同包方法