Packagecom.afcomponents.umap.overlays
Classpublic class Layer
InheritanceLayer Inheritance MapObjectContainer Inheritance MapObject Inheritance flash.display.Sprite
ImplementsIMapObjectContainer, IOverlay
SubclassesFeedLayer, KMLLayer, RouteLayer

Layer is a special IOverlay that can be used as a container for IOverlay objects.


Example
Here is how you can create a Layer and add Markers to it:
 import com.afcomponents.umap.core.UMap;
 import com.afcomponents.umap.overlays.Layer;
 import com.afcomponents.umap.overlays.Marker;
 import com.afcomponents.umap.types.LatLng;
  
 // create map & attach it to stage
 var map:UMap = new UMap();
 map.setSize(300,300);
 addChild(map);
  
 // create new layer
 var layer:Layer = new Layer();
  
 // add markers
 layer.addOverlay(new Marker({position:new LatLng(10,10), index:"A"}));
 layer.addOverlay(new Marker({position:new LatLng(-10,-10), index:"B"}));
  
 // add layer to the map
 map.addOverlay(layer);



Public Properties
 PropertyDefined by
 InheritedasDisplayObject : DisplayObject
Returns reference to the object as a DisplayObject instance.
MapObject
  autoCloseInfo : Boolean
Gets or sets the autCloseInfo flag, which indicates whether to close info window automatically when user clicks somewhere on the map.
Layer
  autoInfo : Boolean
Gets or sets the autInfo flag, which indicates whether to open info window automatically upon mouse click.
Layer
 Inheritedcore : UMap
Returns reference to the core UMap object.
MapObject
  description : String
Gets or sets the description text for the layer.
Layer
 Inheritedid : uint
Gets or sets the ID of the object.
MapObject
  info : IInfoWindow
[read-only] Return referens to opened InfoWindow
Layer
  infoParam : Object
Gets or sets the info window param object.
Layer
  infoStyle : Object
Gets or sets the info window style object associated with the Overlay.
Layer
  name : String
[write-only] Gets or sets the name of the object.
Layer
 Inheritedowner : IMapObjectContainer
Returns reference to the owner container object.
MapObject
  visible : Boolean
Gets or sets the Layer's visibility.
Layer
Public Methods
 MethodDefined by
  
Layer(param:Object = null)
Layer constructor.
Layer
 Inherited
addObject(object:IMapObject):void
Adds new IMapObject to the container.
MapObjectContainer
  
Adds new IOverlay to this Layer, invalidates and refreshes it.
Layer
 Inherited
bringForward(object:IMapObject):void
Moves the attached IMapObject forward in the display list.
MapObjectContainer
 Inherited
bringToFront(object:IMapObject):void
Brings the attached IMapObject to the top of the display list.
MapObjectContainer
 Inherited
clearObjects(filter:Class = null):void
Removes all attached objects.
MapObjectContainer
  
Removes all attached overlays from the layer.
Layer
  
Creates an exact copy of this Layer with the attached Overlays and returns it to the user.
Layer
  
dispose():void
Releases all the resources accuired by the object.
Layer
  
fromXML(xml:XML):Layer
[static] Creates new Layer from XML object in KML 2.1 format.
Layer
  
Retruns Overlay bounds in geographical coordinates.
Layer
  
getBoundsXY(zoom:Number = 0):Bounds
Retruns Overlay bounds in bitmap coordinates.
Layer
 Inherited
getObject(id_or_name:*, filter:Class = null):IMapObject
Searches for an object with specified id or name.
MapObjectContainer
 Inherited
getObjectById(id:uint, filter:Class = null):IMapObject
Searches for an object with specified id.
MapObjectContainer
 Inherited
getObjectByName(name:String, matchCase:Boolean = false, filter:Class = null):IMapObject
Searches for an object with specified name.
MapObjectContainer
 Inherited
getObjects(filter:Class = null):Array
Returns an array of IMapObjects that where added to the container.
MapObjectContainer
  
getOverlay(id_or_name:*):IOverlay
Searches for an IOverlay object with specified id or name.
Layer
  
getOverlays():Array
Returns an array of IOverlay objects that where added to the Layer.
Layer
  
hide():void
Hides the Layer.
Layer
  
