Class: HeatMap

OM.style. HeatMap


new HeatMap(config)

This class represents a heat map style. To generate a heat map from
a point set, you simply create a vector layer that contains all the point
data, then create a HeatMap style with the desired options, and set the
vector layer's rendering style to the HeatMap style.

Two types of heat maps are supported. The classical one is purely based on
the distribution or density of the data points. The attribute value weighted
heat map takes into account a specific attribute value of each point, and
derives the heat map based only on those values. To get the heat map based on
attribute values, you must specify a 'styleAttribute' property on the
VectorLayer instance.

Parameters:
Name Type Description
config Object

A configuration object for the HeatMap style which has the following attributes:


  • styleName {String} The style's name

  • colorStops {Array} An array specifying the color stops. Each array entry is a (color) string specified as "#rrggbb"

  • spotlightRadius {float} The spotlight radius. This specifies how far an event or record
    will cast its 'influence' or contribute to the heat of its nearby area.
    The influence of any given event is at maximum at where it is located,
    and decreases as you move away from the event location. It will have no
    influence beyond the spotlight radius.

  • lengthUnit {String} The unit of the spotlightRadius, such as "pixel", "meter", "kilometer", "km",
    "feet" or "mile". Default value is "pixel"

  • opacity {float} The opacity. A global opacity value of the generated heat map.
    Must be between 0 and 1. Default value is 1 (fully opaque); 0 means completely transparent.

  • containerVectorLayer {OM.layer.VectorLayer} A vector layer that defines the boundary of the heat map. Optional.
  • maxValue {float} max value. Optional. When specified, it will be used if the vector layer also has a style attribute
    specified, as the heat map will be generated based on an attribute value weighted algorithm. If maxValue
    is not specified and the heat map is based on attribute values, then the maxValue will be
    obtained automatically from the data set.
    For non attribute value weighted (classical) heat map, you should NOT set the maxValue or minValue.
  • minValue {float} min value. Optional. See notes about maxValue for its usage.

  • sampleFactor {float} The factor by which the internal computation grid
    will be scaled down from the actual map window size. Default is 2.
    Setting to 1 will cause no scaling, but will require the most browser
    memory and most CPU time; setting to a larger number will
    result in less memory usage but a less smooth-looking heat map.
  • isTop {Boolean} If true, the heat map layer will display on top of other vector layers.
    If false, it will display on the bottom of other vector layers. By default,
    it's false.
Returns:

An instance of OM.style.HeatMap

Type
OM.style.HeatMap

Extends

Methods


bindData(attribute, column, formatter)

Binds a Column data set to a specified aspect of this style. This creates
a single binding on this style instance. Check individual sub-styles to
see how many bindings they support.
Each binding is comprised of three key pieces: the style attribute being
bound, the Column data set that drives the style attribute, and a resolver
function that computes and returns an effective style attribute for any
given data value from the Column.

Parameters:
Name Type Description
attribute string

the name of the style attribute to be bound to a data Column. An
attribute is a visual aspect of the style, such as "Fill",
"Size" etc.

column object

A data column (typically an instance of OM.Column) that will
format the specified visual attribute of the style. If a String type
value is passed in, then it is assumed to be the name of
an property in the target VectorLayer's features.

formatter object

an instance of OM.style.Formatter; it
maps an individual item's value (such as sales volume) to a
particular visual style attribute value (such as a color).

Inherited From:

draw(feature, mapContext, options)

The actual logic for drawing a feature using a style is implemented in this method.
Must be overidden by sub-classes.

Parameters:
Name Type Description
feature OM.Feature

the feature to be applied with this style

mapContext OM.MapContext

the current map context

options Object

the rendering options, typically the graphics group

Inherited From:
Returns:
Type
undefined

getBindables()

Returns a list of bindable style attributes. A bindable attribute is
a certain aspect of a style (such as its fill color, stroke width or
overall size) that can be changed based on some business data value
associated with each feature. It is typically bound to a Column data
set.

Inherited From:
Overrides:
Returns:

an array containing names of bindable attributes; if
no bindable attribute exists then an empty array is
returned.

Type
Array

getConfig()

Gets the config of style.

Inherited From:
Returns:

the config object


getDataValueFromBinding(feature)

Resolves a feature against a heat map binding attribute and returns the
associated data value for the given feature from the attribute.

Parameters:
Name Type Description
feature Object

the feature to be used for resolving data value

Returns:

the resolved style attribute value

Type
Object

getIsTop()

Returns if the heat map layer using this style will be displayed on top of other vector layers.
If true, the heat map layer will display on top of other vector layers.
If false, it will display on the bottom of other vector layers.

Returns:

ordering flag

Type
Boolean

getStyleName()

Return the style name

Inherited From:
Returns:

the style name


hasBinding()

Checks if this style has associated data bindings.

Inherited From:
Returns:

true if there is one or more data bindings; false otherwise

Type
Boolean

isBindable(attr)

Checks whether a specified style attribute is bindable.

Parameters:
Name Type Description
attr String

the name of the attribute to be checked

Inherited From:
Returns:

true if the argument is bindable; false otherwise

Type
Boolean

isBound()

Checks whether a specified (bindable) attribute is already bound to some
Column data set.

Inherited From:

isFeatureBound(feature)

Checks whether the given feature is bound to any of the bindings in
this style.

Parameters:
Name Type Description
feature OM.Feature

the feature instance to be checked

Inherited From:
Returns:

returns true if the feature has associated values from
any of the style bindings' Column instances. Returns false if there
is no values associated with this feature, or there is no bindings
at all in this style.

Type
Boolean

resolveBinding(b, feature)

Resolves a specified binding for a given feature.
When a Style object has one or more of its visual attributes (such as Size
for a Marker style or Fill for a Color style) bound to an external data
column, then such visual attributes must be resolved for each and every feature
using the feature's associated data column value. The resolved visual
attribute values are then used to apply the style to that feature.

In other words, each time this method is called against a specific feature,
the following process always takes place:


  • the feature's unique id is obtained
  • the id is then used by the binding to find the corresponding data
    value from the associated Column instance
  • the data value is used to determine or resolve the visual attribute
    of this style such as Size or Fill color.
  • the visual attribute value is set on this Style instance for the
    duration of rendering the feature.

Parameters:
Name Type Description
b Object

the binding object

feature Object

the feature to be resolved with

Inherited From:
Returns:

the resolved style attribute

Type
Object

setIsTop(ordering)

Sets if the heat map layer using this style will be displayed on top of other vector layers.
If true, the heat map layer will display on top of other vector layers.
If false, it will display on the bottom of other vector layers.

Parameters:
Name Type Description
ordering Boolean

flag


unbindAllData(attribute)

Un-binds all Column data sets currently bound to the specified style attribute.

Parameters:
Name Type Description
attribute String

the name of the style attribute

Inherited From:

unbindData(attribute)

Un-binds all Column data set for the given attribute.

Parameters:
Name Type Description
attribute String

name of the style attribute (such as 'Fill', 'Size'

Inherited From: