Class: UWA.Controls.Map

UWA/Controls/Map. UWA.Controls.Map

new UWA.Controls.Map(options)

Display a Google Map.

Available Events
Event Description
onPreInject Triggered before inject
onPostInject Triggered after inject
onResize Invoked when control needs to resize
onLoad Invoked when the map is loaded
Example
var onMapLoad = function() {
    MyMap.setPosition({
        coords: {
            latitude: 42.123,
            longitude: 42.123
        }
    });
};

var MyMap = new UWA.Controls.Map({
    events: {
        onLoad: onMapLoad
    }
});
Parameters
Name Type Description
options Object

Options hash or a option/value pair.

Properties
Name Type Argument Default Description
className String <optional>
'uwa-map'

Customized container classname

width Number <optional>
320

Map width in pixel

height Number <optional>
240

Map height in pixel

api Object <optional>
{zoom:15}

Google map options

Extends

  • UWA.Controls.Abstract

Mixes In

  • UWA.Classes.Timed

Index

Members

<protected> id

Properties:
Name Type Description
id Number

Instance unique id.

<protected> api

Properties:
Name Type Description
api Object

The current google.maps object.

<protected> map

Properties:
Name Type Description
map Object

The current google.maps.Map instance.

<protected> defaultOptions

Properties:
Name Type Description
defaultOptions Object

The default controls options.

Methods

callApi(callback)

To be sure the google map api is loaded, you must wrap all your calls in this method if the api is not loaded, this method will try a bit later

Parameters
Name Type Description
callback Function

Executed once the api is fully loaded

setPosition(position)

Set Center of the Map to a position.

Parameters
Name Type Description
position Object

A position object with coords object attribute with longitude and latitude

addMarker(position, title, content)

Add a marker on the Map to a position.

Parameters
Name Type Description
position Object

A position object with coords object attribute with longitude and latitude

title String

Marker title

content String

Marker content (could contain HTML)

onApiReady()

Invoked when google Api is loaded

onLoad()

Triggered after google Api is loaded

onResize()

Invoked when control needs to resize