using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml; using System.Xml.Serialization; namespace GeoSigma.SigmaDrawerStyle { public class AverageMethodSecondProperty : IPropertyFileImport { private IRectangularCSGridPropertyChange iChange; private string horizon = "无"; private string x = "无"; private string y = "无"; private string averageSecondName = "无"; private string inclinationAngle = "无"; private string azimuth = "无"; private string vDepth = "无"; /// /// Initializes a new instance of the class. /// public AverageMethodSecondProperty() { } /// /// Initializes a new instance of the class. /// /// public AverageMethodSecondProperty(IRectangularCSGridPropertyChange iChange) { } [Browsable(false)] public string ColumnLength { get; set; } [Category("\t属性"), DisplayName("\t\t\t\t\t\t层位"), Description("需要:井口坐标、垂深、井斜角、方位角")] [TypeConverter(typeof(Converter.AverageMethodSecondColumnCorrespondConvert))] public string Horizon { get { return horizon; } set { horizon = value; } } [Category("\t属性"), DisplayName("\t\t\t\t\tX"), Description("需要:井口坐标、垂深、井斜角、方位角")] [TypeConverter(typeof(Converter.AverageMethodSecondColumnCorrespondConvert))] public string X { get { return x; } set { x = value; } } [Category("\t属性"), DisplayName("\t\t\t\tY"), Description("需要:井口坐标、垂深、井斜角、方位角")] [TypeConverter(typeof(Converter.AverageMethodSecondColumnCorrespondConvert))] public string Y { get { return y; } set { y = value; } } [Category("\t属性"), DisplayName("\t\t\t名称"), Description("需要:井口坐标、垂深、井斜角、方位角")] [TypeConverter(typeof(Converter.AverageMethodSecondColumnCorrespondConvert))] public string AverageSecondName { get { return averageSecondName; } set { averageSecondName = value; } } [Category("\t属性"), DisplayName("\t\t井斜角"), Description("需要:井口坐标、垂深、井斜角、方位角")] [TypeConverter(typeof(Converter.AverageMethodSecondColumnCorrespondConvert))] public string WellInclinationAngle { get { return inclinationAngle; } set { inclinationAngle = value; } } [Category("\t属性"), DisplayName("\t方位角"), Description("需要:井口坐标、垂深、井斜角、方位角")] [TypeConverter(typeof(Converter.AverageMethodSecondColumnCorrespondConvert))] public string Azimuth { get { return azimuth; } set { azimuth = value; } } [Category("\t属性"), DisplayName("垂深"), Description("需要:井口坐标、垂深、井斜角、方位角")] [TypeConverter(typeof(Converter.AverageMethodSecondColumnCorrespondConvert))] public string VerticalDepth { get { return vDepth; } set { vDepth = value; } } /// /// 输出Xml数据 /// /// public string SerialXml() { string strData = ""; XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.IndentChars = " "; settings.NewLineChars = "\r\n"; settings.Encoding = Encoding.Default; // 去除xml声明 settings.OmitXmlDeclaration = true; System.IO.MemoryStream mem = new MemoryStream(); using (XmlWriter writer = XmlWriter.Create(mem, settings)) { //去除默认命名空间xmlns:xsd和xmlns:xsi XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ns.Add(string.Empty, string.Empty); XmlSerializer formatter = new XmlSerializer(this.GetType()); formatter.Serialize(writer, this, ns); } return Encoding.Default.GetString(mem.ToArray()); } } }