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.

96 lines
2.2 KiB
C#

1 month ago
using GeoSigmaDrawLib;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace SigmaDrawerElement
{
public class DrawerXyz : ElementBase
{
/// <summary>
/// Initializes a new instance of the <see cref="DrawerXyz"/> class.
/// </summary>
public DrawerXyz()
{
ElementType = DrawElementType.ELEMENT_XYZ;
}
[Browsable(false)]
[XmlElement("Base")]
public DrawerXyzBase Base { get; set; } = new DrawerXyzBase();
[XmlIgnore]
[Category("\t数据"), DisplayName("X")]
public double X
{
get { return Base.X; }
set { Base.X = value; }
}
[XmlIgnore]
[Category("\t数据"), DisplayName("Y")]
public double Y
{
get { return Base.Y; }
set { Base.Y = value; }
}
[XmlIgnore]
[Category("\t数据"), DisplayName("Z")]
public double Z
{
get { return Base.Z; }
set { Base.Z = value; }
}
public override string Name
{
get
{
return Base.Z.ToString();
}
}
}
public class DrawerXyzBase
{
private string dataValue = "";
[XmlAttribute("Value")]
public string DataValue
{
get
{
return $"{X},{Y},{Z}";
}
set
{
if (string.IsNullOrEmpty(value))
{
return;
}
string[] saData = value.Split(',');
if (saData.Length < 3)
{
return;
}
X = Convert.ToDouble(saData[0]);
Y = Convert.ToDouble(saData[1]);
Z = Convert.ToDouble(saData[2]);
}
}
[XmlAttribute]
public double X { get; set; }
[XmlAttribute]
public double Y { get; set; }
[XmlAttribute]
public double Z { get; set; }
}
}