Ejemplo n.º 1
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;

            return(GetSpliceFilename(resolution, dataIdentify, inArg, envName));
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
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;
            arg.MosaicIdentify    = MosaicIdentify;
            arg.MosaicBands       = MosaicBands;
            arg.MosaicResoultionX = MosaicResoultionX;
            arg.MosaicResoultionY = MosaicResoultionY;
            return(arg);
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
0
 private void CheckArgs(MosaicInputArg inArg)
 {
     if (string.IsNullOrWhiteSpace(inArg.InputFilename))
     {
         throw new ArgumentNullException("输入的文件为空");
     }
     if (inArg.InputFilename.Contains("|"))
     {
         string[] fileInfo = inArg.InputFilename.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
         if (fileInfo == null || fileInfo.Length != 2 || !Directory.Exists(fileInfo[0]))
         {
             throw new ArgumentNullException("输入的文件路径不存在");
         }
         if (Directory.GetFiles(fileInfo[0], fileInfo[1], SearchOption.TopDirectoryOnly).Length == 0)
         {
             throw new ArgumentNullException("输入的路径不存在待拼接的数据");
         }
     }
     else if (!File.Exists(inArg.InputFilename))
     {
         throw new FileNotFoundException("未发现该文件", inArg.InputFilename);
     }
 }
Ejemplo n.º 6
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");;
         arg.MosaicIdentify    = XmlHelper.ParseXElementValueToString(xml, "MosaicIdentify");
         arg.MosaicBands       = XmlHelper.ParseXElementValueToString(xml, "MosaicBands");
         arg.MosaicResoultionX = float.Parse(XmlHelper.ParseXElementValueToString(xml, "MosaicResoultionX"));
         arg.MosaicResoultionY = float.Parse(XmlHelper.ParseXElementValueToString(xml, "MosaicResoultionY"));
         return(arg);
     }
     catch (Exception ex)
     {
         throw new Exception("解析拼接镶嵌输入参数文件失败", ex);
     }
 }
Ejemplo n.º 7
0
        private string GetSpliceFilename(float resolution, DataIdentify dataIdentify, MosaicInputArg inArg, string envName)
        {
            //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
                                 ));
        }