Beispiel #1
0
 public static MosaicInputArg FromXml(string filename)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(filename))
         {
             throw new ArgumentNullException("argXml", "参数文件为空");
         }
         if (!File.Exists(filename))
         {
             throw new FileNotFoundException("参数文件不存在", filename);
         }
         XElement xml = XElement.Load(filename);
         if (xml == null || xml.IsEmpty)
         {
             throw new FileNotFoundException("参数内容为空", filename);
         }
         MosaicInputArg arg = new MosaicInputArg();
         arg.InputFilename   = XmlHelper.ParseXElementValueToString(xml, "InputFilename");;
         arg.DayOrNight      = XmlHelper.ParseXElementValueToString(xml, "DayOrNight");;
         arg.OrbitIdentify   = XmlHelper.ParseXElementValueToString(xml, "OrbitIdentify");;
         arg.MosaicMode      = XmlHelper.ParseXElementValueToString(xml, "MosaicMode");;
         arg.MosaicEnvelopes = XmlHelper.ParseXElementEnvelopes(xml, "MosaicEnvelopes");;
         arg.OutputDir       = XmlHelper.ParseXElementValueToString(xml, "OutputDir");;
         arg.OutputType      = XmlHelper.ParseXElementValueToString(xml, "OutputType");;
         return(arg);
     }
     catch (Exception ex)
     {
         throw new Exception("解析拼接镶嵌输入参数文件失败", ex);
     }
 }
Beispiel #2
0
 private void CheckArgs(MosaicInputArg inArg)
 {
     if (string.IsNullOrWhiteSpace(inArg.InputFilename))
     {
         throw new ArgumentNullException("输入的文件为空");
     }
     if (!File.Exists(inArg.InputFilename))
     {
         throw new FileNotFoundException("未发现该文件", inArg.InputFilename);
     }
 }
Beispiel #3
0
        public MosaicSplice(MosaicInputArg inArg, Action <int, string> action)
        {
            this.inArg  = inArg;
            this.action = action;

            string size = System.Configuration.ConfigurationManager.AppSettings["MosaicThumbnailSize"];

            if (!string.IsNullOrWhiteSpace(size))
            {
                int.TryParse(size, out _mosaicSize);
            }
        }
Beispiel #4
0
        public MosaicInputArg Copy()
        {
            MosaicInputArg arg = new MosaicInputArg();

            arg.InputFilename   = InputFilename;
            arg.DayOrNight      = DayOrNight;
            arg.OrbitIdentify   = OrbitIdentify;
            arg.MosaicMode      = MosaicMode;
            arg.MosaicEnvelopes = MosaicEnvelopes;
            arg.OutputDir       = OutputDir;
            arg.OutputType      = OutputType;
            return(arg);
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            string         xmlFile = args[0];
            MosaicInputArg arg     = MosaicInputArg.FromXml(xmlFile);

            Console.WriteLine("启动镶嵌拼接");
            Console.WriteLine(arg.InputFilename);
            try
            {
                MosaicSplice mosaic = new MosaicSplice(arg, new Action <int, string>(OnProgress));
                mosaic.DoMosaicSplice();
            }
            catch (Exception ex)
            {
                LogFactory.WriteLine(ex);
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #6
0
        //NOAA18_AVHRR_CHINA_GLL_L1_20000101_0001_1000M_Day.LDF
        private string GetSpliceFilename(IRasterDataProvider inputRaster, MosaicInputArg inArg, string envName)
        {
            float        resolution   = inputRaster.ResolutionX;
            DataIdentify dataIdentify = inputRaster.DataIdentify;
            //PrjEnvelopeItem item = inArg.MosaicEnvelopes[0];
            string projectionIdentify = "GLL";
            string dayOrNight         = inArg.DayOrNight;
            string orbitIdentify      = inArg.OrbitIdentify;

            return(string.Format("{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}_{8}_MOSA.ldf",
                                 dataIdentify.Satellite,
                                 dataIdentify.Sensor,
                                 envName,
                                 projectionIdentify,
                                 "L1",
                                 dataIdentify.OrbitDateTime.ToString("yyyyMMdd"),
                                 orbitIdentify.PadRight(4, '0'),
                                 projectionIdentify == "GLL" ? GLLResolutionIdentify(resolution) : ResolutionIdentify(resolution),
                                 dayOrNight
                                 ));
        }