From 215965cada89ff0f5fd5acebbfe091585dc1b9c4 Mon Sep 17 00:00:00 2001
From: cloudflight <cloudflight@126.com>
Date: 星期三, 08 五月 2024 10:40:51 +0800
Subject: [PATCH] 提交2024年5月8日

---
 WinfrmUI/Hydro.MapUI/Map/MapViewer.Draw.cs |   48 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/WinfrmUI/Hydro.MapUI/Map/MapViewer.Draw.cs b/WinfrmUI/Hydro.MapUI/Map/MapViewer.Draw.cs
index 48b3d60..e04d803 100644
--- a/WinfrmUI/Hydro.MapUI/Map/MapViewer.Draw.cs
+++ b/WinfrmUI/Hydro.MapUI/Map/MapViewer.Draw.cs
@@ -1,4 +1,5 @@
 锘縰sing Hydro.MapView;
+using Hydro.MapView.Common;
 using System;
 using System.Collections.Generic;
 using System.Drawing;
@@ -588,7 +589,18 @@
                     using (var pen = new Pen(Color.Black, 1 * r))
                     {
                         pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
-                        bufferG.DrawLine(pen, WorldPointToMapPoint(_select_junction1), _MousePosition);
+                        if (mapOption.IsOrtho)
+                        {
+                            var wPos = GetZZWorldPoint(_select_junction1.Position3D, _MousePosition, new Vector3(1, 1, 0));
+                            //getPointAndHeight(e, _select_junction1, out p, out z);
+                            var mapPos= WorldPointToMapPoint(wPos);
+                            bufferG.DrawLine(pen, WorldPointToMapPoint(_select_junction1), mapPos);
+                        }
+                        else
+                        {
+                            bufferG.DrawLine(pen, WorldPointToMapPoint(_select_junction1), _MousePosition);
+                        }
+                        
                     }
                 }
             }
@@ -792,7 +804,39 @@
             }
             else
             {
-                return new PointF3D(0, 0, 0);
+                var p2=MapPointToWorldPoint(mousePosition, position3D.Z);
+                var vector = new Vector2(p2.X - position3D.X, p2.Y - position3D.Y);
+                //鍒ゆ柇浜岀淮鍚戦噺vector鍦ㄧ鍑犺薄闄愶紝璺濈鍝釜杞存渶杩�
+                var x = vector.X;
+                var y = vector.Y;
+                var x1 = Math.Abs(x);
+                var y1 = Math.Abs(y);
+                if (x1 > y1)
+                {
+                    if (x > 0)
+                    {
+                        //绗竴璞¢檺
+                        return new PointF3D(position3D.X + Math.Abs(x), position3D.Y, position3D.Z);
+                    }
+                    else
+                    {
+                        //绗笁璞¢檺
+                        return new PointF3D(position3D.X - Math.Abs(x), position3D.Y, position3D.Z);
+                    }
+                }
+               else
+                {
+                    if (y > 0)
+                    {
+                        //绗簩璞¢檺
+                        return new PointF3D(position3D.X, position3D.Y + Math.Abs(y), position3D.Z);
+                    }
+                    else
+                    {
+                        //绗洓璞¢檺
+                        return new PointF3D(position3D.X, position3D.Y - Math.Abs(y), position3D.Z);
+                    }
+                }
             }
         }
 

--
Gitblit v1.9.3