Packagecom.google.maps.overlays
Classpublic class Polygon
Implementsflash.events.IEventDispatcher, IPolygon

Class Polygon defines a polygon displayed over the map.



Public Properties
 PropertyDefined by
  foreground : DisplayObject
[read-only] Display object that represents the overlay's content.
Polygon
  pane : IPane
Pane this overlay resides on (null if the overlay is not added to the map).
Polygon
  shadow : DisplayObject
[read-only] Display object that represents the overlay's shadow (null if the overlay never has a shadow).
Polygon
  visible : Boolean
Visibility of the overlay.
Polygon
Public Methods
 MethodDefined by
  
Polygon(points:Array, options:PolygonOptions = null)
Constructs a new polygon at the specified lat-lng, using the specified options.
Polygon
  
fromEncoded(polylineList:Array, options:PolygonOptions = null):Polygon
[static] Constructs a polygon from encoded data.
Polygon
  
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).
Polygon
  
Returns the number of polylines that make up the inner boundaries of this polygon.
Polygon
  
getInnerVertex(line:Number, index:Number):LatLng
Returns the LatLng of the vertex with the specified index from the specified inner polyline boundary.
Polygon
  
getInnerVertexCount(line:Number):Number
Returns the number of vertices in a specified inner line.
Polygon
  
Returns the LatLngBounds of this polygon, or null if the polygon contains no points.
Polygon
  
Retrieves the polygon's options.
Polygon
  
getOuterVertex(index:Number):LatLng
Returns the vertex from the outer boundary with the specified index.
Polygon
  
Returns the number of vertices in the outer line.
Polygon
  
positionOverlay(zoomChanged:Boolean):void
Reposition the overlay on the screen.
Polygon
  
setOptions(options:PolygonOptions):void
Updates the polygon's options.
Polygon
Protected Methods
 MethodDefined by
  
clearWrapper():void
Remove all event listeners and clear the wrapper.
Polygon
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
Polygon()constructor
public function Polygon(points:Array, options:PolygonOptions = null)

Constructs a new polygon at the specified lat-lng, using the specified options. To create a polygon from encoded data, use the fromEncoded method.

Parameters
points:Array — Array of LatLng vertex locations.
 
options:PolygonOptions (default = null) — Full or partial set of polygon options. When a partial set of options is specified, the polygon's complete set of options will be a combination of partial options 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(polylineList:Array, options:PolygonOptions = null):Polygon

Constructs a polygon from encoded data.

Parameters
polylineList:Array — An array of EncodedPolylineData objects for polylines.
 
options:PolygonOptions (default = null) — Full or partial set of polygon options. When a partial set of options is specified, the polygon's complete set of options will be a combination of partial options and the existing defaults set using PolygonOptions.setDefaultOptions() call.

Returns
Polygon — Newly constructed polygon.
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.
getInnerPolylineCount()method 
public function getInnerPolylineCount():Number

Returns the number of polylines that make up the inner boundaries of this polygon.

Returns
Number — Number of polylines making up the inner polygon boundaries.
getInnerVertex()method 
public function getInnerVertex(line:Number, index:Number):LatLng

Returns the LatLng of the vertex with the specified index from the specified inner polyline boundary.

Parameters
line:Number — Index of the inner polyline.
 
index:Number — Index of the target vertex within the specified polyline.

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

Returns the number of vertices in a specified inner line.

Parameters
line:Number — Index of the inner line.

Returns
Number — Number of vertices.
getLatLngBounds()method 
public function getLatLngBounds():LatLngBounds

Returns the LatLngBounds of this polygon, or null if the polygon contains no points.

Returns
LatLngBounds
getOptions()method 
public function getOptions():PolygonOptions

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

Returns
PolygonOptions — Full set of options on the polygon.

See also

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

Returns the vertex from the outer boundary with the specified index.

Parameters
index:Number — Index of the target vertex.

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

Returns the number of vertices in the outer line.

Returns
Number — 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:PolygonOptions):void

Updates the polygon's options. The options parameter may specify a complete or partial set of polygon options. If a partial set of options is specified, it will supplement the existing polygon options, overriding only the values that were set explicitly and leaving the rest unchanged. For example, the following piece of code will modify the polygon's fill alpha, leaving the rest of its options unchanged. var options:PolygonOptions = new PolygonOptions( { fillStyle: { alpha: 0.2 }} ); myPolygon.setOptions(options);

Parameters
options:PolygonOptions — New full or partial set of options for the polygon.