private void btnGO_Click(object sender, EventArgs e) { string fileName; string shpFile; int startX, endX; string shpDir; try { if (bDataPath == true) { fileName = txtOutPath.Text; shpDir = fileName.Substring(0, fileName.LastIndexOf("\\")); startX = fileName.LastIndexOf("\\"); endX = fileName.Length; shpFile = fileName.Substring(startX + 1, endX - startX - 1); } else { shpDir = txtOutPath.Text; shpFile = "·½ÏòÕ¤¸ñ"; } if (m_pRasterLyr != null) { double dCellSize = Convert.ToDouble(txtCellSize.Text); ISurfaceOp pRasterSurfaceOp = Utility.SetRasterSurfaceAnalysisEnv(shpDir, dCellSize); ¡¡ IRaster pInRaster = m_pRasterLyr.Raster; IRaster pOutRaster = null; IRasterLayer pRasterLayer = new RasterLayerClass(); ¡¡ pOutRaster = pRasterSurfaceOp.Aspect(pInRaster as IGeoDataset) as IRaster; pRasterLayer.Name = shpFile; Utility.ConvertRasterToRsDataset(shpDir, pOutRaster, shpFile); pRasterLayer = Utility.SetStretchRenderer(pOutRaster); pMainFrm.getMapControl().AddLayer(pRasterLayer, 0); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//坡向计算 private void button2_Click(object sender, EventArgs e) { outGeodataset = surfaceOp.Aspect(inGeodataset); ShowRasterResult(outGeodataset, "Aspect"); }