private void ApplyAOI(IRasterDataProvider prd, IMonitoringSubProduct subprd) { if (!subprd.Definition.IsUseAoiTemplate || prd == null) { return; } string aoistring = subprd.Definition.AoiTemplates; if (string.IsNullOrEmpty(aoistring)) { return; } string[] aoiNames = aoistring.Split(','); CoordEnvelope evp = prd.CoordEnvelope; Size size = new Size(prd.Width, prd.Height); int[] retAOI = null; foreach (string aoiName in aoiNames) { int[] aoi = AOITemplateFactory.MakeAOI(aoiName, evp.MinX, evp.MaxX, evp.MinY, evp.MaxY, size); if (retAOI == null) { retAOI = aoi; } else { retAOI = AOIHelper.Merge(new int[][] { retAOI, aoi }); } } subprd.ArgumentProvider.AOI = retAOI; }
private int[] TryGetAoiFromFeatures(int rowIndex, int rowCount) { double minLon = _fileOut[0].Raster.CoordEnvelope.MinX; double maxLon = _fileOut[0].Raster.CoordEnvelope.MaxX; double minLat = _fileOut[0].Raster.CoordEnvelope.MaxY - (rowIndex + rowCount) * _fileOut[0].Raster.ResolutionY; double maxLat = _fileOut[0].Raster.CoordEnvelope.MaxY - rowIndex * _fileOut[0].Raster.ResolutionY; Size outSize = new Size(_fileOut[0].Raster.Width, rowCount); int[] aoiIndex = AOITemplateFactory.MakeAOI(_aoiFeatures, minLon, maxLon, minLat, maxLat, outSize); return(aoiIndex); }
private int[] GetMoreTemplateAOI(double minLon, double maxLon, double minLat, double maxLat, Size outSize) { string[] templateAOIS = _aoiValue.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); List <int> aoiIndex = new List <int>(); int[] aoitemp = null; foreach (string aoi in templateAOIS) { aoitemp = AOITemplateFactory.MakeAOI(aoi, minLon, maxLon, minLat, maxLat, outSize); if (aoitemp != null) { aoiIndex.AddRange(aoitemp); } } return(aoiIndex.Count == 0 ? null : aoiIndex.ToArray()); }
private int[] TryGetAoiFromTemplate(int rowIndex, int rowCount) { double minLon = _fileOut[0].Raster.CoordEnvelope.MinX; double maxLon = _fileOut[0].Raster.CoordEnvelope.MaxX; double minLat = _fileOut[0].Raster.CoordEnvelope.MaxY - (rowIndex + rowCount) * _fileOut[0].Raster.ResolutionY; double maxLat = _fileOut[0].Raster.CoordEnvelope.MaxY - rowIndex * _fileOut[0].Raster.ResolutionY; Size outSize = new Size(_fileOut[0].Raster.Width, rowCount); int[] aoiIndex = null; if (_aoiValue.Contains(";") && _aoiValue.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Length != 1) { aoiIndex = GetMoreTemplateAOI(minLon, maxLon, minLat, maxLat, outSize); } else { aoiIndex = AOITemplateFactory.MakeAOI(_aoiValue, minLon, maxLon, minLat, maxLat, outSize); } return(aoiIndex); }