private void GetSatellite(RasterIdentifyForClip rid) { if (string.IsNullOrEmpty(rid.Satellite) || string.IsNullOrEmpty(Satellite) || rid.Satellite.ToLower() != Satellite.ToLower()) { Satellite = "MULT"; } }
private void GetSensor(RasterIdentifyForClip rid) { if (string.IsNullOrEmpty(rid.Sensor) || string.IsNullOrEmpty(Sensor) || rid.Sensor.ToLower() != Sensor.ToLower()) { Sensor = "MULT"; } }
public Dictionary <DateTime, string> SortByOrbitDate(string[] files) { if (files == null || files.Length == 0) { return(null); } Dictionary <DateTime, string> result = new Dictionary <DateTime, string>(); if (files.Length == 1) { CreateRasterIdentify(files[0]); result.Add(OrbitDateTime, files[0]); } else { RasterIdentifyForClip rid = null; CreateRasterIdentify(files[0]); foreach (string file in files) { rid = new RasterIdentifyForClip(file); GetOrbitDateTime(rid); result.Add(rid.OrbitDateTime, file); } } return(result.Count == 0 ? null : result.OrderBy(o => o.Key).ToDictionary(o => o.Key, v => v.Value)); }
public RasterIdentifyForClip(string[] files) { if (files == null || files.Length == 0) { return; } if (files.Length == 1) { CreateRasterIdentify(files[0]); } else { RasterIdentifyForClip rid = null; CreateRasterIdentify(files[0]); foreach (string file in files) { rid = new RasterIdentifyForClip(file); GetOrbitDateTime(rid); GetSatellite(rid); GetSensor(rid); TryGetRegionIdentify(rid); } GetMinMaxTime(); } }
public static string GetBlockFilename(BlockDef blockItem, string filename, string outdir, string driver) { RasterIdentifyForClip rid = new RasterIdentifyForClip(filename); string exts = string.Empty; if (IsAngleFile(filename)) { exts = filename.Substring(filename.IndexOf('.')); } else { exts = GetExtByDriver(driver); } rid.RegionIdentify = blockItem.Name; string outFilename = Path.Combine(outdir, rid.ToWksFileName(exts)); if (!File.Exists(outFilename)) { return(outFilename); } else { while (File.Exists(outFilename)) { outFilename = Path.Combine(outdir, UpdateFilename(outFilename, blockItem.Name, rid)); } } return(outFilename); }
private void TryGetRegionIdentify(RasterIdentifyForClip rid) { if (string.IsNullOrEmpty(rid.RegionIdentify) && string.IsNullOrEmpty(RegionIdentify)) { _regionIdentify = ""; } else if ((string.IsNullOrEmpty(rid.RegionIdentify) || string.IsNullOrEmpty(RegionIdentify)) || (rid.RegionIdentify.ToUpper() != RegionIdentify.ToUpper())) { _regionIdentify = "MULT"; } }
private static string UpdateFilename(string outFilename, string srcRegion, RasterIdentifyForClip rid) { string regexStr = "_" + srcRegion + @"(?<num>\d+)_"; Match m = Regex.Match(outFilename, regexStr); if (m.Success) { string num = m.Groups["num"].Value; int numtemp = int.Parse(num) + 1; string newNUM = srcRegion + numtemp; return(outFilename.Replace(srcRegion + num, newNUM)); } else { rid.RegionIdentify += "1"; return(Path.Combine(Path.GetDirectoryName(outFilename), rid.ToWksFileName(Path.GetExtension(outFilename)))); } }
private void GetOrbitDateTime(RasterIdentifyForClip rid) { if (_obritTimes == null) { _obritTimes = new List <DateTime>(); } _obritTimes.Add(rid.OrbitDateTime); if (rid.OrbitDateTime.ToString("yyyMMdd") == OrbitDateTime.ToString("yyyyMMdd")) { return; } else if (rid.OrbitDateTime.ToString("yyyyMM") == OrbitDateTime.ToString("yyyyMM")) { OrbitDateTime = DateTime.Parse(rid.OrbitDateTime.ToString("yyyy-MM") + "-01"); } else if (rid.OrbitDateTime.ToString("yyyy") == OrbitDateTime.ToString("yyyy")) { OrbitDateTime = DateTime.Parse(rid.OrbitDateTime.ToString("yyyy") + "-01-01"); } }