[Users] Zoom to Multiselect
Alexandre Dube
adube at mapgears.com
Tue Oct 26 17:14:15 CEST 2010
Hi,
You could try something like that (untested) :
wea_attribgridPanel.on('rowdblclick', function(){
var totalBounds;
wea_attribgridPanel.getSelectionModel().each(function(rec){
var feature = rec.get("feature");
if (totalBounds) {
totalBounds.extend(feature.geometry.getBounds());
} else {
totalBounds = feature.geometry.getBounds();
}
})
if (totalBounds) {
wea_mapPanel.map.zoomToExtent(totalBounds);
}
});
That means : on a row double click, get each record and the according
feature bounds. Get the bounds of all these features all together and
zoom to it.
Hope this helps,
Alexandre
On 10-10-26 10:54 AM, Robert Buckley wrote:
> Thanks for the response.
>
> I wanted to zoom into the total bounding box of the selected features in a grid.
> This is my code which works for one selected feature in a grid, if I select more
> than one in the grid only the bounding box of first
>
> feature is zoomed on...
>
> bbar: [{
> text: "an Auswahl heranzoomen",
> handler: function(){
> wea_attribgridPanel.getSelectionModel().each(function(rec){
> var feature = rec.get("feature");
> wea_mapPanel.map.zoomToExtent(feature.geometry.getBounds());
> })
> }
> },toolbarItems]
> });
> // 2 x Click in grid
> wea_attribgridPanel.on('rowdblclick', function(){
> wea_attribgridPanel.getSelectionModel().each(function(rec){
> var feature = rec.get("feature");
>
> wea_mapPanel.map.setCenter(feature.geometry.getBounds().getCenterLonLat(), 15);
> })
> });
>
>
> Thanks for any pointers...
>
>
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
--
Alexandre Dubé
Mapgears
www.mapgears.com
More information about the Users
mailing list