| | |
| | | using DevExpress.XtraPrinting.Native; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | void DrawBackGroud(Graphics bufferG, Settings template) |
| | | { |
| | | if (template == null) return; |
| | | |
| | | |
| | | var _Nodes = _network.Nodes.ViewNodes; |
| | | var _Links = _network.Links.ViewLinks; |
| | | |
| | |
| | | float radius = 5 * r; |
| | | float diameter = radius * 2; |
| | | #region 圆形拆分 |
| | | |
| | | |
| | | List<PointF> p = new List<PointF>(); |
| | | Cpoints.ForEach(cp => p.Add(GraphHelper.getRotatePoint(c.X + cp.X * radius - radius, c.Y + cp.Y * radius, c, p1, p2))); |
| | | |
| | |
| | | |
| | | bufferG.FillPolygon(link.Selected ? pen_valveChoosed.Brush : pen.Brush, p.ToArray()); |
| | | |
| | | |
| | | |
| | | |
| | | // 绘制连接线 |
| | | |
| | |
| | | break; |
| | | } |
| | | if (zoomAtMin >= zoom) continue; |
| | | |
| | | |
| | | if (node == _OperaNode) |
| | | { |
| | | //bufferG.DrawEllipse(junction.Choosed ? penChoosed : pen, rectangle); |
| | |
| | | p2 = new PointF(p1.X + 6 * pr, p1.Y - 6 * pr); |
| | | bufferG.DrawLine(node.Selected ? penChoosed : pen, p1, p2); |
| | | |
| | | |
| | | |
| | | } |
| | | else if (node is TankViewModel) |
| | | { |
| | |
| | | // 根据旋转角度计算旋转后的坐标 |
| | | private PointF Get平面旋转Point(PointF p, PointF MapC) |
| | | { |
| | | |
| | | PointF center = MapC ; |
| | | |
| | | PointF center = MapC; |
| | | double radian = Rotation * Math.PI / 180; // 角度转弧度 |
| | | float x = (float)(Math.Cos(radian) * (p.X - center.X) - Math.Sin(radian) * (p.Y - center.Y) + center.X); |
| | | float y = (float)(Math.Sin(radian) * (p.X - center.X) + Math.Cos(radian) * (p.Y - center.Y) + center.Y); |
| | |
| | | /// <returns></returns> |
| | | public PointF MapPointToWorldPoint(PointF point, float z = 0) |
| | | { |
| | | var pointT = Get俯视角还原Point(point, z,MapCenter); |
| | | var pointT = Get俯视角还原Point(point, z, MapCenter); |
| | | pointT = Get平面还原Point(pointT, MapCenter); |
| | | |
| | | //var n=new PointF((float)pointR.X - Z(z).X, (float)(pointR.Y - Z(z).Y)); |
| | |
| | | #endregion |
| | | |
| | | #region 计算三维相机 |
| | | public PointF3D GetCameraPosition( float distance=1) |
| | | public PointF3D GetCameraPosition(float distance = 1) |
| | | { |
| | | // 将角度转换为弧度 |
| | | float rotationRadians = (float)Rotation * (float)Math.PI / 180; |
| | |
| | | { |
| | | case "左": |
| | | //Rotation为0~180时显示 |
| | | if (RotationF<=90-delta && Rotation >= 0 + delta && Rotation <= 180 - delta) |
| | | if (RotationF <= 90 - delta && Rotation >= 0 + delta && Rotation <= 180 - delta) |
| | | flag = true; |
| | | break; |
| | | case "前": |
| | |
| | | break; |
| | | case "后": |
| | | //Rotation为0~180时显示 |
| | | if (RotationF <= 90 - delta && ((Rotation >= 90 + delta && Rotation<=180)||( Rotation>=-180 && Rotation <= -90 - delta))) |
| | | if (RotationF <= 90 - delta && ((Rotation >= 90 + delta && Rotation <= 180) || (Rotation >= -180 && Rotation <= -90 - delta))) |
| | | flag = true; |
| | | break; |
| | | case "上": |
| | |
| | | |
| | | // 判断面是否朝向相机 |
| | | bool isFacingCamera = dotProduct > 0; |
| | | return isFacingCamera; |
| | | return isFacingCamera; |
| | | } |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 判断可见性 |