| | |
| | | using Hydro.MapView; |
| | | using Hydro.MapView.Common; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Drawing; |
| | |
| | | var p1 = WorldPointToMapPoint(link.StartNode, template.OffSet); |
| | | var p2 = WorldPointToMapPoint(link.EndNode, template.OffSet); |
| | | if (!isVisible(p1) && !isVisible(p2)) continue; |
| | | if (_LinkColour != null) |
| | | if (LinkColour != null) |
| | | { |
| | | pen0.Color = penClosed.Color = GraphHelper.getLinkColor(_LinkColour, link); |
| | | pen0.Color = penClosed.Color = GraphHelper.getLinkColor(LinkColour, link); |
| | | } |
| | | |
| | | Pen pen = pen0; |
| | |
| | | dict_point.Add(ps_20); |
| | | //var x = junction.Position.X * zoom + PanningOffset.X - radius / 2.0f; |
| | | //var y = junction.Position.Y * zoom + PanningOffset.Y - radius / 2.0f; |
| | | if (_NodeColour != null) |
| | | if (NodeColour != null) |
| | | { |
| | | pen.Color = penChoosed.Color = GraphHelper.getNodeColor(_NodeColour, node); |
| | | pen.Color = penChoosed.Color = GraphHelper.getNodeColor(NodeColour, node); |
| | | brush = pen.Brush; |
| | | brushChoosed = penChoosed.Brush; |
| | | |
| | |
| | | dict_point.Add(ps_20); |
| | | //var x = junction.Position.X * zoom + PanningOffset.X - radius / 2.0f; |
| | | //var y = junction.Position.Y * zoom + PanningOffset.Y - radius / 2.0f; |
| | | if (_NodeColour != null) |
| | | if (NodeColour != null) |
| | | { |
| | | pen.Color = GraphHelper.getNodeColor(_NodeColour, node); |
| | | pen.Color = GraphHelper.getNodeColor(NodeColour, node); |
| | | brush = pen.Brush; |
| | | brushChoosed = penChoosed.Brush; |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | |
| | | 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); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | return new PointF3D(position3D.X, position3D.Y, position3D.Z+ dz); |
| | | |
| | | } |
| | | |
| | | private PointF MapPointToWorldPoint(PointF3D point) |
| | | { |
| | | return MapPointToWorldPoint(new PointF(point.X, point.Y), point.Z); |
| | |
| | | /// <param name="point"></param> |
| | | /// <param name="z"></param> |
| | | /// <returns></returns> |
| | | private PointF MapPointToWorldPoint(PointF point, float z = 0) |
| | | public PointF MapPointToWorldPoint(PointF point, float z = 0) |
| | | { |
| | | var pointT = Get俯视角还原Point(point, z); |
| | | pointT = Get平面还原Point(pointT); |