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_pRasterLyr != null)
                {
                    double       dCellSize        = Convert.ToDouble(txtCellSize.Text);
                    double       dAzimuth         = Convert.ToDouble(txtAzimuth.Text);
                    double       dAltitude        = Convert.ToDouble(txtAltitude.Text);
                    bool         bModel           = chkModelShadow.Checked;
                    double       dZFactor         = Convert.ToDouble(txtZFactor.Text);
                    object       objZFactor       = dZFactor;
                    ISurfaceOp   pRasterSurfaceOp = Utility.SetRasterSurfaceAnalysisEnv(shpDir, dCellSize);
                    IRaster      pInRaster        = m_pRasterLyr.Raster;
                    IRaster      pOutRaster       = null;
                    IRasterLayer pRasterLayer     = new RasterLayerClass();

                    pOutRaster = pRasterSurfaceOp.HillShade(pInRaster as IGeoDataset, dAzimuth, dAltitude, bModel, ref objZFactor) 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);
            }
        }
Exemplo n.º 2
0
 //山体阴影计算
 private void button6_Click(object sender, EventArgs e)
 {
     outGeodataset = surfaceOp.HillShade(inGeodataset, azimuth, altitude, true, ref Missing);
     ShowRasterResult(outGeodataset, "HillShade");
 }