java.lang.Object | |
↳ | com.google.android.gms.maps.model.Polyline |
A polyline is a list of points, where line segments are drawn between consecutive points. A polyline has the following properties:
Color
.
The default value is black (0xff000000
).GroundOverlay
s, TileOverlay
s, Circle
s, and Polygon
s but
not Marker
s). An overlay with a larger z-index is drawn over overlays with smaller
z-indices. The order of overlays with the same z-index is arbitrary. The default
zIndex is 0.true
, i.e., visible.
Methods that modify a Polyline must be called on the main thread. If not, an
IllegalStateException
will be thrown at runtime.
GoogleMap map;
// ... get a map.
// Add a thin red line from London to New York.
Polyline line = map.addPolyline(new PolylineOptions()
.add(new LatLng(51.5, -0.1), new LatLng(40.7, -74.0))
.width(5)
.color(Color.RED));
For more information, read the Shapes developer guide.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the color of this polyline.
| |||||||||||
Gets this polyline's id.
| |||||||||||
Returns a snapshot of the vertices of this polyline at this time .
| |||||||||||
Gets the width of this polyline.
| |||||||||||
Gets the zIndex of this polyline.
| |||||||||||
Gets whether each segment of the line is drawn as a geodesic or not.
| |||||||||||
Gets the visibility of this polyline.
| |||||||||||
Removes this polyline from the map.
| |||||||||||
Sets the color of this polyline.
| |||||||||||
Sets whether to draw each segment of the line as a geodesic or not.
| |||||||||||
Sets the points of this polyline.
| |||||||||||
Sets the visibility of this polyline.
| |||||||||||
Sets the width of this polyline.
| |||||||||||
Sets the zIndex of this polyline.
|
[Expand]
Inherited Methods | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Gets the color of this polyline.
Gets this polyline's id. The id will be unique amongst all Polylines on a map.
Returns a snapshot of the vertices of this polyline at this time . The list returned is a
copy of the list of vertices and so changes to the polyline's vertices will not be reflected
by this list, nor will changes to this list be reflected by the polyline. To change the
vertices of the polyline, call setPoints(List)
.
Gets the width of this polyline.
Gets the zIndex of this polyline.
Gets whether each segment of the line is drawn as a geodesic or not.
true
if each segment is drawn as a geodesic; false
if each segment is
drawn as a straight line on the Mercator projection.
Gets the visibility of this polyline.
Removes this polyline from the map. After a polyline has been removed, the behavior of all its methods is undefined.
Sets the color of this polyline.
color | the color in ARGB format |
---|
Sets whether to draw each segment of the line as a geodesic or not.
geodesic | if true , then each segment is drawn as a geodesic; if false ,
each segment is drawn as a straight line on the Mercator projection.
|
---|
Sets the points of this polyline. This method will take a copy of the points, so further
mutations to points
will have no effect on this polyline.
points | an list of LatLng s that are the vertices of the polyline.
|
---|
Sets the visibility of this polyline. When not visible, a polyline is not drawn, but it keeps all its other properties.
visible | if true , then the polyline is visible; if false , it is not.
|
---|
Sets the width of this polyline.
width | the width in screen pixels |
---|
Sets the zIndex of this polyline. Polylines with higher zIndices are drawn above those with lower indices.
zIndex | the zIndex of this polyline. |
---|