API Docs for: 7.2
Show:

MQA.HtmlPoi Class

Extends MQA.Poi
Module: MQA

HTML POI library. This library extends the StdPoi with standard A standard POI has the following attributes:

  • HTMLContent
  • HTMLOffset
  • infoTitleHTML
  • infoContentHTML
  • cursor (pointer)

Constructor

MQA.HtmlPoi

(
  • latLng
)

Parameters:

Properties

_applyZIndex

Unknown private

Inherited from MQA.Poi

_cnts

MQA.Collection.map private

Inherited from MQA.BasePoi

Map of key {String} to content element. For most POIs this will be the Icon img and Shadow img. Though any valid DOM Element will work.

Each content element is extended with the following fields:

  • ofsX: Position of the anchor point relative to the upper left corner
      of the content (X)
    
  • ofsY: Position of the anchor point relative to the upper left corner
      of the content (Y)
    
  • eventGroup: The name of the event group this content element belongs
            to.  If null/empty, then events will not be hooked.
    

_dspStates

Object

Inherited from MQA.Poi

Array of content states. These are keyed by the contentMode name which can be '', 'alt', 'bias', or 'html' with mapped MQA.DisplayState keyed by name

_pxX

Number private

Inherited from MQA.BasePoi

Display coordinate position x

_pxY

Number private

Inherited from MQA.BasePoi

Display coordinate position y

altStateFlag

Boolean

Inherited from MQA.Poi

Set to true for the POI to be in its 'alt' state.

Default: false

bias

MQA.Point

Inherited from MQA.BasePoi

How far to offset the POI from its XY position

Example:

//Set the poi icon 25 pixels to the left
poi.setBias(new MQA.Point(-25,0));

className

String

Inherited from MQA.Poi

The class name used for identifying objects for shape events.

declutter

Boolean

Inherited from MQA.Poi

Set to true if the POI should be decluttered. This moves the location of the POI and provides a black leader line pointing back to its original location if many POIs are concentrated in the same area.

declutterFixed

Boolean

Inherited from MQA.Poi

Set to true if the POI should not be decluttered. This forces the POI to remain fixed at its location and others will declutter around it.

draggable

Boolean

Inherited from MQA.Poi

extraFields

Map

Inherited from MQA.BasePoi

infoContentHTML

String

Inherited from MQA.Poi

Set the HTML contents for the InfoWindow. This is displayed when a user hovers over and clicks on a POI.

infoTitleHTML

String deprecated

Inherited from MQA.Poi

Set the title bar for the InfoWindow.

key

String

Inherited from MQA.BasePoi

The unique key for the POI

latLng

MQA.LatLng

Inherited from MQA.BasePoi

The current lat/lng position of the POI

maxZoomLevel

Number

Inherited from MQA.BasePoi

The closest in the map can be zoomed and still show the POI

minZoomLevel

Number

Inherited from MQA.BasePoi

The farthest out the map can be zoomed and still show the POI

rolloverContent

String

Inherited from MQA.Poi

Set the HTML rollover content for the InfoWindow. This is displayed when a user hovers over a POI. If this is not set, the infoContentHTML will be displayed on hover.

snapback

Boolean

Inherited from MQA.Poi

Set to true if the POI should snap back to its original location while in a drag state.

stateStack

Array

Inherited from MQA.Poi

titleVisible

Boolean deprecated

Inherited from MQA.Poi

Set to true to display the title bar for the InfoWindow.

visible

Boolean

Inherited from MQA.BasePoi

If true, signals for the POI to be visible on the map

zIndex

String

Inherited from MQA.Poi

Methods

_actIsVisible

() Boolean private

Inherited from MQA.BasePoi

Return true if the POI should actually be visible. This takes into account zoom level, explicit visibility and other constraints.

Returns <Boolean>

if the POI should be visible.

_applyState

() private

Inherited from MQA.Poi

_applyZIndex

() private

Inherited from MQA.Poi

_fakeClick

() private

Inherited from MQA.Poi

The normal DOM click event interferes with dragging gestures if handled directly. We therefore simulate clicks based on combinations of mousedown, mouseup and drag state management. Whichever event triggered the interaction should be passed here (ie. mouseup).

_onDOMclick

() private

Inherited from MQA.Poi

_onDOMEvent

() private

Inherited from MQA.BasePoi

Stub event for AddDOMEventProtocol

