示例#1
0
        /// <summary>
        /// 加载指定日期目录下的产品待入库文件
        /// yyyy-MM-dd\
        /// </summary>
        /// <param name="dt"></param>
        private void LoadTodayExtractResult(DateTime dt)
        {
            _catalogNodes.Clear();
            _treeView.Nodes.Clear();
            string dir = Path.Combine(MifEnvironment.GetWorkspaceDir(), wDef.Identify);

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            string dateDir = Path.Combine(dir, dt.ToString("yyyy-MM-dd"));

            if (!Directory.Exists(dateDir))
            {
                Directory.CreateDirectory(dateDir);
            }
            RadTreeNode rootNode = new RadTreeNode((new DirectoryInfo(dateDir)).Name);

            rootNode.Font = _font;
            _treeView.Nodes.Add(rootNode);
            ExtractingCatalogDef c = _definition as ExtractingCatalogDef;

            foreach (CatalogNodeItemDef it in (c.NodeDefs[0] as CatalogNodeGroupDef).NodeDefs)
            {
                LoadFiles(it, rootNode, dateDir);
            }
            rootNode.ExpandAll();
        }
示例#2
0
        /// <summary>
        /// 加载指定日期目录下的产品待入库文件
        /// \Workspace\{PrdIdentify}\yyyy-MM-dd\...
        /// </summary>
        /// <param name="dt"></param>
        private void LoadTheDayExtractResult(DateTime dt)
        {
            _catalogNodes.Clear();
            _treeView.Nodes.Clear();

            string      dir        = Path.Combine(MifEnvironment.GetWorkspaceDir(), _wDef.Identify);
            string      data       = dt.ToString("yyyy-MM-dd");
            string      prdRootDir = Path.Combine(dir, data);
            RadTreeNode rootNode   = new RadTreeNode(data);

            rootNode.Font = _font;
            _treeView.Nodes.Add(rootNode);

            //区域名称,时间,文件
            Dictionary <string, Dictionary <string, List <string> > > fileClassic = null;

            if (Directory.Exists(prdRootDir))
            {
                //整理产品数据,用于TreeView
                fileClassic = ClassicFiles(prdRootDir, rootNode, fileClassic);
                if (fileClassic != null)
                {
                    FullTreeView(rootNode, fileClassic);
                }
            }
            rootNode.ExpandAll();
        }
示例#3
0
        void oprBar_Click(object sender, EventArgs e)
        {
            ICatalog             c          = _catalogs[(sender as ToolStripButton).Tag.ToString()];
            SubProductCatalogDef catalogDef = c.Definition as SubProductCatalogDef;
            string filter = catalogDef.Filter;

            using (OpenFileDialog dlg = new OpenFileDialog())
            {
                dlg.Filter           = filter;
                dlg.Multiselect      = true;
                dlg.InitialDirectory = MifEnvironment.GetWorkspaceDir();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    string[] fnames = dlg.FileNames;
                    if (fnames == null || fnames.Length == 0)
                    {
                        return;
                    }
                    foreach (string f in fnames)
                    {
                        c.AddItem(new CatalogItem(f, catalogDef, null));
                    }
                }
            }
        }
示例#4
0
        private void SearchData()
        {
            string dir        = Path.Combine(MifEnvironment.GetWorkspaceDir(), _productIdentify);
            string data       = DateTime.Now.ToString("yyyy-MM-dd");
            string prdRootDir = Path.Combine(dir, data);

            string[] files = Directory.GetFiles(prdRootDir, "*.*", SearchOption.AllDirectories);
            if (files == null || files.Length == 0)
            {
                return;
            }
            DateTime startTime, endTime;

            GetReportTime(out startTime, out endTime);
            List <string>  fileList  = new List <string>();
            string         reportDir = CreateSubFoldername();
            RasterIdentify rid       = null;

            foreach (string file in files)
            {
                rid = new RasterIdentify(file);
                if (rid.GenerateDateTime >= startTime && rid.GenerateDateTime <= endTime)
                {
                    fileList.Add(file);
                    CopyFile(reportDir, file);
                }
            }
            SaveToDb(reportDir);
        }
