From fa577fd8d4e73e258ededa6462f80bb5c0358898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toan=20Tr=E1=BA=A7n?= Date: Sat, 4 Mar 2017 00:22:06 +0700 Subject: [PATCH] 2036: Update follow new map --- sources/RoboforkApp/DesignerCanvas.cs | 93 +++++++++++++++--------------- sources/RoboforkApp/RoboforkMenu.xaml | 14 ++--- sources/RoboforkApp/RoboforkMenu.xaml.cs | 99 ++++++++++++++++++++++++++++++++ 3 files changed, 154 insertions(+), 52 deletions(-) diff --git a/sources/RoboforkApp/DesignerCanvas.cs b/sources/RoboforkApp/DesignerCanvas.cs index e258dbf..9ddecfe 100644 --- a/sources/RoboforkApp/DesignerCanvas.cs +++ b/sources/RoboforkApp/DesignerCanvas.cs @@ -703,52 +703,55 @@ namespace RoboforkApp /// public void MakeRoot() { - LineGeometry lineGeometry; - EllipseGeometry ellipseGeometry; - Point startPoint; - Point endPoint; + //LineGeometry lineGeometry; + //EllipseGeometry ellipseGeometry; + //Point startPoint; + //Point endPoint; // If still not route if (gGrpLine.Children.Count == 0) return; - // Setting for path line - pRootLine.Stroke = new SolidColorBrush(Colors.Red); - pRootLine.StrokeThickness = STROKE_ROOT_LINE; - pRootLine.Data = gGrpRootLine; - this.Children.Add(pRootLine); + pLine.Stroke = new SolidColorBrush(Colors.Red); + pLine.StrokeThickness = STROKE_ROOT_LINE; + + //// Setting for path line + //pRootLine.Stroke = new SolidColorBrush(Colors.Red); + //pRootLine.StrokeThickness = STROKE_ROOT_LINE; + //pRootLine.Data = gGrpRootLine; + //this.Children.Add(pRootLine); // Setting for path curver line - pCurverLine.StrokeThickness = STROKE_ROOT_LINE; + //pCurverLine.StrokeThickness = STROKE_ROOT_LINE; - // Get start point - lineGeometry = (LineGeometry)gGrpLine.Children[0]; - startPoint = lineGeometry.StartPoint; + //// Get start point + //lineGeometry = (LineGeometry)gGrpLine.Children[0]; + //startPoint = lineGeometry.StartPoint; - for (int i = 0; i < gGrpYellowNode.Children.Count; i = i + 2) - { - ellipseGeometry = (EllipseGeometry)gGrpYellowNode.Children[i]; - endPoint = ellipseGeometry.Center; + //for (int i = 0; i < gGrpYellowNode.Children.Count; i = i + 2) + //{ + // ellipseGeometry = (EllipseGeometry)gGrpYellowNode.Children[i]; + // endPoint = ellipseGeometry.Center; - DrawLine(startPoint, endPoint, gGrpRootLine); + // DrawLine(startPoint, endPoint, gGrpRootLine); - ellipseGeometry = (EllipseGeometry)gGrpYellowNode.Children[i + 1]; - startPoint = ellipseGeometry.Center; - } + // ellipseGeometry = (EllipseGeometry)gGrpYellowNode.Children[i + 1]; + // startPoint = ellipseGeometry.Center; + //} - lineGeometry = (LineGeometry)gGrpLine.Children[gGrpLine.Children.Count - 1]; - endPoint = lineGeometry.EndPoint; + //lineGeometry = (LineGeometry)gGrpLine.Children[gGrpLine.Children.Count - 1]; + //endPoint = lineGeometry.EndPoint; - DrawLine(startPoint, endPoint, gGrpRootLine); + //DrawLine(startPoint, endPoint, gGrpRootLine); - this.Children.Remove(pYellowNode); - this.Children.Remove(pBlueNode); - this.Children.Remove(_startPoint); - this.Children.Remove(_goalPoint); - this.Children.Add(pYellowNode); - this.Children.Add(pBlueNode); - this.Children.Add(_startPoint); - this.Children.Add(_goalPoint); + //this.Children.Remove(pYellowNode); + //this.Children.Remove(pBlueNode); + //this.Children.Remove(_startPoint); + //this.Children.Remove(_goalPoint); + //this.Children.Add(pYellowNode); + //this.Children.Add(pBlueNode); + //this.Children.Add(_startPoint); + //this.Children.Add(_goalPoint); } /// @@ -904,20 +907,20 @@ namespace RoboforkApp endPoint = new Point(newLine.StartPoint.X + radius, newLine.StartPoint.Y); } - // Setting sweep direction - SweepDirection sweepDirection = SweepDirection.Clockwise; - if (IsVerticalLine(oldLine) && ((startPoint.Y - endPoint.Y) * (startPoint.X - endPoint.X)) > 0) - { - sweepDirection = SweepDirection.Counterclockwise; - } - - if (!IsVerticalLine(oldLine) && ((startPoint.Y - endPoint.Y) * (startPoint.X - endPoint.X)) < 0) - { - sweepDirection = SweepDirection.Counterclockwise; - } + //// Setting sweep direction + //SweepDirection sweepDirection = SweepDirection.Clockwise; + //if (IsVerticalLine(oldLine) && ((startPoint.Y - endPoint.Y) * (startPoint.X - endPoint.X)) > 0) + //{ + // sweepDirection = SweepDirection.Counterclockwise; + //} + + //if (!IsVerticalLine(oldLine) && ((startPoint.Y - endPoint.Y) * (startPoint.X - endPoint.X)) < 0) + //{ + // sweepDirection = SweepDirection.Counterclockwise; + //} - // Add curver line - DrawCurverLine(startPoint, endPoint, sweepDirection, gGrpCurverLine); + //// Add curver line + //DrawCurverLine(startPoint, endPoint, sweepDirection, gGrpCurverLine); // Add node to postion distance 1300mm AddNode(startPoint, gGrpYellowNode); diff --git a/sources/RoboforkApp/RoboforkMenu.xaml b/sources/RoboforkApp/RoboforkMenu.xaml index 03e684c..49e2c7b 100644 --- a/sources/RoboforkApp/RoboforkMenu.xaml +++ b/sources/RoboforkApp/RoboforkMenu.xaml @@ -40,12 +40,12 @@ - + + + + + + - +