Packagecom.afcomponents.umap.providers
Classpublic class DefaultProvider
InheritanceDefaultProvider Inheritance flash.events.EventDispatcher
ImplementsIProvider
SubclassesCloudMadeProvider, DummyProvider, XMLProvider

Default implemetation for the IProvider interface. Subclass this to create your own custom provider for UMap.

Contains the folowing functionality:

  • Methods to add, list and search map types, as described by IProvider
  • Provider logo which can be loaded from an external resource or defined as a valid DisplayObject.
  • Entry point for your map types implemetation.

  • Example
    Here is how you can define a custom provider:



    Public Properties
     PropertyDefined by
      logo : DisplayObject
    [read-only] Returns a display object with the provider's logo.
    DefaultProvider
      mapTypes : Array
    [read-only] Array which holds map types supported by this Provider.
    DefaultProvider
    Protected Properties
     PropertyDefined by
      _core : UMap
    Reference to the core UMap class.
    DefaultProvider
      _logo : DisplayObject
    Display object which containes the provider logo.
    DefaultProvider
      _logoURL : URLRequest
    URI of the provider logo.
    DefaultProvider
      _mapTypes : Array
    Array of map types.
    DefaultProvider
    Public Methods
     MethodDefined by
      
    DefaultProvider(logo:* = null)
    Provider constructor.
    DefaultProvider
      
    addMapType(type:IMapType):Boolean
    Adds new map type to the map types Array.
    DefaultProvider
      
    clearLogo():void
    Clears the logo.
    DefaultProvider
      
    dispose():void
    Frees the resources accuired by the Provider.
    DefaultProvider
      
    Returns default copyright string.
    DefaultProvider
      
    getMapTypeByName(mapTypeName:String):IMapType
    Returns map type reference by it's name.
    DefaultProvider
      
    init(core:UMap):void
    Initializes the provider and starts the loading process.
    DefaultProvider
      
    loadCopyright(center:LatLng, bounds:LatLngBounds, zoom:Number, event:String = ""):void
    Loads copyrights for the specified center, bounds, zoom and event.
    DefaultProvider
      
    setLogo(logo:*):void
    Setups the logo for the provider, loads it if necessary.
    DefaultProvider
    Protected Methods
     MethodDefined by
      
    getMapTypeCopyright(bounds:LatLngBounds, zoom:Number, mapType:IMapType = null):void
    Queries specified map type for copyright string and generates COPYRIGHT_CHANGED event.
    DefaultProvider
      
    initMapTypes():void
    Override this function to define map types.
    DefaultProvider
    Property detail
    _coreproperty
    protected var _core:UMap

    Reference to the core UMap class.

    _logoproperty 
    protected var _logo:DisplayObject

    Display object which containes the provider logo.

    logoproperty 
    logo:DisplayObject  [read-only]

    Returns a display object with the provider's logo. Override it for custom logo.

    Implementation
        public function get logo():DisplayObject
    _logoURLproperty 
    protected var _logoURL:URLRequest

    URI of the provider logo.

    _mapTypesproperty 
    protected var _mapTypes:Array

    Array of map types.

    mapTypesproperty 
    mapTypes:Array  [read-only]

    Array which holds map types supported by this Provider.

    Implementation
        public function get mapTypes():Array
    Constructor detail
    DefaultProvider()constructor
    public function DefaultProvider(logo:* = null)

    Provider constructor.

    Defines an empty array of map types. Use init() function to initalize the provider.

    Parameters
    logo:* (default = null) — An object that specifes the provider logo. Can be one of the following:
  • DisplayObject instance.
  • A String which defines path to the external asset.
  • An URLRequest object which defines path to the external asset.
  • null value disables the logo.
  • Method detail
    addMapType()method
    public function addMapType(type:IMapType):Boolean

    Adds new map type to the map types Array.

    Parameters
    type:IMapType — Valid map type object.

    Returns
    Boolean — A value of true if the map type was sucessfully added to the map types array; false if it was not.
    clearLogo()method 
    public function clearLogo():void

    Clears the logo.

    dispose()method 
    public function dispose():void

    Frees the resources accuired by the Provider.

    getDefaultCopyright()method 
    public function getDefaultCopyright():String

    Returns default copyright string.

    Returns
    String
    getMapTypeByName()method 
    public function getMapTypeByName(mapTypeName:String):IMapType

    Returns map type reference by it's name.

    Parameters
    mapTypeName:String — Name of the map type to search.

    Returns
    IMapType — Reference to the found map type; null if it wasn't found.
    getMapTypeCopyright()method 
    protected function getMapTypeCopyright(bounds:LatLngBounds, zoom:Number, mapType:IMapType = null):void

    Queries specified map type for copyright string and generates COPYRIGHT_CHANGED event.

    Parameters
    bounds:LatLngBounds
     
    zoom:Number
     
    mapType:IMapType (default = null)
    init()method 
    public function init(core:UMap):void

    Initializes the provider and starts the loading process.

    Parameters
    core:UMap — Reference to the core object.
    initMapTypes()method 
    protected function initMapTypes():void

    Override this function to define map types. Provider should add map types in this function. After that, provider should dispatch ProviderEvent.COMPLETE event both from self and core. The easiest way to achieve that, will be to call super.initMapTypes() function.

    See also

    loadCopyright()method 
    public function loadCopyright(center:LatLng, bounds:LatLngBounds, zoom:Number, event:String = ""):void

    Loads copyrights for the specified center, bounds, zoom and event. After the copyright data has been loaded, class should dispatch ControlEvent.COPYRIGHT_CHANGED event with the new copyright information.

    Parameters
    center:LatLng — The coordinates of the map center.
     
    bounds:LatLngBounds — The bounds of the map view.
     
    zoom:Number — Current map zoom level.
     
    event:String (default = "") — Indicates the map event.
    setLogo()method 
    public function setLogo(logo:*):void

    Setups the logo for the provider, loads it if necessary.

    Parameters
    logo:* — An object that specifes the provider logo. Can be one of the following:
  • DisplayObject instance.
  • A String which defines path to the external asset.
  • An URLRequest object which defines path to the external asset.
  • null value disables the logo.