private void GetFireAreaNum(PixelWndAccessor <int> wndVisitor, int index, Dictionary <int, PixelFeature> features, int fAreaNum, Dictionary <int, FireAreaFeature> fireAreaFeatures, IRasterDataProvider prd) { int[][] wndBuffers = new int[1][]; wndBuffers[0] = new int[9]; if (wndVisitor.ReadWndPixels(index, 3, wndBuffers)) { for (int i = 0; i < wndBuffers[0].Length; i++) { if (wndBuffers[0][i] != 0) { if (features[wndBuffers[0][i]].FireAreaNum != -1) { continue; } else { features[wndBuffers[0][i]].FireAreaNum = features[index].FireAreaNum; fireAreaFeatures[features[index].FireAreaNum] = UpdateFireAreaFeature(fireAreaFeatures[features[index].FireAreaNum], features[index], prd); GetFireAreaNum(wndVisitor, wndBuffers[0][i], features, fAreaNum, fireAreaFeatures, prd); } } } } }
internal Dictionary <int, FireAreaFeature> GetFireArea(IArgumentProvider argProvider, IPixelIndexMapper pixelMapper, Dictionary <int, PixelFeature> features) { RasterIdentify rid = new RasterIdentify(); Size size = new Size(argProvider.DataProvider.Width, argProvider.DataProvider.Height); string iir = string.Empty; using (InterestedRaster <int> result = new InterestedRaster <int>(rid, size, argProvider.DataProvider.CoordEnvelope)) { foreach (int index in pixelMapper.Indexes) { result.Put(index, index); } iir = result.FileName; } List <int> aoiIndexs = new List <int>(); foreach (int keys in features.Keys) { if (features[keys].IsVertified) { aoiIndexs.Add(features[keys].PixelIndex); } } int[] aoi = aoiIndexs.ToArray(); Rectangle aoiRect = AOIHelper.ComputeAOIRect(aoi, size); IRasterDataProvider dataProvider = GeoDataDriver.Open(iir) as IRasterDataProvider; PixelWndAccessor <int> wndVisitor = new PixelWndAccessor <int>(dataProvider); wndVisitor.Reset(new int[] { 1 }, aoiRect); int fAreaNum = -1; Dictionary <int, FireAreaFeature> fireAreaFeatures = new Dictionary <int, FireAreaFeature>(); foreach (int index in aoi) { if (features[index].FireAreaNum == -1) { fAreaNum++; features[index].FireAreaNum = fAreaNum; fireAreaFeatures.Add(fAreaNum, GetFireAreaInfo(features[index], fAreaNum, argProvider.DataProvider)); GetFireAreaNum(wndVisitor, index, features, fAreaNum, fireAreaFeatures, argProvider.DataProvider); } } return(fireAreaFeatures); }