Ejemplo n.º 1
0
 private void button13_Click(object sender, EventArgs e)
 {
     RasterCut.CutArgument arg = new RasterCut.CutArgument();
     using (OpenFileDialog dlg = new OpenFileDialog())
     {
         if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             arg.OutFileName = Path.Combine(Path.GetDirectoryName(dlg.FileName), Path.GetFileNameWithoutExtension(dlg.FileName) + "_Clip_{0}");
             Cut(arg, dlg.FileName);
         }
     }
 }
Ejemplo n.º 2
0
        private void Cut(RasterCut.CutArgument arg, string fname)
        {
            IRasterCut cut = new RasterCut();

            using (IRasterDataProvider prd = GeoDataDriver.Open(fname) as IRasterDataProvider)
            {
                //
                List <RasterCut.BlockItem> items = new List <RasterCut.BlockItem>();
                int w    = 1000;
                int h    = 1000;
                int rows = prd.Height / h;
                int cols = prd.Width / w;
                for (int r = 0; r < rows; r++)
                {
                    for (int c = 0; c < cols; c++)
                    {
                        items.Add(new RasterCut.BlockItem(c * w, r * h, w, h));
                    }
                }
                arg.Items = items.ToArray();
                //
                cut.Cut(prd, arg, (pro, tip) => { Text = "正在裁切(" + pro.ToString() + "%)..."; });
            }
        }