new Tooltip(options)
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Extend Popup options Properties
|
Extends
Methods
-
addPopupClass(c)
-
Add a CSS class to the popup.
Parameters:
Name Type Description c
string class name.
- Inherited From:
- Overrides:
-
formatArea(area)
-
Format area to display in the popup. Can be overwritten to display measure in a different unit (default: square-metter).
Parameters:
Name Type Description area
number area in m2
Returns:
the formated area
- Type
- string
-
formatLength(length)
-
Format area to display in the popup Can be overwritten to display measure in different unit (default: meter).
Parameters:
Name Type Description length
number length in m
Returns:
the formated length
- Type
- string
-
getHTML(feature, info)
-
Get the information to show in the tooltip The area/length will be added if a feature is attached.
Parameters:
Name Type Description feature
ol.Feature | undefined the feature
info
string the info string
-
getVisible()
-
Check if popup is visible
- Inherited From:
- Overrides:
Returns:
- Type
- boolean
-
hide()
-
Hide the popup
- Inherited From:
- Overrides:
-
removeFeature()
-
Remove the current featue attached to the tip Similar to setFeature() with no argument
-
removePopupClass(c)
-
Remove a CSS class to the popup.
Parameters:
Name Type Description c
string class name.
- Inherited From:
- Overrides:
-
setClosebox(b)
-
Set a close box to the popup.
Parameters:
Name Type Description b
bool - Inherited From:
- Overrides:
-
setFeature(feature)
-
Set a feature associated with the tooltips, measure info on the feature will be added in the tooltip
Parameters:
Name Type Description feature
ol.Feature | ol.Event an ol.Feature or an event (object) with a feature property
-
setInfo(what)
-
Set the Tooltip info If information is not null it will be set with a delay, thus watever the information is inserted, the significant information will be set. ie. ttip.setInformation('ok'); ttip.setInformation(null); will set 'ok' ttip.set('info','ok'); ttip.set('info', null); will set null
Parameters:
Name Type Description what
string The information to display in the tooltip, default remove information
-
setMap(map)
-
Set the map instance the control is associated with and add its controls associated to this map.
Parameters:
Name Type Description map
_ol_Map_ The map instance.
-
setPopupClass(c)
-
Set the CSS class of the popup.
Parameters:
Name Type Description c
string class name.
- Inherited From:
- Overrides:
-
setPositioning(pos)
-
Set positionning of the popup
Parameters:
Name Type Description pos
ol.OverlayPositioning | string | undefined an ol.OverlayPositioning or 'auto' to var the popup choose the best position
- Inherited From:
- Overrides:
-
show(coordinate, html)
-
Set the position and the content of the popup.
Parameters:
Name Type Description coordinate
ol.Coordinate | string the coordinate of the popup or the HTML content.
html
string | undefined the HTML content (undefined = previous content).
- Inherited From:
- Overrides:
Example
var popup = new ol.Overlay.Popup(); // Show popup popup.show([166000, 5992000], "Hello world!"); // Move popup at coord with the same info popup.show([167000, 5990000]); // set new info popup.show("New informations");