mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-05 16:56:34 +08:00
绘图形状补充一部分
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@@ -19,6 +20,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
this.Erasable = item.Erasable;
|
||||
this.Geometry = item.Geometry.ToString();
|
||||
//if (item.Geometry.Transform != null)
|
||||
//{
|
||||
// this.Matrix = item.Geometry.Transform.Value;
|
||||
//}
|
||||
this.Points = item.Points;
|
||||
this.DrawMode = item.DrawMode;
|
||||
}
|
||||
@@ -35,6 +40,25 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
get; set;
|
||||
}
|
||||
|
||||
//[XmlIgnore]
|
||||
//public Matrix Matrix
|
||||
//{
|
||||
// get; set;
|
||||
//}
|
||||
//[JsonIgnore]
|
||||
//[XmlElement("Matrix")]
|
||||
//public string XmlMatrix
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return SerializeHelper.SerializeMatrix(Matrix);
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Matrix = SerializeHelper.DeserializeMatrix(value);
|
||||
// }
|
||||
//}
|
||||
|
||||
[XmlIgnore]
|
||||
public List<Point> Points
|
||||
{
|
||||
|
||||
@@ -634,6 +634,17 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
return value;
|
||||
}
|
||||
|
||||
public static string SerializeMatrix(Matrix matrix)
|
||||
{
|
||||
return string.Format("{0},{1},{2},{3},{4},{5}", matrix.M11, matrix.M12, matrix.M21, matrix.M22, matrix.OffsetX, matrix.OffsetY); ;
|
||||
}
|
||||
|
||||
public static Matrix DeserializeMatrix(string matrix)
|
||||
{
|
||||
string[] pieces = matrix.Split(new char[] { ',' });
|
||||
return new Matrix(double.Parse(pieces[0]), double.Parse(pieces[1]), double.Parse(pieces[2]), double.Parse(pieces[3]), double.Parse(pieces[4]), double.Parse(pieces[5]));
|
||||
}
|
||||
|
||||
public static string SerializeObject(object obj, string serializableType = null)
|
||||
{
|
||||
if (serializableType?.ToLower() == ".xml")
|
||||
|
||||
Reference in New Issue
Block a user