_onDomEvent

() private

Inherited from MQA.Poi

Main DOM event handler

_onDOMmousedown

() private

Inherited from MQA.Poi

_onDOMmouseup

() private

Inherited from MQA.Poi

_updateBias

() private

Inherited from MQA.BasePoi

Override the _updateBias function to draw leader lines. See the original function in the base class to understand the coordinate system.

_updatePosition

() private

Inherited from MQA.BasePoi

Updates the POI position on the map based on the existing Display transform.

_updateVisibility

() Boolean private

Inherited from MQA.BasePoi

Update the visibility of a POI's elements based on its current visibility.

Returns <Boolean>

if the POI should be visible

activateContent

(
  • poi
  • contentElt
  • eventGroup
)
private

Inherited from MQA.BasePoi

Attach events to the content.

Parameters:

  • poi MQA.BasePoi
  • contentElt DOMElement
  • eventGroup EventGroup

addExtraField

(
  • key
  • value
)

Inherited from MQA.BasePoi

Adds keyed extra fields to the POI. Removes extra field if supplied value is null.

Parameters:

  • key String

    The unique key for the extra field.

  • value Object

    The value for the unique key. If null, the key is deleted.

createPeer

()

Inherited from MQA.BasePoi

POIs are their own peer. Defining method for Shape interface.

deactivateContent

(
  • poi
  • contentElt
  • eventGroup
)
private

Inherited from MQA.BasePoi

Detach events from the content.

Parameters:

  • poi MQA.BasePoi
  • contentElt DOMElement
  • eventGroup EventGroup

defineProperty

(
  • name
  • transformFunction
  • defaultValue
  • setTrigger
)

Inherited from MQA.Component

Dynamically define a property, complete with getters, setters, an optional transformFunction, default value and setTrigger. This method can be invoked on a function's prototype to create a permanent property for all instances.

Parameters:

  • name String

    Camel-cased property name

  • transformFunction Function

    (Optional) If defined, then the setter will filter the value to set through this function

  • defaultValue Object

    (Optional) If defined the default value to initialize immediately

  • setTrigger Function | String

    (Optional) If defined the given named trigger method will be called when the setter results in a change.

Example:

 myObj.defineProperty('myNewProp', parseInt, 0, function () { alert('myNewProp changed'); });
 myObj.setMyNewProp('1'); // Will trigger alert
 myObj.getMyNewProp();  // --> 1

 myObj.boolTrigger = function () { alert('bool changed'); };
 myObj.defineProperty('reallyBig', Boolean, false, 'boolTrigger');
 myObj.isReallyBig();   // --> false
 myObj.setReallyBig(1); // alert "bool changed"
 myObj.isReallyBig();   // --> true

dispose

()

Inherited from MQA.Component

Override the dispose method of MQA.Component to cleanup after POIs. Defining method for Shape interface.

dispose$Before

()

Inherited from MQA.Poi

Dispose of infowindows when pois are diposed. Added by MQA.BasicWindowManager

getContent

(
  • key
)
HTMLElement

Inherited from MQA.BasePoi

Get content associated with key.

Parameters:

  • key String

    The unique key for the content.

Returns <HTMLElement>

The content element, or null if it doesn't exist.

getCurrentBounds

()

Inherited from MQA.Poi

Returns a bounds object describing the display coordinates occupied by the various POI attachments. This method takes bias into account and can be used for determining the location and sizes of the POI. Returns an object like the following:

