Sunday, 15 February 2015

javascript - Different color to noise marker using here maps -


Is it possible to apply different noise markers to different colors, while clustering using Map App ?

One is available, but it applies to all markers. I want to set a specific color to a specific point based on specific conditions.

It is definitely possible to have a custom theme H.clustering.DataPoint The definition of an object contains a data () that can hold arbitrary data.

When you prepare your dataset you can add it is shown:

  var datapoint = []; Data Points Push (New H. Clustering.datapoint (lat, lng, null, {color: 'red'})); Data Points Pat (New H. Clustering.datapoint (lat, lng, null, {color: 'green'})); Datapoints.push (New H. Clustering. Datapoint (lat, lng, null, {color: 'blue'})); // etc ...  

If you use a custom theme, you can read the data from the noise point and display it as visible:

  function color clusteringTheme () {var baseTheme = new H. Clustering Default theme (); This.getClusterPresentation = function (cluster) {var cluster Icon = baseTheme.getClusterPresentation (cluster) .getIcon (); New HMP Marker (cluster .GetPosition ()), {icon: clusterIcon, min: cluster.getMinZoom (), Max: cluster.getMaxZoom ()}); Return; }; This.getNoisePresentation = function (noisePoint) {if (noisePoint.data.color === 'red') {// add red noise point new H.map.Marker (noisePoint.getPosition), {icon: redIcon}); } If (noisePoint.data.color === 'green') {// red marker returns new H.P. marker (Noisepoint.Gatposition (), {icon: greenIcon}); } If (noisePoint.data.color === 'blue') {// blue noise point back to new HMP Marker (Noisepoint.Gatposition), {icon: Blue Icon}); }}; };  

You can add themes to the map as normal:

  var clustrate provider = new HK. Clustering Provider (Data Points, {Clustering Options: {EPS: 16, Minweight: 5}, Theme: New Color ClusteringTheme ()}); Var Clustering Layer = New HMPLierObjectLayer (ClusterDetTextWidder); Map.addLayer (clusteringLayer);  

No comments:

Post a Comment