Making a little research on that.. I've seen that there is a ticket that seems to be similar to my issue..
http://trac.osgeo.org/openlayers/ticket/1806 Could this be related? Thanks! El 28 de març de 2012 17:04, jkm <[email protected]> ha escrit: > Hi, > > I would like to know if I'm doing something wrong, or not.. > > I have a cluster strategy associated to a vector layer.. And I select and > unselect features with the "selectCtrl": > selectCtrl = new OpenLayers.Control.SelectFeature(layerTest, { > onSelect: onFeatureSelect, onUnselect: onFeatureUnselect }); > map.addControl(selectCtrl); > selectCtrl.activate(); > > When I select a feature I do: > > function onFeatureSelect(feature) { > selectedFeature = feature; > if (currentPopup) currentPopup.hide(); > if (!feature.cluster) { > if (!feature.popup) { > popup = new OpenLayers.Popup.FramedCloud("chicken", > feature.data.point, null, feature.data.info, null, true, onPopupClose); > feature.popup = popup; > } > else { popup = feature.popup; } > } > else { > var txt = 'Clustered feature'; > if (!feature.popup) { > popup = new OpenLayers.Popup.FramedCloud("chicken", > feature.cluster[0].data.point, null, txt, null, true, onPopupClose); > feature.popup = popup; > } > else { popup = feature.popup; } > } > map.addPopup(popup); > currentPopup = popup; > } > > What I pretend is to show a popup indicating the information of a single > point, or indicate that the point is a cluster of different features. > > > When I unselect a feature, I do: > > function onFeatureUnselect(feature) { > if (currentPopup) { > currentPopup.hide(); > } > if (currentPopup = feature.popup) { > map.removePopup(feature.popup); > feature.popup.destroy(); > feature.popup = null; > currentPopup = undefined; > } > } > > If the feature has an associated popup, I destroy it. > > But, if I show a popup for a feature and I zoom in or out making feature > changing (because there are more features clustered, or on the other side, > the cluster doesn't exist anymore), when I unselect the feature, I get an > error in Openlayers.js, in the unhighlight function: > "layer.drawFeature(feature,feature.style||feature.layer.style||"default");" > And this is due to the feature.layer is null... > > I don't know if i'm definig something in a bad way, or what is happening > here.. Any help will be apreciated. > > Thanks! >
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