示例#5
0
        private void LoadSubProductItems()
        {
            string wkddir     = MifEnvironment.GetWorkspaceDir();
            string catalogDir = Path.Combine(wkddir, _wks.Definition.Identify);

            if (!Directory.Exists(catalogDir))
            {
                return;
            }
            string[] dateFolders = Directory.GetDirectories(catalogDir);
            dateFolders = FilterByDate(dateFolders);
            string dir;
            SubProductCatalogDef def = _definition as SubProductCatalogDef;

            foreach (string dateDir in dateFolders)
            {
                string date = (new DirectoryInfo(dateDir)).Name;
                dir = Path.Combine(dateDir, def.Folder);
                if (!Directory.Exists(dir))
                {
                    continue;
                }
                string[] fnames = GetFiles(dir, def.Identify, def.Pattern, true);
                if (fnames != null && fnames.Length > 0)
                {
                    foreach (string f in fnames)
                    {
                        AddFileToUI(date, f);
                    }
                }
            }
        }
示例#6
0
 public override string[] Find(string currentRasterFile, ref string extinfo, string argument)
 {
     argDic = new Dictionary <string, string>();
     if (ParseArugment(argument, out argDic))
     {
         DateTime orbitDatetime = DateTime.Now;
         if (GetOrbitDatetime(currentRasterFile, out orbitDatetime))
         {
             string WorkDir = MifEnvironment.GetWorkspaceDir() + "\\" + "FLD" + "\\";
             if (argDic.ContainsKey("MONTHS"))
             {
                 string   monthStr    = argDic["MONTHS"];
                 int      months      = 0;
                 DateTime dstDatetime = DateTime.MinValue;
                 if (int.TryParse(monthStr, out months))
                 {
                     dstDatetime = orbitDatetime.AddMonths(months);
                 }
                 string searchStr = JointFindStr(dstDatetime);
             }
             else if (argDic.ContainsKey("DAYS"))
             {
                 string   dayStr      = argDic["DAYS"];
                 int      days        = 0;
                 DateTime dstDatetime = DateTime.MinValue;
                 if (int.TryParse(dayStr, out days))
                 {
                     dstDatetime = orbitDatetime.AddDays(days);
                 }
                 string searchStr = JointFindStr(dstDatetime);
             }
         }
     }
     return(null);
 }
        private string[] GetFiles()
        {
            string dir = MifEnvironment.GetWorkspaceDir() + @"\VGT\" + DateTime.Now.ToString("yyyy-MM-dd") + "\\栅格产品\\";

            if (!Directory.Exists(dir))
            {
                return(null);
            }
            return(Directory.GetFiles(dir, "*.dat", SearchOption.TopDirectoryOnly));
        }
示例#8
0
        /// <summary>
        /// 加载指定日期目录下的产品待入库文件
        /// \Workspace\{PrdIdentify}\yyyy-MM-dd\...
        /// </summary>
        /// <param name="dt"></param>
        private void LoadTheDayExtractResult(DateTime dt)
        {
            _catalogNodes.Clear();
            _treeView.Nodes.Clear();

            string      dir        = Path.Combine(MifEnvironment.GetWorkspaceDir(), _wDef.Identify);
            string      data       = dt.ToString("yyyy-MM-dd");
            string      prdRootDir = Path.Combine(dir, data);
            RadTreeNode rootNode   = new RadTreeNode(data);

            rootNode.Font = _font;
            _treeView.Nodes.Add(rootNode);

            if (Directory.Exists(prdRootDir))
            {
                foreach (CatalogDef catalogDef in _wDef.CatalogDefs)
                {
                    if (catalogDef is SubProductCatalogDef)//子产品目录
                    {
                        SubProductCatalogDef subProductdef = catalogDef as SubProductCatalogDef;
                        string      subProductDir          = Path.Combine(prdRootDir, subProductdef.Folder);
                        RadTreeNode subProductNode         = new RadTreeNode(subProductdef.Text);
                        subProductNode.Tag         = subProductdef;
                        subProductNode.ToolTipText = subProductDir;
                        subProductNode.Font        = _font;
                        subProductNode.Image       = GetImge("Open");
                        rootNode.Nodes.Add(subProductNode);
                        string[] files = GetFiles(subProductDir, subProductdef.Identify, subProductdef.Pattern, false);
                        if (files != null && files.Length > 0)
                        {
                            foreach (string file in files)
                            {
                                ICatalogItem ca = new CatalogItem(file, subProductdef);
                                if (!_showHasToDb && ca.Info.GetPropertyValue(ToDBInfoKey) == ToDBInfoValue)//是否标记为已入库
                                {
                                    continue;
                                }
                                RadTreeNode fileNode = new RadTreeNode(GetCatalogCN(file));
                                fileNode.Tag         = file;
                                fileNode.ToolTipText = Path.GetFileName(file);
                                fileNode.Image       = GetImge(Path.GetExtension(file).ToUpper());
                                fileNode.CheckType   = CheckType.CheckBox;
                                fileNode.Checked     = true;
                                subProductNode.Nodes.Add(fileNode);
                            }
                        }
                    }
                }
            }
            else
            {
                rootNode.Nodes.Add(new RadTreeNode("当期日期下没有产品生成"));
            }
            rootNode.ExpandAll();
        }
