Example #1
0
        /// <summary>
        /// 初始化工作
        /// </summary>
        /// <param name="Gmetadata"></param>
        protected virtual void Init(Gmetadata Gmetadata)
        {
            this.ItemSpliters          = Gmetadata.ItemSplliter;
            this.IsPropertyUnitChanged = this.Metadata.IsPropertyUnitChanged;
            this.DestPropertyUnits     = Metadata.DestPropertyUnits;
            this.PropertyUnits         = Metadata.PropertyUnits;
            this.StartIndex            = Metadata.StartRowIndex;

            PropertyIndexes = new Dictionary <string, int>();
            int i = 0;

            foreach (var name in this.Metadata.PropertyNames)
            {
                PropertyIndexes.Add(name.Trim(), i++);
            }
            //采用默认序列
            if (PropertyIndexes.Count == 0)
            {
                var defaultObj = Activator.CreateInstance <T>();// typeof(TLineClass);

                var names = defaultObj.OrderedProperties;
                this.Metadata.PropertyNames = names.ToArray();
                i = 0;
                foreach (var name in this.Metadata.PropertyNames)
                {
                    PropertyIndexes.Add(name.Trim(), i++);
                }
            }

            InitStreamReader();
        }
Example #2
0
        /// <summary>
        /// 默认的元数据
        /// </summary>
        /// <returns></returns>
        public override Gmetadata GetDefaultMetadata()
        {
            Gmetadata data = Gmetadata.NewInstance;

            data.PropertyNames = new string[] { Geo.Utils.ObjectUtil.GetPropertyName <InputParam>(m => m.InputPath) };
            return(data);
        }
Example #3
0
 private void SetMetaData(Gmetadata Gmetadata)
 {
     if (Gmetadata != null)
     {
         this.Metadata = Gmetadata;
     }
     else
     {
         this.Metadata = GetDefaultMetadata();
     }
 }
Example #4
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="Stream"></param>
        /// <param name="Gmetadata"></param>
        public virtual void Init(Stream Stream, Gmetadata Gmetadata, Encoding Encoding = null)
        {
            if (Encoding == null)
            {
                Encoding = Encoding.ASCII;
            }

            SetMetaData(Gmetadata);
            SetProperties();
            InitStreamWriter(Stream, Encoding);
        }
Example #5
0
        /// <summary>
        /// 获取默认的元数据。没有排序。
        /// </summary>
        /// <returns></returns>
        public virtual Gmetadata GetDefaultMetadata()
        {
            Gmetadata data = Gmetadata.NewInstance;

            //var names = Utils.ObjectUtil.GetPropertyNames(typeof(TLineClass));

            //foreach (var key in names)
            //{
            //    data.PropertyNames = names.ToArray();
            //}
            return(data);
        }
Example #6
0
        /// <summary>
        /// 获取默认的元数据。没有排序。
        /// </summary>
        /// <returns></returns>
        public virtual Gmetadata GetDefaultMetadata()
        {
            Gmetadata data = Gmetadata.NewInstance;

            data.PropertyNames = Activator.CreateInstance <T>().OrderedProperties.ToArray();
            //var names = Utils.ObjectUtil.GetPropertyNames(typeof(TLineClass));

            //foreach (var key in names)
            //{
            //    data.PropertyNames = names.ToArray();
            //}
            return(data);
            //   throw new NotImplementedException(Path.GetExtension(FilePath) + " 暂时不支持这种格式,请手动指定格式元数据!");
        }
Example #7
0
        /// <summary>
        /// 初始化,等同于构造函数
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="Gmetadata"></param>
        public void Init(string filePath, Gmetadata Gmetadata)
        {
            this.InputPath = filePath;
            this.Metadata  = Gmetadata;
            EnumCount      = int.MaxValue / 2;

            this.BaseDirectory = Path.GetDirectoryName(filePath);
            if (Gmetadata == null)
            {
                Init(filePath, "");
            }
            else
            {
                Init(Gmetadata);
            }
        }
Example #8
0
        /// <summary>
        /// 读取文件ID和数据库ID。比如平差之星的Pname文件。
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static GidManager ReadFileIdDbId(string path)
        {
            Geo.IO.Gmetadata nameData = Geo.IO.Gmetadata.NewInstance;
            nameData.PropertyNames = new string[] { "FileId", "DbId" };
            nameData.ItemSplliter  = new string[] { " ", "\t" };

            GidManager GidManager      = new Data.GidManager();
            LineFileReader <GidItem> r = new LineFileReader <GidItem>(path, nameData);
            var list = r.ReadAll();

            foreach (var item in list)
            {
                GidManager[item.FileId] = item.DbId;
            }
            return(GidManager);
        }
