示例#1
0
 private string BulidArgXml(FileIdentify file)
 {
     try
     {
         InputArg arg = _argMode.Copy();
         arg.InputFilename = file.FileName;
         if (file.Identify.OrbitDateTime == DateTime.MinValue)//没解析出来时间。
         {
             PrintInfo("获取轨道时间失败:" + file.FileName);
         }
         else if (_orbitDataTime == null || (Math.Abs((_orbitDataTime.Value - file.Identify.OrbitDateTime).TotalMinutes) >= 20))
         {
             _orbitDataTime          = file.Identify.OrbitDateTime;
             arg.PervObservationDate = _orbitDataTime.Value.ToString("yyyyMMdd");
             arg.PervObservationTime = _orbitDataTime.Value.ToString("HHmm");
             arg.OrbitIdentify       = _orbitDataTime.Value.ToString("HHmm");
         }
         else
         {
             arg.PervObservationDate = _orbitDataTime.Value.ToString("yyyyMMdd");
             arg.PervObservationTime = _orbitDataTime.Value.ToString("HHmm");
             arg.OrbitIdentify       = _orbitDataTime.Value.ToString("HHmm");
         }
         string xml = Path.Combine(arg.OutputDir, "batchArgs\\" + Path.GetFileName(file.FileName) + ".xml");
         arg.ToXml(xml);
         return(xml);
     }
     catch (Exception ex)
     {
         PrintInfo("创建执行程序参数失败 " + ex.Message);
         return(null);
     }
 }
示例#2
0
        private void btnExcute_Click(object sender, EventArgs e)
        {
            //Save arg xml
            ////check argments
            if (CheckArgument() == false)
            {
                MessageBox.Show("参数设置不完整!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            InputArg arg = new InputArg();

            if (rdbInputFiles.Checked)
            {
                arg.InputFilename = txtInputFiles.Text;
            }
            else
            {
                arg.InputFilename = txtInputDir.Text + " " + txtFilter.Text;
            }
            if (rdoAllBands.Checked == true)
            {
                arg.Bands = null;
            }
            else
            {
                int      bandNo;
                string[] bandNos = txtBands.Text.Trim().Split(',');
                arg.Bands = new int[bandNos.Length];
                for (int i = 0; i < bandNos.Length; i++)
                {
                    if (int.TryParse(bandNos[i], out bandNo))
                    {
                        arg.Bands[i] = bandNo;
                    }
                }
            }
            arg.OutputDir = txtOutputDir.Text;
            if (rdoCResolution.Checked == true)
            {
                float resX;
                if (float.TryParse(txtResolution.Text, out resX))
                {
                    arg.ResolutionX = arg.ResolutionY = resX;
                }
            }
            //region
            arg.ValidEnvelopes = new PrjEnvelopeItem[_envList.Count()];
            arg.Envelopes      = new PrjEnvelopeItem[_envList.Count()];
            if (ckbMoasic.Checked == true)
            {
                arg.MosaicInputArg = new MosaicInputArg();
                RasterProject.PrjEnvelope envelope = GetEnvelopeFromUI();
                arg.MosaicInputArg.Envelope  = new PrjEnvelopeItem(txtRegionName.Text, envelope);
                arg.MosaicInputArg.OutputDir = txtMoasicOutDir.Text;
            }
            for (int i = 0; i < _envList.Count; i++)
            {
                arg.ValidEnvelopes[i] =
                    arg.Envelopes[i]  = _envList[i];
            }
            arg.IsOnlySaveMosaicFile = ckbOnlyMoasicFile.Checked;
            arg.ProjectionIdentify   = "GLL";
            arg.ToXml(_path);
            DialogResult = DialogResult.OK;
            Close();
        }