2017-04-24 87 views
0

我想隐藏特定标记点击复选框,这就是为什么我试图 添加这些标记组。但是,当我做这个iconsGroup.getObjects(); 它返回一个空数组。我究竟做错了什么 ?如何添加群集标记到群组[这里地图api]

var iconsGroup = new H.map.Group(); 
    var CUSTOM_THEME = { 
      getClusterPresentation : function (cluster) { 
       var randomDataPoint = getRandomDataPoint(cluster), 
        bubbleContent = getBubbleContent(cluster); 
        // Get a reference to data object that DataPoint holds 
       map.setCenter(cluster.getPosition()); 
        data = randomDataPoint.getData(); 
       var marker = new H.map.DomMarker(cluster.getPosition(), { 
        icon: data.icon, 
        min: cluster.getMinZoom(), 
        max: cluster.getMaxZoom() 

        }); 
       iconsGroup.addObject(marker); 
       marker.setData(bubbleContent); 
       marker.addEventListener('tap', onClusterClick); 
       return marker; 
      }, 
      getNoisePresentation : function (noisePoint) { 
       var data = noisePoint.getData(); 
       var noiseMarker = new H.map.DomMarker(noisePoint.getPosition(), { 
        icon: noisePoint.getData().icon, 
        min: noisePoint.getMinZoom() 
        }); 
       noiseMarker.setData(data); 
       noiseMarker.addEventListener('tap', onMarkerClick); 
       return noiseMarker; 
      } 
      } 


     var clusterProvider = new H.clustering.Provider(arr, { 
      clusteringOptions: { 
      minWeight: 1, 
      eps: 32 
      } 
     }); 
    clusterProvider.setTheme(CUSTOM_THEME); 
    clusteringProviderArray.push(clusterProvider); 
    var clusterLayer = new H.map.layer.ObjectLayer(clusterProvider); 
    map.addLayer(clusterLayer); 
clusteringLayerArray.push(clusterLayer); 
    groupLayers.push(iconsGroup); 

回答

0

我将只使用数组来代替组