private IInterestedRaster <T> CreateDstRaster(IRasterDataProvider baseRaster, CoordEnvelope dstEnvelope, RasterIdentify rasterIdentify, Size dstSize) { ////修改不同区域生成结果文件大小不足问题 by chennan 20120806 //IInterestedRaster<T> dst = new InterestedRaster<T>(rasterIdentify, new Size(baseRaster.Width, baseRaster.Height), dstEnvelope, baseRaster.SpatialRef); IInterestedRaster <T> dst = new InterestedRaster <T>(rasterIdentify, new Size(dstSize.Width, dstSize.Height), dstEnvelope, baseRaster.SpatialRef); return(dst); }
public IExtractResult CompareAnalysisByPixel <T1, T>(string productName, string productIdentify, string extInfos, Func <T1, T1, T> function) { string[] files = GetStringArray("SelectedPrimaryFiles"); if (files == null || files.Length == 0 || files.Length == 1) { return(null); } //文件列表排序 string[] dstFiles = SortFileName(files); string outFileIdentify = GetStringArugment("OutFileIdentify"); object obj = _argumentProvider.GetArg("ThemeGraphyGenerator"); if (obj == null) { return(null); } IThemeGraphGenerator tgg = obj as IThemeGraphGenerator; if (tgg == null) { return(null); } string templatName = GetStringArugment("ThemeGraphTemplateName"); string colorTabelName = GetColorTableName("colortablename"); ExtractResultArray results = new ExtractResultArray(productIdentify + "_COMP"); for (int i = 0; i < dstFiles.Length - 1; i++) { //生成专题图 IPixelFeatureMapper <T> rasterResult = MakeCompareRaster <T1, T>(productIdentify, dstFiles[i], dstFiles[i + 1], function); string aoiTemplateName = string.Empty; Dictionary <string, int[]> aoi = null; GetAOI(out aoiTemplateName, out aoi); if (rasterResult == null) { continue; } RasterIdentify rid = new RasterIdentify(dstFiles[i]); IInterestedRaster <T> iir = new InterestedRaster <T>(rid, rasterResult.Size, rasterResult.CoordEnvelope, rasterResult.SpatialRef); iir.Put(rasterResult); iir.Dispose(); string resultFilename = tgg.Generate(iir.FileName, templatName, MasicAOI(aoi, ref extInfos), extInfos, outFileIdentify, colorTabelName); if (string.IsNullOrEmpty(resultFilename)) { return(null); } FileExtractResult result = new FileExtractResult(outFileIdentify, resultFilename); if (result != null) { results.Add(result); } } return(results); }
unsafe private IRasterDataProvider GetSubPrd <T>(IRasterDataProvider dstPrd, IRasterDataProvider rst, RasterIdentify rasterIdentify, int offsetX, int offsetY) { string ExtInfos = rasterIdentify.ExtInfos; rasterIdentify.ExtInfos = DateTime.Now.ToString("HHmmss"); IInterestedRaster <T> dst = new InterestedRaster <T>(rasterIdentify, new Size(rst.Width, rst.Height), rst.CoordEnvelope, rst.SpatialRef); switch (dstPrd.DataType) { case enumDataType.Int16: Int16[] dataBlock = new Int16[rst.Width * rst.Height]; fixed(Int16 *buffer = dataBlock) { IntPtr ptr = new IntPtr(buffer); dstPrd.Read(offsetX, offsetY, rst.Width, rst.Height, ptr, dstPrd.DataType, rst.Width, rst.Height, 1, new int[] { 1 }, enumInterleave.BSQ); IRasterBand bp = dst.HostDataProvider.GetRasterBand(1); bp.Write(0, 0, rst.Width, rst.Height, ptr, enumDataType.Int16, rst.Width, rst.Height); } break; case enumDataType.UInt16: UInt16[] dataBlockUint = new UInt16[rst.Width * rst.Height]; fixed(UInt16 *buffer = dataBlockUint) { IntPtr ptr = new IntPtr(buffer); dstPrd.Read(offsetX, offsetY, rst.Width, rst.Height, ptr, dstPrd.DataType, rst.Width, rst.Height, 1, new int[] { 1 }, enumInterleave.BSQ); IRasterBand bp = dst.HostDataProvider.GetRasterBand(1); bp.Write(0, 0, rst.Width, rst.Height, ptr, enumDataType.UInt16, rst.Width, rst.Height); } break; } rasterIdentify.ExtInfos = ExtInfos; return(dst.HostDataProvider); }