Exemplo n.º 1
0
        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_pInBRsLyr != null) && (m_pInARsLyr != null))
                {
                    double       dCellSize        = Convert.ToDouble(txtCellSize.Text);
                    ISurfaceOp   pRasterSurfaceOp = Utility.SetRasterSurfaceAnalysisEnv(shpDir, dCellSize);
                    double       dZFactor         = Convert.ToDouble(txtZFactor.Text);
                    object       objZFactor       = dZFactor;
                    IRaster      pInBRaster       = m_pInBRsLyr.Raster;
                    IRaster      pInARaster       = m_pInARsLyr.Raster;
                    IRaster      pOutRaster       = null;
                    IRasterLayer pRasterLayer     = new RasterLayerClass();

                    pOutRaster = pRasterSurfaceOp.CutFill(pInBRaster as IGeoDataset, pInARaster as IGeoDataset, ref objZFactor) as IRaster;

                    pRasterLayer.Name = shpFile;
                    Utility.ConvertRasterToRsDataset(shpDir, pOutRaster, shpFile);
                    pRasterLayer = Utility.SetCutFillRenderer(pOutRaster, "Value", shpDir);
                    pMainFrm.getMapControl().AddLayer(pRasterLayer, 0);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
 //填挖计算
 private void button5_Click(object sender, EventArgs e)
 {
     outGeodataset = surfaceOp.CutFill(beforeGeo, afterGeo, ref Missing);
     ShowRasterResult(outGeodataset, "CutFill");
 }