void SetTextBlock(syPoChild spc, Point position, bool boolvisible) { if (!boolRunDefaultText) { return; } if (boolvisible) { tbTemp.Text = string.Format(VisibleText, spc.SyX.ToString(), spc.SyY.ToString()); Canvas.SetLeft(tbTemp, position.X - tbTemp.Width / 2); Canvas.SetTop(tbTemp, position.Y / 2 - tbTemp.Height / 2); Canvas.SetZIndex(tbTemp, int.MaxValue); tbTemp.Visibility = Visibility.Visible; } else { tbTemp.Visibility = Visibility.Hidden; } }
void SetTextBlock(syPoChild spc, Point position, bool boolvisible) { if (!boolRunDefaultText) return; if (boolvisible) { tbTemp.Text = string.Format(VisibleText, spc.SyX.ToString(), spc.SyY.ToString()); Canvas.SetLeft(tbTemp, position.X - tbTemp.Width / 2); Canvas.SetTop(tbTemp, position.Y / 2 - tbTemp.Height / 2); Canvas.SetZIndex(tbTemp, int.MaxValue); tbTemp.Visibility = Visibility.Visible; } else { tbTemp.Visibility = Visibility.Hidden; } }
public syPoRelation(syPoChild child, Point p) { syChild = child; syPoint = p; syGuid = System.Guid.NewGuid().ToString(); }
public Point PoChildToPoint(syPoChild syChild, syPoDrawing refCurrPoDrawing) { //Point p=new Point(); double xWide = refCurrPoDrawing.SyXWide; double yWide = refCurrPoDrawing.SyYWide; double DanWeiX = (double)refCurrPoDrawing.SyXValue[1] - (double)refCurrPoDrawing.SyXValue[0]; double DanWeiY = (double)refCurrPoDrawing.SyYValue[1] - (double)refCurrPoDrawing.SyYValue[0]; double NxWide = xWide / DanWeiX; double NyWide = yWide / DanWeiY; double syX = Math.Round(syChild.SyX, 4); double syY = Math.Round(syChild.SyY, 4); int ZhengX = (int)Math.Round(syX, 0); int ZhengY = (int)Math.Round(syY, 0); int Tx = 0; int Ty = 0; for (int i = 0; i < refCurrPoDrawing.SyXValue.Count - 1; i++) { if ((double)refCurrPoDrawing.SyXValue[i] <= ZhengX && ZhengX <= (double)refCurrPoDrawing.SyXValue[i + 1]) { Tx = i +1; break; } } for (int i = 0; i < refCurrPoDrawing.SyYValue.Count - 1; i++) { if ((double)refCurrPoDrawing.SyYValue[i] <= ZhengY && ZhengY <= (double)refCurrPoDrawing.SyYValue[i + 1]) { Ty = i +1 ; break; } } double LingX = 0; try { LingX = syX - (double)refCurrPoDrawing.SyXValue[Tx - 1]; } catch { } double HouJX = Math.Round( NxWide * LingX,4); double LingY = 0; try { LingY = syY - (double)refCurrPoDrawing.SyYValue[Ty - 1]; } catch { } double HouJY = Math.Round(NyWide * LingY,4); //y是反数 double TeY = refCurrPoDrawing.SyYValue.Count - Ty; double QuX = Tx * xWide; double QuY = TeY * yWide; double ZuoX = QuX + HouJX; double ZuoY = QuY - HouJY; ZuoY += refCurrPoDrawing.SyYMarin; ZuoX += refCurrPoDrawing.SyXMarin; ZuoX -= xWide; ZuoY += yWide; return new Point(ZuoX, ZuoY); }
public Point PoChildToPoint(syPoChild syChild, syPoDrawing refCurrPoDrawing) { //Point p=new Point(); double xWide = refCurrPoDrawing.SyXWide; double yWide = refCurrPoDrawing.SyYWide; double DanWeiX = (double)refCurrPoDrawing.SyXValue[1] - (double)refCurrPoDrawing.SyXValue[0]; double DanWeiY = (double)refCurrPoDrawing.SyYValue[1] - (double)refCurrPoDrawing.SyYValue[0]; double NxWide = xWide / DanWeiX; double NyWide = yWide / DanWeiY; double syX = Math.Round(syChild.SyX, 4); double syY = Math.Round(syChild.SyY, 4); int ZhengX = (int)Math.Round(syX, 0); int ZhengY = (int)Math.Round(syY, 0); int Tx = 0; int Ty = 0; for (int i = 0; i < refCurrPoDrawing.SyXValue.Count - 1; i++) { if ((double)refCurrPoDrawing.SyXValue[i] <= ZhengX && ZhengX <= (double)refCurrPoDrawing.SyXValue[i + 1]) { Tx = i + 1; break; } } for (int i = 0; i < refCurrPoDrawing.SyYValue.Count - 1; i++) { if ((double)refCurrPoDrawing.SyYValue[i] <= ZhengY && ZhengY <= (double)refCurrPoDrawing.SyYValue[i + 1]) { Ty = i + 1; break; } } double LingX = 0; try { LingX = syX - (double)refCurrPoDrawing.SyXValue[Tx - 1]; } catch { } double HouJX = Math.Round(NxWide * LingX, 4); double LingY = 0; try { LingY = syY - (double)refCurrPoDrawing.SyYValue[Ty - 1]; } catch { } double HouJY = Math.Round(NyWide * LingY, 4); //y是反数 double TeY = refCurrPoDrawing.SyYValue.Count - Ty; double QuX = Tx * xWide; double QuY = TeY * yWide; double ZuoX = QuX + HouJX; double ZuoY = QuY - HouJY; ZuoY += refCurrPoDrawing.SyYMarin; ZuoX += refCurrPoDrawing.SyXMarin; ZuoX -= xWide; ZuoY += yWide; return(new Point(ZuoX, ZuoY)); }