public final class

Polyline

extends Object
java.lang.Object
   ↳ com.amazon.geo.mapsv2.model.Polyline

Class Overview

A line overlay that can be drawn on the map. A Polyline is a line connecting a series of points on the map. Unlike a a Polygon, a Polyline is not closed.

Obtain a Polyline by creating a PolylineOptions object with the initial properties and then passing it to addPolyline(PolylineOptions).

You can change the properties of the Polyline using the setter methods after the Polyline is created. Note that all getter and setter methods must be called on the main thread or an IllegalStateException is thrown.

Summary

Public Constructors
Polyline(IPolylineDelegate delegate)
Public constructor.
Public Methods
boolean equals(Object obj)
int getColor()
Gets the color of this Polyline's line segments.
String getId()
Gets the unique ID for this Polyline.
List<LatLng> getPoints()
Gets a list of the geographic points that comprise the vertices of this Polyline.
float getWidth()
Gets the stroke width of this Polyline.
float getZIndex()
Gets the z-index of this Polyline.
int hashCode()
boolean isGeodesic()
Retrieves a boolean value indicating whether the line segments for the Polyline are drawn as geodesic (curved to correspond to the shortest path between two points on the surface of the Earth) or as straight lines.

Geodesic is not supported in Amazon Maps API v2.5

boolean isVisible()
Retrieves a boolean value indicating whether the Polyline is visible or hidden.
void remove()
Removes this Polyline from the map.
void setColor(int color)
Sets the color for the Polyline in ARGB format.
void setGeodesic(boolean geodesic)
Sets whether the line segments of this Polyline are drawn geodesic or non-geodesic.

Geodesic is not supported in Amazon Maps API v2.5

void setPoints(List<LatLng> points)
Sets the vertices of this Polyline.
void setVisible(boolean visible)
Sets the visibility of the Polyline.
void setWidth(float width)
Sets the stroke width of this Polyline in screen pixels.
void setZIndex(float zIndex)
Sets the z-index of the Polyline.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Polyline (IPolylineDelegate delegate)

Public constructor. Instead of using this constructor, use AmazonMap.addPolyline(PolylineOptions) to create a Polyline.

Public Methods

public boolean equals (Object obj)

public int getColor ()

Gets the color of this Polyline's line segments.

Returns
  • The color of this Polyline in ARGB format. See Color for more details.

public String getId ()

Gets the unique ID for this Polyline. The ID is unique for all Polyline objects currently added to the map. This method may be called on a background thread.

Returns
  • This Polyline's ID as a String.

public List<LatLng> getPoints ()

Gets a list of the geographic points that comprise the vertices of this Polyline. Each point in the list is represented by a LatLng.

The returned list is a copy, so any subsequent changes to the vertices of the Polyline are not reflected in this list, and any changes to this list do not change the appearance of the Polyline. To update the points of the Polyline, use setPoints(List) .

Returns
  • A list of LatLng objects representing the vertices for this Polyline.

public float getWidth ()

Gets the stroke width of this Polyline.

Returns
  • This Polyline's stroke width in screen pixels.

public float getZIndex ()

Gets the z-index of this Polyline.

Returns
  • This Polyline's z-index.

public int hashCode ()

public boolean isGeodesic ()

Retrieves a boolean value indicating whether the line segments for the Polyline are drawn as geodesic (curved to correspond to the shortest path between two points on the surface of the Earth) or as straight lines.

Geodesic is not supported in Amazon Maps API v2.5

Returns
  • true if each segment is drawn geodesic, or false if each segment is drawn as a straight line. Checks if each line segment is drawn geodesic.

public boolean isVisible ()

Retrieves a boolean value indicating whether the Polyline is visible or hidden.

Returns
  • true if this Polyline is visible, or false if it is hidden.

public void remove ()

Removes this Polyline from the map. After calling this method, calling other methods on the object has no effect on the appearance of the map.

public void setColor (int color)

Sets the color for the Polyline in ARGB format. The default value is is BLACK.

Parameters
color The color in ARGB format. See Color for more details.

public void setGeodesic (boolean geodesic)

Sets whether the line segments of this Polyline are drawn geodesic or non-geodesic. The default is false to draw straight lines.

Geodesic line segments are drawn as a curve that corresponds to the shortest path between two points on the surface of the Earth. The curve is drawn assuming that the Earth is a sphere.

Non-geodesic line segments are drawn as straight lines on top of the map's projection.

Geodesic is not supported in Amazon Maps API v2.5

Parameters
geodesic true to draw geodesic line segments, or false to draw straight lines on the map.

public void setPoints (List<LatLng> points)

Sets the vertices of this Polyline. The list of points passed to this method is copied, so modifying the contents of points after calling this method has no effect.

Parameters
points A list of LatLng objects that represent the vertices of this Polyline. Must not be null or empty.

public void setVisible (boolean visible)

Sets the visibility of the Polyline. If false, the Polyline is hidden, but all state is preserved. The default value is true.

Parameters
visible true to make this Polyline visible, or false to make it hidden.

public void setWidth (float width)

Sets the stroke width of this Polyline in screen pixels. Must be zero or greater. The line is not drawn if the width is set to zero. The default value is 10.

Parameters
width The width of the Polyline in screen pixels.
Throws
IllegalArgumentException if width is less than zero.

public void setZIndex (float zIndex)

Sets the z-index of the Polyline. Z-index determines the order in which overlays are drawn. Overlays with higher indices are drawn over overlays with lower indices. Overlays with the same z-index are drawn in an arbitrary order.

Overlays that are affected by z-index include GroundOverlay, TileOverlay, Circle, Polyline, and Polygon.

Marker overlays are not affected by the z-index of other overlays.

The default value is zero.

Parameters
zIndex The z-index.

public String toString ()