From 5323358eb074bbcfcf5057c1f2d9d59f5dd2be18 Mon Sep 17 00:00:00 2001 From: DebugST <2212233137@qq.com> Date: Thu, 21 Jan 2021 18:18:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DHUB=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E6=96=AD=E5=BC=80=E9=93=BE=E6=8E=A5BUG=20=E5=B0=86=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E8=BF=9E=E7=BA=BF=E5=9B=BE=E5=B1=82=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E8=87=B3=E8=8A=82=E7=82=B9=E5=9B=BE=E5=B1=82=E5=90=8E?= =?UTF-8?q?=E6=96=B9=20=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86STNode=E9=87=8D?= =?UTF-8?q?=E8=BD=BDADD:(OnSetOptionDotLocation,OnSetOptionTextRectangle,O?= =?UTF-8?q?nEditorLoadCompleted)=20=E5=AF=B9=E4=BF=9D=E5=AD=98=E7=9A=84?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=BF=9B=E8=A1=8CGZIP=E5=8E=8B=E7=BC=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ST.Library.UI/ST.Library.UI.csproj | 3 +- ST.Library.UI/STNodeEditor/STNode.cs | 149 ++++++++++++------ .../STNodeEditor/STNodeCollection.cs | 11 +- ST.Library.UI/STNodeEditor/STNodeEditor.cs | 139 +++++++++------- ST.Library.UI/STNodeEditor/STNodeOption.cs | 11 +- .../STNodeEditor/STNodeOptionCollection.cs | 7 + WinNodeEditerTest.suo | Bin 70656 -> 75264 bytes .../Demo_Image/STNodeImageInput.cs | 4 +- WinNodeEditerTest/Form1.cs | 2 +- WinNodeEditerTest/Form2.Designer.cs | 96 +++++++++++ WinNodeEditerTest/Form2.cs | 36 +++++ WinNodeEditerTest/Form2.resx | 120 ++++++++++++++ WinNodeEditerTest/NodeNumberAdd.cs | 2 +- WinNodeEditerTest/WinNodeEditerTest.csproj | 9 ++ docs/doc.html | 48 ++++-- 15 files changed, 507 insertions(+), 130 deletions(-) create mode 100755 WinNodeEditerTest/Form2.Designer.cs create mode 100755 WinNodeEditerTest/Form2.cs create mode 100755 WinNodeEditerTest/Form2.resx diff --git a/ST.Library.UI/ST.Library.UI.csproj b/ST.Library.UI/ST.Library.UI.csproj index e915560..f847233 100755 --- a/ST.Library.UI/ST.Library.UI.csproj +++ b/ST.Library.UI/ST.Library.UI.csproj @@ -23,13 +23,14 @@ 4 - none + pdbonly true bin\Release\ TRACE prompt 4 bin\Release\ST.Library.UI.XML + true diff --git a/ST.Library.UI/STNodeEditor/STNode.cs b/ST.Library.UI/STNodeEditor/STNode.cs index 5119534..c9598a7 100755 --- a/ST.Library.UI/STNodeEditor/STNode.cs +++ b/ST.Library.UI/STNodeEditor/STNode.cs @@ -48,10 +48,11 @@ namespace ST.Library.UI internal set { if (value == _Owner) return; if (_Owner != null) { - foreach (STNodeOption op in this._InputOptions) op.DisConnectionAll(); - foreach (STNodeOption op in this._OutputOptions) op.DisConnectionAll(); + foreach (STNodeOption op in this._InputOptions.ToArray()) op.DisConnectionAll(); + foreach (STNodeOption op in this._OutputOptions.ToArray()) op.DisConnectionAll(); } _Owner = value; + this.BuildSize(true, true, false); this.OnOwnerChanged(); } } @@ -368,8 +369,14 @@ namespace ST.Library.UI set { _Tag = value; } } - private bool m_isBuildNodeSize; - private bool m_isBuildMarkSize; + private Guid _Guid; + /// + /// 获取全局唯一标识 + /// + public Guid Guid { + get { return _Guid; } + } + private static Point m_static_pt_init = new Point(10, 10); public STNode(/*string strTitle, int x, int y*/) { @@ -395,6 +402,7 @@ namespace ST.Library.UI m_sf.SetTabStops(0, new float[] { 40 }); m_static_pt_init.X += 10; m_static_pt_init.Y += 10; + this._Guid = Guid.NewGuid(); this.OnCreate(); } @@ -409,30 +417,34 @@ namespace ST.Library.UI /// protected STNodeControl m_ctrl_hover; - public void BuildSize(bool bBuildNode, bool bBuildMark, bool bRedraw) { - m_isBuildNodeSize = bBuildNode; - m_isBuildMarkSize = bBuildMark; - if (bRedraw) { - if (this._Owner != null) this._Owner.Invalidate(); - } - } - - internal void CheckSize(DrawingTools dt) { - if (m_isBuildNodeSize) { - Size sz = this.OnBuildNodeSize(dt); - this._Width = sz.Width; - this._Height = sz.Height; - m_isBuildNodeSize = false; - } - if (m_isBuildMarkSize) { - m_isBuildMarkSize = true; - if (string.IsNullOrEmpty(this._Mark)) return; - this._MarkRectangle = this.OnBuildMarkRectangle(dt); + protected internal void BuildSize(bool bBuildNode, bool bBuildMark, bool bRedraw) { + if (this._Owner == null) return; + Pen p = new Pen(this._BackColor); + SolidBrush sb = new SolidBrush(this._BackColor); + using (Graphics g = this._Owner.CreateGraphics()) { + DrawingTools dt = new DrawingTools() { + Graphics = g, + Pen = p, + SolidBrush = sb + }; + if (bBuildNode) { + Size sz = this.OnBuildNodeSize(dt); + this._Width = sz.Width; + this._Height = sz.Height; + this.SetOptionLocation(); + this.OnResize(new EventArgs()); + } + if (bBuildMark) { + if (string.IsNullOrEmpty(this._Mark)) return; + this._MarkRectangle = this.OnBuildMarkRectangle(dt); + } } + if (bRedraw) this._Owner.Invalidate(); } internal Dictionary OnSaveNode() { Dictionary dic = new Dictionary(); + dic.Add("Guid", this._Guid.ToByteArray()); dic.Add("Left", BitConverter.GetBytes(this._Left)); dic.Add("Top", BitConverter.GetBytes(this._Top)); dic.Add("Mark", string.IsNullOrEmpty(this._Mark) ? new byte[] { 0 } : Encoding.UTF8.GetBytes(this._Mark)); @@ -444,7 +456,11 @@ namespace ST.Library.UI internal virtual byte[] GetSaveData() { List lst = new List(); - byte[] byData = Encoding.UTF8.GetBytes(this.GetType().GUID.ToString()); + Type t = this.GetType(); + byte[] byData = Encoding.UTF8.GetBytes(t.Module.Name); + lst.Add((byte)byData.Length); + lst.AddRange(byData); + byData = Encoding.UTF8.GetBytes(t.GUID.ToString()); lst.Add((byte)byData.Length); lst.AddRange(byData); @@ -552,31 +568,13 @@ namespace ST.Library.UI /// 绘制工具 protected virtual void OnDrawBody(DrawingTools dt) { SolidBrush brush = dt.SolidBrush; - Rectangle rect = new Rectangle(this.Left + 10, this._Top + this._TitleHeight, this._Width - 20, m_nItemHeight); - m_sf.Alignment = StringAlignment.Near; foreach (STNodeOption op in this._InputOptions) { - brush.Color = op.TextColor;// this._ForeColor; - dt.Graphics.DrawString(op.Text, this._Font, brush, rect, m_sf); - op.DotLeft = this.Left - 5; - op.DotTop = rect.Y + 5; - Point pt = this.OnSetOptionLocation(op); - op.DotLeft = pt.X; - op.DotTop = pt.Y; this.OnDrawOptionDot(dt, op); - rect.Y += m_nItemHeight; + this.OnDrawOptionText(dt, op); } - rect.Y = this._Top + this._TitleHeight; - m_sf.Alignment = StringAlignment.Far; foreach (STNodeOption op in this._OutputOptions) { - brush.Color = op.TextColor;// this._ForeColor; - dt.Graphics.DrawString(op.Text, this._Font, brush, rect, m_sf); - op.DotLeft = this.Left + this.Width - 5; - op.DotTop = rect.Y + 5; - Point pt = this.OnSetOptionLocation(op); - op.DotLeft = pt.X; - op.DotTop = pt.Y; this.OnDrawOptionDot(dt, op); - rect.Y += m_nItemHeight; + this.OnDrawOptionText(dt, op); } if (this._Controls.Count != 0) { //绘制子控件 //将坐标原点与节点对齐 @@ -655,12 +653,38 @@ namespace ST.Library.UI } } /// - /// 当计算Option位置时候发生 + /// 绘制选项的文本 + /// + /// 绘制工具 + /// 指定的选项 + protected virtual void OnDrawOptionText(DrawingTools dt, STNodeOption op) { + Graphics g = dt.Graphics; + SolidBrush brush = dt.SolidBrush; + if (op.IsInput) { + m_sf.Alignment = StringAlignment.Near; + } else { + m_sf.Alignment = StringAlignment.Far; + } + brush.Color = op.TextColor; + g.DrawString(op.Text, this.Font, brush, op.TextRectangle, m_sf); + } + /// + /// 当计算Option连线点位置时候发生 /// /// 需要计算的Option + /// 自动计算出的位置 /// 新的位置 - protected virtual Point OnSetOptionLocation(STNodeOption op) { - return new Point(op.DotLeft, op.DotTop); + protected virtual Point OnSetOptionDotLocation(STNodeOption op, Point pt) { + return pt; + } + /// + /// 当计算Option文本区域时候发生 + /// + /// 需要计算的Option + /// 自动计算出的区域 + /// 新的区域 + protected virtual Rectangle OnSetOptionTextRectangle(STNodeOption op, Rectangle rect) { + return rect; } /// /// 计算当前Node所需要的矩形区域 @@ -712,6 +736,7 @@ namespace ST.Library.UI /// /// 保存时候的数据 protected internal virtual void OnLoadNode(Dictionary dic) { + if (dic.ContainsKey("Guid")) this._Guid = new Guid(dic["Guid"]); if (dic.ContainsKey("Left")) this._Left = BitConverter.ToInt32(dic["Left"], 0); if (dic.ContainsKey("Top")) this._Top = BitConverter.ToInt32(dic["Top"], 0); if (dic.ContainsKey("Mark")) { @@ -721,6 +746,12 @@ namespace ST.Library.UI if (dic.ContainsKey("LockOption")) this._LockOption = dic["LockOption"][0] == 1; if (dic.ContainsKey("LockLocation")) this._LockLocation = dic["LockLocation"][0] == 1; } + /// + /// 当编辑器加载完成所有的节点时候发生 + /// + protected internal virtual void OnEditorLoadCompleted() { + + } //[event]===========================[event]==============================[event]============================[event] @@ -821,8 +852,8 @@ namespace ST.Library.UI if (m_ctrl_active != null) m_ctrl_active.OnKeyPress(e); } - protected internal virtual void OnMove(EventArgs e) { } - protected internal virtual void OnResize(EventArgs e) { } + protected internal virtual void OnMove(EventArgs e) { this.SetOptionLocation(); } + protected internal virtual void OnResize(EventArgs e) { this.SetOptionLocation(); } /// @@ -840,6 +871,26 @@ namespace ST.Library.UI #endregion protected + private void SetOptionLocation() { + Rectangle rect = new Rectangle(this.Left + 10, this._Top + this._TitleHeight, this._Width - 20, m_nItemHeight); + foreach (STNodeOption op in this._InputOptions) { + Point pt = this.OnSetOptionDotLocation(op, new Point(this.Left - 5, rect.Y + 5)); + op.TextRectangle = this.OnSetOptionTextRectangle(op, rect); + op.DotLeft = pt.X; + op.DotTop = pt.Y; + rect.Y += m_nItemHeight; + } + rect.Y = this._Top + this._TitleHeight; + m_sf.Alignment = StringAlignment.Far; + foreach (STNodeOption op in this._OutputOptions) { + Point pt = this.OnSetOptionDotLocation(op, new Point(this._Left + this._Width - 5, rect.Y + 5)); + op.TextRectangle = this.OnSetOptionTextRectangle(op, rect); + op.DotLeft = pt.X; + op.DotTop = pt.Y; + rect.Y += m_nItemHeight; + } + } + /// /// 重绘Node /// diff --git a/ST.Library.UI/STNodeEditor/STNodeCollection.cs b/ST.Library.UI/STNodeEditor/STNodeCollection.cs index 18eac67..6d23e01 100755 --- a/ST.Library.UI/STNodeEditor/STNodeCollection.cs +++ b/ST.Library.UI/STNodeEditor/STNodeCollection.cs @@ -27,7 +27,7 @@ namespace ST.Library.UI if (-1 == nIndex) { nIndex = this._Count; node.Owner = m_owner; - node.BuildSize(true, true, false); + //node.BuildSize(true, true, false); m_nodes[this._Count++] = node; m_owner.BuildBounds(); m_owner.OnNodeAdded(new STNodeEditorEventArgs(node)); @@ -87,7 +87,7 @@ namespace ST.Library.UI node.Owner = m_owner; m_nodes[nIndex] = node; this._Count++; - node.BuildSize(true, true,false); + //node.BuildSize(true, true,false); m_owner.Invalidate(); m_owner.BuildBounds(); } @@ -225,5 +225,12 @@ namespace ST.Library.UI IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } + + public STNode[] ToArray() { + STNode[] nodes = new STNode[this._Count]; + for (int i = 0; i < nodes.Length; i++) + nodes[i] = m_nodes[i]; + return nodes; + } } } diff --git a/ST.Library.UI/STNodeEditor/STNodeEditor.cs b/ST.Library.UI/STNodeEditor/STNodeEditor.cs index b8b0597..aaed817 100755 --- a/ST.Library.UI/STNodeEditor/STNodeEditor.cs +++ b/ST.Library.UI/STNodeEditor/STNodeEditor.cs @@ -10,6 +10,7 @@ using System.Drawing.Drawing2D; using System.Threading; using System.ComponentModel; using System.Reflection; +using System.IO.Compression; /* MIT License @@ -632,11 +633,12 @@ namespace ST.Library.UI g.TranslateTransform(this._CanvasOffsetX, this._CanvasOffsetY); //移动坐标系 g.ScaleTransform(this._CanvasScale, this._CanvasScale); //缩放绘图表面 - this.OnDrawNode(m_drawing_tools, this.ControlToCanvas(this.ClientRectangle)); this.OnDrawConnectedLine(m_drawing_tools); + this.OnDrawNode(m_drawing_tools, this.ControlToCanvas(this.ClientRectangle)); if (m_ca == CanvasAction.ConnectOption) { //如果正在连线 m_drawing_tools.Pen.Color = this._HighLineColor; + g.SmoothingMode = SmoothingMode.HighQuality; if (m_option_down.IsInput) this.DrawBezier(g, m_drawing_tools.Pen, m_pt_in_canvas, m_pt_dot_down, this._Curvature); else @@ -777,21 +779,23 @@ namespace ST.Library.UI this.OnHoverChanged(new EventArgs()); bRedraw = true; } - if (this._HoverNode != null) + if (this._HoverNode != null) { this._HoverNode.OnMouseMove(new MouseEventArgs(e.Button, e.Clicks, (int)m_pt_in_canvas.X - this._HoverNode.Left, (int)m_pt_in_canvas.Y - this._HoverNode.Top, e.Delta)); - - GraphicsPath gp = null; - foreach (var v in m_dic_gp_info) { //判断鼠标是否悬停到连线路径上 - if (v.Key.IsOutlineVisible(m_pt_in_canvas, m_p_line_hover)) { - gp = v.Key; - break; + m_gp_hover = null; + } else { + GraphicsPath gp = null; + foreach (var v in m_dic_gp_info) { //判断鼠标是否悬停到连线路径上 + if (v.Key.IsOutlineVisible(m_pt_in_canvas, m_p_line_hover)) { + gp = v.Key; + break; + } + } + if (m_gp_hover != gp) { + m_gp_hover = gp; + bRedraw = true; } - } - if (m_gp_hover != gp) { - m_gp_hover = gp; - bRedraw = true; } if (bRedraw) this.Invalidate(); } @@ -942,7 +946,7 @@ namespace ST.Library.UI //var rect_canvas_display = this.ControlToCanvas(rect); Image img_border = null; foreach (STNode n in this._Nodes) { - n.CheckSize(dt); + //n.CheckSize(dt); img_border = m_img_border; if (this._ShowBorder) { //如果绘制边框 判断状态 if (this._ActiveNode == n) img_border = m_img_border_active; @@ -1701,24 +1705,26 @@ namespace ST.Library.UI Dictionary dic = new Dictionary(); s.Write(new byte[] { (byte)'S', (byte)'T', (byte)'N', (byte)'D' }, 0, 4); //file head s.WriteByte(1); //ver - s.Write(BitConverter.GetBytes(this._CanvasOffsetX), 0, 4); - s.Write(BitConverter.GetBytes(this._CanvasOffsetY), 0, 4); - s.Write(BitConverter.GetBytes(this._CanvasScale), 0, 4); - s.Write(BitConverter.GetBytes(this._Nodes.Count), 0, 4); - foreach (STNode node in this._Nodes) { - try { - byte[] byNode = node.GetSaveData(); - s.Write(BitConverter.GetBytes(byNode.Length), 0, 4); - s.Write(byNode, 0, byNode.Length); - foreach (STNodeOption op in node.InputOptions) dic.Add(op, dic.Count); - foreach (STNodeOption op in node.OutputOptions) dic.Add(op, dic.Count); - } catch (Exception ex) { - throw new Exception("获取节点数据出错-" + node.Title, ex); + using (GZipStream gs = new GZipStream(s, CompressionMode.Compress)) { + gs.Write(BitConverter.GetBytes(this._CanvasOffsetX), 0, 4); + gs.Write(BitConverter.GetBytes(this._CanvasOffsetY), 0, 4); + gs.Write(BitConverter.GetBytes(this._CanvasScale), 0, 4); + gs.Write(BitConverter.GetBytes(this._Nodes.Count), 0, 4); + foreach (STNode node in this._Nodes) { + try { + byte[] byNode = node.GetSaveData(); + gs.Write(BitConverter.GetBytes(byNode.Length), 0, 4); + gs.Write(byNode, 0, byNode.Length); + foreach (STNodeOption op in node.InputOptions) dic.Add(op, dic.Count); + foreach (STNodeOption op in node.OutputOptions) dic.Add(op, dic.Count); + } catch (Exception ex) { + throw new Exception("获取节点数据出错-" + node.Title, ex); + } } + gs.Write(BitConverter.GetBytes(m_dic_gp_info.Count), 0, 4); + foreach (var v in m_dic_gp_info.Values) + gs.Write(BitConverter.GetBytes(((dic[v.Output] << 32) | dic[v.Input])), 0, 8); } - s.Write(BitConverter.GetBytes(m_dic_gp_info.Count), 0, 4); - foreach (var v in m_dic_gp_info.Values) - s.Write(BitConverter.GetBytes(((dic[v.Output] << 32) | dic[v.Input])), 0, 8); } /// /// 获取画布中内容二进制数据 @@ -1800,42 +1806,53 @@ namespace ST.Library.UI if (BitConverter.ToInt32(byLen, 0) != BitConverter.ToInt32(new byte[] { (byte)'S', (byte)'T', (byte)'N', (byte)'D' }, 0)) throw new InvalidDataException("无法识别的文件类型"); if (s.ReadByte() != 1) throw new InvalidDataException("无法识别的文件版本号"); - s.Read(byLen, 0, 4); - float x = BitConverter.ToSingle(byLen, 0); - s.Read(byLen, 0, 4); - float y = BitConverter.ToSingle(byLen, 0); - s.Read(byLen, 0, 4); - float scale = BitConverter.ToSingle(byLen, 0); - s.Read(byLen, 0, 4); - int nCount = BitConverter.ToInt32(byLen, 0); - Dictionary dic = new Dictionary(); - byte[] byData = null; - for (int i = 0; i < nCount; i++) { - s.Read(byLen, 0, byLen.Length); - nLen = BitConverter.ToInt32(byLen, 0); - byData = new byte[nLen]; - s.Read(byData, 0, byData.Length); - STNode node = this.GetNodeFromData(byData); - try { this._Nodes.Add(node); } catch (Exception ex) { throw new Exception("加载节点出错-" + node.Title, ex); } - foreach (STNodeOption op in node.InputOptions) dic.Add(dic.Count, op); - foreach (STNodeOption op in node.OutputOptions) dic.Add(dic.Count, op); + using (GZipStream gs = new GZipStream(s, CompressionMode.Decompress)) { + gs.Read(byLen, 0, 4); + float x = BitConverter.ToSingle(byLen, 0); + gs.Read(byLen, 0, 4); + float y = BitConverter.ToSingle(byLen, 0); + gs.Read(byLen, 0, 4); + float scale = BitConverter.ToSingle(byLen, 0); + gs.Read(byLen, 0, 4); + int nCount = BitConverter.ToInt32(byLen, 0); + Dictionary dic = new Dictionary(); + byte[] byData = null; + for (int i = 0; i < nCount; i++) { + gs.Read(byLen, 0, byLen.Length); + nLen = BitConverter.ToInt32(byLen, 0); + byData = new byte[nLen]; + gs.Read(byData, 0, byData.Length); + STNode node = null; + try { node = this.GetNodeFromData(byData); } catch (Exception ex) { + throw new Exception("加载节点时发生错误可能数据已损坏\r\n" + ex.Message, ex); + } + try { this._Nodes.Add(node); } catch (Exception ex) { + throw new Exception("加载节点出错-" + node.Title, ex); + } + foreach (STNodeOption op in node.InputOptions) dic.Add(dic.Count, op); + foreach (STNodeOption op in node.OutputOptions) dic.Add(dic.Count, op); + } + gs.Read(byLen, 0, 4); + nCount = BitConverter.ToInt32(byLen, 0); + byData = new byte[8]; + for (int i = 0; i < nCount; i++) { + gs.Read(byData, 0, byData.Length); + long id = BitConverter.ToInt64(byData, 0); + long op_out = id >> 32; + long op_in = (int)id; + dic[op_out].ConnectOption(dic[op_in]); + } + this.ScaleCanvas(scale, 0, 0); + this.MoveCanvas(x, y, false, CanvasMoveArgs.All); } - s.Read(byLen, 0, 4); - nCount = BitConverter.ToInt32(byLen, 0); - byData = new byte[8]; - for (int i = 0; i < nCount; i++) { - s.Read(byData, 0, byData.Length); - long id = BitConverter.ToInt64(byData, 0); - long op_out = id >> 32; - long op_in = (int)id; - dic[op_out].ConnectOption(dic[op_in]); - } - this.ScaleCanvas(scale, 0, 0); - this.MoveCanvas(x, y, false, CanvasMoveArgs.All); this.BuildBounds(); + foreach (STNode node in this._Nodes) node.OnEditorLoadCompleted(); } + private STNode GetNodeFromData(byte[] byData) { int nIndex = 0; + string strModel = Encoding.UTF8.GetString(byData, nIndex + 1, byData[nIndex]); + nIndex += byData[nIndex] + 1; string strGUID = Encoding.UTF8.GetString(byData, nIndex + 1, byData[nIndex]); nIndex += byData[nIndex] + 1; @@ -1854,7 +1871,7 @@ namespace ST.Library.UI nIndex += nLen; dic.Add(strKey, byValue); } - if (!m_dic_type.ContainsKey(strGUID)) throw new TypeLoadException("无法找到类型 {" + strGUID + "} 所在程序集 确保所需程序集已被编辑器正确加载 可通过调用LoadAssembly()加载程序集"); + if (!m_dic_type.ContainsKey(strGUID)) throw new TypeLoadException("无法找到类型 {" + strGUID + "} 所在程序集 确保程序集{" + strModel + "}已被编辑器正确加载 可通过调用LoadAssembly()加载程序集"); Type t = m_dic_type[strGUID]; ; STNode node = (STNode)Activator.CreateInstance(t); node.OnLoadNode(dic); diff --git a/ST.Library.UI/STNodeEditor/STNodeOption.cs b/ST.Library.UI/STNodeEditor/STNodeOption.cs index 8b96550..db11c63 100755 --- a/ST.Library.UI/STNodeEditor/STNodeOption.cs +++ b/ST.Library.UI/STNodeEditor/STNodeOption.cs @@ -103,7 +103,16 @@ namespace ST.Library.UI /// public int DotSize { get { return _DotSize; } - protected internal set { _DotSize = value; } + protected set { _DotSize = value; } + } + + private Rectangle _TextRectangle; + /// + /// 获取当前 Option 文本区域 + /// + public Rectangle TextRectangle { + get { return _TextRectangle; } + internal set { _TextRectangle = value; } } private object _Data; diff --git a/ST.Library.UI/STNodeEditor/STNodeOptionCollection.cs b/ST.Library.UI/STNodeEditor/STNodeOptionCollection.cs index 762a98d..e0902f5 100755 --- a/ST.Library.UI/STNodeEditor/STNodeOptionCollection.cs +++ b/ST.Library.UI/STNodeEditor/STNodeOptionCollection.cs @@ -220,5 +220,12 @@ namespace ST.Library.UI IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } + + public STNodeOption[] ToArray() { + STNodeOption[] ops = new STNodeOption[this._Count]; + for (int i = 0; i < ops.Length; i++) + ops[i] = m_options[i]; + return ops; + } } } \ No newline at end of file diff --git a/WinNodeEditerTest.suo b/WinNodeEditerTest.suo index a85da7b68b11f38e390e427956d8d63faba138a7..732b6f1feff655ac12e59da294b717bfab9c2d6d 100755 GIT binary patch delta 5723 zcmai23s}^}7N234Wr2lQ1QJjlf}o)YNahv8U0D%{bw-0r=rK!4bo})JQirz1P8|Zdm#t2fg~FIny6=(5pAaf!@~q|> z>7M6X3aY>B$IGN+-iH!opeF7r%iv?&}9$OzAW&c=jmGpP>OS{P>>vC(d`0 zWr&8tlho$#UHK8-Ah+4;g;fbMZ+U_r<&8q*pTf$~V=ksp%Ji5CbLe#dr_Ot)t4o&I~4oIDEW~j# zEh`@8+u12}OQ1dV&&IyrSmm&PwoXICtH;rN?;btNmLhvGp$HNMv4cDzAy%di?V>89TEUs;P6)Ns$Poj+#t+rKivr3Ba^8Q<>1kbSzDy zlQj{NY1u`!Qr9Ilt;tlz+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+>=M^w;*ce6I|99 zc5vn!pZ|GkhGOeiqfHD)@Kp9ee1&X`yeX6A!q#Sc@y{CrfXDc_z=SAUJ- u4yOR@lh_c+gBA)Szs31`z+Z5x=j`Nh_Pk3taFtyy#I{rHxj@8Ei diff --git a/WinNodeEditerTest/Demo_Image/STNodeImageInput.cs b/WinNodeEditerTest/Demo_Image/STNodeImageInput.cs index ec54ade..940e237 100755 --- a/WinNodeEditerTest/Demo_Image/STNodeImageInput.cs +++ b/WinNodeEditerTest/Demo_Image/STNodeImageInput.cs @@ -41,8 +41,8 @@ namespace ST.Library.UI.Demo_Image return m_sz; } - protected override Point OnSetOptionLocation(STNodeOption op) { - return new Point(op.DotLeft, this.Top + 35); + protected override Point OnSetOptionDotLocation(STNodeOption op, Point pt) { + return new Point(pt.X, pt.Y + 10); //return base.OnSetOptionLocation(op); } diff --git a/WinNodeEditerTest/Form1.cs b/WinNodeEditerTest/Form1.cs index 7102db6..2bdce0f 100755 --- a/WinNodeEditerTest/Form1.cs +++ b/WinNodeEditerTest/Form1.cs @@ -80,8 +80,8 @@ namespace ST.Library.UI OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "*.stn|*.stn"; if (ofd.ShowDialog() != DialogResult.OK) return; - stNodeEditor1.LoadCanvas(ofd.FileName); stNodeEditor1.Nodes.Clear(); + stNodeEditor1.LoadCanvas(ofd.FileName); } } } diff --git a/WinNodeEditerTest/Form2.Designer.cs b/WinNodeEditerTest/Form2.Designer.cs new file mode 100755 index 0000000..5392566 --- /dev/null +++ b/WinNodeEditerTest/Form2.Designer.cs @@ -0,0 +1,96 @@ +namespace ST.Library.UI +{ + partial class Form2 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(0, 0); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 0; + this.button1.Text = "button1"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(0, 29); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 1; + this.button2.Text = "button2"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button3 + // + this.button3.Location = new System.Drawing.Point(0, 58); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(75, 23); + this.button3.TabIndex = 2; + this.button3.Text = "button3"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button4 + // + this.button4.Location = new System.Drawing.Point(0, 87); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(75, 23); + this.button4.TabIndex = 3; + this.button4.Text = "button4"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // Form2 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(292, 273); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Name = "Form2"; + this.Text = "Form2"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + } +} \ No newline at end of file diff --git a/WinNodeEditerTest/Form2.cs b/WinNodeEditerTest/Form2.cs new file mode 100755 index 0000000..c8457af --- /dev/null +++ b/WinNodeEditerTest/Form2.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace ST.Library.UI +{ + public partial class Form2 : Form + { + public Form2() { + InitializeComponent(); + } + + Graphics m_g; + + private void button1_Click(object sender, EventArgs e) { + m_g = this.CreateGraphics(); + } + + private void button2_Click(object sender, EventArgs e) { + m_g.DrawRectangle(Pens.Red, 10, 10, 30, 30); + } + + private void button3_Click(object sender, EventArgs e) { + m_g.DrawRectangle(Pens.Yellow, 45, 45, 20, 20); + } + + private void button4_Click(object sender, EventArgs e) { + this.CreateGraphics().FillRectangle(Brushes.Black, 20, 20, 20, 20); + } + } +} diff --git a/WinNodeEditerTest/Form2.resx b/WinNodeEditerTest/Form2.resx new file mode 100755 index 0000000..29dcb1b --- /dev/null +++ b/WinNodeEditerTest/Form2.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WinNodeEditerTest/NodeNumberAdd.cs b/WinNodeEditerTest/NodeNumberAdd.cs index d2c12e4..7d30aa9 100755 --- a/WinNodeEditerTest/NodeNumberAdd.cs +++ b/WinNodeEditerTest/NodeNumberAdd.cs @@ -28,7 +28,7 @@ namespace ST.Library.UI //当有数据传入时 void m_in_num_DataTransfer(object sender, STNodeOptionEventArgs e) { //判断连线是否是连接状态(建立连线 断开连线 都会触发该事件) - if (e.Status == ConnectionStatus.Connected) { + if (e.Status == ConnectionStatus.Connected && e.TargetOption.Data != null) { if (sender == m_in_num1) m_nNum1 = (int)e.TargetOption.Data;//TargetOption为触发此事件的Option else diff --git a/WinNodeEditerTest/WinNodeEditerTest.csproj b/WinNodeEditerTest/WinNodeEditerTest.csproj index 67964b8..b13a2df 100755 --- a/WinNodeEditerTest/WinNodeEditerTest.csproj +++ b/WinNodeEditerTest/WinNodeEditerTest.csproj @@ -64,6 +64,12 @@ Form1.cs + + Form + + + Form2.cs + @@ -73,6 +79,9 @@ Form1.cs + + Form2.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/docs/doc.html b/docs/doc.html index acc910b..ab585a2 100755 --- a/docs/doc.html +++ b/docs/doc.html @@ -88,7 +88,7 @@ - 最后编辑时间 2020-12-30 + 最后编辑时间 2021-01-21

