public StatDimClass(enumStatDimType dimType, enumStatCompoundType compoundType, enumStatDayMosaicType dayMosaicType) { DimType = dimType; CompoundType = compoundType; DayMosaicType = dayMosaicType; }
public Dictionary <string, Dictionary <string, StatInfoBase[]> > GetStatInfo(SubProductDef subProductDef, IArgumentProvider argProvider, Action <int, string> progressTracker) { _subProductDef = subProductDef; _argumentProvider = argProvider; if (argProvider == null) { return(null); } string[] filenames = GetStringArray("SelectedPrimaryFiles"); if (filenames == null || filenames.Length == 0) { return(null); } StatDimClass dimClass = argProvider.GetArg("StatDim") == null ? null : argProvider.GetArg("StatDim") as StatDimClass; if (dimClass == null) { return(null); } enumStatDimType dimType = dimClass.DimType; enumStatDayMosaicType dayMosaicType = dimClass.DayMosaicType; Dictionary <string, Dictionary <string, StatInfoBase[]> > result = new Dictionary <string, Dictionary <string, StatInfoBase[]> >(); RasterIdentify rid = null; StatInfoBase statInfo = null; string key = string.Empty; if (progressTracker != null) { progressTracker.Invoke(10, "开始进行长序列面积统计,请稍后..."); } float interval = (80f / filenames.Length); int fileIndex = 0; foreach (string file in filenames) { if (progressTracker != null) { progressTracker.Invoke((int)(++fileIndex * interval) + 10, "开始进行第[" + fileIndex + "]个文件面积统计,请稍后..."); } if (string.IsNullOrEmpty(file) || !File.Exists(file)) { continue; } rid = new RasterIdentify(file); if (rid == null) { continue; } statInfo = new StatInfoBase(rid.OrbitDateTime.ToString("yyyyMMddHHmmss"), file); switch (dimType) { case enumStatDimType.区分: key = "不区分"; break; case enumStatDimType.年: key = rid.OrbitDateTime.ToString("yyyy年"); break; case enumStatDimType.季: key = GetSeason(rid.OrbitDateTime.ToString("yyyy年"), rid.OrbitDateTime.Month); break; case enumStatDimType.月: key = rid.OrbitDateTime.ToString("yyyy年MM月"); break; case enumStatDimType.旬: key = GetTenDays(rid.OrbitDateTime.ToString("yyyy年MM月"), rid.OrbitDateTime.Day); break; case enumStatDimType.日: key = rid.OrbitDateTime.ToString("yyyy年MM月dd日"); break; default: break; } if (string.IsNullOrEmpty(key)) { continue; } if (!result.ContainsKey(key)) { Dictionary <string, StatInfoBase[]> tempInfo = GetDayInfo(file, rid.OrbitDateTime.ToString("yyyyMMdd"), new Dictionary <string, StatInfoBase[]>(), ref statInfo, argProvider, progressTracker); if (tempInfo != null && tempInfo.Count != 0) { result.Add(key, tempInfo); } } else { Dictionary <string, StatInfoBase[]> tempInfo = GetDayInfo(file, rid.OrbitDateTime.ToString("yyyyMMdd"), result[key], ref statInfo, argProvider, progressTracker); if (tempInfo != null && tempInfo.Count != 0) { result[key] = tempInfo; } } } return(result.Count == 0 ? null : result); }