Openlayers event cluster feature id does not appear on layer vector feature id list

المشرف العام

Administrator
طاقم الإدارة
My application's objective is to

  1. click on a cluster and produce a popup
  2. with a list of all placemarks clustered there
  3. where every entry is a hyperlink
  4. that closes current popup
  5. and opens a new popup with data from placemark
I can execute everything EXCEPT FINDING the EVENT.FEATURE (placemark) in the layer. I can read the layer (vector) feature list, but the original clustered feature (placemark) is not among the features that compose the layer.

is the clustered feature "hidden" while its cluster is displayed? if so, how can i access it?

i am using openlayers with javascript, loosely based on the sundials example, yet with a cluster strategy.

1 is a standard cluster strategy.

var pointStyleTaxi = new OpenLayers.Style({ externalGraphic: "img/taxi.png", pointRadius: 20, graphicYOffset: -30, fillOpacity: 0.6, 'label': "${label}" }, { context: { label: function(feature) { // clustered features count or blank if feature is not a cluster return feature.cluster ? feature.cluster.length : ""; }, radius: function(feature) { return Math.min(feature.attributes.count*5, 20) + 5; } }});var styleMapClusterTaxi = new OpenLayers.StyleMap({ 'default': pointStyleTaxi,});var clusterStrategyTaxi = new OpenLayers.Strategy.Cluster({ distance: 35, threshold: 2 });var refresh = new OpenLayers.Strategy.Refresh({force: true, active: true});var stops = new OpenLayers.Layer.Vector("Paradas", { styleMap: styleMapClusterTaxi, strategies: [new OpenLayers.Strategy.Fixed(), clusterStrategyTaxi, refresh], projection: map.displayProjection, protocol: new OpenLayers.Protocol.HTTP({ url: "", format: new OpenLayers.Format.KML({ extractStyles: true, extractAttributes: true, maxDepth: 2 }) })});map.addLayers([wms, stops]);i achieve 2 by identifying that the selected feature is a cluster inside onFeatureSelect(event)

if (feature.cluster) {

and proceeding to extract the name of each clustered placemark.

for (var i = 0; i < feature.attributes.count; i++) { var feat = feature.cluster; var featId = feature.cluster.id; var featName = feat.attributes.name;3 is obtained by creating a javascript hyperlink for each clustered placemark

content += "
"+featName+"";}


after clicking on link, 4 is obtained by calling

function popupClear() { //alert('number of popups '+map.popups.length); while( map.popups.length ) { map.removePopup(map.popups[0]); }}which produces Jecabitiba

which is a javascript call to onFeatureSelectFeature('OpenLayers_Feature_Vector_58');

function onFeatureSelectFeature(featId) { var layerNow = map.getLayersByName('Paradas')[0]; var layerFeatCount = layerNow.features.length; //alert ("featId: "+featId+"\r\nlayer name:"+layerNow.name+"\r\nlayerFeatCount:"+layerFeatCount); for(var i=0; i
 
أعلى