예제 #1
0
        public void Import(ICatalogItem fetClassItem, ICatalogItem locationItem, IProgressTracker tracker, string name, string displayName, string description)
        {
            CatalogFile  cfile  = fetClassItem as CatalogFile;
            CatalogLocal cloc   = locationItem as CatalogLocal;
            string       file   = cfile.Tag.ToString();
            string       dstdir = cloc.Tag.ToString();

            CopyFile(file, name, displayName, dstdir, tracker);
        }
        private static IFeatureClassReader GetFeatureClassReaderForFile(CatalogFile catalogFile)
        {
            string file = catalogFile.Tag.ToString().ToUpper();

            if (file.EndsWith(".SHP"))
            {
                return(new FetClassReaderForShpFile(file) as IFeatureClassReader);
            }
            throw new NotSupportedException("数据源\"" + file + "\"的要素读取器未实现。");
        }
예제 #3
0
 internal override void LoadChildren()
 {
     if (!_isLoaded)
     {
         string[] dirs = null;
         try
         {
             dirs = Directory.GetDirectories(_tag.ToString());
         }
         catch (Exception ex)
         {
             MsgBox.ShowError(ex.Message);
             return;
         }
         //load dirs
         if (dirs != null && dirs.Length > 0)
         {
             foreach (string d in dirs)
             {
                 string[]     dparts = d.Split(Path.DirectorySeparatorChar);
                 CatalogLocal loc    = new CatalogLocal(dparts[dparts.Length - 1], d, d);
                 AddChild(loc);
             }
         }
         //load files
         foreach (string ext in _supportedFileExts)
         {
             string[] files = Directory.GetFiles(_tag.ToString(), ext);
             if (files != null && files.Length > 0)
             {
                 foreach (string f in files)
                 {
                     CatalogFile cf = null;
                     if (ext == "*.shp")
                     {
                         cf = new CatalogFile(Path.GetFileNameWithoutExtension(f), f, f);
                     }
                     else if (ext == "*.rst")
                     {
                         cf = new CatalogRasterFile(Path.GetFileNameWithoutExtension(f), f, f);
                     }
                     AddChild(cf);
                 }
             }
         }
         //
         Refresh();
         _isLoaded = true;
     }
 }
예제 #4
0
        private static IDataSource GetDataSource(CatalogFile catalogFile)
        {
            IDataSource ds   = null;
            string      name = Path.GetFileNameWithoutExtension(catalogFile.Name);

            //if (catalogFile is CatalogRasterFile)
            //{
            //    ds = new RasterDataSource(catalogFile.Tag.ToString());
            //}
            if (catalogFile is CatalogFile)
            {
                ds = new FileDataSource(name, catalogFile.Tag.ToString());
            }
            return(ds);
        }