[Users] how to zoom to the extend of selected feature?
Febin T T
febin at sblgis.com
Mon Jun 21 12:15:23 CEST 2010
yes it works fine by adding a button to my tool bar..
Thanks Pierre...
=============================================================================
editToolBar = new Ext.Toolbar({
id:'editToolBar',
items: [
{
xtype: 'tbbutton',
text: "Zoom",
handler: function() {
attribGridPanel.getSelectionModel().each(function(rec) {
var feature = rec.get("feature");
mapPanel.map.zoomToExtent(feature.geometry.getBounds());
})
}
}
]
});
On Mon, Jun 21, 2010 at 3:12 PM, Pierre Giraud <pierre.giraud at camptocamp.com
> wrote:
> Hi,
>
> You can use the following :
> feature.geometry.getBounds()
>
> http://dev.openlayers.org/releases/OpenLayers-2.7/doc/apidocs/files/OpenLayers/Geometry-js.html#OpenLayers.Geometry.getBounds
>
> Kind regards,
> Pierre
>
> On Mon, Jun 21, 2010 at 11:29 AM, Febin T T <febin at sblgis.com> wrote:
> > hi all..
> >
> > following lines contain my code to display the attribute grid of a
> > geometry...
> > how the selected feature's extend is obtained so that I can zoom the map
> up
> > to that extend?
> >
> > thanking u
> >
> > Febin
> > ===================================================================
> >
> > layerFeatureStore = new GeoExt.data.FeatureStore({
> > fields : [
> > {name: "WATER_TYPE", type: "string"},
> > {name: "CNTRY_NAME", type: "string"},
> > {name: "CONTINENT", type: "string"}
> > ],
> > layer :wfsEditableLayer,
> > addFeatureFilter: function(feature) {
> > return feature.state !== OpenLayers.State.DELETE;
> > },
> > autoload:true
> > });
> > columnModel = new Ext.grid.ColumnModel({
> > defaults: {
> > sortable: true,
> > editable:true,
> > },
> > columns: [
> > {header: "WATER_TYPE", dataIndex:
> > "WATER_TYPE",editor: new Ext.form.TextField()},
> > {header: "CNTRY_NAME", dataIndex:
> > "CNTRY_NAME",editor: new Ext.form.TextField()},
> > {header: "CONTINENT", dataIndex:
> > "CONTINENT",editor: new Ext.form.TextField()},
> > ]
> > });
> > attribGridPanel = new Ext.grid.EditorGridPanel({
> > title : "Feature Table " + layer_name,
> > region : "center",
> > viewConfig : {forceFit: true},
> > store : layerFeatureStore,
> > listeners : {
> > afteredit: function(e) {
> > var feature = e.record.get("feature");
> > if(feature.state !== OpenLayers.State.INSERT) {
> > feature.state = OpenLayers.State.UPDATE;
> > }
> > }
> > },
> > sm: new GeoExt.grid.FeatureSelectionModel({
> > selectControl: modifyControl.selectControl,
> > singleSelect: true,
> > clicksToEdit:1,
> > }),
> > cm: columnModel
> > });
> >
> > _______________________________________________
> > Users mailing list
> > Users at geoext.org
> > http://www.geoext.org/cgi-bin/mailman/listinfo/users
> >
> >
>
>
>
> --
> Pierre GIRAUD
> Géomaticien, Analyste
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 93
> Mail : pierre.giraud at camptocamp.com
> http://www.camptocamp.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100621/e6b9df65/attachment.htm
More information about the Users
mailing list