private Dictionary <string, PrjEnvelope> MosaicRegion(FileListItem[] fli, int length, List <string> gllFiles) { Dictionary <string, PrjEnvelope> mosaicFiles = new Dictionary <string, PrjEnvelope>(); Dictionary <string, List <string> > fileArray = new Dictionary <string, List <string> >(); List <string> files = null; string dstFilename; for (int i = 0; i < length; i++) { dstFilename = Path.Combine(txtOutDir.Text + fli[i].Rid.OrbitDateTime.ToString("-yyyy-MM").Replace("-", "\\"), fli[i].Rid.ToWksFileName(".HDF")); if (!fileArray.ContainsKey(dstFilename)) { files = new List <string>(); files.Add(fli[i].FileName); fileArray.Add(dstFilename, files); } else { fileArray[dstFilename].Add(fli[i].FileName); } } string path = string.Empty; foreach (string key in fileArray.Keys) { try { path = Path.GetDirectoryName(key); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } SHdf4To5 shdf4To5 = new SHdf4To5(fileArray[key].ToArray(), key); Hdf4FileAttrs hdf4FileAttrs = UtilHdf4To5.PreConvertHdf4To5(shdf4To5); UtilHdf4To5.DoConvertHdf4To5(shdf4To5, hdf4FileAttrs, GetDstEnvelope(), GetDstResultion(), ckGLL.Checked ? SpatialReference.GetDefault() : null); if (File.Exists(key)) { mosaicFiles.Add(key, new PrjEnvelope(hdf4FileAttrs.Hdf4FileAttr.Envelope.XMin, hdf4FileAttrs.Hdf4FileAttr.Envelope.XMax, hdf4FileAttrs.Hdf4FileAttr.Envelope.YMin, hdf4FileAttrs.Hdf4FileAttr.Envelope.YMax)); } } catch (Exception ex) { AddLog(ex.Message); } } return(mosaicFiles.Count == 0 ? null : mosaicFiles); }
private Dictionary <string, PrjEnvelope> GetSrcFiles(Dictionary <string, PrjEnvelope> MosaicFiles, FileListItem[] fli) { Dictionary <string, PrjEnvelope> srcFiles = new Dictionary <string, PrjEnvelope>(); if (ckGCTPChina.Checked) { srcFiles = MosaicFiles; } else { foreach (FileListItem filename in fli) { SHdf4To5 shdf4To5 = new SHdf4To5(new string[] { filename.FileName }, filename.FileName); Hdf4FileAttrs hdf4FileAttrs = UtilHdf4To5.PreConvertHdf4To5(shdf4To5); SEnvelope envelopef4 = hdf4FileAttrs.Hdf4FileAttr.Envelope; srcFiles.Add(filename.FileName, new PrjEnvelope(envelopef4.XMin, envelopef4.XMax, envelopef4.YMin, envelopef4.YMax)); } } return(srcFiles.Count == 0 ? null : srcFiles); }