Welcome! Our Tools - BpBrowser
- BpControl
- BpDownloadUrl
- BpLabel
- BpMarker
- BpMarkerLight
- BpMarkerList
About Us Licensing Fees Support Contact Us

808-281-3359


BpLabel Reference

Introduction

Download

This class implements a fully-featured label class. Labels are markers in which any HTML can be displayed.

new BpLabel()

Code:
var label = new BpLabel(latlng,html,className?,anchor?,hide?);


Remarks:

latlng determines where on the map this label is to be placed. html becomes the contents of the label. className determines how the label will be styled. If there is no className passed in, the label will be styled automatically to something I hope is reasonable. anchor determines what part of the label is anchored to latlng. Valid anchor values are:
  • center (default)
  • nw
  • n
  • ne
  • e
  • se
  • s
  • sw
  • w
hide determines whether the label is initially hidden when it's first added to the map, which is useful for tooltips. This defaults to false.
Examples:

get/setAnchor()

Code:
var anchor = label.getAnchor();
label.setAnchor(anchor);


Remarks:

Gets/sets the label anchor. See above for valid anchor values.

Examples:

get/setClassName()

Code:
var class = label.getClassName();
label.setClassName(class);


Notes:
  • This will only work if a className was passed to the constructor.

Examples:

get/setCursor()

Code:
var cursor = label.getCursor();
label.setCursor(cursor);


Notes:
  • Use pointer instead of hand.

Examples:

getEventTarget()

Code:
var div = label.getEventTarget();


Remarks:

This returns an HTML node that can be used like so to handle events:

GEvent.bindDom(label.getEventTarget(),'click',label,handler);


Examples:

getHeight()

Code:
var integer = label.getHeight();


Remarks:

Returns the label's height in pixels.

Examples:

get/setHoverLine()

Code:
var line = label.getHoverLine();
label.setHoverLine(GPolyline);


Remarks:

Set the line which is to be added to the map on mouseover and removed on mouseout.

Examples:

get/setHtml()

Code:
var html = label.getHtml();
label.setHtml(html);


Remarks:

Get/set the content of the label.

Examples:

getId()

Code:
var integer = label.getId();


Remarks:

Returns a unique id for this label.

Examples:

get/setInfoWindowOffset()

Code:
var offset = label.getInfoWindowOffset();
label.setInfoWindowOffset(GPoint);


Remarks:

By default, infoWindows open with their stems pointing at the center of a label. These methods can be used to change that default.

getMap()

Code:
var map = label.getMap();


Remarks:

Returns the map to which this label has been added.

Examples:

get/setOpacity()

Code:
var integer = label.getOpacity();
label.getOpacity(integer);


Remarks:

Manage the opacity of the label.

Notes:
  • opacity should be an integer between 0 and 100.
  • Does not work in Opera.

Examples:

get/setPane()

Code:
var pane = label.getPane();
label.setPane(pane);


Remarks:

This determines which of the map panes the label is attached to. The possible panes are :
  • G_MAP_MAP_PANE
  • G_MAP_MARKER_SHADOW_PANE
  • G_MAP_MARKER_PANE
  • G_MAP_FLOAT_SHADOW_PANE
  • G_MAP_MARKER_MOUSE_TARGET_PANE
  • G_MAP_FLOAT_PANE (default)

Notes:
  • This only works if you set this value prior to calling map.addOverlay(label).
  • The pane cannot be changed after the label is added to the map.

get/setPoint()

Code:
var latlng = label.getPoint();
label.setPoint(latlng);


Remarks:

Manage where the label appears on the map.

Examples:

get/setUserData()

Code:
var data = label.getUserData();
label.setUserData(data);


Remarks:

Stores any information that you like.

Examples:

getWidth()

Code:
var integer = label.getWidth();


Remarks:

Returns the width of the label in pixels.

Examples:

get/setZIndex()

Code:
var zIndex = label.getZIndex();
label.setZIndex(zIndex);


Remarks:

Determines which labels appear above and below other labels.

openInfoWindow*()

Code:
label.openInfoWindow(node,opts?);
label.openInfoWindowHtml(html,opts?);
label.openInfoWindowTabs(tabs,opts?);
label.openInfoWindowTabsHtml(tabs,opts?);
label.showMapBlowup(opts?);


Notes:
  • Manage the offset of the infoWindows with label.get/setInfoWindowOffset()

Examples: