API / geotoolkit / controls / tooltip / ToolTipFormatter / ToolTipFormatter
tooltip.ToolTipFormatter.ToolTipFormatter
Helper class to evaluate Tooltip format expressions and JSON objects
Example
import {ToolTipFormatter} from '@int/geotoolkit/controls/tools/ToolTipFormatter';
const toolTipInfo = {
'name': visual.getName(),
'top': visual.getBounds().getTop(),
'bottom': visual.getBounds().getTop(),
'symbol': ToolTipFormatter.formatSymbol(textStyle || fillStyle, textStyle != null ? fillStyle : lineStyle),
'properties': properties
};
ToolTipFormatter.getDefaultInstance()
.evaluate('${symbol}${name} (${top:#.00}) - ${bottom:#.00})<br/>Description: ${properties.description}', toolTipInfo);Constructors
Methods
▸ evaluate(format, json, visual?): string
Evaluate string format with JSON object
| Name | Type | Description |
|---|---|---|
format | string | string format |
json | any | JSON object |
Optional visual | Node | optional visual |
string
▸ formatValue(value, propertyPath?, params?, visual?): string
convert property to string
| Name | Type | Description |
|---|---|---|
value | any | property value |
Optional propertyPath | string[] | property path |
Optional params | string | proberty params |
Optional visual | Node | optional visual |
string
▸ getConvertor(type): Formatter
Return converter by type, or default
| Name | Type |
|---|---|
type | string |
▸ register(type, formatter): ToolTipFormatter
Register primitive formatter, to format object or primitive value to string
| Name | Type |
|---|---|
type | string |
formatter | Formatter |
▸ Static Protected formatSymbol(fillStyle, lineStyle?, symbolClass?): string
format symbol string
| Name | Type | Description |
|---|---|---|
fillStyle | string | ColoredStyle | symbol fill style |
Optional lineStyle | string | ColoredStyle | symbol line style |
Optional symbolClass | string | symbol css class, 'circle' by default |
string
formatted symbol string like ''
▸ Static getDefaultInstance(): ToolTipFormatter
return default instance which contains converters for primitives and several utility classes