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

下面列出了怎么用com.google.android.gms.maps.model.Cap的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.
 * @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 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
    );
}
 
/**
 * 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 jointType       Joint type for all vertices of the polyline except the start and end vertices.
 * @param startCap        Cap at the start vertex of the polyline.
 * @param endCap          Cap at the end vertex of the polyline.
 * @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,
        int jointType,
        @Nullable Cap startCap,
        @Nullable Cap endCap,
        @Nullable List<PatternItem> patternItemList) {
    PolylineOptions rectLine = new PolylineOptions().width(dpToPx(context, width)).color(color).geodesic(true);
    rectLine.clickable(clickable);
    rectLine.jointType(jointType);
    if (patternItemList != null) {
        rectLine.pattern(patternItemList);
    }
    if (startCap != null) {
        rectLine.startCap(startCap);
    }
    if (endCap != null) {
        rectLine.endCap(endCap);
    }
    if (locationList != null && locationList.size() > 0) {
        for (LatLng location : locationList) {
            rectLine.add(location);
        }
    }
    return rectLine;
}
 
源代码4 项目: android-samples   文件: PolylineDemoActivity.java
private Cap getSelectedCap(int pos) {
    switch (CAP_TYPE_NAME_RESOURCE_IDS[pos]) {
        case R.string.cap_butt:
            return new ButtCap();
        case R.string.cap_square:
            return new SquareCap();
        case R.string.cap_round:
            return new RoundCap();
        case R.string.cap_image:
            return new CustomCap(
                    BitmapDescriptorFactory.fromResource(R.drawable.chevron),
                    CUSTOM_CAP_IMAGE_REF_WIDTH_PX);
    }
    return null;
}
 
源代码5 项目: Curve-Fit   文件: DelegatingCurve.java
@Override
public Cap getEndCap() {
    return polyline.getEndCap();
}
 
源代码6 项目: Curve-Fit   文件: DelegatingCurve.java
@Override
public Cap getStartCap() {
    return polyline.getStartCap();
}
 
源代码7 项目: Curve-Fit   文件: DelegatingCurve.java
@Override
public void setEndCap(Cap endCap) {
    polyline.setEndCap(endCap);
}
 
源代码8 项目: Curve-Fit   文件: DelegatingCurve.java
@Override
public void setStartCap(Cap startCap) {
    polyline.setStartCap(startCap);
}
 
源代码9 项目: Curve-Fit   文件: CurveOptions.java
public CurveOptions endCap(Cap cap) {
    real.endCap(cap);
    return this;
}
 
源代码10 项目: Curve-Fit   文件: CurveOptions.java
public Cap getEndCap() {
    return real.getEndCap();
}
 
源代码11 项目: Curve-Fit   文件: CurveOptions.java
public Cap getStartCap() {
    return real.getStartCap();
}
 
源代码12 项目: Curve-Fit   文件: CurveOptions.java
public CurveOptions startCap(Cap cap) {
    real.startCap(cap);
    return this;
}
 
/**
 * 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.
 * @param clickable              Is polyline clickable.
 * @param jointType              Joint type for all vertices of the polyline except the start and end vertices.
 * @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,
        @Nullable List<PatternItem> transitPatternItemList,
        @Dimension(unit = Dimension.DP) int walkingWidth,
        @ColorInt int walkingColor,
        @Nullable List<PatternItem> walkingPatternItemList,
        boolean clickable,
        int jointType,
        @Nullable Cap startCap,
        @Nullable Cap endCap
) {
    ArrayList<PolylineOptions> polylineOptionsList = new ArrayList<>();
    if (stepList != null && stepList.size() > 0) {
        for (Step step : stepList) {
            ArrayList<LatLng> directionPointList = new ArrayList<>();
            convertStepToPosition(step, directionPointList);
            if (step.isContainStepList()) {
                polylineOptionsList.add(createPolyline(
                        context,
                        directionPointList,
                        walkingWidth,
                        walkingColor,
                        clickable,
                        jointType,
                        startCap,
                        endCap,
                        walkingPatternItemList
                ));
            } else {
                polylineOptionsList.add(createPolyline(
                        context,
                        directionPointList,
                        transitWidth,
                        transitColor,
                        clickable,
                        jointType,
                        startCap,
                        endCap,
                        transitPatternItemList
                ));
            }
        }
    }
    return polylineOptionsList;
}
 
public Cap getStartCap() {
    return startCap;
}
 
public PathOption setStartCap(Cap startCap) {
    this.startCap = startCap;
    return this;
}
 
public Cap getEndCap() {
    return endCap;
}
 
public PathOption setEndCap(Cap endCap) {
    this.endCap = endCap;
    return this;
}
 
@Nullable
public Cap getStartCap() {
    return startCap;
}
 
public TransitPathOption setStartCap(@Nullable Cap startCap) {
    this.startCap = startCap;
    return this;
}
 
@Nullable
public Cap getEndCap() {
    return endCap;
}
 
public TransitPathOption setEndCap(@Nullable Cap endCap) {
    this.endCap = endCap;
    return this;
}
 
源代码22 项目: Curve-Fit   文件: Curve.java
Cap getEndCap(); 
源代码23 项目: Curve-Fit   文件: Curve.java
Cap getStartCap(); 
源代码24 项目: Curve-Fit   文件: Curve.java
void setEndCap(Cap endCap); 
源代码25 项目: Curve-Fit   文件: Curve.java
void setStartCap(Cap startCap); 
 类方法
 同包方法