API Docs for: 7.2
Show:

MQA.GeolocationControl Class

Extends MQA.Control
Module: MQA

Provides a user control to hook into browser geolocation. When activated will recenter the map, and potentially change the zoom level based on the accuracy of the geolocation position.

Constructor

MQA.GeolocationControl

()

Properties

controlVersion

String

Inherited from MQA.Control

The version of the control.

Methods

activate

()

Switches the control to its active state, and kicks off a geolocation request to the client. Will add the "waving man" POI to the map and draw the halo to indicate the accuracy of the geolocation.

deactivate

()

Switches the control to its inactive state, and removes the POI and halo from the map.

getHeight

() Number

Inherited from MQA.Control

Determines the height of the control by selecting the greatest height from all elements in the control subtree. Override this method to provide a custom height (in most cases this should be overridden).

Returns <Number>

The height of the control.

getHeightInternal

() private

Inherited from MQA.Control

Get the height of the control.

getMsg

(
  • key
  • defaultMsg
)
String

Inherited from MQA.Control

Provides localization support for controls with text labels.

Parameters:

  • key String

    The unique key for the message.

  • defaultMsg String

    The default message to use if the message isn't found for the localization.

Returns <String>

The localized message.

getPosition

() MQA.CornerPlacement

Inherited from MQA.Control

Returns the position of the control. A default position is set when instantiated.

Returns <MQA.CornerPlacement>

The position of the control.

getWidth

() Number

Inherited from MQA.Control

Determines the width of the control by selecting the greatest width from all elements in the the control subtree. Override this method to provide a custom width (in most cases this should be overridden).

Returns <Number>

The width of the control.

getWidthInternal

(
  • parent
)
Number private

Inherited from MQA.Control

Get the width of the control.

Parameters:

Returns <Number>

width

initialize

(
  • map
)

Inherited from MQA.Control

Initializes the control when added to the map.

Parameters:

onLocate

(
  • poi
  • pos
)

Provides a customization point for adding behavior to the control. This function will be executed after a successful geolocation request, and takes the constructed POI and the position in the response. position object defined here: http://dev.w3.org/geo/api/spec-source.html#position_interface

Parameters:

setMapType

(
  • evt
)

Listens for "mapTypeChanged" events from the TileMap, and changes the background of the control as needed.

Parameters:

setZoom

()

controlbase hooks into TileMap.onZoomEnd, and will call setZoom on each control. Allows us to redraw the halo on zoom level change with a new scale.

toggle

()

Toggle the state of the control