Class adf.MapTip
Defined in: MapTip.js.
Constructor Attributes | Constructor Name and Description |
---|---|
adf.MapTip(params)
Contains the logic for displaying server side web results as graphical features drawn in the browser by using an
adf.graphics.Element.
|
Field Attributes | Field Name and Description |
---|---|
When set to true, the callout is always in its expanded state when the user clicks or hovers on a feature
|
Method Attributes | Method Name and Description |
---|---|
returns an array of objects with feature's id and visibility properties.
|
|
Highlights a given results based on its unique id.
|
|
init(mapId)
Intializes an instance of adf.MapTip.
|
|
Checks to see if events handling on client features is enabled.
|
|
setEventsEnabled(bool)
Toggles event handling on map tip features on or off.
|
|
showCallOut(id, x, y)
Shows a map tip feature in callOut at given screen coordinate
|
|
toggleFeatures(ids, show)
Toggles the display of a group of features.
|
|
toggleFeaturesByLevel(ids, show, level)
Toggles the display of a group of features at given result level.
|
|
transform(attributeList, template)
Applies the given template to an attribute list.
|
|
Returns the graphics to their normal visual state after being highlighted by adf.MapTip#highlightFeaturesById.
|
|
updateMapTips(reloadCache, extent)
Asynchronous operation to retrieve the latest map tip features from the server
|
Event Attributes | Event Name and Description |
---|---|
onFeatureBlur(feature)
Event fired when a feature loses focus.
|
|
onFeatureFocus(feature)
Event fired when a feature gains focus, Focus will be gained when the user moves mouse from outside of a map tip feature into it.
|
|
onFeatureHighlight(feature)
Event fired when a feature is highlighted.
|
|
onFeaturesChanged(features)
Event fired when maptip features get updated by server
|
|
onFeatureUnHighlight(feature)
Event fired when a feature is un-highlighted.
|
|
onGraphicsUpdate(array)
Event fired when maptip graphics are updated
|
Class Detail
adf.MapTip(params)
Contains the logic for displaying server side web results as graphical features drawn in the browser by using an
adf.graphics.Element. Feature attributes can be displayed within the adf.Map#callOut.
- Parameters:
- {String|Object} params
- When passed as a string, it is considered to be the id of this maptip, otherwise an object literal containing initial values for any of the public fields of this maptip.
Field Detail
{Boolean}
showExpanded
When set to true, the callout is always in its expanded state when the user clicks or hovers on a feature
- Default Value:
- false
Method Detail
getFeaturesVisibility()
returns an array of objects with feature's id and visibility properties.
highlightFeaturesById(id)
Highlights a given results based on its unique id. All graphics that are of the same
result will be visually highlighted as their respective server-side layer definition
symbol properties dictate. Note: there are some limitations on the client-side graphics
API as of 10.0 , for example, dashed lines, double lines, pattern fills are not supported.
- Parameters:
- {String} id
- the web result's id
init(mapId)
Intializes an instance of adf.MapTip. This function should be called only once as it adds
various event handlers
- Parameters:
- {String} mapId
- The id of the adf.Map this maptip is bound to
{Boolean}
isEventsEnabled()
Checks to see if events handling on client features is enabled.
- Returns:
- {Boolean} true if events are enabled
setEventsEnabled(bool)
Toggles event handling on map tip features on or off. Us this when you need to temporarily disable map tips from
showing the maps callout.
- Parameters:
- {Boolean} bool
- Turns on or off, event handling on map tip features
showCallOut(id, x, y)
Shows a map tip feature in callOut at given screen coordinate
- Parameters:
- {String} id
- web result's id to be displayed in the callout
- {Number} x
- Pixel distance to left border of map's viewport
- {Number} y
- Pixel distance to top border of map's viewport
toggleFeatures(ids, show)
Toggles the display of a group of features.
var map = adf.Controls.maps['map1']; var resultList = []; resultList.push("com.esri.adf.web.data.query.QueryResult@a63aba"); map.mapTip.toggleFeatures(resultList, false);
- Parameters:
- {String[]} ids
- the list of feature ids to toggle display
- {Boolean} show
- set to true to show features, false to hide them
toggleFeaturesByLevel(ids, show, level)
Toggles the display of a group of features at given result level.
- Parameters:
- {String[]} ids
- the list of feature ids to toggle display
- {Boolean} show
- set to true to show features, false to hide them
- {Number} level
- Result level that toggling operation works on, there are 3 levels which maps to the hierarchy of check box in result panel. Level 0 is' root'. Level 1 is 'feature layer'. Level 2 is 'feature'.
{Object}
transform(attributeList, template)
Applies the given template to an attribute list. Each attribute in the list is a name-value pair.
The template could be a string 'default' or an object literal with property 'templateString'.
If template is string 'default', default tabular template is applied.
If template is an object literal, its 'templateString' property is an XML string which atmost can contain three nodes:"header", "body", "footer". Inside any node, substring which matches pattern '${attribute-name}' would be replaced with attribute's value in attrbute list. Return would be placed in adf.Map#callOut's respective sections.
var map = adf.Controls.maps['map1']; var attrList = []; attrList['name'] = "Tony"; var template = {}; template.templateString ="This man's name is ${name} "; var resultObj = map.mapTip.transform(attrList, template); console.log(resultObj.header);
- Parameters:
- {Object} attributeList
- Key-value pairs, where the key is the attribute name and the value, is the attrtibute value
- {Object| String} template
- template applied to attriute list. Use default tabular template if template is string 'default'. Use custom template defined by 'templateString' property if template is an object literal.
- Returns:
- {Object} an object literal which has three properties---'header', 'body' and 'footer'
unHighlightFeaturesById(id)
Returns the graphics to their normal visual state after being highlighted by adf.MapTip#highlightFeaturesById.
- Parameters:
- {String} id
- the web result's id
updateMapTips(reloadCache, extent)
Asynchronous operation to retrieve the latest map tip features from the server
- Parameters:
- {Boolean} reloadCache
- Optional Default: false this instance is bound to is configured to cache client features (adf.Map#cacheClientFeatures), If true, forces all map tip features in server side to be resent to client.
- extent
Event Detail
onFeatureBlur(feature)
Event fired when a feature loses focus. Focus will be lost if a user moves the mouse away from the map tip feature which has the mouse above it at the beginning.
- Parameters:
- {Object} feature
- An object literal representing a map tip feature which loses mouse focus. It has 'id', 'header', 'content', 'footer', 'symbol', 'type' and 'isCallout' properties. Value of 'id' is identical to its corresponding web result's id.
onFeatureFocus(feature)
Event fired when a feature gains focus, Focus will be gained when the user moves mouse from outside of a map tip feature into it.
- Parameters:
- {Object} feature
- An object literal representing a map tip feature which gains mouse focus. It has 'id', 'header', 'content', 'footer', 'symbol', 'type' and 'isCallout' properties. Value of 'id' is identical to its corresponding web result's id
onFeatureHighlight(feature)
Event fired when a feature is highlighted.
- Parameters:
- {Object} feature
- An object literal representing a map tip feature which is highlighted. It has 'id', 'header', 'content', 'footer', 'symbol', 'type' and 'isCallout' properties. Value of 'id' is identical to its corresponding web result's id
onFeaturesChanged(features)
Event fired when maptip features get updated by server
- Parameters:
- {Object[]} features
- a feature array
onFeatureUnHighlight(feature)
Event fired when a feature is un-highlighted.
- Parameters:
- {Object} feature
- An object literal representing a map tip feature which is unhighlighted. It has 'id', 'header', 'content', 'footer', 'symbol', 'type' and 'isCallout' properties. Value of 'id' is identical to its corresponding web result's id
onGraphicsUpdate(array)
Event fired when maptip graphics are updated
- Parameters:
- {Array} array
- Array of objects with feature's id and visibility properties