Packagecom.google.maps.overlays
Classpublic class Polyline
Implementsflash.events.IEventDispatcher, IPolyline

Class Polyline defines a map overlay that draws a polyline on the map.



Public Properties
 PropertyDefined by
  foreground : DisplayObject
[read-only] Display object that represents the overlay's content.
Polyline
  pane : IPane
Pane this overlay resides on (null if the overlay is not added to the map).
Polyline
  shadow : DisplayObject
[read-only] Display object that represents the overlay's shadow (null if the overlay never has a shadow).
Polyline
  visible : Boolean
Visibility of the overlay.
Polyline
Public Methods
 MethodDefined by
  
Polyline(points:Array, options:PolylineOptions = null)
Constructs a new polyline at the specified lat-lng, using the specified options.
Polyline
  
[static] Constructs a polyline from the given set of encoded points and levels assuming the given number of levels and zoom factor between the levels.
Polyline
  
Retrieves the default pane that this overlay should be placed on if none is explicitly specified (when the overlay is added through the IMap.addOverlay() call).
Polyline
  
Returns the LatLngBounds of this polyline or a subsequence of this polyline.
Polyline
  
getLength(opt_radius:Number):Number
Returns the length (in meters) of the polyline along the surface of a spherical Earth.
Polyline
  
Retrieves the polyline's options.
Polyline
  
getVertex(index:Number):LatLng
Returns the vertex with the specified index.
Polyline
  
getVertexCount():Number
Returns the number of vertices in this polyline.
Polyline
  
positionOverlay(zoomChanged:Boolean):void
Reposition the overlay on the screen.
Polyline
  
Updates the polyline options.
Polyline
Protected Methods
 MethodDefined by
  
clearWrapper():void
Remove all event listeners and clear the wrapper.
Polyline
Property detail
foregroundproperty
foreground:DisplayObject  [read-only]

Display object that represents the overlay's content.

Implementation
    public function get foreground():DisplayObject
paneproperty 
pane:IPane  [read-write]

Pane this overlay resides on (null if the overlay is not added to the map). This property value is set by the map when the overlay is added to or removed from the map and should not be modified by the developers.

Implementation
    public function get pane():IPane
    public function set pane(value:IPane):void
shadowproperty 
shadow:DisplayObject  [read-only]

Display object that represents the overlay's shadow (null if the overlay never has a shadow).

Implementation
    public function get shadow():DisplayObject
visibleproperty 
visible:Boolean  [read-write]

Visibility of the overlay.

Implementation
    public function get visible():Boolean
    public function set visible(value:Boolean):void
Constructor detail
Polyline()constructor
public function Polyline(points:Array, options:PolylineOptions = null)

Constructs a new polyline at the specified lat-lng, using the specified options. To create a polyline from a set of encoded points, use the fromEncoded method.

Parameters
points:Array — Array of LatLng vertex locations.
 
options:PolylineOptions (default = null) — Full or partial set of polyline options. When a partial set of options is specified, the polyline's complete set of options will be a combination of this partial set and the defaults.

See also

Method detail
clearWrapper()method
protected function clearWrapper():void

Remove all event listeners and clear the wrapper.

fromEncoded()method 
public static function fromEncoded(info:EncodedPolylineData, options:PolylineOptions = null):Polyline

Constructs a polyline from the given set of encoded points and levels assuming the given number of levels and zoom factor between the levels. The encoded format represents the polyline points as a flattened array of latitude/longitude coordinates in E6 representation.

Parameters
info:EncodedPolylineData — EncodedPolylineData object containing polyline data.
 
options:PolylineOptions (default = null) — Full or partial set of polyline options. When a partial set of options is specified, the polyline's complete set of options will be a combination of partial options and the existing defaults set using PolylineOptions.setDefaultOptions() call.

Returns
Polyline — Newly constructed polyline.
getDefaultPane()method 
public function getDefaultPane(map:IMap):IPane

Retrieves the default pane that this overlay should be placed on if none is explicitly specified (when the overlay is added through the IMap.addOverlay() call).

Parameters
map:IMap — Instance of map that this overlay is added to.

Returns
IPane — Instance of IPane to which the overlay will be added by default.
getLatLngBounds()method 
public function getLatLngBounds():LatLngBounds

Returns the LatLngBounds of this polyline or a subsequence of this polyline. Returns null if this polyline contains no points.

Returns
LatLngBounds
getLength()method 
public function getLength(opt_radius:Number):Number

Returns the length (in meters) of the polyline along the surface of a spherical Earth.

Parameters
opt_radius:Number — Radius of the spherical celestial object.

Returns
Number — Polyline length in meters.
getOptions()method 
public function getOptions():PolylineOptions

Retrieves the polyline's options. Use the setOptions() method to modify polyline's options.

Returns
PolylineOptions — Full set of options on the polyline.

See also

getVertex()method 
public function getVertex(index:Number):LatLng

Returns the vertex with the specified index.

Parameters
index:Number — Index of the target vertex.

Returns
LatLng — Lat-lng of the specified vertex.
getVertexCount()method 
public function getVertexCount():Number

Returns the number of vertices in this polyline.

Returns
Number — The number of vertices.
positionOverlay()method 
public function positionOverlay(zoomChanged:Boolean):void

Reposition the overlay on the screen. This method is called in response to changes in the position (centre) of the map and/or the map's zoom level. Developers should not call the method themselves. The implementation of this method should either change the position of the overlay on the screen in response to the change of the map's centre or redraw the overlay completely if it needs to be reconfigured for a different map centre/zoom level. Repositioning of the overlay should be done by changing the placement of the overlay's display object on its pane using the mappings provided by the IPane interface (fromLatLngToPaneCoords or fromProjectionPointToPaneCoords).

Parameters
zoomChanged:Boolean — Whether the zoom level of the map has changed or the call was invoked just as a result of a map pan.
setOptions()method 
public function setOptions(options:PolylineOptions):void

Updates the polyline options. The options parameter may specify a complete or partial set of polyline options. If a partial set of options is specified, it will supplement the existing polyline options, overriding only the values that were set explicitly and leaving the rest unchanged. For example, the following piece of code will modify the polyline's stroke thickness, leaving the rest of its options unchanged. var options:PolylineOptions = new PolylineOptions( { strokeStyle: { thickness: 3 }} ); myPolyline.setOptions(options);

Parameters
options:PolylineOptions — New full or partial set of options for the polyline.