You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kev/Drawer/UCDraw/SigmaDrawerStyle/LineClassInfoProperty123.cs

175 lines
5.1 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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
{
/// <summary>
/// 文件导入线类信息123
/// </summary>
public class LineClassInfoProperty123 : IPropertyFileImport
{
private IRectangularCSGridPropertyChange iChange;
private string horizon = "无";
private string x = "无";
private string y = "无";
private string z = "无";
private string l = "无";
private string line123Name = "无";
private string column123 = "无";
/// <summary>
/// Initializes a new instance of the <see cref="LineClassInfoProperty123"/> class.
/// </summary>
public LineClassInfoProperty123()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LineClassInfoProperty123"/> class.
/// </summary>
/// <param name="iChange"></param>
public LineClassInfoProperty123(IRectangularCSGridPropertyChange iChange)
{
}
[Browsable(false)]
public string ColumnLength
{
get;
set;
}
[Category("\t属性"), DisplayName("\t\t\t\t\t\t层位"), Description("123方式工作站导出的断层数据...")]
[TypeConverter(typeof(Converter.LineClass123ColumnCorrespondConvert))]
public string Horizon
{
get
{
return horizon;
}
set
{
horizon = value;
}
}
[Category("\t属性"), DisplayName("\t\t\t\t\tX"), Description("123方式工作站导出的断层数据...")]
[TypeConverter(typeof(Converter.LineClass123ColumnCorrespondConvert))]
public string X
{
get
{
return x;
}
set
{
x = value;
}
}
[Category("\t属性"), DisplayName("\t\t\t\tY"), Description("123方式工作站导出的断层数据...")]
[TypeConverter(typeof(Converter.LineClass123ColumnCorrespondConvert))]
public string Y
{
get
{
return y;
}
set
{
y = value;
}
}
[Category("\t属性"), DisplayName("\t\t\tZ"), Description("123方式工作站导出的断层数据...")]
[TypeConverter(typeof(Converter.LineClass123ColumnCorrespondConvert))]
public string Z
{
get
{
return z;
}
set
{
z = value;
}
}
[Category("\t属性"), DisplayName("\t\tL"), Description("123方式工作站导出的断层数据...")]
[TypeConverter(typeof(Converter.LineClass123ColumnCorrespondConvert))]
public string L
{
get
{
return l;
}
set
{
l = value;
}
}
[Category("\t属性"), DisplayName("\t名称"), Description("123方式工作站导出的断层数据...")]
[TypeConverter(typeof(Converter.LineClass123ColumnCorrespondConvert))]
public string Line123Name
{
get
{
return line123Name;
}
set
{
line123Name = value;
}
}
[Category("\t属性"), DisplayName("123列"), Description("123方式工作站导出的断层数据...")]
[TypeConverter(typeof(Converter.LineClass123ColumnCorrespondConvert))]
public string Column123
{
get
{
return column123;
}
set
{
column123 = value;
}
}
/// <summary>
/// 输出Xml数据
/// </summary>
/// <returns></returns>
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());
}
}
}