Java Code Examples for com.google.android.gms.maps.model.PolylineOptions#clickable()

The following examples show how to use com.google.android.gms.maps.model.PolylineOptions#clickable() . 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: ShapeActivity.java    From Complete-Google-Map-API-Tutorial with Apache License 2.0 5 votes vote down vote up
private void addPolyline()
{
	googleMap.clear();
	PolylineOptions polylineOptions = new PolylineOptions();
	polylineOptions.add(new LatLng(37.35, -122.0));
	polylineOptions.add(new LatLng(37.45, -122.0));
	polylineOptions.add(new LatLng(37.45, -122.2));
	polylineOptions.add(new LatLng(37.35, -122.2));
	polylineOptions.clickable(true);
	polylineOptions.color(Color.CYAN);

	googleMap.addPolyline(polylineOptions).setTag(new CustomTag("polyline"));
	googleMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(37.35, -122.0)));
}
 
Example 2
Source File: DirectionConverter.java    From GoogleDirectionLibrary with Apache License 2.0 5 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 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;
}
 
Example 3
Source File: Style.java    From android-maps-utils with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new Style object
 */
public Style() {
    mMarkerOptions = new MarkerOptions();
    mPolylineOptions = new PolylineOptions();
    mPolylineOptions.clickable(true);
    mPolygonOptions = new PolygonOptions();
    mPolygonOptions.clickable(true);
}
 
Example 4
Source File: GeoJsonLineStringStyle.java    From android-maps-utils with Apache License 2.0 5 votes vote down vote up
/**
 * Gets a new PolylineOptions object containing styles for the GeoJsonLineString
 *
 * @return new PolylineOptions object
 */
public PolylineOptions toPolylineOptions() {
    PolylineOptions polylineOptions = new PolylineOptions();
    polylineOptions.color(mPolylineOptions.getColor());
    polylineOptions.clickable(mPolylineOptions.isClickable());
    polylineOptions.geodesic(mPolylineOptions.isGeodesic());
    polylineOptions.visible(mPolylineOptions.isVisible());
    polylineOptions.width(mPolylineOptions.getWidth());
    polylineOptions.zIndex(mPolylineOptions.getZIndex());
    polylineOptions.pattern(getPattern());
    return polylineOptions;
}
 
Example 5
Source File: KmlStyle.java    From android-maps-utils with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new PolylineOption from given properties of an existing PolylineOption
 *
 * @param originalPolylineOption An existing PolylineOption instance
 * @return A new PolylineOption
 */
private static PolylineOptions createPolylineOptions(PolylineOptions originalPolylineOption) {
    PolylineOptions polylineOptions = new PolylineOptions();
    polylineOptions.color(originalPolylineOption.getColor());
    polylineOptions.width(originalPolylineOption.getWidth());
    polylineOptions.clickable(originalPolylineOption.isClickable());
    return polylineOptions;
}
 
Example 6
Source File: GeoJsonLineStringStyle.java    From android-maps-utils with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new LineStringStyle object
 */
public GeoJsonLineStringStyle() {
    mPolylineOptions = new PolylineOptions();
    mPolylineOptions.clickable(true);
}