資源描述:
《選中feature并高亮顯示》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫(kù)。
1、選中feature并高亮顯示2008-07-1015:28protectedvoidcmdSelect_Click(objectsender,EventArgse)????{??????//??SelectFeatures(Map1.Extent);????????SelectFeatures();????}????publicvoidSelectFeatures()????{????????#region????????/*????????IEnumerablefunc_enum=null;????????//獲取當(dāng)前map1控件中所有的
2、functionality????????func_enum=Map1.GetFunctionalities();????????System.Data.DataTabledatatable;????????//對(duì)所有的functionality進(jìn)行遍歷????????foreach(ESRI.ArcGIS.ADF.Web.DataSources.IGISFunctionalitygisfunctionalityinfunc_enum)????????{????????????ESRI.ArcGIS.ADF.Web.DataSources.
3、IGISResourcegisresource=null;????????????//得到該functionality的resource????????????gisresource=gisfunctionality.Resource;????????????//判斷該resource是否支持IQueryFunctionality??????????????boolsupported=false;????????????supported=gisresource.SupportsFunctionality(typeof(ESRI.ArcGI
4、S.ADF.Web.DataSources.IQueryFunctionality));????????????if(supported)????????????{????????????????ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionalityqfunc;????????????????qfunc=(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality)gisresource.CreateFunctionality(typeof(ESRI
5、.ArcGIS.ADF.Web.DataSources.IQueryFunctionality),null);????????????????string[]lids;????????????????string[]lnames;????????????????//獲得圖層的layerId和layerName,GetQueryableLayers的重載方法可以指定圖層類型????????????????qfunc.GetQueryableLayers(null,outlids,outlnames);????????????????ESRI.
6、ArcGIS.ADF.Web.SpatialFilterspatialfilter=newESRI.ArcGIS.ADF.Web.SpatialFilter();????????????????//設(shè)置過(guò)濾器的過(guò)濾條件,txtQuery就是panel中textbox的ID????????????????spatialfilter.ReturnADFGeometries=false;????????????????spatialfilter.MaxRecords=1000;????????????????spatialfilter.Where
7、Clause=txtQuery.Text;????????????????spatialfilter.Geometry=geometry;????????????????//對(duì)指定的圖層進(jìn)行查詢,查詢的結(jié)果保存為DataTable????????????????datatable=qfunc.Query(null,lids[0],spatialfilter);????????????????TreeViewPlus1.Nodes.Clear();????????????????if(datatable!=null)?????????????
8、???{????????????????????System.Data.DataSetds=newSystem.Data.DataSet();??????????????????