CustomCap
Stay organized with collections
Save and categorize content based on your preferences.
Bitmap overlay centered at the start or end vertex of a Polyline
,
orientated according to the direction of the line's first or last edge and scaled with
respect to the line's stroke width. CustomCap
can be applied to
Polyline
with any stroke pattern.
Inherited Constant Summary
From interface android.os.Parcelable
int |
CONTENTS_FILE_DESCRIPTOR |
|
int |
PARCELABLE_WRITE_RETURN_VALUE |
|
Field Summary
public final BitmapDescriptor
|
bitmapDescriptor
|
Descriptor of the bitmap to be overlaid at the
start or end vertex. |
public final float |
refWidth
|
Reference stroke width (in pixels) - the stroke
width for which the cap bitmap at its native dimension is designed. |
Public Constructor Summary
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
From interface android.os.Parcelable
abstract int |
describeContents()
|
abstract void |
writeToParcel( Parcel arg0,
int arg1)
|
Fields
Descriptor of the bitmap to be overlaid at the start or end vertex.
public final float
refWidth
Reference stroke width (in pixels) - the stroke width for which the cap bitmap at
its native dimension is designed. The default reference stroke width is 10 pixels.
Public Constructors
public CustomCap (BitmapDescriptor
bitmapDescriptor, float refWidth)
Constructs a new CustomCap
.
Parameters
bitmapDescriptor |
Descriptor of the bitmap to be used. Must not be null . |
refWidth |
Stroke width, in pixels, for which the cap bitmap at its native dimension is
designed. Must be positive. |
public CustomCap (BitmapDescriptor
bitmapDescriptor)
Constructs a new CustomCap
with default reference stroke width of 10
pixels (equal to the default stroke width, see
PolylineOptions.width(float)
).
Parameters
bitmapDescriptor |
Descriptor of the bitmap to be used. Must not be null . |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[null,null,["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eCustomCap\u003c/code\u003e allows you to customize the start/end caps of polylines on a map using bitmap images.\u003c/p\u003e\n"],["\u003cp\u003eIt uses a bitmap image and a reference stroke width to define the cap's appearance.\u003c/p\u003e\n"],["\u003cp\u003eYou can specify the bitmap and reference width when creating a \u003ccode\u003eCustomCap\u003c/code\u003e instance.\u003c/p\u003e\n"],["\u003cp\u003eA default reference width of 10 pixels is used if not explicitly provided during construction.\u003c/p\u003e\n"]]],["`CustomCap` is a class that extends `Cap` and overlays a bitmap at the start or end of a `Polyline`. It uses `BitmapDescriptor` for the bitmap and `refWidth` to define the reference stroke width for scaling. Two constructors are available: one that sets both `bitmapDescriptor` and `refWidth`, and another with a default `refWidth` of 10 pixels. It offers a `toString` method and inherits methods like `equals`, `hashCode`, and `writeToParcel`.\n"],null,["# CustomCap\n\npublic final class **CustomCap** extends [Cap](/android/reference/com/google/android/gms/maps/model/Cap) \nBitmap overlay centered at the start or end vertex of a [Polyline](/android/reference/com/google/android/gms/maps/model/Polyline),\norientated according to the direction of the line's first or last edge and scaled with\nrespect to the line's stroke width. `CustomCap` can be applied to\n`Polyline` with any stroke pattern. \n\n### Inherited Constant Summary\n\nFrom interface android.os.Parcelable \n\n|-----|-------------------------------|---|\n| int | CONTENTS_FILE_DESCRIPTOR | |\n| int | PARCELABLE_WRITE_RETURN_VALUE | |\n\n### Field Summary\n\n|--------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|\n| public final [BitmapDescriptor](/android/reference/com/google/android/gms/maps/model/BitmapDescriptor) | [bitmapDescriptor](/android/reference/com/google/android/gms/maps/model/CustomCap#bitmapDescriptor) | Descriptor of the bitmap to be overlaid at the start or end vertex. |\n| public final float | [refWidth](/android/reference/com/google/android/gms/maps/model/CustomCap#refWidth) | Reference stroke width (in pixels) - the stroke width for which the cap bitmap at its native dimension is designed. |\n\n### Public Constructor Summary\n\n|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [CustomCap](/android/reference/com/google/android/gms/maps/model/CustomCap#CustomCap(com.google.android.gms.maps.model.BitmapDescriptor,%20float))([BitmapDescriptor](/android/reference/com/google/android/gms/maps/model/BitmapDescriptor) bitmapDescriptor, float refWidth) Constructs a new `CustomCap`. |\n| | [CustomCap](/android/reference/com/google/android/gms/maps/model/CustomCap#CustomCap(com.google.android.gms.maps.model.BitmapDescriptor))([BitmapDescriptor](/android/reference/com/google/android/gms/maps/model/BitmapDescriptor) bitmapDescriptor) Constructs a new `CustomCap` with default reference stroke width of 10 pixels (equal to the default stroke width, see [PolylineOptions.width(float)](/android/reference/com/google/android/gms/maps/model/PolylineOptions#width(float))). |\n\n### Public Method Summary\n\n|-------------------------------------------------------------------|-----------------------------------------------------------------------------------------|\n| [String](//developer.android.com/reference/java/lang/String.html) | [toString](/android/reference/com/google/android/gms/maps/model/CustomCap#toString())() |\n\n### Inherited Method Summary\n\nFrom class [com.google.android.gms.maps.model.Cap](/android/reference/com/google/android/gms/maps/model/Cap) \n\n|-------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| boolean | [equals](/android/reference/com/google/android/gms/maps/model/Cap#equals(java.lang.Object))([Object](//developer.android.com/reference/java/lang/Object.html) o) |\n| int | [hashCode](/android/reference/com/google/android/gms/maps/model/Cap#hashCode())() |\n| [String](//developer.android.com/reference/java/lang/String.html) | [toString](/android/reference/com/google/android/gms/maps/model/Cap#toString())() |\n| void | [writeToParcel](/android/reference/com/google/android/gms/maps/model/Cap#writeToParcel(android.os.Parcel,%20int))([Parcel](//developer.android.com/reference/android/os/Parcel.html) out, int flags) |\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface android.os.Parcelable \n\n|---------------|--------------------------------------------------------------------------------------------------|\n| abstract int | describeContents() |\n| abstract void | writeToParcel([Parcel](//developer.android.com/reference/android/os/Parcel.html) arg0, int arg1) |\n\nFields\n------\n\n#### public final [BitmapDescriptor](/android/reference/com/google/android/gms/maps/model/BitmapDescriptor)\n**bitmapDescriptor**\n\nDescriptor of the bitmap to be overlaid at the start or end vertex. \n\n#### public final float\n**refWidth**\n\nReference stroke width (in pixels) - the stroke width for which the cap bitmap at\nits native dimension is designed. The default reference stroke width is 10 pixels.\n\nPublic Constructors\n-------------------\n\n#### public **CustomCap** ([BitmapDescriptor](/android/reference/com/google/android/gms/maps/model/BitmapDescriptor) bitmapDescriptor, float refWidth)\n\nConstructs a new `CustomCap`. \n\n##### Parameters\n\n| bitmapDescriptor | Descriptor of the bitmap to be used. Must not be `null`. |\n| refWidth | Stroke width, in pixels, for which the cap bitmap at its native dimension is designed. Must be positive. |\n|------------------|----------------------------------------------------------------------------------------------------------|\n\n#### public **CustomCap** ([BitmapDescriptor](/android/reference/com/google/android/gms/maps/model/BitmapDescriptor) bitmapDescriptor)\n\nConstructs a new `CustomCap` with default reference stroke width of 10\npixels (equal to the default stroke width, see [PolylineOptions.width(float)](/android/reference/com/google/android/gms/maps/model/PolylineOptions#width(float))). \n\n##### Parameters\n\n| bitmapDescriptor | Descriptor of the bitmap to be used. Must not be `null`. |\n|------------------|----------------------------------------------------------|\n\nPublic Methods\n--------------\n\n#### public [String](//developer.android.com/reference/java/lang/String.html) **toString** ()"]]