Flowchart

This commit is contained in:
艾竹
2022-12-04 23:07:20 +08:00
parent dc42f75610
commit 0487857d7b
30 changed files with 1621 additions and 383 deletions

View File

@@ -46,32 +46,56 @@ namespace AIStudio.Wpf.DiagramDesigner
}
[XmlAttribute]
public Guid Id { get; set; }
public Guid Id
{
get; set;
}
[XmlAttribute]
public int ZIndex { get; set; }
public int ZIndex
{
get; set;
}
[XmlAttribute]
public bool IsGroup { get; set; }
public bool IsGroup
{
get; set;
}
[XmlAttribute]
public Guid ParentId { get; set; }
public Guid ParentId
{
get; set;
}
[XmlAttribute]
public string Text { get; set; }
public string Text
{
get; set;
}
[XmlElement]
public ColorItem ColorItem { get; set; }
public ColorItem ColorItem
{
get; set;
}
[XmlElement]
public FontItem FontItem { get; set; }
public FontItem FontItem
{
get; set;
}
}
public class ColorItem : IColorViewModel
{
{
[XmlIgnore]
public IColorObject LineColor { get; set; }
public IColorObject LineColor
{
get; set;
}
[JsonIgnore]
[XmlElement("LineColor")]
@@ -88,7 +112,10 @@ namespace AIStudio.Wpf.DiagramDesigner
}
[XmlIgnore]
public IColorObject FillColor { get; set; }
public IColorObject FillColor
{
get; set;
}
[JsonIgnore]
[XmlElement("FillColor")]
@@ -106,7 +133,10 @@ namespace AIStudio.Wpf.DiagramDesigner
[XmlIgnore]
public Color ShadowColor { get; set; }
public Color ShadowColor
{
get; set;
}
[JsonIgnore]
[XmlElement("ShadowColor")]
@@ -123,19 +153,34 @@ namespace AIStudio.Wpf.DiagramDesigner
}
[XmlAttribute]
public double LineWidth { get; set; }
public double LineWidth
{
get; set;
}
[XmlAttribute]
public ArrowPathStyle LeftArrowPathStyle { get; set; }
public ArrowPathStyle LeftArrowPathStyle
{
get; set;
}
[XmlAttribute]
public ArrowPathStyle RightArrowPathStyle { get; set; }
public ArrowPathStyle RightArrowPathStyle
{
get; set;
}
[XmlAttribute]
public ArrowSizeStyle LeftArrowSizeStyle { get; set; }
public ArrowSizeStyle LeftArrowSizeStyle
{
get; set;
}
[XmlAttribute]
public ArrowSizeStyle RightArrowSizeStyle { get; set; }
public ArrowSizeStyle RightArrowSizeStyle
{
get; set;
}
public event PropertyChangedEventHandler PropertyChanged;
}
@@ -144,20 +189,41 @@ namespace AIStudio.Wpf.DiagramDesigner
public class FontItem : IFontViewModel
{
[XmlIgnore]
public FontWeight FontWeight { get; set; }
public FontWeight FontWeight
{
get; set;
}
[XmlIgnore]
public FontStyle FontStyle { get; set; }
public FontStyle FontStyle
{
get; set;
}
[XmlIgnore]
public FontStretch FontStretch { get; set; }
public FontStretch FontStretch
{
get; set;
}
[XmlAttribute]
public bool Underline { get; set; }
public bool Underline
{
get; set;
}
[XmlAttribute]
public bool Strikethrough { get; set; }
public bool Strikethrough
{
get; set;
}
[XmlAttribute]
public bool OverLine { get; set; }
public bool OverLine
{
get; set;
}
[XmlIgnore]
public Color FontColor { get; set; }
public Color FontColor
{
get; set;
}
[JsonIgnore]
[XmlElement("FontColor")]
@@ -174,10 +240,16 @@ namespace AIStudio.Wpf.DiagramDesigner
}
[XmlIgnore]
public string FontFamily { get; set; }
public string FontFamily
{
get; set;
}
[XmlIgnore]
public double FontSize { get; set; }
public double FontSize
{
get; set;
}
[XmlIgnore]
@@ -237,7 +309,10 @@ namespace AIStudio.Wpf.DiagramDesigner
}
[XmlIgnore]
public Color TextEffectColor { get; set; }
public Color TextEffectColor
{
get; set;
}
[JsonIgnore]
[XmlElement("TextEffectColor")]
@@ -254,7 +329,10 @@ namespace AIStudio.Wpf.DiagramDesigner
}
[XmlIgnore]
public Color HighlightColor { get; set; }
public Color HighlightColor
{
get; set;
}
[JsonIgnore]
[XmlElement("HighlightColor")]
@@ -271,13 +349,25 @@ namespace AIStudio.Wpf.DiagramDesigner
}
[XmlAttribute]
public FontCase FontCase { get; set; }
public FontCase FontCase
{
get; set;
}
[XmlAttribute]
public HorizontalAlignment HorizontalAlignment { get; set; }
public HorizontalAlignment HorizontalAlignment
{
get; set;
}
[XmlAttribute]
public VerticalAlignment VerticalAlignment { get; set; }
public VerticalAlignment VerticalAlignment
{
get; set;
}
[XmlAttribute]
public double LineHeight { get; set; }
public double LineHeight
{
get; set;
}
public event PropertyChangedEventHandler PropertyChanged;
}
@@ -286,18 +376,38 @@ namespace AIStudio.Wpf.DiagramDesigner
{
public static string SerializeColor(Color color)
{
return string.Format("{0}:{1}:{2}:{3}", color.A, color.R, color.G, color.B);
return string.Format("#{0:X2}{1:X2}{2:X2}{3:X2}", color.A, color.R, color.G, color.B);
}
public static Color DeserializeColor(string color)
{
{
byte a, r, g, b;
string[] pieces = color.Split(new char[] { ':' });
a = byte.Parse(pieces[0]);
r = byte.Parse(pieces[1]);
g = byte.Parse(pieces[2]);
b = byte.Parse(pieces[3]);
return Color.FromArgb(a, r, g, b);
try
{
if (color?.Length == 9)
{
a = Convert.ToByte(color.Substring(1, 2), 16);
r = Convert.ToByte(color.Substring(3, 2), 16);
g = Convert.ToByte(color.Substring(5, 2), 16);
b = Convert.ToByte(color.Substring(7, 2), 16);
return Color.FromArgb(a, r, g, b);
}
else if (color?.Length == 7)
{
r = Convert.ToByte(color.Substring(1, 2), 16);
g = Convert.ToByte(color.Substring(3, 2), 16);
b = Convert.ToByte(color.Substring(5, 2), 16);
return Color.FromRgb(r, g, b);
}
else
{
return Colors.Black;
}
}
catch
{
return Colors.Black;
}
}
public static GradientStop DeserializeGradientStop(string str)
@@ -308,7 +418,7 @@ namespace AIStudio.Wpf.DiagramDesigner
public static string SerializeColorList(IEnumerable<Color> colors)
{
return string.Join("-", colors.Select(color => string.Format("{0}:{1}:{2}:{3}", color.A, color.R, color.G, color.B)));
return string.Join("-", colors.Select(color => string.Format("#{0:X2}{1:X2}{2:X2}{3:X2}", color.A, color.R, color.G, color.B)));
}
public static List<Color> DeserializeColorList(string colorstring)
@@ -317,13 +427,7 @@ namespace AIStudio.Wpf.DiagramDesigner
var colors = colorstring.Split('-');
foreach (var color in colors)
{
byte a, r, g, b;
string[] pieces = color.Split(new char[] { ':' });
a = byte.Parse(pieces[0]);
r = byte.Parse(pieces[1]);
g = byte.Parse(pieces[2]);
b = byte.Parse(pieces[3]);
colorlist.Add(Color.FromArgb(a, r, g, b));
colorlist.Add(DeserializeColor(color));
}
return colorlist;
}
@@ -388,10 +492,16 @@ namespace AIStudio.Wpf.DiagramDesigner
{
[XmlAttribute]
public BrushType BrushType { get; set; }
public BrushType BrushType
{
get; set;
}
[XmlIgnore]
public Color Color { get; set; }
public Color Color
{
get; set;
}
[JsonIgnore]
[XmlElement("FillColor")]
@@ -408,7 +518,10 @@ namespace AIStudio.Wpf.DiagramDesigner
}
[XmlIgnore]
public ObservableCollection<GradientStop> GradientStop { get; set; }
public ObservableCollection<GradientStop> GradientStop
{
get; set;
}
[JsonIgnore]
[XmlArray("GradientStop")]
@@ -427,7 +540,10 @@ namespace AIStudio.Wpf.DiagramDesigner
[XmlIgnore]
public IEnumerable<double> Offset { get; set; }
public IEnumerable<double> Offset
{
get; set;
}
[JsonIgnore]
[XmlArray("Offset")]
@@ -444,13 +560,22 @@ namespace AIStudio.Wpf.DiagramDesigner
}
[XmlAttribute]
public string Image { get; set; }
public string Image
{
get; set;
}
[XmlAttribute]
public int SubType { get; set; }
public int SubType
{
get; set;
}
[XmlIgnore]
public Point StartPoint { get; set; }
public Point StartPoint
{
get; set;
}
[JsonIgnore]
[XmlAttribute("StartPoint")]
@@ -467,7 +592,10 @@ namespace AIStudio.Wpf.DiagramDesigner
}
[XmlIgnore]
public Point EndPoint { get; set; }
public Point EndPoint
{
get; set;
}
[JsonIgnore]
[XmlAttribute("EndPoint")]
@@ -484,13 +612,25 @@ namespace AIStudio.Wpf.DiagramDesigner
}
[XmlAttribute]
public double Opacity { get; set; }
public double Opacity
{
get; set;
}
[XmlAttribute]
public LinearOrientation LinearOrientation { get; set; }
public LinearOrientation LinearOrientation
{
get; set;
}
[XmlAttribute]
public RadialOrientation RadialOrientation { get; set; }
public RadialOrientation RadialOrientation
{
get; set;
}
[XmlAttribute]
public int Angle { get; set; }
public int Angle
{
get; set;
}
}
}