On Wed, 2008-12-10 at 13:03 -0500, Christopher Schmidt wrote: > On Wed, Dec 10, 2008 at 06:39:16PM +0100, Didrik Pinte wrote: > > Hi, > > > > I try to have a vector layer with a Cluster and Fixed strategy > > automatically recenter after the feature are added to the layer. > > > > It works fine with the Fixed strategy only but with the Cluster, it is > > just wrong ... > > > > Does anyone of you knows if this bug could be the source of the problem > > #1820 ? > > > > I am recentering using a layer.getDataExtent(). I suppose this is the > > culprit. > > getDataExtent only works against the features currently in the layer -- > it isn'at aware of the 'subfeatures' inside the clusters.
Ok, that explains the problem but the clusters have a data extent that should approximately match the one of all the features, no ? > I use this instead: > > var e = m.layers[0].features[0].geometry.getBounds(); > for (var i = 0; i < m.layers[0].features.length; i++) { > for (var j = 0; j< m.layers[0].features[i].cluster.length; j++) { > e.extend(m.layers[0].features[i].cluster[j].geometry.getBounds()); > } > } > > This creates an extent that takes into account all the features. Good idea. This solves the problem. But considering I am using a Fixed strategy, the DataExtent does not change in time because they are all loaded from the start. I find it a bit annoying to parse the data set again checking all the features to get de data extent. Could the Fixed strategy be responsible of such a computation ? Didrik
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users