public void Cut(IRasterDataProvider dataProvider, RasterCut.CutArgument args, Action <int, string> progressTracker) { CheckArgIsOK(dataProvider, args); IRasterDataProvider dstDataProvider = null; int count = args.Items.Length; float step = 100 / (float)count; float crtStep = 0; foreach (RasterCut.BlockItem item in args.Items) { if (progressTracker != null) { progressTracker((int)crtStep, null); } using (dstDataProvider = CreateDstDataProvider(dataProvider, args, item)) { Cut(dataProvider, dstDataProvider, args, item, progressTracker); } crtStep += step; } if (progressTracker != null) { progressTracker(100, null); } }
private IRasterDataProvider CreateDstDataProvider(IRasterDataProvider srcDataProvider, RasterCut.CutArgument args, RasterCut.BlockItem item) { string extName; CoordEnvelope evp = GetDstEnvelope(srcDataProvider, item); object[] options = GetOptions(srcDataProvider, args, item, out extName, evp); IRasterDataDriver drv = GeoDataDriver.GetDriverByName(args.Driver, args.DriverOptions) as IRasterDataDriver; string fname = GetOutFileName(args.OutFileName, item, extName); return(drv.Create(fname, item.Width, item.Height, args.BandNos.Length, srcDataProvider.DataType, options)); }