{
  x:       // upper left x,
  y:       // upper left y,
  width:   // width of the complete content,
  height:  // height of the complete content,
  anchorX: // x coord of the anchor point,
  anchorY: // y coord of the anchor point,
  biasX:   // amount by which the anchor is translated in the x direction (from lng),
  biasY:   // amount by which the anchor is translated in the y direction (from lat),
  icon: {
    x:       // upper left of the icon
    y:       // upper left of the icon
    width:   // width of the icon
    height:  // height of the icon
    offsetX: // offset relative to the anchor of the icon,
    offsetY: // offset relative to the anchor of the icon
 },
 shadow: {
   // same properties as icon
 }

getCursor

(
  • [stateName]
)
String

Inherited from MQA.Poi

Get the cursor used when user hovers or clicks on the POI.

Parameters:

  • [stateName] String default = 'def'

    The state of the POI.

Returns <String>

The cursor used.

getDeclutterMode

() Boolean

Inherited from MQA.Poi

Get the declutter mode of the POI. Returns undefined if previously not set.

Returns <Boolean>

getDisplayState

(
  • [stateName]
)

Inherited from MQA.Poi

Get the display state for a given state name. If no state name is given, then the default state is returned.

Parameters:

  • [stateName] String default = 'def'

    The state of the POI.

getExtraField

(
  • key
)
Object

Inherited from MQA.BasePoi

Retrieves value for extra field by key

Parameters:

  • key String

    the unique key for the extra field

Returns <Object>

the value stored on the POI in the key's extra field

getIcon

(
  • [stateName]
)
MQA.Icon

Inherited from MQA.Poi

Get the icon by state.

Parameters:

  • [stateName] String default = 'def'

    The state of the POI.

Returns <MQA.Icon>

The icon used by the POI.

getIconOffset

(
  • [stateName]
)
Object

Inherited from MQA.Poi

Get the icon offset.

Parameters:

  • [stateName] String default = 'def'

    The state of the POI.

Returns <Object>

The x/y offset used by the icon.

getNeededBounds

(
  • transform
)

Inherited from MQA.Poi

Used by declutter to get the bounds of the POI (just the icon) in display coordinates, centered around the latlng for a given transform. Note that this does not take bias into account.

Parameters:

getShadow

(
  • [stateName]
)
MQA.Icon

Inherited from MQA.Poi

Get the shadow used by the icon.

Parameters:

  • [stateName] String default = 'def'

    The state of the POI.

Returns <MQA.Icon>

The shadow used by the POI.

getShadowOffset

(
  • [stateName]
)
Object

Inherited from MQA.Poi

Get the shadow offset.

Parameters:

  • [stateName] String default = 'def'

    The state of the POI.

Returns <Object>

The x/y offset used by the shadow.

getState

()

Inherited from MQA.Poi

getValue

(
  • pcKey
)
Mixed

Inherited from MQA.Component

Returns the value if it exists, undefined otherwise.

Parameters:

  • pcKey String

    The property name of the value to get.

Returns <Mixed>

The value of the specified property name. If the specified property does not exist, undefined is returned.

layerInit

(
  • layer
  • map
)

Inherited from MQA.BasePoi

Initialize the layer, initialization step for display on the map. Defining method for Shape interface.

Parameters:

layerInit$After

()

Inherited from MQA.Poi

onEvent$After

(
  • eventType
  • mqe
)

Inherited from MQA.Poi

Parameters:

onWindowClose

(
  • wnd
)

Inherited from MQA.Poi

The window manager will call onWindowClose when either the infowindow or rollover window is closed. Added by MQA.BasicWindowManager

Parameters:

popState

()

Inherited from MQA.Poi

pushState

(
  • stateName
)

Inherited from MQA.Poi

Parameters:

  • stateName String

    The state of the POI.

reapplyContent

(
  • poi
  • contentElt
)
private

Inherited from MQA.BasePoi

Re-apply the content position and zindex based on the properties _poiOfs and _poiZ.

Parameters:

resetTransform

() private

Inherited from MQA.BasePoi

Stub event to conform to Shape interface. for allowing the POI to reset on a Transform change.

setAltStateFlag

(
  • altStateFlag
)

Inherited from MQA.Poi

Set to true for the alternate attributes of the POI to be used.

Parameters:

  • altStateFlag Boolean

    The alternate state flag.

setContent

(
  • key
  • contentElt
  • ofsX
  • ofsY
  • eventGroup
  • zindex
)

Inherited from MQA.BasePoi

Set a content element for the given key. Only one content element may exist for a given key and the content will be replaced if set again. The content offsetX and offsetY can be set at this time. The offset is the distance from the POI's anchor point (ie. latlng if not biased or latlng+bias if biased) to the content's upper left corner.

If eventGroup is true, then DOM Events subscribed to by addDOMEvent will be captured and will be routed to the POI event handlers. If eventGroup is not specified or evaluates to false, then no events are captured for the content.

If contentElt is null, then the content is removed from the POI for that key.

Parameters:

  • key String

    The unique key for the content.

  • contentElt HTMLElement

    The content element.

  • ofsX Number

    The x offset.

  • ofsY Number

    The y offset.

  • eventGroup Boolean

    Set to true if the DOM Events should be captured.

  • zindex Number

    The z-index for the content.

setContentOffset

(
  • key
  • ofsX
  • ofsY
)

Inherited from MQA.BasePoi

Sets the offset on an existing content element. Does nothing if the content does not exist.

Parameters:

  • key String

    The unique key for the content.

  • ofsX Number

    The x offset.

  • ofsY Number

    The y offset.

setContentVisible

(
  • key
  • visible
)

Inherited from MQA.BasePoi

Sets the visibility of the content element. Element will only be displayed if its POI is also visible.

Parameters:

  • key String

    The unique key for the content.

  • visible Boolean

    Set to true if content should be visible.

setContentZIndex

(
  • key
  • zindex
)

Inherited from MQA.BasePoi

Sets the z-index for the content. This will only be fully valid after the POI has been added to the document.

Parameters:

  • key String

    The unique key for the content.

  • zindex Number

    The z-index value for the content.

setCursor

(
  • cursor
  • [stateName]
)

Inherited from MQA.Poi

Set the cursor to be used when user hovers or clicks on the POI.

Parameters:

  • cursor String

    The cursor to be used.

  • [stateName] String default = 'def'

    The state of the POI.

setDeclutterMode

(
  • mode
)

Inherited from MQA.Poi

Set the declutter mode of the POI.

Parameters:

  • mode Boolean

    Set to true if POIs should be decluttered.

setHtml

(
  • content
  • offsetX
  • offsetY
  • className
)

set the content of the Poi, the div recreated will be placed with the upper left corner at coordinates defined in the constructor. Use the offsets to place it differently

Parameters:

  • content String | HTMLElement

    of POI

  • offsetX Number

    (optional)

  • offsetY Number

    (optional)

  • className String

    of the div containing the content passed in (optional) Default is mqa_htmlpoi

setIcon

(
  • icon
  • [stateName]
)

Inherited from MQA.Poi

Set an icon by the state of the POI. If state is null, then the default state is assumed ('def').

Parameters:

  • icon MQA.Icon

    The icon to be used.

  • [stateName] String default = 'def'

    The state of the POI.

setIconOffset

(
  • iconOffset
  • [stateName]
)

Inherited from MQA.Poi

Set the icon offset.

Parameters:

  • iconOffset Object

    The x/y offset used by the icon.

  • [stateName] String default = 'def'

    The state of the POI.

Example:

var poi = new MQA.Poi({ lat: 39.743943, lng: -105.020089 });

poi.setIconOffset({ x: 10, y: 5 });

setShadow

(
  • shadow
  • [stateName]
)

Inherited from MQA.Poi

Set the shadow used by the icon.

Parameters:

  • shadow MQA.Icon

    The shadow to be used.

  • [stateName] String default = 'def'

    The state of the POI.

setShadowOffset

(
  • shadowOffset
  • [stateName]
)

Inherited from MQA.Poi

Set the shadow offset.

Parameters:

  • shadowOffset Object

    The x/y offset used by the shadow.

  • [stateName] String default = 'def'

    The state of the POI.

Example:

var poi = new MQA.Poi({ lat: 39.743943, lng: -105.020089 });

poi.setShadowOffset({ x: 10, y: 5 });

setState

(
  • [stateName]
)

Inherited from MQA.Poi

Set the state of the POI.

Parameters:

  • [stateName] String default = 'def'

    The state of the POI.

setValue

(
  • pcKey
  • pcValue
)
Boolean

Inherited from MQA.Component

Sets the specified key to the specified value.

Parameters:

  • pcKey String

    The key to the property

  • pcValue Mixed

    The value to set the property to.

Returns <Boolean>

true if the key exists and is set successfully, otherwise false.

setValues

(
  • pcValues
)
Number

Inherited from MQA.Component

Sets multiple properties for the object.

Parameters:

  • pcValues Object

    The key:value pairs to set where "key" is the property name and "value" is the value to set.

Returns <Number>

the number of objects set successfully

shouldDeclutter

()

Inherited from MQA.Poi

Returns false if the POI should not participate in declutter. Returns 'fixed' if the POI should stay fixed and have others declutter around it or 'moveable' if the POI should move.

toggleInfoWindow

()

Inherited from MQA.Poi

Toggle infowindow if the content is available, added by MQA.BasicWindowManager

toggleInfoWindowRollover

()

Inherited from MQA.Poi

Toggle rollover window if the content is available, added by MQA.BasicWindowManager