示例#9
0
        private void btnOpenFile_Click(object sender, EventArgs e)
        {
            if (_maskObj != null)
            {
                _maskObj.Dispose();
            }
            _datValue = null;
            using (OpenFileDialog dlg = new OpenFileDialog())
            {
                dlg.Filter           = "SMART Raster(*.dat)|*.dat|矢量数据(*.shp)|*.shp";
                dlg.InitialDirectory = Path.Combine(MifEnvironment.GetWorkspaceDir(), "\\FLD");
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    string filename = dlg.FileName;
                    string extName  = Path.GetExtension(filename).ToUpper();
                    switch (extName)
                    {
                    case ".SHP":
                        LoadMaskTemplateFromShapeFile(filename);
                        if (_maskObj != null)
                        {
                            txtFileName.Text = _maskObj.FieldNames[0];
                        }
                        _filename = filename;
                        return;

                    case ".DAT":
                        using (IRasterDataProvider udr = RasterDataDriver.Open(dlg.FileName) as IRasterDataProvider)
                        {
                            //if (udr == null || ((Math.Abs(Math.Round(udr.CoordEnvelope.MinX, 4) - Math.Round(_leftUpCoord.X, 4)) > udr.ResolutionX
                            //         || Math.Abs(Math.Round(udr.CoordEnvelope.MaxY, 4) - Math.Round(_leftUpCoord.Y, 4)) > udr.ResolutionY)
                            //     || udr.Width != _size.Width
                            //     || udr.Height != _size.Height
                            //     || udr.ResolutionX - _resolution > 1.0E-15
                            //     || udr.ResolutionY - _resolution > 1.0E-15))
                            //{
                            //    //MsgBox.ShowInfo("选择的背景水体与当前水体位置信息不一致,请重新选择!");
                            //    return;
                            //}
                            txtFileName.Text = Path.GetFileNameWithoutExtension(filename);
                            _filename        = filename;
                        }
                        break;

                    default:
                        return;
                    }
                }
            }
        }
示例#10
0
        public static string GetWorkspaceFileName(RasterIdentify identify)
        {
            string dir = Path.Combine(MifEnvironment.GetWorkspaceDir(), identify.ProductIdentify);

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            dir = Path.Combine(dir, DateTime.Now.ToString("yyyy-MM-dd"));
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            return(identify.ToWksFullFileName(".dat"));
        }
示例#11
0
        protected string FindCloudExtractResult(string inputFileName)
        {
            string         dirName     = Path.Combine(MifEnvironment.GetWorkspaceDir(), "VGT");
            RasterIdentify rstIdentify = GetRasterIdentify(inputFileName);
            string         fname       = InterestedRaster <Int16> .GetWorkspaceFileName(rstIdentify);

            string[] cloudFiles = Directory.GetFiles(dirName, Path.GetFileName(fname), SearchOption.AllDirectories);
            if (cloudFiles != null && cloudFiles.Length > 0)
            {
                return(cloudFiles[0]);
            }
            else
            {
                return(null);
            }
        }