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 CrossPointProperty : IPropertyFileImport { private IRectangularCSGridPropertyChange iChange; private string horizon = "无"; private string x = "无"; private string y = "无"; private string firstZone = "无"; private string secondZone = "无"; private string thirdZone = "无"; private string fourthZone = "无"; /// /// 属性类别排序 /// private List categorys = new List() { "属性", "其他", "杂项" }; /// /// Initializes a new instance of the class. /// public CrossPointProperty() { } /// /// Initializes a new instance of the class. /// /// public CrossPointProperty(IRectangularCSGridPropertyChange iChange) { } [Browsable(false)] public string ColumnLength { get; set; } [Category("属性"), DisplayName("\t\t\t\t\t\t\t层位")] [TypeConverter(typeof(Converter.CrossPointColumnCorrespondConvert))] public string Horizon { get { return horizon; } set { horizon = value; } } [Category("属性"), DisplayName("\t\t\t\t\t\tX")] [TypeConverter(typeof(Converter.CrossPointColumnCorrespondConvert))] public string X { get { return x; } set { x = value; } } [Category("属性"), DisplayName("\t\t\t\t\t\tY")] [TypeConverter(typeof(Converter.CrossPointColumnCorrespondConvert))] public string Y { get { return y; } set { y = value; } } [Category("属性"), DisplayName("\t\t\t\t\t\t第一象限")] [TypeConverter(typeof(Converter.CrossPointColumnCorrespondConvert))] public string FirstZone { get { return firstZone; } set { firstZone = value; } } [Category("属性"), DisplayName("\t\t\t\t\t第二象限")] [TypeConverter(typeof(Converter.CrossPointColumnCorrespondConvert))] public string SecondZone { get { return secondZone; } set { secondZone = value; } } [Category("属性"), DisplayName("\t\t\t\t第三象限")] [TypeConverter(typeof(Converter.CrossPointColumnCorrespondConvert))] public string ThirdZone { get { return thirdZone; } set { thirdZone = value; } } [Category("属性"), DisplayName("\t\t\t第四象限")] [TypeConverter(typeof(Converter.CrossPointColumnCorrespondConvert))] public string FourthZone { get { return fourthZone; } set { fourthZone = 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()); } } }