目录

HeatMap

Class Info

public class HeatMap

Modifies the HeatMap attributes. An instance of this type will be returned when the addHeatMap method in the HuaweiMap class is called.

Public Method Summary

Qualifier and Type

Method Name and Description

void

changeDataSet(String jsonData)

Modifies the heatmap dataset based on the passed GeoJSON-format string.

void

changeDataSet(Context clientContext, int resourceId)

Modifies the heatmap dataset based on the passed context and resource ID.

String

getId()

Obtains the heatmap ID.

HeatMapOptions.RadiusUnit

getRadiusUnit()

Obtains the heatmap radius unit.

void

remove()

Removes the heatmap overlay from the map.

void

setColor(Map<Float, Integer> color)

Modifies the heatmap color.

void

setIntensity(Float intensity)

Modifies the heatmap intensity for all zoom levels.

void

setIntensity(Map<Float, Float> intensity)

Modifies the heatmap intensity for specified zoom levels.

void

setOpacity(Float opacity)

Modifies the heatmap transparency for all zoom levels.

void

setOpacity(Map<Float, Float> opacity)

Modifies the heatmap transparency for specified zoom levels.

void

setRadius(Float radius)

Modifies the heatmap radius for all zoom levels.

void

setRadius(Map<Float, Float> radius)

Modifies the heatmap radius for specified zoom levels.

void

setRadiusUnit(HeatMapOptions.RadiusUnit unit)

Modifies the heatmap radius unit.

void

setVisible(boolean isVisible)

Sets whether the heatmap is visible.

[h2]changeDataSet(String jsonData)

Method

public void changeDataSet(String jsonData)

Modifies the heatmap dataset based on the passed GeoJSON-format string.

Parameters

Name

Description

jsonData

GeoJSON-format dataset.

NOTE:
  • The weight of each point on the heatmap can be set using the mag attribute in GeoJSON. If no weight is set, the default weight 1 will be used.
  • The effect of a point whose weight is 5 on the heatmap is the same as that of five points whose weights are 1.

[h2]changeDataSet(Context clientContext, int resourceId)

Method

public void changeDataSet(Context clientContext, int resourceId)

Modifies the heatmap dataset based on the passed context and resource ID.

Parameters

Name

Description

clientContext

Context.

resourceId

Resource ID of the heatmap dataset file, in GeoJSON format.

NOTE:
  • The weight of each point on the heatmap can be set using the mag attribute in GeoJSON. If no weight is set, the default weight 1 will be used.
  • The effect of a point whose weight is 5 on the heatmap is the same as that of five points whose weights are 1.

[h2]getId

Method

public String getId()

Obtains the heatmap ID.

Returns

Type

Description

String

Heatmap ID.

[h2]getRadiusUnit

Method

public HeatMapOptions.RadiusUnit getRadiusUnit()

Obtains the heatmap radius unit.

Returns

Type

Description

HeatMapOptions.RadiusUnit

Heatmap radius unit. The options are specified by RadiusUnit. The default value is PIXEL.

[h2]remove

Method

public void remove()

Removes the heatmap overlay from the map.

[h2]setColor

Method

public void setColor(Map<Float, Integer> color)

Modifies the heatmap color.

Parameters

Name

Description

color

  • Key: data density.
  • Value: heatmap color.

Default colors for different densities:

  • Density 0: #026C39
  • Density 0.15: #138C4A
  • Density 0.3: #82CB67
  • Density 0.45: #E3F399
  • Density 0.6: #FEDE89
  • Density 0.75: #F67C4A
  • Density 0.9: #BE1827
  • Density 1: #A90426

[h2]setIntensity(Float intensity)

Method

public void setIntensity(Float intensity)

Modifies the heatmap intensity for all zoom levels.

Parameters

Name

Description

intensity

Heatmap intensity. The value must be greater than 0. The default value is 1.0.

[h2]setIntensity(Map<Float, Float> intensity)

Method

public void setIntensity(Map<Float, Float> intensity)

Modifies the heatmap intensity for specified zoom levels.

Parameters

Name

Description

intensity

  • Key: specified zoom levels. If only one zoom level is specified, the intensity takes effect for all zoom levels. If multiple zoom levels are specified, the intensity takes effect only for the specified zoom levels.
  • Value: heatmap intensity. The value must be greater than 0. The default value is 1.0.

[h2]setOpacity(Float opacity)

Method

public void setOpacity(Float opacity)

Modifies the heatmap transparency for all zoom levels.

Parameters

Name

Description

opacity

Heatmap transparency. The value ranges from 0 to 1.

  • 0: fully opaque
  • 1: fully transparent

A larger value indicates a higher transparency. The default value is 0.

Throws

Name

Description

IllegalArgumentException

If the value does not range from 0 to 1.

[h2]setOpacity(Map<Float, Float> opacity)

Method

public void setOpacity(Map<Float, Float> opacity)

Modifies the heatmap transparency for specified zoom levels.

Parameters

Name

Description

opacity

  • Key: specified zoom levels. If only one zoom level is specified, the transparency takes effect for all zoom levels. If multiple zoom levels are specified, the transparency takes effect only for the specified zoom levels.
  • Value: heatmap transparency. The value ranges from 0 to 1.
    • 0: fully opaque
    • 1: fully transparent

    A larger value indicates a higher transparency. The default value is 0.

    NOTE:

    A value out of the range will be automatically corrected. That is, if the value is greater than 1, it will be changed to 1; if less than 0, it will be changed to 0.

[h2]setRadius(Float radius)

Method

public void setRadius(Float radius)

Modifies the heatmap radius for all zoom levels.

Parameters

Name

Description

radius

Heatmap radius. The unit is specified by RadiusUnit. The value must be greater than or equal to 1. The default value is 10.

[h2]setRadius(Map<Float, Float> radius)

Method

public void setRadius(Map<Float, Float> radius)

Modifies the heatmap radius for specified zoom levels.

Parameters

Name

Description

radius

  • Key: specified zoom levels. If only one zoom level is specified, the radius takes effect for all zoom levels. If multiple zoom levels are specified, the radius takes effect only for the specified zoom levels.
  • Value: heatmap radius. The unit is specified by RadiusUnit. The value must be greater than or equal to 1. The default value is 10.

[h2]setRadiusUnit

Method

public void setRadiusUnit(HeatMapOptions.RadiusUnit unit)

Modifies the heatmap radius unit.

Parameters

Name

Description

unit

Heatmap radius unit. The options are specified by RadiusUnit. The default value is PIXEL.

[h2]setVisible

Method

public void setVisible(boolean isVisible)

Sets whether the heatmap is visible.

Parameters

Name

Description

isVisible

Indicates whether the heatmap is visible.

  • true: yes
  • false: no

The default value is true.