//通过读取历史判识文件获取AOI private void 能见度计算file_Click(object sender, EventArgs e) { InitExIdentify(); _exPro.SubProductIdentify = "VISY"; _sub = _pro.GetSubProductDefByIdentify("VISY"); _exAlg.Satellite = "FY3A"; _exAlg.Sensor = "VIRR"; AlgorithmDef visiAlg = _sub.GetAlgorithmDefByIdentify("Visibility"); IArgumentProvider visiArg = MonitoringThemeFactory.GetArgumentProvider(_exPro, _exAlg); IRasterDataProvider prd = GetRasterDataProviderBinaryFile(); Dictionary <string, object> args = new Dictionary <string, object>(); IArgumentProvider argPrd = new ArgumentProvider(prd, args); RasterPixelsVisitor <UInt16> raster = new RasterPixelsVisitor <UInt16>(argPrd); List <int> idxs = new List <int>(); raster.VisitPixel(new int[] { 1 }, (index, value) => { if (value[0] != 0) { idxs.Add(index); } }); visiArg.DataProvider = GetRasterDataProviderVIRR(); visiArg.AOI = idxs.ToArray(); visiArg.SetArg("Visibility", visiAlg); SubProductRasterDst subraster = new SubProductRasterDst(_sub); IPixelFeatureMapper <UInt16> rasterResult = subraster.Make(null) as IPixelFeatureMapper <UInt16>; // RasterIdentify id = new RasterIdentify(); id.ThemeIdentify = "CMA"; id.ProductIdentify = "SAND"; id.SubProductIdentify = "VISIBILITY"; id.Satellite = "FY3A"; id.Sensor = "VIRRX"; id.Resolution = "1000M"; id.OrbitDateTime = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0)); id.GenerateDateTime = DateTime.Now; IInterestedRaster <UInt16> iir = new InterestedRaster <UInt16>(id, new Size(prd.Width, prd.Height), prd.CoordEnvelope.Clone()); iir.Put(rasterResult); iir.Dispose(); MessageBox.Show("能见度计算完成!"); }
//通过实时判识结果获取AOI private void 能见度计算_Click(object sender, EventArgs e) { InitExIdentify(); _exAlg.CustomIdentify = "陆地"; _exAlg.Satellite = "FY3A"; _exAlg.Sensor = "VIRR"; AlgorithmDef alg = _sub.GetAlgorithmDefByIdentify("FY3Land"); IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(_exPro, _exAlg); IRasterDataProvider prd = GetRasterDataProviderVIRR(); arg.DataProvider = prd; arg.AOI = GetAOI(prd, true); arg.SetArg("FY3Land", alg); SubProductBinaryDst bin = new SubProductBinaryDst(_sub); IPixelIndexMapper result = bin.Make(null) as IPixelIndexMapper; int[] indxs = result.Indexes.ToArray(); _exPro.SubProductIdentify = "VISY"; _sub = _pro.GetSubProductDefByIdentify("VISY"); _exAlg.CustomIdentify = null; AlgorithmDef visiAlg = _sub.GetAlgorithmDefByIdentify("Visibility"); IArgumentProvider visiArg = MonitoringThemeFactory.GetArgumentProvider(_exPro, _exAlg); visiArg.DataProvider = prd; visiArg.AOI = indxs; visiArg.SetArg("Visibility", visiAlg); SubProductRasterDst raster = new SubProductRasterDst(_sub); IPixelFeatureMapper <UInt16> rasterResult = raster.Make(null) as IPixelFeatureMapper <UInt16>; // RasterIdentify id = new RasterIdentify(); id.ThemeIdentify = "CMA"; id.ProductIdentify = "SAND"; id.SubProductIdentify = "VISIBILITY"; id.Satellite = "FY3A"; id.Sensor = "VIRRX"; id.Resolution = "1000M"; id.OrbitDateTime = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0)); id.GenerateDateTime = DateTime.Now; IInterestedRaster <UInt16> iir = new InterestedRaster <UInt16>(id, new Size(prd.Width, prd.Height), prd.CoordEnvelope.Clone()); iir.Put(rasterResult); iir.Dispose(); MessageBox.Show("能见度计算完成!"); }