示例#1
0
        public override FilePrjSettings CreateDefaultPrjSettings()
        {
            Fy2_NOM_PrjSettings prj = new Fy2_NOM_PrjSettings();

            prj.OutFormat      = ".ldf";
            prj.OutResolutionX = 0.05f;
            prj.OutResolutionY = 0.05f;
            return(prj);
        }
示例#2
0
 public override void Project(AbstractWarpDataset srcRaster, FilePrjSettings prjSettings, SpatialReference dstSpatialRef, Action <int, string> progressCallback)
 {
     try
     {
         _setting = prjSettings as Fy2_NOM_PrjSettings;
         InitLutList(srcRaster);
         InitLocationArgs(srcRaster);
         CreateDstRaster(srcRaster, prjSettings, dstSpatialRef, progressCallback);
         WriteMetaData(srcRaster, _prdWriter, prjSettings);
         ReadySession(srcRaster, prjSettings, dstSpatialRef, progressCallback);
         base.Project(srcRaster, prjSettings, dstSpatialRef, progressCallback);
     }
     finally
     {
         EndSession();
     }
 }
示例#3
0
        private void ReadyArgs(AbstractWarpDataset srcRaster, FilePrjSettings prjSettings, SpatialReference dstSpatialRef, Action <int, string> progressCallback)
        {
            if (dstSpatialRef == null)
            {
                dstSpatialRef = _srcSpatialRef;
            }
            if (string.IsNullOrWhiteSpace(prjSettings.OutFormat))
            {
                prjSettings.OutFormat = "LDF";
            }
            if (prjSettings.OutResolutionX == 0 || prjSettings.OutResolutionY == 0)
            {
                bool isProjectSpatialRef = dstSpatialRef.IsProjected() == 1;
                if (!isProjectSpatialRef)
                {
                    prjSettings.OutResolutionX = 0.05F;
                    prjSettings.OutResolutionY = 0.05F;
                }
                else
                {
                    prjSettings.OutResolutionX = 5000F;
                    prjSettings.OutResolutionY = 5000F;
                }
            }
            if (prjSettings.OutBandNos == null || prjSettings.OutBandNos.Length == 0)
            {
                prjSettings.OutBandNos = new int[] { 1, 2, 3, 4, 5, 6 };
            }

            if (dstSpatialRef == null || dstSpatialRef.IsGeographic() == 1)
            {
                _srcImgResolution = 0.05f;
            }
            else
            {
                _srcImgResolution = 5000f;
            }

            _prjSettings = prjSettings as Fy2_NOM_PrjSettings;
            ReadExtArgs(prjSettings);
            DoSession(srcRaster, dstSpatialRef, prjSettings as Fy2_NOM_PrjSettings, progressCallback);
            _isRadRef       = _prjSettings.IsRadiation;
            _isSolarZenith  = _prjSettings.IsSolarZenith;
            _isSensorZenith = _prjSettings.IsSensorZenith;

            _outResolutionX = prjSettings.OutResolutionX;
            _outResolutionY = prjSettings.OutResolutionY;
            _dstEnvelope    = prjSettings.OutEnvelope;
            _dstBandCount   = prjSettings.OutBandNos.Length;
            _outfilename    = prjSettings.OutPathAndFileName;
            _dstSize        = prjSettings.OutEnvelope.GetSize(_outResolutionX, _outResolutionY);
            _orbitBlock     = new Block {
                xBegin = 0, yBegin = 0, xEnd = srcRaster.Width - 1, yEnd = srcRaster.Height - 1
            };

            if (_prjSettings.OutEnvelope == null || _prjSettings.OutEnvelope == PrjEnvelope.Empty)
            {
                _prjSettings.OutEnvelope = _maxPrjEnvelope;
                _orbitBlock = new Block {
                    xBegin = 0, yBegin = 0, xEnd = _srcLocationSize.Width - 1, yEnd = _srcLocationSize.Height - 1
                };
            }
            else
            {
                GetEnvelope(_xs, _ys, _srcLocationSize.Width, _srcLocationSize.Height, _prjSettings.OutEnvelope, out _orbitBlock);
                if (_orbitBlock == null || _orbitBlock.Width <= 0 || _orbitBlock.Height <= 0)
                {
                    throw new Exception("数据不在目标区间内");
                }
            }

            _rasterDataBands = GetSrcRasterBand(srcRaster, prjSettings);
        }
示例#4
0
 private void DoSession(AbstractWarpDataset srcRaster, SpatialReference dstSpatialRef, Fy2_NOM_PrjSettings prjSettings, Action <int, string> progressCallback)
 {
     if (_curSession == null || _curSession != srcRaster || _isBeginSession)
     {
         Size geoSize = new Size(srcRaster.Width, srcRaster.Height);
         ReadyLocations(srcRaster, dstSpatialRef, geoSize, out _xs, out _ys, out _maxPrjEnvelope, progressCallback);
         if (prjSettings.OutEnvelope == null)
         {
             prjSettings.OutEnvelope = _maxPrjEnvelope;
         }
         if (progressCallback != null)
         {
             progressCallback(4, "准备亮温计算参数");
         }
         if (progressCallback != null)
         {
             progressCallback(5, "准备亮温计算参数");
         }
         if (prjSettings.IsSensorZenith)//执行临边变暗订正
         {
             ReadySensorZenith(srcRaster);
         }
         //亮温值映射表
         ReadBandNoValueMap(srcRaster);
         _isBeginSession = false;
     }
 }