invalidate():void
Schedules the Layer for invalidation in 1 frame after this call.
Layer
 Inherited
isOwnerVisible():Boolean
Recursevly checks visibility of parent objects
MapObjectContainer
  
redraw():void
Invalidates Overlays attached to the Layer.
Layer
  
refresh(full:Boolean = false):void
Refreshes the position of the Overlays attached to the Layer.
Layer
 Inherited
remove():void
Removes the object from the owner container object.
MapObject
 Inherited
removeObject(object:IMapObject):void
Removes IMapObject from the container.
MapObjectContainer
  
removeOverlay(overlay:IOverlay):void
Removes target IOverlay from the Layer.
Layer
 Inherited
sendBackward(object:IMapObject):void
Sends the attached IMapObject backward in the display list.
MapObjectContainer
 Inherited
sendToBack(object:IMapObject):void
Sends the attached IMapObject to the bottom of the display list.
MapObjectContainer
  
Adds the object to the specified IMapObjectContainer.
Layer
  
show():void
Shows the Layer.
Layer
 Inherited
toString():String
Returns a textual representation of the object.
MapObject
  
toXML(full:Boolean = true, afcTags:Boolean = false):XML
Builds an XML object in KML 2.1 format that describes the Overlay & it's style.
Layer
  
updateMapType(mapType:IMapType):void
Invoked when map type has been changed.
Layer
  
updatePosition(latlng:LatLng):void
Invoked when the map position has been updated.
Layer
  
updateZoom(zoom:Number):void
Invoked when map the zoom has been updated.
Layer
Property detail
autoCloseInfoproperty
autoCloseInfo:Boolean  [read-write]

Gets or sets the autCloseInfo flag, which indicates whether to close info window automatically when user clicks somewhere on the map.

Implementation
    public function get autoCloseInfo():Boolean
    public function set autoCloseInfo(value:Boolean):void
autoInfoproperty 
autoInfo:Boolean  [read-write]

Gets or sets the autInfo flag, which indicates whether to open info window automatically upon mouse click.

Implementation
    public function get autoInfo():Boolean
    public function set autoInfo(value:Boolean):void
descriptionproperty 
description:String  [read-write]

Gets or sets the description text for the layer.

Implementation
    public function get description():String
    public function set description(value:String):void
infoproperty 
info:IInfoWindow  [read-only]

Return referens to opened InfoWindow

Implementation
    public function get info():IInfoWindow
infoParamproperty 
infoParam:Object  [read-write]

Gets or sets the info window param object.

Implementation
    public function get infoParam():Object
    public function set infoParam(value:Object):void
infoStyleproperty 
infoStyle:Object  [read-write]

Gets or sets the info window style object associated with the Overlay.

Implementation
    public function get infoStyle():Object
    public function set infoStyle(value:Object):void
nameproperty 
name:String  [write-only]

Gets or sets the name of the object.

Implementation
    public function set name(value:String):void
visibleproperty 
visible:Boolean  [read-write]

Gets or sets the Layer's visibility.

Implementation
    public function get visible():Boolean
    public function set visible(value:Boolean):void
Constructor detail
Layer()constructor
public function Layer(param:Object = null)

Layer constructor. Creates new Layer container object. Properties defined in param object will override the default values.

Here is a list of properties you can specify in the param object:

PropertyTypeDefaultDescription
name String Layer(id) Specifies layer's name.
description String null Specifies layers's description.
description String null Specifies layers's description.
infoParam Object null Children overlays will use this param object in openInfoWindow calls.
infoStyle Object null Children overlays will use this style object in openInfoWindow calls.
autoInfo Boolean true A flag, that specifies whether info window should popup automatically when user clicks the overlay.
autoCloseInfo Boolean true A flag, that specifies whether info window should be closed when user clicks somewhere on the map.

Parameters
param:Object (default = null) — Object that contains additional creation parameters for the Layer.
Method detail
addOverlay()method
public function addOverlay(overlay:IOverlay):IOverlay

Adds new IOverlay to this Layer, invalidates and refreshes it.

Parameters
overlay:IOverlay — Target IOverlay object to add.

Returns
IOverlay — Reference to added IOverlay object.
clearOverlays()method 
public function clearOverlays():void

