private void 显示_Click(object sender, EventArgs e) { IStatAnalysisEngine <UInt16> stat = new StatAnalysisEngine <UInt16>(); StatResultItem[] results = stat.StatArea(_fname, "省级行政区划", x => x == 1); //IStatResultWindow window = new frm }
private void 统计行政区划_Click(object sender, EventArgs e) { //fname = @"D:\MAS_Workspace\OutputItem\SandDust\MultiValueGraph\20110615\DST_DBLV_FY3A_VIRR_1000M_DXX_P001_20110430030500.MVG"; IStatAnalysisEngine <UInt16> stat = new StatAnalysisEngine <UInt16>(); StatResultItem[] results = stat.StatArea(_fname, "省级行政区划", x => x == 1); }
private void 分级行政区划_Click(object sender, EventArgs e) { string fname = @"E:\王羽\历史数据\FOG_DBLV_FY3A_MERSI_1000M_20120614005135_20120615005135.dat"; using (IRasterDataProvider prd = GeoDataDriver.Open(fname) as IRasterDataProvider) { StatResultItem[] items = null; IStatAnalysisEngine <UInt16> exe = new StatAnalysisEngine <UInt16>(); items = exe.StatArea(prd, "分级行政区划", (v) => { return(v == 1); }); } }
public override IExtractResult Make(Action <int, string> progressTracker) { if (_argumentProvider == null || _argumentProvider.GetArg("AlgorithmName") == null) { return(null); } if (_argumentProvider.GetArg("AlgorithmName").ToString() == "FLLS") { string[] files = GetStringArray("SelectedPrimaryFiles"); if (files == null || files.Count() == 0) { return(null); } foreach (string file in files) { if (!File.Exists(file)) { return(null); } } IRasterOperator <Int16> roper = new RasterOperator <Int16>(); IInterestedRaster <Int16> timeResult = null; DataIdentify di = GetDataIdentify(); timeResult = roper.Times(files, CreatRasterIndetifyId(files, "FLD", "FLLS", di, null, null), (dstValue, srcValue) => { //泛滥水体值==4 if (srcValue == 4) { return(++dstValue); } else { return(dstValue); } }); if (timeResult != null && !string.IsNullOrEmpty(timeResult.FileName) && File.Exists(timeResult.FileName)) { //发生[1,5)次 StatResultItem[] lowResults = null; //发生[5,10)次 StatResultItem[] midResults = null; //发生十次及十次以上 StatResultItem[] highResults = null; IStatAnalysisEngine <Int16> exe = new StatAnalysisEngine <Int16>(); using (IRasterDataProvider prd = timeResult.HostDataProvider) { lowResults = exe.StatArea(prd, "省级行政区+土地利用类型", (srcValue) => { if (srcValue >= 1 && srcValue < 5) { return(true); } else { return(false); } }); if (files.Count() >= 5) { midResults = exe.StatArea(prd, "省级行政区+土地利用类型", (srcValue) => { if (srcValue >= 5 && srcValue < 10) { return(true); } else { return(false); } }); } if (files.Count() >= 10) { highResults = exe.StatArea(prd, "省级行政区+土地利用类型", (srcValue) => { if (srcValue >= 10) { return(true); } else { return(false); } }); } } List <StatResultItem> resultList = new List <StatResultItem>(); if (lowResults != null && lowResults.Count() > 0) { foreach (StatResultItem item in lowResults) { item.Name += "_1-5次"; } resultList.AddRange(lowResults); } if (midResults != null && midResults.Count() > 0) { foreach (StatResultItem item in midResults) { item.Name += "_5-10次"; } resultList.AddRange(midResults); } if (highResults != null && highResults.Count() > 0) { foreach (StatResultItem item in midResults) { item.Name += "_10次以上"; } resultList.AddRange(highResults); } FileExtractResult fileResult = null; if (resultList != null && resultList.Count() > 0) { string filename = StatResultToFile(files, resultList.ToArray(), "FLD", "FLLS", "水情泛滥历时面积", null); fileResult = new FileExtractResult("FLLS", filename); } timeResult.Dispose(); File.Delete(timeResult.FileName); return(fileResult); } return(null); } return(null); }