[Users] how to zoom to the extend of selected feature?

Pierre Giraud pierre.giraud at camptocamp.com
Mon Jun 21 11:42:41 CEST 2010


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


More information about the Users mailing list