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); }
private Dictionary <enumStatCompoundType, IStatResult> IntegrateInfo(Dictionary <string, Dictionary <string, StatInfoBase[]> > srcResult) { Dictionary <string, Dictionary <enumStatCompoundType, IStatResult> > dstResult = new Dictionary <string, Dictionary <enumStatCompoundType, IStatResult> >(); StatDimClass dimClass = _argumentProvider.GetArg("StatDim") == null ? null : _argumentProvider.GetArg("StatDim") as StatDimClass; switch (dimClass.DayMosaicType) { case enumStatDayMosaicType.面积: foreach (string dimKey in srcResult.Keys) { switch (dimClass.CompoundType) { case enumStatCompoundType.全部: GetDstResultByCompoundArea(srcResult, dstResult, dimKey, enumStatCompoundType.最大); GetDstResultByCompoundArea(srcResult, dstResult, dimKey, enumStatCompoundType.最小); break; case enumStatCompoundType.最大: GetDstResultByCompoundArea(srcResult, dstResult, dimKey, enumStatCompoundType.最大); break; case enumStatCompoundType.最小: GetDstResultByCompoundArea(srcResult, dstResult, dimKey, enumStatCompoundType.最小); break; default: break; } } break; case enumStatDayMosaicType.空间合成: break; default: break; } if (dstResult == null) { return(null); } Dictionary <enumStatCompoundType, IStatResult> resultDic = new Dictionary <enumStatCompoundType, IStatResult>(); Dictionary <enumStatCompoundType, IStatResult> tempDic = null; IStatResult tempResult = null; string proTempResult = dstResult.Keys.First(); foreach (string item in dstResult.Keys) { tempDic = dstResult[item]; foreach (enumStatCompoundType compundType in tempDic.Keys) { switch (compundType) { case enumStatCompoundType.最大: if (resultDic.ContainsKey(enumStatCompoundType.最大)) { resultDic[enumStatCompoundType.最大] = MergeResult(resultDic[enumStatCompoundType.最大], tempDic[enumStatCompoundType.最大], proTempResult, item); } else { resultDic.Add(enumStatCompoundType.最大, AddDate(tempDic[enumStatCompoundType.最大], item)); } break; case enumStatCompoundType.最小: if (resultDic.ContainsKey(enumStatCompoundType.最小)) { resultDic[enumStatCompoundType.最小] = MergeResult(resultDic[enumStatCompoundType.最小], tempDic[enumStatCompoundType.最小], proTempResult, item); } else { resultDic.Add(enumStatCompoundType.最小, AddDate(tempDic[enumStatCompoundType.最小], item)); } break; } } proTempResult = item; } if (resultDic.ContainsKey(enumStatCompoundType.最小)) { List <string> colums = new List <string>(); foreach (string item in resultDic[enumStatCompoundType.最小].Columns) { colums.Add(item.Replace("最大覆盖", "最小覆盖")); } resultDic[enumStatCompoundType.最小] = new StatResult(resultDic[enumStatCompoundType.最小].Title, colums.ToArray(), resultDic[enumStatCompoundType.最小].Rows); } return(resultDic); }