From 5fa6947054206e2e781eadd4effdcdf52eda28c4 Mon Sep 17 00:00:00 2001 From: cloudflight <cloudflight@126.com> Date: 星期二, 26 十二月 2023 11:02:28 +0800 Subject: [PATCH] 2023年12月26日 --- Hydro.MapView/Base/LinkViewModel.cs | 41 +++++++++++++---------------------------- 1 files changed, 13 insertions(+), 28 deletions(-) diff --git a/Hydro.MapView/Base/LinkViewModel.cs b/Hydro.MapView/Base/LinkViewModel.cs index d358281..9158c55 100644 --- a/Hydro.MapView/Base/LinkViewModel.cs +++ b/Hydro.MapView/Base/LinkViewModel.cs @@ -14,6 +14,7 @@ namespace Hydro.MapView { + [Serializable] public class LinkViewModel : LinkCalcModel, IBaseViewModel { public LinkViewModel() @@ -24,30 +25,24 @@ { StartNode = new NodeViewModel(startPoint); EndNode = new NodeViewModel(endPoint); - Points = new List<PointF>() { startPoint, endPoint }; + //Points = new List<PointF>() { startPoint, endPoint }; } public LinkViewModel(PointF startPoint, PointF endPoint, List<PointF> points) { StartNode = new NodeViewModel(startPoint); EndNode = new NodeViewModel(endPoint); - Points = points; + //Points = points; } - //private string Node1; - [Category("1銆佸熀鏈俊鎭�")] [DisplayName("鑺傜偣1")] [Browsable(true)] - public new string Node1 + public string Node1 { get { - if (StartNode != null && base.Node1 != StartNode.ID) - { - base.Node1 = StartNode.ID; - } return base.Node1; } set @@ -56,20 +51,15 @@ base.Node1 = value; } } - //private string Node2; [Category("1銆佸熀鏈俊鎭�")] [DisplayName("鑺傜偣2")] [Browsable(true)] - public new string Node2 + public string Node2 { get { - if (EndNode != null && base.Node2 != EndNode.ID) - { - base.Node2 = EndNode.ID; - } return base.Node2; } set @@ -81,22 +71,17 @@ [Browsable(false)] [JsonIgnore] - public NodeViewModel StartNode { get; set; } + public NodeViewModel StartNode { get { return (NodeViewModel)base.StartNode; } set { base.StartNode = value; } } [Browsable(false)] [JsonIgnore] - public NodeViewModel EndNode { get; set; } + public NodeViewModel EndNode { get { return (NodeViewModel)base.EndNode; } set { base.EndNode = value; } } private PointF _position { get; set; } = new PointF(0, 0); public PointF Position { get { - //if (StartPoint.Position==new PointF(0,0) || EndPoint.Position == new PointF(0, 0)) - //{ - // return new PointF(0,0); - //} - //if (_position == new PointF(0, 0)) { if (StartNode == null || EndNode == null) return _position; var x = (StartNode.Position.X + EndNode.Position.X) / 2; @@ -107,16 +92,16 @@ } return _position; } - set - { - _position = value; + set + { } + } [Browsable(false)] - public List<PointF> Points { get; set; } + public List<PointF> Points { get { return new List<PointF>() { StartNode.Position, EndNode.Position }; } } public PointF[] ToArray(bool is3Dview = false) { if (!is3Dview) @@ -218,7 +203,7 @@ } set { - Position = new PointF(value, Position.Y); + //Position = new PointF(value, Position.Y); } } [Category("1銆佸熀鏈俊鎭�")] @@ -233,7 +218,7 @@ } set { - Position = new PointF(Position.X, value); + //Position = new PointF(Position.X, value); } } -- Gitblit v1.9.3