/// <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(); }
/// <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); }
private void SetMetaData(Gmetadata Gmetadata) { if (Gmetadata != null) { this.Metadata = Gmetadata; } else { this.Metadata = GetDefaultMetadata(); } }
/// <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); }
/// <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); }
/// <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) + " 暂时不支持这种格式,请手动指定格式元数据!"); }
/// <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); } }
/// <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); }
/// <summary> /// 构造函数 /// </summary> /// <param name="filePath">数据文件路径。</param> /// <param name="Gmetadata"></param> public EntityFileReader(string filePath, Gmetadata Gmetadata) { Name = InputPath; Init(filePath, Gmetadata); }
/// <summary> /// 构造函数 /// </summary> /// <param name="filePath"></param> /// <param name="Gmetadata"></param> public VectorNameReader(string filePath, Gmetadata Gmetadata) : base(filePath, Gmetadata) { }
/// <summary> /// 构造函数 /// </summary> /// <param name="filePath"></param> /// <param name="Gmetadata"></param> public IdAstroProductReader(string filePath, Gmetadata Gmetadata) : base(filePath, Gmetadata) { }
protected override void Init(Gmetadata Gmetadata) { Comments = new List <string>(); CommentMarkers = Gmetadata.CommentMarkers; base.Init(Gmetadata); }
/// <summary> /// 构造函数 /// </summary> /// <param name="filePath">数据文件路径。</param> /// <param name="Gmetadata"></param> public XmlFileWriter(string filePath, Gmetadata Gmetadata) : base(filePath, Gmetadata) { }
/// <summary> /// 构造函数 /// </summary> /// <param name="filePath"></param> /// <param name="Gmetadata"></param> public ArrayParamReader(string filePath, Gmetadata Gmetadata) : base(filePath, Gmetadata) { }
/// <summary> /// 构造函数 /// </summary> /// <param name="filePath"></param> /// <param name="Gmetadata"></param> public IdAzimuthReader(string filePath, Gmetadata Gmetadata) : base(filePath, Gmetadata) { }
/// <summary> /// 构造函数 /// </summary> /// <param name="Stream">数据流。</param> /// <param name="Gmetadata"></param> public XmlFileWriter(Stream Stream, Gmetadata Gmetadata) : base(Stream, Gmetadata) { }
/// <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); }
/// <summary> /// 构造函数 /// </summary> /// <param name="Stream">数据流。</param> /// <param name="Gmetadata"></param> public EntityWriter(Stream Stream, Gmetadata Gmetadata, Encoding Encoding = null) : this() { Init(Stream, Gmetadata, Encoding); }
/// <summary> /// 构造函数 /// </summary> /// <param name="filePath"></param> /// <param name="Gmetadata"></param> public VersionedIoParamReader(string filePath, Gmetadata Gmetadata) : base(filePath, Gmetadata) { }
/// <summary> /// 构造函数 /// </summary> /// <param name="filePath"></param> /// <param name="Gmetadata"></param> public IdTwoFloatReader(string filePath, Gmetadata Gmetadata) : base(filePath, Gmetadata) { }
/// <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'; }
/// <summary> /// 构造函数 /// </summary> /// <param name="filePath"></param> /// <param name="Gmetadata"></param> public IdXyzReader(string filePath, Gmetadata Gmetadata) : base(filePath, Gmetadata) { }
/// <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'; }
/// <summary> /// 构造函数 /// </summary> /// <param name="filePath"></param> /// <param name="Gmetadata"></param> public InputParamWriter(string filePath, Gmetadata Gmetadata) : base(filePath, Gmetadata) { }
/// <summary> /// 构造函数 /// </summary> /// <param name="filePath">数据文件路径。</param> /// <param name="Gmetadata"></param> public XmlStreamReader(string filePath, Gmetadata Gmetadata) : base(filePath, Gmetadata) { }
/// <summary> /// 构造函数 /// </summary> /// <param name="filePath"></param> /// <param name="Gmetadata"></param> public IdGeoCoordReader(string filePath, Gmetadata Gmetadata) : base(filePath, Gmetadata) { }
/// <summary> /// 构造函数 /// </summary> /// <param name="filePath">数据文件路径。</param> /// <param name="Gmetadata"></param> public LineFileReader(string filePath, Gmetadata Gmetadata) : base(filePath, Gmetadata) { }