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.

185 lines
4.8 KiB
C#

1 month ago
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 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 = "无";
/// <summary>
/// 属性类别排序
/// </summary>
private List<string> categorys = new List<string>() { "属性", "其他", "杂项" };
/// <summary>
/// Initializes a new instance of the <see cref="CrossPointProperty"/> class.
/// </summary>
public CrossPointProperty()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CrossPointProperty"/> class.
/// </summary>
/// <param name="iChange"></param>
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;
}
}
/// <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());
}
}
}