Removes all attached overlays from the layer.

clone()method 
public function clone():IOverlay

Creates an exact copy of this Layer with the attached Overlays and returns it to the user. Please note that it doesn't attach new Layer to the same or any other parent.

Returns
IOverlay — New Layer with the same properties and clones of the children.
dispose()method 
public override function dispose():void

Releases all the resources accuired by the object.

fromXML()method 
public static function fromXML(xml:XML):Layer

Creates new Layer from XML object in KML 2.1 format.

Parameters
xml:XML — XML object with root <Container> node container several <Placemark> nodes.

Returns
Layer — New Layer object.
getBoundsLatLng()method 
public function getBoundsLatLng():LatLngBounds

Retruns Overlay bounds in geographical coordinates.

Returns
LatLngBounds — Overlay bounding rectangle in geographical coordinates.
getBoundsXY()method 
public function getBoundsXY(zoom:Number = 0):Bounds

Retruns Overlay bounds in bitmap coordinates. Use zoom parameter to specify zoom level for bounds conversion.

Parameters
zoom:Number (default = 0) — Defines the zoom level at which to perform bounds conversion; if omitted, current zoom level will be used.

Returns
Bounds — Overlay bounding rectangle in bitmap coordinates.
getOverlay()method 
public function getOverlay(id_or_name:*):IOverlay

Searches for an IOverlay object with specified id or name. Please also consider using getObjectById(), and getObjectByName() methods with IOverlay filter.

Parameters
id_or_name:* — ID or name of the object. If you pass a Number object will be searched by it's ID. If you pass a String object will be searched by it's name and the letter case will not match.

Returns
IOverlay — Reference to the found Overlay or null if it was not found.

See also

getOverlays()method 
public function getOverlays():Array

Returns an array of IOverlay objects that where added to the Layer.

Returns
Array — An Array holding all the attached objects.
hide()method 
public function hide():void

Hides the Layer. Fires OverlayEvent.HIDE & OverlayEvent.CHAGNED events if visibility has been changed.

invalidate()method 
public function invalidate():void

Schedules the Layer for invalidation in 1 frame after this call.

redraw()method 
public function redraw():void

Invalidates Overlays attached to the Layer.

refresh()method 
public function refresh(full:Boolean = false):void

Refreshes the position of the Overlays attached to the Layer. If the full paramter is set to true then bitmap coordinates for this overlay are recalculated. Otherwise overlay will be repositioned using previuosly calculated coordinates.

Parameters
full:Boolean (default = false) — Indicates whether to perform full refresh.
removeOverlay()method 
public function removeOverlay(overlay:IOverlay):void

Removes target IOverlay from the Layer.

Parameters
overlay:IOverlay — Reference to the IOverlay object that should be removed.
setOwner()method 
public override function setOwner(owner:IMapObjectContainer):void

Adds the object to the specified IMapObjectContainer.

If the object was previosly attached to a container, object will be removed from it. If you specify null instead of the owner, IllegalOperationError will be thrown.

Parameters
owner:IMapObjectContainer — New owner of the object.
show()method 
public function show():void

Shows the Layer. Fires OverlayEvent.SHOW & OverlayEvent.CHAGNED events if visibility has been changed.

toXML()method 
public function toXML(full:Boolean = true, afcTags:Boolean = false):XML

Builds an XML object in KML 2.1 format that describes the Overlay & it's style. Flag full indicates whether to build a complete KML data or just a container.

Parameters
full:Boolean (default = true) — A value of true if you want to return a full KML file with header; false if you want to get only a container with style and placemark nodes.
 
afcTags:Boolean (default = false) — Flag that determines whether to generate KML data with extended AFC tags.

Returns
XML — XML object in KML 2.1 format.
updateMapType()method 
public function updateMapType(mapType:IMapType):void

Invoked when map type has been changed.

Parameters
mapType:IMapType — Reference to the new map type.
updatePosition()method 
public function updatePosition(latlng:LatLng):void

Invoked when the map position has been updated.

Parameters
latlng:LatLng — Geographical coordinates of the new map center.
updateZoom()method 
public function updateZoom(zoom:Number):void

Invoked when map the zoom has been updated.

Parameters
zoom:Number — New zoom level.