Beispiel #1
0
        /// <summary>
        /// 栅格传输
        /// </summary>
        /// <param name="task"></param>
        public static void CopyRaster(TransferTask task)
        {
            RasterReadHelper inputReadHelper            = new RasterReadHelper(task.SourceFileName);
            RasterReadHelper outputReadHelper           = new RasterReadHelper(task.DestFileName);
            string           outputNameWithoutExtention = string.Empty;

            if (task.RenameMode.Equals(RenameMode.Overwrite))
            {
                outputReadHelper.Delete(outputReadHelper.NameWithoutExtension + outputReadHelper.Extension);
                outputNameWithoutExtention = outputReadHelper.NameWithoutExtension;
            }
            else
            {
                outputNameWithoutExtention = inputReadHelper.AccumulativeName;
            }

            ESRI.ArcGIS.DataManagementTools.CopyRaster CpyRst = new ESRI.ArcGIS.DataManagementTools.CopyRaster(task.SourceFileName, outputReadHelper.Directory + "\\" + outputNameWithoutExtention);
            Geoprocessor gp = new Geoprocessor();

            gp.SetEnvironmentValue("Compression", inputReadHelper.RstDs.CompressionType);
            gp.OverwriteOutput = true;
            IGeoProcessorResult gpResult = gp.Execute(CpyRst, null) as IGeoProcessorResult;

            if (gpResult == null || gpResult.Status == esriJobStatus.esriJobFailed)
            {
                for (int i = 0; i < gpResult.MessageCount; i++)
                {
                    MessageBox.Show(gpResult.GetMessage(i));
                }
            }
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            RasterReadHelper featReadHelper = new RasterReadHelper(@"E:\Desktop(2014.10.10)\Test\BMP.jpg");

            featReadHelper.Delete("BMP.bmp");
        }