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.
160 lines
4.6 KiB
C#
160 lines
4.6 KiB
C#
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>
|
|
/// 文件导入,偏移量法
|
|
/// </summary>
|
|
public class OffsetMethodProperty : IPropertyFileImport
|
|
{
|
|
private IRectangularCSGridPropertyChange iChange;
|
|
private string horizon = "无";
|
|
private string x = "无";
|
|
private string y = "无";
|
|
private string offsetName = "无";
|
|
private string dx = "无";
|
|
private string dy = "无";
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="OffsetMethodProperty"/> class.
|
|
/// </summary>
|
|
public OffsetMethodProperty()
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="OffsetMethodProperty"/> class.
|
|
/// </summary>
|
|
/// <param name="iChange"></param>
|
|
public OffsetMethodProperty(IRectangularCSGridPropertyChange iChange)
|
|
{
|
|
|
|
}
|
|
|
|
[Browsable(false)]
|
|
public string ColumnLength
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[Category("\t属性"), DisplayName("\t\t\t\t\t\t层位"), Description("需要:井口坐标、横偏移、纵偏移")]
|
|
[TypeConverter(typeof(Converter.OffsetMethodColumnCorrespondConvert))]
|
|
public string Horizon
|
|
{
|
|
get
|
|
{
|
|
return horizon;
|
|
}
|
|
set
|
|
{
|
|
horizon = value;
|
|
}
|
|
}
|
|
|
|
[Category("\t属性"), DisplayName("\t\t\t\t\tX"), Description("需要:井口坐标、横偏移、纵偏移")]
|
|
[TypeConverter(typeof(Converter.OffsetMethodColumnCorrespondConvert))]
|
|
public string X
|
|
{
|
|
get
|
|
{
|
|
return x;
|
|
}
|
|
set
|
|
{
|
|
x = value;
|
|
}
|
|
}
|
|
|
|
[Category("\t属性"), DisplayName("\t\t\t\tY"), Description("需要:井口坐标、横偏移、纵偏移")]
|
|
[TypeConverter(typeof(Converter.OffsetMethodColumnCorrespondConvert))]
|
|
public string Y
|
|
{
|
|
get
|
|
{
|
|
return y;
|
|
}
|
|
set
|
|
{
|
|
y = value;
|
|
}
|
|
}
|
|
|
|
[Category("\t属性"), DisplayName("\t\t\t名称"), Description("需要:井口坐标、横偏移、纵偏移")]
|
|
[TypeConverter(typeof(Converter.OffsetMethodColumnCorrespondConvert))]
|
|
public string OffsetMethodName
|
|
{
|
|
get
|
|
{
|
|
return offsetName;
|
|
}
|
|
set
|
|
{
|
|
offsetName = value;
|
|
}
|
|
}
|
|
|
|
[Category("\t属性"), DisplayName("\t\tDX"), Description("需要:井口坐标、横偏移、纵偏移")]
|
|
[TypeConverter(typeof(Converter.OffsetMethodColumnCorrespondConvert))]
|
|
public string DX
|
|
{
|
|
get
|
|
{
|
|
return dx;
|
|
}
|
|
set
|
|
{
|
|
dx = value;
|
|
}
|
|
}
|
|
|
|
[Category("\t属性"), DisplayName("\tDY"), Description("需要:井口坐标、横偏移、纵偏移")]
|
|
[TypeConverter(typeof(Converter.OffsetMethodColumnCorrespondConvert))]
|
|
public string DY
|
|
{
|
|
get
|
|
{
|
|
return dy;
|
|
}
|
|
set
|
|
{
|
|
dy = 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());
|
|
}
|
|
}
|
|
}
|