概述

@@ -595,21 +595,40 @@ void OnDrawMark(DrawingTools dt) dt绘制工具 - -   - 当计算Option位置时候发生 - Point OnSetOptionLocation(STNodeOption op) - - op需要计算的Option - -   +   绘制选项连线的点 void OnDrawOptionDot(DrawingTools dt, STNodeOption op) dt绘制工具 - op指定的选项 + op需要绘制的Option +   + 绘制选项的文本 + void OnDrawOptionText(DrawingTools dt, STNodeOption op) + + dt绘制工具 + + + op需要绘制的Option + +   + 当计算Option连线点位置时候发生 + Point OnSetOptionDotLocation(STNodeOption op, Point pt) + + op需要计算的Option + + + op自动计算出的位置 + +   + 当计算Option文本区域时候发生 + Rectangle OnSetOptionTextRectangle(STNodeOption op, Rectangle rect) + + op需要计算的Option + + + op自动计算出的区域   计算当前Node所需要的矩形区域 @@ -634,13 +653,18 @@ 当需要保存时候 此Node有哪些需要额外保存的数据 void OnSaveNode(Dictionary<string, byte[]>) - 保存时并不会进行序列化 仅自动保存Mark属性 还原时候仅重新通过空参数构造器创建此Node + + dic需要保存的数据 + + 保存时并不会进行序列化 仅自动保存部分(Guid,Left,Top,Mark,LockOption,LockLocation)属性 还原时候仅重新通过空参数构造器创建此Node
然后调用OnLoadNode()将保存的数据进行还原
- void OnLoadNode(Dictionary dic) + void OnLoadNode(Dictionary<string, byte[]> dic) dic保存时候的数据   + 当编辑器加载完成所有的节点时候发生 + void OnEditorLoadCompleted()
protected override void OnSaveNode(Dictionary<string, byte[]>) {
     dic.Add("count", BitConverter.GetBytes(this.InputOptionsCount));