阅读:2329回复:2
[求助]用AE+c#开发一个应用程序
请问一下,如何用ae+c#实现IDW插值。如果有程序就更好了。先谢谢了!<br>
|
|
1楼#
发布于:2008-10-11 05:57
<P> public void Interpolation_IDW()<BR> {<BR> string sRelField;<BR> object dCellSize;<BR> //Change the following to run this sample<BR> sRelField = "SPOT";<BR> dCellSize = 2;<BR> string sel = Aotoolcontrol1.sel;<BR> <BR> //Get the first layer from the current focus map<BR> //IMxDocument pDoc = application.Document as IMxDocument;<BR> //map = pDoc.Maps.get_Item(0);//一个文档包含若干地图</P>
<P> ILayer pLayer = getLayerByName(m_hookHelper.FocusMap, sel);</P> <P> //Make a feature layer<BR> IFeatureLayer pFLayer = pLayer as IFeatureLayer;<BR> //Get the display table<BR> IDisplayTable pDisplayTable = pFLayer as IDisplayTable;<BR> ITable pTable = pDisplayTable.DisplayTable as ITable;<BR> //Make a relationship query table from the display table<BR> IRelQueryTable pRelQueryTable = pTable as IRelQueryTable;<BR> //Get the feature class from the relationship query table<BR> IFeatureClass pFeatClass = pFLayer.FeatureClass;<BR> //Make a feature class descriptor from the feature class<BR> IFeatureClassDescriptor pFDesc = new FeatureClassDescriptor() as IFeatureClassDescriptor;<BR> pFDesc.Create(pFeatClass, null, sRelField);<BR> //Make a new interpolator object</P> <P> IInterpolationOp pInterpolationOp = new RasterInterpolationOp() as IInterpolationOp;<BR> // the analysis environment<BR> IRasterAnalysisEnvironment pRasterAnalysisEnv = pInterpolationOp as IRasterAnalysisEnvironment;<BR> pRasterAnalysisEnv.SetCellSize(esriRasterEnvSettingEnum.esriRasterEnvValue, ref dCellSize);<BR> object snap = 0; object extendp = 0;<BR> pRasterAnalysisEnv.SetExtent(esriRasterEnvSettingEnum.esriRasterEnvMaxOf, ref extendp, ref snap);<BR> // the search radius<BR> IRasterRadius pRasterRadius = new RasterRadius() as IRasterRadius;<BR> object minc = 10;<BR> pRasterRadius.SetFixed((double)50, ref minc);<BR> //Perform the IDW<BR> object barrier = 0;<BR> IRaster pRaster = pInterpolationOp.IDW((IGeoDataset)pFDesc, (double)2, pRasterRadius, ref barrier) as IRaster;<BR> //Create a new raster layer<BR> IRasterLayer pRasterLayer = new RasterLayer() as IRasterLayer;<BR> pRasterLayer.CreateFromRaster(pRaster);</P> <P> //Add the layer to the current focus map<BR> m_hookHelper.FocusMap.AddLayer((ILayer)pRasterLayer);<BR> m_hookHelper.ActiveView.Refresh();<BR> }<BR></P> |
|
2楼#
发布于:2008-11-12 16:15
<P>真的有高人啊,不服不行的</P>
|
|