Example #9
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath">数据文件路径。</param>
 /// <param name="Gmetadata"></param>
 public EntityFileReader(string filePath, Gmetadata Gmetadata)
 {
     Name = InputPath;
     Init(filePath, Gmetadata);
 }
Example #10
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="Gmetadata"></param>
 public VectorNameReader(string filePath, Gmetadata Gmetadata)
     : base(filePath, Gmetadata)
 {
 }
Example #11
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="Gmetadata"></param>
 public IdAstroProductReader(string filePath, Gmetadata Gmetadata)
     : base(filePath, Gmetadata)
 {
 }
Example #12
0
 protected override void Init(Gmetadata Gmetadata)
 {
     Comments       = new List <string>();
     CommentMarkers = Gmetadata.CommentMarkers;
     base.Init(Gmetadata);
 }
Example #13
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath">数据文件路径。</param>
 /// <param name="Gmetadata"></param>
 public XmlFileWriter(string filePath, Gmetadata Gmetadata)
     : base(filePath, Gmetadata)
 {
 }
Example #14
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="Gmetadata"></param>
 public ArrayParamReader(string filePath, Gmetadata Gmetadata)
     : base(filePath, Gmetadata)
 {
 }
Example #15
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="Gmetadata"></param>
 public IdAzimuthReader(string filePath, Gmetadata Gmetadata)
     : base(filePath, Gmetadata)
 {
 }
Example #16
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="Stream">数据流。</param>
 /// <param name="Gmetadata"></param>
 public XmlFileWriter(Stream Stream, Gmetadata Gmetadata)
     : base(Stream, Gmetadata)
 {
 }
Example #17
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath">数据文件路径。</param>
 /// <param name="Gmetadata"></param>
 public EntityWriter(string filePath, Gmetadata Gmetadata, Encoding Encoding = null, FileMode FileMode = FileMode.Create)
     : this()
 {
     this.FilePath = filePath;
     Init(new FileStream(this.FilePath, FileMode, FileAccess.Write), Gmetadata, Encoding);
 }
Example #18
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="Stream">数据流。</param>
 /// <param name="Gmetadata"></param>
 public EntityWriter(Stream Stream, Gmetadata Gmetadata, Encoding Encoding = null)
     : this()
 {
     Init(Stream, Gmetadata, Encoding);
 }
Example #19
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="Gmetadata"></param>
 public VersionedIoParamReader(string filePath, Gmetadata Gmetadata)
     : base(filePath, Gmetadata)
 {
 }
Example #20
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="Gmetadata"></param>
 public IdTwoFloatReader(string filePath, Gmetadata Gmetadata)
     : base(filePath, Gmetadata)
 {
 }
Example #21
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath">数据文件路径。</param>
 /// <param name="Gmetadata"></param>
 public LineFileWriter(string filePath, Gmetadata Gmetadata, Encoding Encoding = null, FileMode FileMode = FileMode.Create)
     : base(filePath, Gmetadata, Encoding, FileMode)
 {
     ItemSpliter = '\t';
 }
Example #22
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="Gmetadata"></param>
 public IdXyzReader(string filePath, Gmetadata Gmetadata)
     : base(filePath, Gmetadata)
 {
 }
Example #23
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="Stream">数据流。</param>
 /// <param name="Gmetadata"></param>
 public LineFileWriter(Stream Stream, Gmetadata Gmetadata, Encoding Encoding = null)
     : base(Stream, Gmetadata, Encoding)
 {
     ItemSpliter = '\t';
 }
Example #24
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="Gmetadata"></param>
 public InputParamWriter(string filePath, Gmetadata Gmetadata)
     : base(filePath, Gmetadata)
 {
 }
Example #25
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath">数据文件路径。</param>
 /// <param name="Gmetadata"></param>
 public XmlStreamReader(string filePath, Gmetadata Gmetadata)
     : base(filePath, Gmetadata)
 {
 }
Example #26
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="Gmetadata"></param>
 public IdGeoCoordReader(string filePath, Gmetadata Gmetadata)
     : base(filePath, Gmetadata)
 {
 }
Example #27
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath">数据文件路径。</param>
 /// <param name="Gmetadata"></param>
 public LineFileReader(string filePath, Gmetadata Gmetadata) : base(filePath, Gmetadata)
 {
 }