Commit ef52277ed4d5a1e6c13f1d77d5609c62b257db52
1 parent
d55d921a3b
Exists in
master
開発 #2045 : node の設置の変更
Showing 4 changed files with 26 additions and 22 deletions Inline Diff
sources/RoboforkApp/DesignerCanvas.cs
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Linq; | 3 | using System.Linq; |
4 | using System.Windows; | 4 | using System.Windows; |
5 | using System.Windows.Controls; | 5 | using System.Windows.Controls; |
6 | using System.Windows.Documents; | 6 | using System.Windows.Documents; |
7 | using System.Windows.Input; | 7 | using System.Windows.Input; |
8 | using System.Windows.Markup; | 8 | using System.Windows.Markup; |
9 | using System.Windows.Media; | 9 | using System.Windows.Media; |
10 | using System.Windows.Shapes; | 10 | using System.Windows.Shapes; |
11 | using System.Xml; | 11 | using System.Xml; |
12 | 12 | ||
13 | namespace RoboforkApp | 13 | namespace RoboforkApp |
14 | { | 14 | { |
15 | public class DesignerCanvas : Canvas | 15 | public class DesignerCanvas : Canvas |
16 | { | 16 | { |
17 | const double RADIUS_NODE = 25d; //8d; | 17 | const double RADIUS_NODE = 25d; //8d; |
18 | const double RADIUS_CURVER_LINE = 130d; | 18 | const double RADIUS_CURVER_LINE = 130d; |
19 | const double DISTANCE_AUTO_NODES = 100d; | 19 | const double DISTANCE_AUTO_NODES = 100d; |
20 | const double DISTANCE_START_NODES = 30d; | 20 | const double DISTANCE_START_NODES = 30d; |
21 | const double DISTANCE_END_NODES = 30d; | 21 | const double DISTANCE_END_NODES = 30d; |
22 | const double DISTANCE_FREE_NODES = 40d; | 22 | const double DISTANCE_FREE_NODES = 40d; |
23 | const double STROKE_ROOT_LINE = 6d; | 23 | const double STROKE_ROOT_LINE = 6d; |
24 | const double STROKE_LINE = 4d; | 24 | const double STROKE_LINE = 4d; |
25 | const double STROKE_NODE = 1d; | 25 | const double STROKE_NODE = 1d; |
26 | const double DISTANCE_RATIO = 100; | 26 | const double DISTANCE_RATIO = 100; |
27 | 27 | ||
28 | private List<Rectangle> shapeList = new List<Rectangle>(); | 28 | private List<Rectangle> shapeList = new List<Rectangle>(); |
29 | private TextBlock shapePosIndicator; | 29 | private TextBlock shapePosIndicator; |
30 | private TextBlock shapeSizeIndicator; | 30 | private TextBlock shapeSizeIndicator; |
31 | private int currentLine; | 31 | private int currentLine; |
32 | private ucStartEndButton _startPoint; | 32 | private ucStartEndButton _startPoint; |
33 | private ucStartEndButton _goalPoint; | 33 | private ucStartEndButton _goalPoint; |
34 | private ucDisplayCoordinate _displayAxiPosition; | 34 | private ucDisplayCoordinate _displayAxiPosition; |
35 | 35 | ||
36 | // Add variable for draw route | 36 | // Add variable for draw route |
37 | public Path pLine = new Path(); | 37 | public Path pLine = new Path(); |
38 | public Path pRootLine = new Path(); | 38 | public Path pRootLine = new Path(); |
39 | public Path pCurverLine = new Path(); | 39 | public Path pCurverLine = new Path(); |
40 | public Path pRedNode = new Path(); | 40 | public Path pRedNode = new Path(); |
41 | public Path pYellowNode = new Path(); | 41 | public Path pYellowNode = new Path(); |
42 | public GeometryGroup gGrpLine = new GeometryGroup(); | 42 | public GeometryGroup gGrpLine = new GeometryGroup(); |
43 | public GeometryGroup gGrpRootLine = new GeometryGroup(); | 43 | public GeometryGroup gGrpRootLine = new GeometryGroup(); |
44 | public GeometryGroup gGrpCurverLine = new GeometryGroup(); | 44 | public GeometryGroup gGrpCurverLine = new GeometryGroup(); |
45 | public GeometryGroup gGrpRedNode = new GeometryGroup(); | 45 | public GeometryGroup gGrpRedNode = new GeometryGroup(); |
46 | public GeometryGroup gGrpYellowNode = new GeometryGroup(); | 46 | public GeometryGroup gGrpYellowNode = new GeometryGroup(); |
47 | public int currentShape; | 47 | public int currentShape; |
48 | public static bool isStartDrawRoute = false; | 48 | public static bool isStartDrawRoute = false; |
49 | public static bool isGoalDrawRoute = false; | 49 | public static bool isGoalDrawRoute = false; |
50 | 50 | ||
51 | public struct NodeInfo | 51 | public struct NodeInfo |
52 | { | 52 | { |
53 | public double X; | 53 | public double X; |
54 | public double Y; | 54 | public double Y; |
55 | public String Mode1; | 55 | public String Mode1; |
56 | public String Mode2; | 56 | public String Mode2; |
57 | public String Mode3; | 57 | public String Mode3; |
58 | } | 58 | } |
59 | List<NodeInfo> NodeInfo_List = new List<NodeInfo>(); | 59 | List<NodeInfo> NodeInfo_List = new List<NodeInfo>(); |
60 | 60 | ||
61 | // Add variable for Set Schedule | 61 | // Add variable for Set Schedule |
62 | public Path pScheduleNode = new Path(); | 62 | public Path pScheduleNode = new Path(); |
63 | public Path pScheduleLine = new Path(); | 63 | public Path pScheduleLine = new Path(); |
64 | public GeometryGroup gGrpScheduleNode = new GeometryGroup(); | 64 | public GeometryGroup gGrpScheduleNode = new GeometryGroup(); |
65 | public GeometryGroup gGrpScheduleLine = new GeometryGroup(); | 65 | public GeometryGroup gGrpScheduleLine = new GeometryGroup(); |
66 | 66 | ||
67 | 67 | ||
68 | //2017/03/04 NAM ADD START | 68 | //2017/03/04 NAM ADD START |
69 | public static bool isDrawingNode = false; | 69 | public static bool isDrawingNode = false; |
70 | public Path pNewLine = new Path(); | 70 | public Path pNewLine = new Path(); |
71 | public GeometryGroup gGrpNewLine = new GeometryGroup(); | 71 | public GeometryGroup gGrpNewLine = new GeometryGroup(); |
72 | 72 | ||
73 | public struct NewNodeInfo | 73 | public struct NewNodeInfo |
74 | { | 74 | { |
75 | public double X; | 75 | public double X; |
76 | public double Y; | 76 | public double Y; |
77 | public String Mode; | 77 | public String Mode; |
78 | } | 78 | } |
79 | List<NewNodeInfo> NewNodeInfo_List = new List<NewNodeInfo>(); | 79 | List<NewNodeInfo> NewNodeInfo_List = new List<NewNodeInfo>(); |
80 | List<TextBlock> NodeNo = new List<TextBlock>(); | 80 | List<TextBlock> NodeNo = new List<TextBlock>(); |
81 | List<ucNode> ucNode_Lst = new List<ucNode>(); | 81 | List<ucNode> ucNode_Lst = new List<ucNode>(); |
82 | List<ucNode> ucScheduleNode_Lst = new List<ucNode>(); | ||
82 | int stt = 1; | 83 | int stt = 1; |
83 | //2017/03/04 NAM ADD END | 84 | //2017/03/04 NAM ADD END |
84 | 85 | ||
85 | 86 | ||
86 | public ScheduleCanvas scheduleCanvas; | 87 | public ScheduleCanvas scheduleCanvas; |
87 | 88 | ||
88 | 89 | ||
89 | // Add variable for Set Auto Nodes | 90 | // Add variable for Set Auto Nodes |
90 | public Path pBlueNode = new Path(); | 91 | public Path pBlueNode = new Path(); |
91 | private GeometryGroup gGrpBlueNode = new GeometryGroup(); | 92 | private GeometryGroup gGrpBlueNode = new GeometryGroup(); |
92 | 93 | ||
93 | // Add variable for Set Free Nodes | 94 | // Add variable for Set Free Nodes |
94 | public Path pFreeNode = new Path(); | 95 | public Path pFreeNode = new Path(); |
95 | //private GeometryGroup gGrpFreeNode = new GeometryGroup(); | 96 | //private GeometryGroup gGrpFreeNode = new GeometryGroup(); |
96 | 97 | ||
97 | // The part of the rectangle the mouse is over. | 98 | // The part of the rectangle the mouse is over. |
98 | private enum HitType | 99 | private enum HitType |
99 | { | 100 | { |
100 | None, Body, UL, UR, LR, LL, L, R, T, B | 101 | None, Body, UL, UR, LR, LL, L, R, T, B |
101 | }; | 102 | }; |
102 | public enum OperationState | 103 | public enum OperationState |
103 | { | 104 | { |
104 | None, DrawObstract, DrawRoute, DrawSetFreeNode, EditNode, NewDrawSetFreeNode | 105 | None, DrawObstract, DrawRoute, DrawSetFreeNode, EditNode, NewDrawSetFreeNode |
105 | }; | 106 | }; |
106 | public enum MouseState | 107 | public enum MouseState |
107 | { | 108 | { |
108 | None, Draw, Drag, | 109 | None, Draw, Drag, |
109 | } | 110 | } |
110 | public OperationState Operation = OperationState.None; | 111 | public OperationState Operation = OperationState.None; |
111 | public MouseState mouseState = MouseState.None; | 112 | public MouseState mouseState = MouseState.None; |
112 | 113 | ||
113 | // The draw start point. | 114 | // The draw start point. |
114 | private Point StartDrawPoint; | 115 | private Point StartDrawPoint; |
115 | 116 | ||
116 | // The drag's last point. | 117 | // The drag's last point. |
117 | private Point LastPoint; | 118 | private Point LastPoint; |
118 | 119 | ||
119 | // The part of the rectangle under the mouse. | 120 | // The part of the rectangle under the mouse. |
120 | HitType MouseHitType = HitType.None; | 121 | HitType MouseHitType = HitType.None; |
121 | 122 | ||
122 | public void Init() { | 123 | public void Init() { |
123 | if (shapePosIndicator == null) | 124 | if (shapePosIndicator == null) |
124 | { | 125 | { |
125 | shapePosIndicator = new TextBlock() | 126 | shapePosIndicator = new TextBlock() |
126 | { | 127 | { |
127 | Foreground = Brushes.Black, | 128 | Foreground = Brushes.Black, |
128 | Background = Brushes.Transparent, | 129 | Background = Brushes.Transparent, |
129 | FontSize = 20, | 130 | FontSize = 20, |
130 | }; | 131 | }; |
131 | } | 132 | } |
132 | if (shapeSizeIndicator == null) | 133 | if (shapeSizeIndicator == null) |
133 | { | 134 | { |
134 | shapeSizeIndicator = new TextBlock() | 135 | shapeSizeIndicator = new TextBlock() |
135 | { | 136 | { |
136 | Foreground = Brushes.Black, | 137 | Foreground = Brushes.Black, |
137 | Background = Brushes.Transparent, | 138 | Background = Brushes.Transparent, |
138 | FontSize = 20, | 139 | FontSize = 20, |
139 | }; | 140 | }; |
140 | } | 141 | } |
141 | } | 142 | } |
142 | 143 | ||
143 | // Return a HitType value to indicate what is at the point. | 144 | // Return a HitType value to indicate what is at the point. |
144 | private HitType SetHitType(Point point) | 145 | private HitType SetHitType(Point point) |
145 | { | 146 | { |
146 | if (shapeList.Count == 0) | 147 | if (shapeList.Count == 0) |
147 | { | 148 | { |
148 | currentShape = 0; | 149 | currentShape = 0; |
149 | return HitType.None; | 150 | return HitType.None; |
150 | } | 151 | } |
151 | for (int i = 0; i < shapeList.Count; i++) | 152 | for (int i = 0; i < shapeList.Count; i++) |
152 | { | 153 | { |
153 | Rectangle rect = shapeList[i]; | 154 | Rectangle rect = shapeList[i]; |
154 | double left = Canvas.GetLeft(rect); | 155 | double left = Canvas.GetLeft(rect); |
155 | double top = Canvas.GetTop(rect); | 156 | double top = Canvas.GetTop(rect); |
156 | double right = left + rect.Width; | 157 | double right = left + rect.Width; |
157 | double bottom = top + rect.Height; | 158 | double bottom = top + rect.Height; |
158 | if (point.X < left) continue; | 159 | if (point.X < left) continue; |
159 | if (point.X > right) continue; | 160 | if (point.X > right) continue; |
160 | if (point.Y < top) continue; | 161 | if (point.Y < top) continue; |
161 | if (point.Y > bottom) continue; | 162 | if (point.Y > bottom) continue; |
162 | currentShape = i; | 163 | currentShape = i; |
163 | 164 | ||
164 | const double GAP = 10; | 165 | const double GAP = 10; |
165 | if (point.X - left < GAP) | 166 | if (point.X - left < GAP) |
166 | { | 167 | { |
167 | // Left edge. | 168 | // Left edge. |
168 | if (point.Y - top < GAP) return HitType.UL; | 169 | if (point.Y - top < GAP) return HitType.UL; |
169 | if (bottom - point.Y < GAP) return HitType.LL; | 170 | if (bottom - point.Y < GAP) return HitType.LL; |
170 | return HitType.L; | 171 | return HitType.L; |
171 | } | 172 | } |
172 | if (right - point.X < GAP) | 173 | if (right - point.X < GAP) |
173 | { | 174 | { |
174 | // Right edge. | 175 | // Right edge. |
175 | if (point.Y - top < GAP) return HitType.UR; | 176 | if (point.Y - top < GAP) return HitType.UR; |
176 | if (bottom - point.Y < GAP) return HitType.LR; | 177 | if (bottom - point.Y < GAP) return HitType.LR; |
177 | return HitType.R; | 178 | return HitType.R; |
178 | } | 179 | } |
179 | if (point.Y - top < GAP) return HitType.T; | 180 | if (point.Y - top < GAP) return HitType.T; |
180 | if (bottom - point.Y < GAP) return HitType.B; | 181 | if (bottom - point.Y < GAP) return HitType.B; |
181 | return HitType.Body; | 182 | return HitType.Body; |
182 | } | 183 | } |
183 | currentShape = 0; | 184 | currentShape = 0; |
184 | return HitType.None; | 185 | return HitType.None; |
185 | } | 186 | } |
186 | 187 | ||
187 | // Set a mouse cursor appropriate for the current hit type. | 188 | // Set a mouse cursor appropriate for the current hit type. |
188 | private void SetMouseCursor() | 189 | private void SetMouseCursor() |
189 | { | 190 | { |
190 | // See what cursor we should display. | 191 | // See what cursor we should display. |
191 | Cursor desired_cursor = Cursors.Arrow; | 192 | Cursor desired_cursor = Cursors.Arrow; |
192 | switch (MouseHitType) | 193 | switch (MouseHitType) |
193 | { | 194 | { |
194 | case HitType.None: | 195 | case HitType.None: |
195 | desired_cursor = Cursors.Arrow; | 196 | desired_cursor = Cursors.Arrow; |
196 | break; | 197 | break; |
197 | case HitType.Body: | 198 | case HitType.Body: |
198 | desired_cursor = Cursors.ScrollAll; | 199 | desired_cursor = Cursors.ScrollAll; |
199 | break; | 200 | break; |
200 | case HitType.UL: | 201 | case HitType.UL: |
201 | case HitType.LR: | 202 | case HitType.LR: |
202 | desired_cursor = Cursors.SizeNWSE; | 203 | desired_cursor = Cursors.SizeNWSE; |
203 | break; | 204 | break; |
204 | case HitType.LL: | 205 | case HitType.LL: |
205 | case HitType.UR: | 206 | case HitType.UR: |
206 | desired_cursor = Cursors.SizeNESW; | 207 | desired_cursor = Cursors.SizeNESW; |
207 | break; | 208 | break; |
208 | case HitType.T: | 209 | case HitType.T: |
209 | case HitType.B: | 210 | case HitType.B: |
210 | desired_cursor = Cursors.SizeNS; | 211 | desired_cursor = Cursors.SizeNS; |
211 | break; | 212 | break; |
212 | case HitType.L: | 213 | case HitType.L: |
213 | case HitType.R: | 214 | case HitType.R: |
214 | desired_cursor = Cursors.SizeWE; | 215 | desired_cursor = Cursors.SizeWE; |
215 | break; | 216 | break; |
216 | } | 217 | } |
217 | 218 | ||
218 | // Display the desired cursor. | 219 | // Display the desired cursor. |
219 | if (Cursor != desired_cursor) Cursor = desired_cursor; | 220 | if (Cursor != desired_cursor) Cursor = desired_cursor; |
220 | } | 221 | } |
221 | 222 | ||
222 | // constance | 223 | // constance |
223 | int indicatorAligment = 2; | 224 | int indicatorAligment = 2; |
224 | 225 | ||
225 | /* | 226 | /* |
226 | private Point? dragStartPoint = null; | 227 | private Point? dragStartPoint = null; |
227 | 228 | ||
228 | */ | 229 | */ |
229 | public IEnumerable<DesignerItem> SelectedItems | 230 | public IEnumerable<DesignerItem> SelectedItems |
230 | { | 231 | { |
231 | get | 232 | get |
232 | { | 233 | { |
233 | var selectedItems = from item in this.Children.OfType<DesignerItem>() | 234 | var selectedItems = from item in this.Children.OfType<DesignerItem>() |
234 | where item.IsSelected == true | 235 | where item.IsSelected == true |
235 | select item; | 236 | select item; |
236 | 237 | ||
237 | return selectedItems; | 238 | return selectedItems; |
238 | } | 239 | } |
239 | } | 240 | } |
240 | 241 | ||
241 | public void DeselectAll() | 242 | public void DeselectAll() |
242 | { | 243 | { |
243 | /* | 244 | /* |
244 | foreach (DesignerItem item in this.SelectedItems) | 245 | foreach (DesignerItem item in this.SelectedItems) |
245 | { | 246 | { |
246 | item.IsSelected = false; | 247 | item.IsSelected = false; |
247 | }*/ | 248 | }*/ |
248 | } | 249 | } |
249 | 250 | ||
250 | //test | 251 | //test |
251 | public void AddNewNode(Point FreeNode, bool RightClick) | 252 | public void AddNewNode(Point FreeNode, bool RightClick) |
252 | { | 253 | { |
253 | pBlueNode.Stroke = new SolidColorBrush(Colors.Blue); | 254 | pBlueNode.Stroke = new SolidColorBrush(Colors.Blue); |
254 | pBlueNode.Fill = new SolidColorBrush(Colors.LightBlue); | 255 | pBlueNode.Fill = new SolidColorBrush(Colors.LightBlue); |
255 | pBlueNode.StrokeThickness = STROKE_NODE; | 256 | pBlueNode.StrokeThickness = STROKE_NODE; |
256 | pBlueNode.Data = gGrpBlueNode; | 257 | pBlueNode.Data = gGrpBlueNode; |
257 | 258 | ||
258 | TextBlock textBlock = new TextBlock(); | 259 | TextBlock textBlock = new TextBlock(); |
259 | textBlock.Text = "1"; | 260 | textBlock.Text = "1"; |
260 | textBlock.FontSize = 15; | 261 | textBlock.FontSize = 15; |
261 | textBlock.Foreground = new SolidColorBrush(Colors.White); | 262 | textBlock.Foreground = new SolidColorBrush(Colors.White); |
262 | Canvas.SetLeft(textBlock, FreeNode.X-5 ); | 263 | Canvas.SetLeft(textBlock, FreeNode.X-5 ); |
263 | Canvas.SetTop(textBlock, FreeNode.Y-8); | 264 | Canvas.SetTop(textBlock, FreeNode.Y-8); |
264 | 265 | ||
265 | AddNode(FreeNode, gGrpBlueNode); | 266 | AddNode(FreeNode, gGrpBlueNode); |
266 | 267 | ||
267 | 268 | ||
268 | //Ellipse myEllipse = new Ellipse(); | 269 | //Ellipse myEllipse = new Ellipse(); |
269 | //SolidColorBrush mySolidColorBrush = new SolidColorBrush(); | 270 | //SolidColorBrush mySolidColorBrush = new SolidColorBrush(); |
270 | //mySolidColorBrush.Color = Colors.Blue; | 271 | //mySolidColorBrush.Color = Colors.Blue; |
271 | //myEllipse.Fill = mySolidColorBrush; | 272 | //myEllipse.Fill = mySolidColorBrush; |
272 | //myEllipse.StrokeThickness = 2; | 273 | //myEllipse.StrokeThickness = 2; |
273 | //myEllipse.Stroke = Brushes.White; | 274 | //myEllipse.Stroke = Brushes.White; |
274 | //myEllipse.Width = 16d; | 275 | //myEllipse.Width = 16d; |
275 | //myEllipse.Height = 16d; | 276 | //myEllipse.Height = 16d; |
276 | //Canvas.SetLeft(myEllipse, FreeNode.X); | 277 | //Canvas.SetLeft(myEllipse, FreeNode.X); |
277 | //Canvas.SetTop(myEllipse, FreeNode.Y); | 278 | //Canvas.SetTop(myEllipse, FreeNode.Y); |
278 | 279 | ||
279 | //this.Children.Add(myEllipse); | 280 | //this.Children.Add(myEllipse); |
280 | //this.Children.Add(pBlueNode); | 281 | //this.Children.Add(pBlueNode); |
281 | this.Children.Add(textBlock); | 282 | this.Children.Add(textBlock); |
282 | 283 | ||
283 | 284 | ||
284 | 285 | ||
285 | 286 | ||
286 | 287 | ||
287 | } | 288 | } |
288 | //test | 289 | //test |
289 | 290 | ||
290 | protected override void OnMouseDown(MouseButtonEventArgs e) | 291 | protected override void OnMouseDown(MouseButtonEventArgs e) |
291 | { | 292 | { |
292 | base.OnMouseDown(e); | 293 | base.OnMouseDown(e); |
293 | 294 | ||
294 | MouseHitType = SetHitType(Mouse.GetPosition(this)); | 295 | MouseHitType = SetHitType(Mouse.GetPosition(this)); |
295 | SetMouseCursor(); | 296 | SetMouseCursor(); |
296 | 297 | ||
297 | if (Operation == OperationState.DrawRoute && isStartDrawRoute) | 298 | if (Operation == OperationState.DrawRoute && isStartDrawRoute) |
298 | { | 299 | { |
299 | if (isGoalDrawRoute) | 300 | if (isGoalDrawRoute) |
300 | { | 301 | { |
301 | return; | 302 | return; |
302 | } | 303 | } |
303 | 304 | ||
304 | // Check state draw | 305 | // Check state draw |
305 | if (MouseHitType == HitType.None) | 306 | if (MouseHitType == HitType.None) |
306 | { | 307 | { |
307 | if (gGrpLine.Children.Count == 1) | 308 | if (gGrpLine.Children.Count == 1) |
308 | { | 309 | { |
309 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[0]; | 310 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[0]; |
310 | lineGeometry.EndPoint = LastPoint; | 311 | lineGeometry.EndPoint = LastPoint; |
311 | 312 | ||
312 | // Check end route | 313 | // Check end route |
313 | if (IsEndRoute(_goalPoint, lineGeometry)) | 314 | if (IsEndRoute(_goalPoint, lineGeometry)) |
314 | { | 315 | { |
315 | isGoalDrawRoute = true; | 316 | isGoalDrawRoute = true; |
316 | ProcessEndRoute(); | 317 | ProcessEndRoute(); |
317 | return; | 318 | return; |
318 | } | 319 | } |
319 | } | 320 | } |
320 | else if (IsCurverNode((LineGeometry)gGrpLine.Children[currentLine - 1] | 321 | else if (IsCurverNode((LineGeometry)gGrpLine.Children[currentLine - 1] |
321 | , (LineGeometry)gGrpLine.Children[currentLine])) | 322 | , (LineGeometry)gGrpLine.Children[currentLine])) |
322 | { | 323 | { |
323 | // Set end point to finish draw line | 324 | // Set end point to finish draw line |
324 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[currentLine]; | 325 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[currentLine]; |
325 | lineGeometry.EndPoint = LastPoint; | 326 | lineGeometry.EndPoint = LastPoint; |
326 | 327 | ||
327 | // Add node to curver postion | 328 | // Add node to curver postion |
328 | AddNode(lineGeometry.StartPoint, gGrpRedNode); | 329 | AddNode(lineGeometry.StartPoint, gGrpRedNode); |
329 | 330 | ||
330 | // Check end route | 331 | // Check end route |
331 | if (IsEndRoute(_goalPoint, lineGeometry)) | 332 | if (IsEndRoute(_goalPoint, lineGeometry)) |
332 | { | 333 | { |
333 | isGoalDrawRoute = true; | 334 | isGoalDrawRoute = true; |
334 | ProcessEndRoute(); | 335 | ProcessEndRoute(); |
335 | return; | 336 | return; |
336 | } | 337 | } |
337 | 338 | ||
338 | // Draw curver line | 339 | // Draw curver line |
339 | //DrawCurver((LineGeometry)gGrpLine.Children[currentLine - 1], (LineGeometry)gGrpLine.Children[currentLine]); | 340 | //DrawCurver((LineGeometry)gGrpLine.Children[currentLine - 1], (LineGeometry)gGrpLine.Children[currentLine]); |
340 | } | 341 | } |
341 | else | 342 | else |
342 | { | 343 | { |
343 | // Remove current line | 344 | // Remove current line |
344 | gGrpLine.Children.RemoveAt(currentLine); | 345 | gGrpLine.Children.RemoveAt(currentLine); |
345 | // Remove yellow node | 346 | // Remove yellow node |
346 | //if (gGrpYellowNode.Children.Count > 0) | 347 | //if (gGrpYellowNode.Children.Count > 0) |
347 | //{ | 348 | //{ |
348 | // gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); | 349 | // gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); |
349 | // gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); | 350 | // gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); |
350 | //} | 351 | //} |
351 | //// Remove curver line | 352 | //// Remove curver line |
352 | //if (gGrpCurverLine.Children.Count > 0) | 353 | //if (gGrpCurverLine.Children.Count > 0) |
353 | //{ | 354 | //{ |
354 | // gGrpCurverLine.Children.RemoveAt(gGrpCurverLine.Children.Count - 1); | 355 | // gGrpCurverLine.Children.RemoveAt(gGrpCurverLine.Children.Count - 1); |
355 | //} | 356 | //} |
356 | 357 | ||
357 | // Set end point to finish draw line | 358 | // Set end point to finish draw line |
358 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[currentLine - 1]; | 359 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[currentLine - 1]; |
359 | lineGeometry.EndPoint = LastPoint; | 360 | lineGeometry.EndPoint = LastPoint; |
360 | 361 | ||
361 | // Check end route | 362 | // Check end route |
362 | if (IsEndRoute(_goalPoint, lineGeometry)) | 363 | if (IsEndRoute(_goalPoint, lineGeometry)) |
363 | { | 364 | { |
364 | isGoalDrawRoute = true; | 365 | isGoalDrawRoute = true; |
365 | ProcessEndRoute(); | 366 | ProcessEndRoute(); |
366 | return; | 367 | return; |
367 | } | 368 | } |
368 | 369 | ||
369 | //// Re-draw cuver line | 370 | //// Re-draw cuver line |
370 | //if (currentLine > 1) | 371 | //if (currentLine > 1) |
371 | //{ | 372 | //{ |
372 | // if (IsCurverNode((LineGeometry)gGrpLine.Children[currentLine - 2] | 373 | // if (IsCurverNode((LineGeometry)gGrpLine.Children[currentLine - 2] |
373 | // , (LineGeometry)gGrpLine.Children[currentLine - 1])) | 374 | // , (LineGeometry)gGrpLine.Children[currentLine - 1])) |
374 | // DrawCurver((LineGeometry)gGrpLine.Children[currentLine - 2], (LineGeometry)gGrpLine.Children[currentLine - 1]); | 375 | // DrawCurver((LineGeometry)gGrpLine.Children[currentLine - 2], (LineGeometry)gGrpLine.Children[currentLine - 1]); |
375 | //} | 376 | //} |
376 | } | 377 | } |
377 | 378 | ||
378 | // Draw new line | 379 | // Draw new line |
379 | DrawLine(LastPoint, LastPoint, gGrpLine); | 380 | DrawLine(LastPoint, LastPoint, gGrpLine); |
380 | // Setting start point for new line | 381 | // Setting start point for new line |
381 | StartDrawPoint = LastPoint; | 382 | StartDrawPoint = LastPoint; |
382 | 383 | ||
383 | mouseState = MouseState.Draw; | 384 | mouseState = MouseState.Draw; |
384 | currentLine = gGrpLine.Children.Count - 1; | 385 | currentLine = gGrpLine.Children.Count - 1; |
385 | return; | 386 | return; |
386 | } | 387 | } |
387 | } | 388 | } |
388 | else if (Operation == OperationState.DrawSetFreeNode) | 389 | else if (Operation == OperationState.DrawSetFreeNode) |
389 | { | 390 | { |
390 | bool RightClick = false; | 391 | bool RightClick = false; |
391 | if (IsStopDrawRoute(e)) | 392 | if (IsStopDrawRoute(e)) |
392 | RightClick = true; | 393 | RightClick = true; |
393 | 394 | ||
394 | StartDrawPoint = e.MouseDevice.GetPosition(this); | 395 | StartDrawPoint = e.MouseDevice.GetPosition(this); |
395 | 396 | ||
396 | SetFreeNodes(StartDrawPoint, RightClick); | 397 | SetFreeNodes(StartDrawPoint, RightClick); |
397 | } | 398 | } |
398 | //2017/03/04 NAM EDT START | 399 | //2017/03/04 NAM EDT START |
399 | else if (Operation == OperationState.NewDrawSetFreeNode) | 400 | else if (Operation == OperationState.NewDrawSetFreeNode) |
400 | { | 401 | { |
401 | bool RightClick = false; | 402 | bool RightClick = false; |
402 | bool LeftClick = false; | 403 | bool LeftClick = false; |
403 | if (IsStopDrawRoute(e)) | 404 | if (IsStopDrawRoute(e)) |
404 | RightClick = true; | 405 | RightClick = true; |
405 | 406 | ||
406 | StartDrawPoint = e.MouseDevice.GetPosition(this); | 407 | StartDrawPoint = e.MouseDevice.GetPosition(this); |
407 | CreateNode(StartDrawPoint,LeftClick, RightClick); | 408 | CreateNode(StartDrawPoint,LeftClick, RightClick); |
408 | //NewSetFreeNodes(StartDrawPoint, RightClick); | 409 | //NewSetFreeNodes(StartDrawPoint, RightClick); |
409 | } | 410 | } |
410 | //2017/03/04 NAM EDT END | 411 | //2017/03/04 NAM EDT END |
411 | 412 | ||
412 | else if (Operation == OperationState.EditNode) | 413 | else if (Operation == OperationState.EditNode) |
413 | { | 414 | { |
414 | Point node_edited = e.MouseDevice.GetPosition(this); | 415 | Point node_edited = e.MouseDevice.GetPosition(this); |
415 | 416 | ||
416 | // start Edit Node Infor | 417 | // start Edit Node Infor |
417 | EditNode(node_edited); | 418 | EditNode(node_edited); |
418 | 419 | ||
419 | } | 420 | } |
420 | else if (Operation == OperationState.DrawObstract) | 421 | else if (Operation == OperationState.DrawObstract) |
421 | { | 422 | { |
422 | if (MouseHitType == HitType.None) | 423 | if (MouseHitType == HitType.None) |
423 | { | 424 | { |
424 | Rectangle shape = new Rectangle(); | 425 | Rectangle shape = new Rectangle(); |
425 | shape.Width = 1; | 426 | shape.Width = 1; |
426 | shape.Height = 1; | 427 | shape.Height = 1; |
427 | // Create a SolidColorBrush and use it to | 428 | // Create a SolidColorBrush and use it to |
428 | // paint the rectangle. | 429 | // paint the rectangle. |
429 | shape.Stroke = Brushes.Blue; | 430 | shape.Stroke = Brushes.Blue; |
430 | shape.StrokeThickness = 1; | 431 | shape.StrokeThickness = 1; |
431 | shape.Fill = new SolidColorBrush(Colors.LightCyan); | 432 | shape.Fill = new SolidColorBrush(Colors.LightCyan); |
432 | StartDrawPoint = e.MouseDevice.GetPosition(this); | 433 | StartDrawPoint = e.MouseDevice.GetPosition(this); |
433 | shape.SetValue(Canvas.LeftProperty, StartDrawPoint.X); | 434 | shape.SetValue(Canvas.LeftProperty, StartDrawPoint.X); |
434 | shape.SetValue(Canvas.TopProperty, StartDrawPoint.Y); | 435 | shape.SetValue(Canvas.TopProperty, StartDrawPoint.Y); |
435 | this.Children.Add(shape); | 436 | this.Children.Add(shape); |
436 | shapeList.Add(shape); | 437 | shapeList.Add(shape); |
437 | 438 | ||
438 | mouseState = MouseState.Draw; | 439 | mouseState = MouseState.Draw; |
439 | currentShape = shapeList.Count() - 1; | 440 | currentShape = shapeList.Count() - 1; |
440 | 441 | ||
441 | double shapeX = Canvas.GetLeft(shapeList[currentShape]); | 442 | double shapeX = Canvas.GetLeft(shapeList[currentShape]); |
442 | double shapeY = Canvas.GetTop(shapeList[currentShape]); | 443 | double shapeY = Canvas.GetTop(shapeList[currentShape]); |
443 | shapePosIndicator.Text = "(" + Math.Round(shapeX, 0) + "," + Math.Round(shapeY, 0) + ")"; | 444 | shapePosIndicator.Text = "(" + Math.Round(shapeX, 0) + "," + Math.Round(shapeY, 0) + ")"; |
444 | shapePosIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment); | 445 | shapePosIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment); |
445 | shapePosIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment); | 446 | shapePosIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment); |
446 | 447 | ||
447 | double width = (int)shapeList[currentShape].Width; | 448 | double width = (int)shapeList[currentShape].Width; |
448 | double height = (int)shapeList[currentShape].Height; | 449 | double height = (int)shapeList[currentShape].Height; |
449 | shapeSizeIndicator.Text = "(" + Math.Round(width, 0) + "," + Math.Round(height, 0) + ")"; | 450 | shapeSizeIndicator.Text = "(" + Math.Round(width, 0) + "," + Math.Round(height, 0) + ")"; |
450 | shapeSizeIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment + width); | 451 | shapeSizeIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment + width); |
451 | shapeSizeIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment + height); | 452 | shapeSizeIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment + height); |
452 | 453 | ||
453 | this.Children.Add(shapePosIndicator); | 454 | this.Children.Add(shapePosIndicator); |
454 | this.Children.Add(shapeSizeIndicator); | 455 | this.Children.Add(shapeSizeIndicator); |
455 | 456 | ||
456 | 457 | ||
457 | return; | 458 | return; |
458 | } | 459 | } |
459 | else | 460 | else |
460 | { | 461 | { |
461 | if (shapeList.Count() != 0) | 462 | if (shapeList.Count() != 0) |
462 | shapeList[currentShape].Fill = new SolidColorBrush(Colors.LightCyan); | 463 | shapeList[currentShape].Fill = new SolidColorBrush(Colors.LightCyan); |
463 | 464 | ||
464 | double shapeX = Canvas.GetLeft(shapeList[currentShape]); | 465 | double shapeX = Canvas.GetLeft(shapeList[currentShape]); |
465 | double shapeY = Canvas.GetTop(shapeList[currentShape]); | 466 | double shapeY = Canvas.GetTop(shapeList[currentShape]); |
466 | shapePosIndicator.Text = "(" + Math.Round(shapeX, 0) + "," + Math.Round(shapeY, 0) + ")"; | 467 | shapePosIndicator.Text = "(" + Math.Round(shapeX, 0) + "," + Math.Round(shapeY, 0) + ")"; |
467 | shapePosIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment); | 468 | shapePosIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment); |
468 | shapePosIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment); | 469 | shapePosIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment); |
469 | 470 | ||
470 | double width = (int)shapeList[currentShape].Width; | 471 | double width = (int)shapeList[currentShape].Width; |
471 | double height = (int)shapeList[currentShape].Height; | 472 | double height = (int)shapeList[currentShape].Height; |
472 | shapeSizeIndicator.Text = "(" + Math.Round(width, 0) + "," + Math.Round(height, 0) + ")"; | 473 | shapeSizeIndicator.Text = "(" + Math.Round(width, 0) + "," + Math.Round(height, 0) + ")"; |
473 | shapeSizeIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment + width); | 474 | shapeSizeIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment + width); |
474 | shapeSizeIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment + height); | 475 | shapeSizeIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment + height); |
475 | 476 | ||
476 | this.Children.Add(shapePosIndicator); | 477 | this.Children.Add(shapePosIndicator); |
477 | this.Children.Add(shapeSizeIndicator); | 478 | this.Children.Add(shapeSizeIndicator); |
478 | } | 479 | } |
479 | 480 | ||
480 | LastPoint = Mouse.GetPosition(this); | 481 | LastPoint = Mouse.GetPosition(this); |
481 | mouseState = MouseState.Drag; | 482 | mouseState = MouseState.Drag; |
482 | } | 483 | } |
483 | e.Handled = true; | 484 | e.Handled = true; |
484 | } | 485 | } |
485 | 486 | ||
486 | protected override void OnMouseMove(MouseEventArgs e) | 487 | protected override void OnMouseMove(MouseEventArgs e) |
487 | { | 488 | { |
488 | base.OnMouseMove(e); | 489 | base.OnMouseMove(e); |
489 | 490 | ||
490 | if (mouseState == MouseState.None) | 491 | if (mouseState == MouseState.None) |
491 | { | 492 | { |
492 | MouseHitType = SetHitType(Mouse.GetPosition(this)); | 493 | MouseHitType = SetHitType(Mouse.GetPosition(this)); |
493 | SetMouseCursor(); | 494 | SetMouseCursor(); |
494 | } | 495 | } |
495 | else if (Operation == OperationState.DrawRoute && isStartDrawRoute) | 496 | else if (Operation == OperationState.DrawRoute && isStartDrawRoute) |
496 | { | 497 | { |
497 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[currentLine]; | 498 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[currentLine]; |
498 | 499 | ||
499 | // See how much the mouse has moved. | 500 | // See how much the mouse has moved. |
500 | Point point = Mouse.GetPosition(this); | 501 | Point point = Mouse.GetPosition(this); |
501 | double offset_x = point.X - StartDrawPoint.X; | 502 | double offset_x = point.X - StartDrawPoint.X; |
502 | double offset_y = point.Y - StartDrawPoint.Y; | 503 | double offset_y = point.Y - StartDrawPoint.Y; |
503 | 504 | ||
504 | // Get the line's current position. | 505 | // Get the line's current position. |
505 | double new_x = lineGeometry.StartPoint.X; | 506 | double new_x = lineGeometry.StartPoint.X; |
506 | double new_y = lineGeometry.StartPoint.Y; | 507 | double new_y = lineGeometry.StartPoint.Y; |
507 | 508 | ||
508 | if (offset_x != 0 || offset_y != 0) | 509 | if (offset_x != 0 || offset_y != 0) |
509 | { | 510 | { |
510 | if (Math.Abs(offset_x) >= Math.Abs(offset_y)) | 511 | if (Math.Abs(offset_x) >= Math.Abs(offset_y)) |
511 | { | 512 | { |
512 | new_x = point.X; | 513 | new_x = point.X; |
513 | } | 514 | } |
514 | else | 515 | else |
515 | { | 516 | { |
516 | new_y = point.Y; | 517 | new_y = point.Y; |
517 | } | 518 | } |
518 | } | 519 | } |
519 | 520 | ||
520 | // Set end point of current line | 521 | // Set end point of current line |
521 | LastPoint = new Point(new_x, new_y); | 522 | LastPoint = new Point(new_x, new_y); |
522 | lineGeometry.EndPoint = LastPoint; | 523 | lineGeometry.EndPoint = LastPoint; |
523 | DisplayCoordinate(LastPoint); | 524 | DisplayCoordinate(LastPoint); |
524 | } | 525 | } |
525 | else if (Operation == OperationState.DrawObstract) | 526 | else if (Operation == OperationState.DrawObstract) |
526 | { | 527 | { |
527 | if (mouseState == MouseState.Drag) | 528 | if (mouseState == MouseState.Drag) |
528 | { | 529 | { |
529 | // See how much the mouse has moved. | 530 | // See how much the mouse has moved. |
530 | Point point = Mouse.GetPosition(this); | 531 | Point point = Mouse.GetPosition(this); |
531 | double offset_x = point.X - LastPoint.X; | 532 | double offset_x = point.X - LastPoint.X; |
532 | double offset_y = point.Y - LastPoint.Y; | 533 | double offset_y = point.Y - LastPoint.Y; |
533 | 534 | ||
534 | // Get the rectangle's current position. | 535 | // Get the rectangle's current position. |
535 | double new_x = Canvas.GetLeft(shapeList[currentShape]); | 536 | double new_x = Canvas.GetLeft(shapeList[currentShape]); |
536 | double new_y = Canvas.GetTop(shapeList[currentShape]); | 537 | double new_y = Canvas.GetTop(shapeList[currentShape]); |
537 | double new_width = shapeList[currentShape].Width; | 538 | double new_width = shapeList[currentShape].Width; |
538 | double new_height = shapeList[currentShape].Height; | 539 | double new_height = shapeList[currentShape].Height; |
539 | 540 | ||
540 | // Update the rectangle. | 541 | // Update the rectangle. |
541 | switch (MouseHitType) | 542 | switch (MouseHitType) |
542 | { | 543 | { |
543 | case HitType.Body: | 544 | case HitType.Body: |
544 | new_x += offset_x; | 545 | new_x += offset_x; |
545 | new_y += offset_y; | 546 | new_y += offset_y; |
546 | break; | 547 | break; |
547 | case HitType.UL: | 548 | case HitType.UL: |
548 | new_x += offset_x; | 549 | new_x += offset_x; |
549 | new_y += offset_y; | 550 | new_y += offset_y; |
550 | new_width -= offset_x; | 551 | new_width -= offset_x; |
551 | new_height -= offset_y; | 552 | new_height -= offset_y; |
552 | break; | 553 | break; |
553 | case HitType.UR: | 554 | case HitType.UR: |
554 | new_y += offset_y; | 555 | new_y += offset_y; |
555 | new_width += offset_x; | 556 | new_width += offset_x; |
556 | new_height -= offset_y; | 557 | new_height -= offset_y; |
557 | break; | 558 | break; |
558 | case HitType.LR: | 559 | case HitType.LR: |
559 | new_width += offset_x; | 560 | new_width += offset_x; |
560 | new_height += offset_y; | 561 | new_height += offset_y; |
561 | break; | 562 | break; |
562 | case HitType.LL: | 563 | case HitType.LL: |
563 | new_x += offset_x; | 564 | new_x += offset_x; |
564 | new_width -= offset_x; | 565 | new_width -= offset_x; |
565 | new_height += offset_y; | 566 | new_height += offset_y; |
566 | break; | 567 | break; |
567 | case HitType.L: | 568 | case HitType.L: |
568 | new_x += offset_x; | 569 | new_x += offset_x; |
569 | new_width -= offset_x; | 570 | new_width -= offset_x; |
570 | break; | 571 | break; |
571 | case HitType.R: | 572 | case HitType.R: |
572 | new_width += offset_x; | 573 | new_width += offset_x; |
573 | break; | 574 | break; |
574 | case HitType.B: | 575 | case HitType.B: |
575 | new_height += offset_y; | 576 | new_height += offset_y; |
576 | break; | 577 | break; |
577 | case HitType.T: | 578 | case HitType.T: |
578 | new_y += offset_y; | 579 | new_y += offset_y; |
579 | new_height -= offset_y; | 580 | new_height -= offset_y; |
580 | break; | 581 | break; |
581 | } | 582 | } |
582 | // Don't use negative width or height. | 583 | // Don't use negative width or height. |
583 | if ((new_width > 0) && (new_height > 0)) | 584 | if ((new_width > 0) && (new_height > 0)) |
584 | { | 585 | { |
585 | // Update the rectangle. | 586 | // Update the rectangle. |
586 | Canvas.SetLeft(shapeList[currentShape], new_x); | 587 | Canvas.SetLeft(shapeList[currentShape], new_x); |
587 | Canvas.SetTop(shapeList[currentShape], new_y); | 588 | Canvas.SetTop(shapeList[currentShape], new_y); |
588 | shapeList[currentShape].Width = new_width; | 589 | shapeList[currentShape].Width = new_width; |
589 | shapeList[currentShape].Height = new_height; | 590 | shapeList[currentShape].Height = new_height; |
590 | 591 | ||
591 | // Save the mouse's new location. | 592 | // Save the mouse's new location. |
592 | LastPoint = point; | 593 | LastPoint = point; |
593 | 594 | ||
594 | } | 595 | } |
595 | } | 596 | } |
596 | else if (mouseState == MouseState.Draw) | 597 | else if (mouseState == MouseState.Draw) |
597 | { | 598 | { |
598 | 599 | ||
599 | // See how much the mouse has moved. | 600 | // See how much the mouse has moved. |
600 | Point point = Mouse.GetPosition(this); | 601 | Point point = Mouse.GetPosition(this); |
601 | 602 | ||
602 | 603 | ||
603 | double offset_x = point.X - StartDrawPoint.X; | 604 | double offset_x = point.X - StartDrawPoint.X; |
604 | double offset_y = point.Y - StartDrawPoint.Y; | 605 | double offset_y = point.Y - StartDrawPoint.Y; |
605 | 606 | ||
606 | // Get the rectangle's current position. | 607 | // Get the rectangle's current position. |
607 | double start_x = Canvas.GetLeft(shapeList[currentShape]); | 608 | double start_x = Canvas.GetLeft(shapeList[currentShape]); |
608 | double start_y = Canvas.GetTop(shapeList[currentShape]); | 609 | double start_y = Canvas.GetTop(shapeList[currentShape]); |
609 | double new_x = Canvas.GetLeft(shapeList[currentShape]); | 610 | double new_x = Canvas.GetLeft(shapeList[currentShape]); |
610 | double new_y = Canvas.GetTop(shapeList[currentShape]); | 611 | double new_y = Canvas.GetTop(shapeList[currentShape]); |
611 | double new_width = offset_x; | 612 | double new_width = offset_x; |
612 | double new_height = offset_y; | 613 | double new_height = offset_y; |
613 | if (offset_x < 0) | 614 | if (offset_x < 0) |
614 | { | 615 | { |
615 | new_x = point.X; | 616 | new_x = point.X; |
616 | new_width = -offset_x; | 617 | new_width = -offset_x; |
617 | } | 618 | } |
618 | if (offset_y < 0) | 619 | if (offset_y < 0) |
619 | { | 620 | { |
620 | new_y = point.Y; | 621 | new_y = point.Y; |
621 | new_height = -offset_y; | 622 | new_height = -offset_y; |
622 | } | 623 | } |
623 | Canvas.SetLeft(shapeList[currentShape], new_x); | 624 | Canvas.SetLeft(shapeList[currentShape], new_x); |
624 | Canvas.SetTop(shapeList[currentShape], new_y); | 625 | Canvas.SetTop(shapeList[currentShape], new_y); |
625 | shapeList[currentShape].Width = new_width; | 626 | shapeList[currentShape].Width = new_width; |
626 | shapeList[currentShape].Height = new_height; | 627 | shapeList[currentShape].Height = new_height; |
627 | 628 | ||
628 | } | 629 | } |
629 | 630 | ||
630 | double shapeX = Canvas.GetLeft(shapeList[currentShape]); | 631 | double shapeX = Canvas.GetLeft(shapeList[currentShape]); |
631 | double shapeY = Canvas.GetTop(shapeList[currentShape]); | 632 | double shapeY = Canvas.GetTop(shapeList[currentShape]); |
632 | shapePosIndicator.Text = "(" + Math.Round(shapeX, 0) + "," + Math.Round(shapeY, 0) + ")"; | 633 | shapePosIndicator.Text = "(" + Math.Round(shapeX, 0) + "," + Math.Round(shapeY, 0) + ")"; |
633 | shapePosIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment); | 634 | shapePosIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment); |
634 | shapePosIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment); | 635 | shapePosIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment); |
635 | 636 | ||
636 | double width = (int)shapeList[currentShape].Width; | 637 | double width = (int)shapeList[currentShape].Width; |
637 | double height = (int)shapeList[currentShape].Height; | 638 | double height = (int)shapeList[currentShape].Height; |
638 | shapeSizeIndicator.Text = "(" + Math.Round(width, 0) + "," + Math.Round(height, 0) + ")"; | 639 | shapeSizeIndicator.Text = "(" + Math.Round(width, 0) + "," + Math.Round(height, 0) + ")"; |
639 | shapeSizeIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment + width); | 640 | shapeSizeIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment + width); |
640 | shapeSizeIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment + height); | 641 | shapeSizeIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment + height); |
641 | } | 642 | } |
642 | e.Handled = true; | 643 | e.Handled = true; |
643 | } | 644 | } |
644 | 645 | ||
645 | protected override void OnMouseUp(MouseButtonEventArgs e) | 646 | protected override void OnMouseUp(MouseButtonEventArgs e) |
646 | { | 647 | { |
647 | base.OnMouseUp(e); | 648 | base.OnMouseUp(e); |
648 | if (Operation == OperationState.DrawObstract) | 649 | if (Operation == OperationState.DrawObstract) |
649 | { | 650 | { |
650 | if (shapeList.Count() != 0) | 651 | if (shapeList.Count() != 0) |
651 | shapeList[currentShape].Fill = new SolidColorBrush(Colors.Blue); | 652 | shapeList[currentShape].Fill = new SolidColorBrush(Colors.Blue); |
652 | shapePosIndicator.Text = ""; | 653 | shapePosIndicator.Text = ""; |
653 | shapeSizeIndicator.Text = ""; | 654 | shapeSizeIndicator.Text = ""; |
654 | this.Children.Remove(shapePosIndicator); | 655 | this.Children.Remove(shapePosIndicator); |
655 | this.Children.Remove(shapeSizeIndicator); | 656 | this.Children.Remove(shapeSizeIndicator); |
656 | 657 | ||
657 | mouseState = MouseState.None; | 658 | mouseState = MouseState.None; |
658 | currentShape = 0; | 659 | currentShape = 0; |
659 | } | 660 | } |
660 | e.Handled = true; | 661 | e.Handled = true; |
661 | } | 662 | } |
662 | 663 | ||
663 | /// <summary> | 664 | /// <summary> |
664 | /// On Preview Mouse Down | 665 | /// On Preview Mouse Down |
665 | /// </summary> | 666 | /// </summary> |
666 | /// <param name="e"></param> | 667 | /// <param name="e"></param> |
667 | protected override void OnPreviewMouseDown(MouseButtonEventArgs e) | 668 | protected override void OnPreviewMouseDown(MouseButtonEventArgs e) |
668 | { | 669 | { |
669 | base.OnPreviewMouseDown(e); | 670 | base.OnPreviewMouseDown(e); |
670 | if (Operation != OperationState.NewDrawSetFreeNode) | 671 | if (Operation != OperationState.NewDrawSetFreeNode) |
671 | { | 672 | { |
672 | return; | 673 | return; |
673 | } | 674 | } |
674 | 675 | ||
675 | Point currentPoint = e.MouseDevice.GetPosition(this); | 676 | Point currentPoint = e.MouseDevice.GetPosition(this); |
676 | //bool _isStart = IsStartEndRoute(_startPoint, currentPoint); | 677 | //bool _isStart = IsStartEndRoute(_startPoint, currentPoint); |
677 | 678 | ||
678 | if (isDrawingNode == false) | 679 | if (isDrawingNode == false) |
679 | { | 680 | { |
680 | //double centerY = Canvas.GetTop(_startPoint); | 681 | //double centerY = Canvas.GetTop(_startPoint); |
681 | //double centerX = Canvas.GetLeft(_startPoint); | 682 | //double centerX = Canvas.GetLeft(_startPoint); |
682 | 683 | ||
683 | isDrawingNode = true; | 684 | isDrawingNode = true; |
684 | InitDrawRoute(); | 685 | InitDrawRoute(); |
685 | //DrawLine(new Point(centerX + 25, centerY + 25), new Point(centerX + 25, centerY + 25), gGrpLine); | 686 | //DrawLine(new Point(centerX + 25, centerY + 25), new Point(centerX + 25, centerY + 25), gGrpLine); |
686 | mouseState = MouseState.Draw; | 687 | mouseState = MouseState.Draw; |
687 | //currentLine = gGrpLine.Children.Count - 1; | 688 | //currentLine = gGrpLine.Children.Count - 1; |
688 | //StartDrawPoint = new Point(centerX + 25, centerY + 25); | 689 | //StartDrawPoint = new Point(centerX + 25, centerY + 25); |
689 | 690 | ||
690 | //this.Children.Remove(_startPoint); | 691 | //this.Children.Remove(_startPoint); |
691 | //this.Children.Add(_startPoint); | 692 | //this.Children.Add(_startPoint); |
692 | 693 | ||
693 | return; | 694 | return; |
694 | } | 695 | } |
695 | //2017/03/04 NAM EDT START | 696 | //2017/03/04 NAM EDT START |
696 | else | 697 | else |
697 | { | 698 | { |
698 | 699 | ||
699 | bool RightClick = false; | 700 | bool RightClick = false; |
700 | bool LeftClick = false; | 701 | bool LeftClick = false; |
701 | 702 | ||
702 | 703 | ||
703 | if (IsMouseLeftClick(e)) | 704 | if (IsMouseLeftClick(e)) |
704 | LeftClick = true; | 705 | LeftClick = true; |
705 | if (IsStopDrawRoute(e)) | 706 | if (IsStopDrawRoute(e)) |
706 | RightClick = true; | 707 | RightClick = true; |
707 | 708 | ||
708 | StartDrawPoint = e.MouseDevice.GetPosition(this); | 709 | StartDrawPoint = e.MouseDevice.GetPosition(this); |
709 | CreateNode(StartDrawPoint, LeftClick, RightClick); | 710 | CreateNode(StartDrawPoint, LeftClick, RightClick); |
710 | } | 711 | } |
711 | //2017/03/04 NAM EDT END | 712 | //2017/03/04 NAM EDT END |
712 | 713 | ||
713 | 714 | ||
714 | bool _isgoal = IsStartEndRoute(_goalPoint, LastPoint); | 715 | bool _isgoal = IsStartEndRoute(_goalPoint, LastPoint); |
715 | if (_isgoal && isGoalDrawRoute == false) | 716 | if (_isgoal && isGoalDrawRoute == false) |
716 | { | 717 | { |
717 | isGoalDrawRoute = true; | 718 | isGoalDrawRoute = true; |
718 | ProcessEndRoute(); | 719 | ProcessEndRoute(); |
719 | } | 720 | } |
720 | } | 721 | } |
721 | 722 | ||
722 | #region Functions for draw route | 723 | #region Functions for draw route |
723 | 724 | ||
724 | /// <summary> | 725 | /// <summary> |
725 | /// Check start or end draw route | 726 | /// Check start or end draw route |
726 | /// </summary> | 727 | /// </summary> |
727 | /// <param name="_ucStartEndButton">Button start</param> | 728 | /// <param name="_ucStartEndButton">Button start</param> |
728 | /// <param name="currentPoint">Position for check</param> | 729 | /// <param name="currentPoint">Position for check</param> |
729 | /// <returns>true: start, false: not start</returns> | 730 | /// <returns>true: start, false: not start</returns> |
730 | private bool IsStartEndRoute(ucStartEndButton _ucStartEndButton, Point currentPoint) | 731 | private bool IsStartEndRoute(ucStartEndButton _ucStartEndButton, Point currentPoint) |
731 | { | 732 | { |
732 | if(_ucStartEndButton == null) | 733 | if(_ucStartEndButton == null) |
733 | { | 734 | { |
734 | return false; | 735 | return false; |
735 | } | 736 | } |
736 | 737 | ||
737 | double centerX = Canvas.GetLeft(_ucStartEndButton); | 738 | double centerX = Canvas.GetLeft(_ucStartEndButton); |
738 | double centerY = Canvas.GetTop(_ucStartEndButton); | 739 | double centerY = Canvas.GetTop(_ucStartEndButton); |
739 | 740 | ||
740 | if (currentPoint.X < centerX + 50 && currentPoint.X > centerX | 741 | if (currentPoint.X < centerX + 50 && currentPoint.X > centerX |
741 | && currentPoint.Y < centerY + 50 && currentPoint.Y > centerY) | 742 | && currentPoint.Y < centerY + 50 && currentPoint.Y > centerY) |
742 | { | 743 | { |
743 | return true; | 744 | return true; |
744 | } | 745 | } |
745 | return false; | 746 | return false; |
746 | } | 747 | } |
747 | 748 | ||
748 | /// <summary> | 749 | /// <summary> |
749 | /// Process when end draw route | 750 | /// Process when end draw route |
750 | /// </summary> | 751 | /// </summary> |
751 | private void ProcessEndRoute() | 752 | private void ProcessEndRoute() |
752 | { | 753 | { |
753 | Operation = OperationState.None; | 754 | Operation = OperationState.None; |
754 | AutoEditLine(); | 755 | AutoEditLine(); |
755 | this.Children.Remove(_displayAxiPosition); | 756 | this.Children.Remove(_displayAxiPosition); |
756 | this.Children.Remove(_goalPoint); | 757 | this.Children.Remove(_goalPoint); |
757 | this.Children.Add(_goalPoint); | 758 | this.Children.Add(_goalPoint); |
758 | } | 759 | } |
759 | 760 | ||
760 | /// <summary> | 761 | /// <summary> |
761 | /// Check end draw route | 762 | /// Check end draw route |
762 | /// </summary> | 763 | /// </summary> |
763 | /// <param name="_ucStartEndButton">Button end</param> | 764 | /// <param name="_ucStartEndButton">Button end</param> |
764 | /// <param name="currentPoint">Position for check</param> | 765 | /// <param name="currentPoint">Position for check</param> |
765 | /// <returns>true: end, false: not end</returns> | 766 | /// <returns>true: end, false: not end</returns> |
766 | private bool IsEndRoute(ucStartEndButton _ucStartEndButton, LineGeometry lineGeometry) | 767 | private bool IsEndRoute(ucStartEndButton _ucStartEndButton, LineGeometry lineGeometry) |
767 | { | 768 | { |
768 | if (_ucStartEndButton == null) | 769 | if (_ucStartEndButton == null) |
769 | { | 770 | { |
770 | return false; | 771 | return false; |
771 | } | 772 | } |
772 | 773 | ||
773 | double centerX = Canvas.GetLeft(_ucStartEndButton); | 774 | double centerX = Canvas.GetLeft(_ucStartEndButton); |
774 | double centerY = Canvas.GetTop(_ucStartEndButton); | 775 | double centerY = Canvas.GetTop(_ucStartEndButton); |
775 | Point startPoint = lineGeometry.StartPoint; | 776 | Point startPoint = lineGeometry.StartPoint; |
776 | Point endPoint = lineGeometry.EndPoint; | 777 | Point endPoint = lineGeometry.EndPoint; |
777 | 778 | ||
778 | if(IsVerticalLine(lineGeometry)) | 779 | if(IsVerticalLine(lineGeometry)) |
779 | { | 780 | { |
780 | if(endPoint.X < centerX || endPoint.X > centerX + 50) | 781 | if(endPoint.X < centerX || endPoint.X > centerX + 50) |
781 | return false; | 782 | return false; |
782 | 783 | ||
783 | if (startPoint.Y > centerY + 50 && endPoint.Y > centerY + 50) | 784 | if (startPoint.Y > centerY + 50 && endPoint.Y > centerY + 50) |
784 | return false; | 785 | return false; |
785 | 786 | ||
786 | if (startPoint.Y < centerY && endPoint.Y < centerY) | 787 | if (startPoint.Y < centerY && endPoint.Y < centerY) |
787 | return false; | 788 | return false; |
788 | }else | 789 | }else |
789 | { | 790 | { |
790 | if (endPoint.Y < centerY || endPoint.Y > centerY + 50) | 791 | if (endPoint.Y < centerY || endPoint.Y > centerY + 50) |
791 | return false; | 792 | return false; |
792 | 793 | ||
793 | if (startPoint.X > centerX + 50 && endPoint.X > centerX + 50) | 794 | if (startPoint.X > centerX + 50 && endPoint.X > centerX + 50) |
794 | return false; | 795 | return false; |
795 | 796 | ||
796 | if (startPoint.X < centerX && endPoint.X < centerX) | 797 | if (startPoint.X < centerX && endPoint.X < centerX) |
797 | return false; | 798 | return false; |
798 | } | 799 | } |
799 | 800 | ||
800 | return true; | 801 | return true; |
801 | } | 802 | } |
802 | 803 | ||
803 | /// <summary> | 804 | /// <summary> |
804 | /// Make root | 805 | /// Make root |
805 | /// </summary> | 806 | /// </summary> |
806 | public void MakeRoot() | 807 | public void MakeRoot() |
807 | { | 808 | { |
808 | //LineGeometry lineGeometry; | 809 | //LineGeometry lineGeometry; |
809 | //EllipseGeometry ellipseGeometry; | 810 | //EllipseGeometry ellipseGeometry; |
810 | //Point startPoint; | 811 | //Point startPoint; |
811 | //Point endPoint; | 812 | //Point endPoint; |
812 | 813 | ||
813 | // If still not route | 814 | // If still not route |
814 | if (gGrpLine.Children.Count == 0) | 815 | if (gGrpLine.Children.Count == 0) |
815 | return; | 816 | return; |
816 | 817 | ||
817 | pLine.Stroke = new SolidColorBrush(Colors.Red); | 818 | pLine.Stroke = new SolidColorBrush(Colors.Red); |
818 | pLine.StrokeThickness = STROKE_ROOT_LINE; | 819 | pLine.StrokeThickness = STROKE_ROOT_LINE; |
819 | 820 | ||
820 | //// Setting for path line | 821 | //// Setting for path line |
821 | //pRootLine.Stroke = new SolidColorBrush(Colors.Red); | 822 | //pRootLine.Stroke = new SolidColorBrush(Colors.Red); |
822 | //pRootLine.StrokeThickness = STROKE_ROOT_LINE; | 823 | //pRootLine.StrokeThickness = STROKE_ROOT_LINE; |
823 | //pRootLine.Data = gGrpRootLine; | 824 | //pRootLine.Data = gGrpRootLine; |
824 | //this.Children.Add(pRootLine); | 825 | //this.Children.Add(pRootLine); |
825 | 826 | ||
826 | // Setting for path curver line | 827 | // Setting for path curver line |
827 | //pCurverLine.StrokeThickness = STROKE_ROOT_LINE; | 828 | //pCurverLine.StrokeThickness = STROKE_ROOT_LINE; |
828 | 829 | ||
829 | //// Get start point | 830 | //// Get start point |
830 | //lineGeometry = (LineGeometry)gGrpLine.Children[0]; | 831 | //lineGeometry = (LineGeometry)gGrpLine.Children[0]; |
831 | //startPoint = lineGeometry.StartPoint; | 832 | //startPoint = lineGeometry.StartPoint; |
832 | 833 | ||
833 | //for (int i = 0; i < gGrpYellowNode.Children.Count; i = i + 2) | 834 | //for (int i = 0; i < gGrpYellowNode.Children.Count; i = i + 2) |
834 | //{ | 835 | //{ |
835 | // ellipseGeometry = (EllipseGeometry)gGrpYellowNode.Children[i]; | 836 | // ellipseGeometry = (EllipseGeometry)gGrpYellowNode.Children[i]; |
836 | // endPoint = ellipseGeometry.Center; | 837 | // endPoint = ellipseGeometry.Center; |
837 | 838 | ||
838 | // DrawLine(startPoint, endPoint, gGrpRootLine); | 839 | // DrawLine(startPoint, endPoint, gGrpRootLine); |
839 | 840 | ||
840 | // ellipseGeometry = (EllipseGeometry)gGrpYellowNode.Children[i + 1]; | 841 | // ellipseGeometry = (EllipseGeometry)gGrpYellowNode.Children[i + 1]; |
841 | // startPoint = ellipseGeometry.Center; | 842 | // startPoint = ellipseGeometry.Center; |
842 | //} | 843 | //} |
843 | 844 | ||
844 | //lineGeometry = (LineGeometry)gGrpLine.Children[gGrpLine.Children.Count - 1]; | 845 | //lineGeometry = (LineGeometry)gGrpLine.Children[gGrpLine.Children.Count - 1]; |
845 | //endPoint = lineGeometry.EndPoint; | 846 | //endPoint = lineGeometry.EndPoint; |
846 | 847 | ||
847 | //DrawLine(startPoint, endPoint, gGrpRootLine); | 848 | //DrawLine(startPoint, endPoint, gGrpRootLine); |
848 | 849 | ||
849 | //this.Children.Remove(pYellowNode); | 850 | //this.Children.Remove(pYellowNode); |
850 | //this.Children.Remove(pBlueNode); | 851 | //this.Children.Remove(pBlueNode); |
851 | //this.Children.Remove(_startPoint); | 852 | //this.Children.Remove(_startPoint); |
852 | //this.Children.Remove(_goalPoint); | 853 | //this.Children.Remove(_goalPoint); |
853 | //this.Children.Add(pYellowNode); | 854 | //this.Children.Add(pYellowNode); |
854 | //this.Children.Add(pBlueNode); | 855 | //this.Children.Add(pBlueNode); |
855 | //this.Children.Add(_startPoint); | 856 | //this.Children.Add(_startPoint); |
856 | //this.Children.Add(_goalPoint); | 857 | //this.Children.Add(_goalPoint); |
857 | } | 858 | } |
858 | 859 | ||
859 | /// <summary> | 860 | /// <summary> |
860 | /// Auto edit leght of line | 861 | /// Auto edit leght of line |
861 | /// </summary> | 862 | /// </summary> |
862 | private void AutoEditLine() | 863 | private void AutoEditLine() |
863 | { | 864 | { |
864 | double temp; | 865 | double temp; |
865 | int index = gGrpLine.Children.Count - 1; | 866 | int index = gGrpLine.Children.Count - 1; |
866 | double centerY = Canvas.GetTop(_goalPoint) + 25; | 867 | double centerY = Canvas.GetTop(_goalPoint) + 25; |
867 | double centerX = Canvas.GetLeft(_goalPoint) + 25; | 868 | double centerX = Canvas.GetLeft(_goalPoint) + 25; |
868 | LineGeometry lastLine = (LineGeometry)gGrpLine.Children[index]; | 869 | LineGeometry lastLine = (LineGeometry)gGrpLine.Children[index]; |
869 | LineGeometry beforeLastLine = (LineGeometry)gGrpLine.Children[index]; | 870 | LineGeometry beforeLastLine = (LineGeometry)gGrpLine.Children[index]; |
870 | 871 | ||
871 | if(gGrpLine.Children.Count > 1) | 872 | if(gGrpLine.Children.Count > 1) |
872 | { | 873 | { |
873 | beforeLastLine = (LineGeometry)gGrpLine.Children[index - 1]; | 874 | beforeLastLine = (LineGeometry)gGrpLine.Children[index - 1]; |
874 | 875 | ||
875 | if (!IsCurverNode(beforeLastLine, lastLine)) | 876 | if (!IsCurverNode(beforeLastLine, lastLine)) |
876 | { | 877 | { |
877 | beforeLastLine.EndPoint = lastLine.EndPoint; | 878 | beforeLastLine.EndPoint = lastLine.EndPoint; |
878 | gGrpLine.Children.RemoveAt(index); | 879 | gGrpLine.Children.RemoveAt(index); |
879 | //// Remove yellow node | 880 | //// Remove yellow node |
880 | //if (gGrpYellowNode.Children.Count > 0) | 881 | //if (gGrpYellowNode.Children.Count > 0) |
881 | //{ | 882 | //{ |
882 | // gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); | 883 | // gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); |
883 | // gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); | 884 | // gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); |
884 | //} | 885 | //} |
885 | //// Remove curver line | 886 | //// Remove curver line |
886 | //if (gGrpCurverLine.Children.Count > 0) | 887 | //if (gGrpCurverLine.Children.Count > 0) |
887 | //{ | 888 | //{ |
888 | // gGrpCurverLine.Children.RemoveAt(gGrpCurverLine.Children.Count - 1); | 889 | // gGrpCurverLine.Children.RemoveAt(gGrpCurverLine.Children.Count - 1); |
889 | //} | 890 | //} |
890 | index = index - 1; | 891 | index = index - 1; |
891 | lastLine = (LineGeometry)gGrpLine.Children[index]; | 892 | lastLine = (LineGeometry)gGrpLine.Children[index]; |
892 | } | 893 | } |
893 | } | 894 | } |
894 | 895 | ||
895 | if (index == gGrpRedNode.Children.Count + 1) | 896 | if (index == gGrpRedNode.Children.Count + 1) |
896 | { | 897 | { |
897 | AddNode(lastLine.StartPoint, gGrpRedNode); | 898 | AddNode(lastLine.StartPoint, gGrpRedNode); |
898 | } | 899 | } |
899 | 900 | ||
900 | if (lastLine.EndPoint.X == centerX && lastLine.EndPoint.Y == centerY) | 901 | if (lastLine.EndPoint.X == centerX && lastLine.EndPoint.Y == centerY) |
901 | return; | 902 | return; |
902 | 903 | ||
903 | if(IsVerticalLine(lastLine)) | 904 | if(IsVerticalLine(lastLine)) |
904 | { | 905 | { |
905 | temp = lastLine.StartPoint.Y; | 906 | temp = lastLine.StartPoint.Y; |
906 | lastLine.StartPoint = new Point(centerX, temp); | 907 | lastLine.StartPoint = new Point(centerX, temp); |
907 | lastLine.EndPoint = new Point(centerX, centerY); | 908 | lastLine.EndPoint = new Point(centerX, centerY); |
908 | 909 | ||
909 | if(gGrpLine.Children.Count > 1){ | 910 | if(gGrpLine.Children.Count > 1){ |
910 | beforeLastLine = (LineGeometry)gGrpLine.Children[index - 1]; | 911 | beforeLastLine = (LineGeometry)gGrpLine.Children[index - 1]; |
911 | temp = beforeLastLine.EndPoint.Y; | 912 | temp = beforeLastLine.EndPoint.Y; |
912 | beforeLastLine.EndPoint = new Point(centerX, temp); | 913 | beforeLastLine.EndPoint = new Point(centerX, temp); |
913 | } | 914 | } |
914 | }else | 915 | }else |
915 | { | 916 | { |
916 | temp = lastLine.StartPoint.X; | 917 | temp = lastLine.StartPoint.X; |
917 | lastLine.StartPoint = new Point(temp, centerY); | 918 | lastLine.StartPoint = new Point(temp, centerY); |
918 | lastLine.EndPoint = new Point(centerX, centerY); | 919 | lastLine.EndPoint = new Point(centerX, centerY); |
919 | if (gGrpLine.Children.Count > 1) | 920 | if (gGrpLine.Children.Count > 1) |
920 | { | 921 | { |
921 | beforeLastLine = (LineGeometry)gGrpLine.Children[index - 1]; | 922 | beforeLastLine = (LineGeometry)gGrpLine.Children[index - 1]; |
922 | temp = beforeLastLine.EndPoint.X; | 923 | temp = beforeLastLine.EndPoint.X; |
923 | beforeLastLine.EndPoint = new Point(temp, centerY); | 924 | beforeLastLine.EndPoint = new Point(temp, centerY); |
924 | } | 925 | } |
925 | } | 926 | } |
926 | 927 | ||
927 | // Draw curver line | 928 | // Draw curver line |
928 | if (IsCurverNode(beforeLastLine, lastLine)) | 929 | if (IsCurverNode(beforeLastLine, lastLine)) |
929 | { | 930 | { |
930 | EllipseGeometry ellipseGeometry = (EllipseGeometry)gGrpRedNode.Children[gGrpRedNode.Children.Count - 1]; | 931 | EllipseGeometry ellipseGeometry = (EllipseGeometry)gGrpRedNode.Children[gGrpRedNode.Children.Count - 1]; |
931 | ellipseGeometry.Center = lastLine.StartPoint; | 932 | ellipseGeometry.Center = lastLine.StartPoint; |
932 | // | 933 | // |
933 | //if (GetDistance(lastLine.StartPoint, lastLine.EndPoint) > RADIUS_CURVER_LINE + 25) | 934 | //if (GetDistance(lastLine.StartPoint, lastLine.EndPoint) > RADIUS_CURVER_LINE + 25) |
934 | //{ | 935 | //{ |
935 | //DrawCurver(beforeLastLine, lastLine); | 936 | //DrawCurver(beforeLastLine, lastLine); |
936 | //} | 937 | //} |
937 | } | 938 | } |
938 | } | 939 | } |
939 | 940 | ||
940 | /// <summary> | 941 | /// <summary> |
941 | /// Check draw curver node | 942 | /// Check draw curver node |
942 | /// </summary> | 943 | /// </summary> |
943 | /// <param name="oldLine">Old line</param> | 944 | /// <param name="oldLine">Old line</param> |
944 | /// <param name="newLine">New line</param> | 945 | /// <param name="newLine">New line</param> |
945 | /// <returns>true:is curver, fasle: not curver</returns> | 946 | /// <returns>true:is curver, fasle: not curver</returns> |
946 | private bool IsCurverNode(LineGeometry oldLine, LineGeometry newLine) | 947 | private bool IsCurverNode(LineGeometry oldLine, LineGeometry newLine) |
947 | { | 948 | { |
948 | if (oldLine.StartPoint.Y == oldLine.EndPoint.Y && oldLine.StartPoint.Y == newLine.EndPoint.Y) | 949 | if (oldLine.StartPoint.Y == oldLine.EndPoint.Y && oldLine.StartPoint.Y == newLine.EndPoint.Y) |
949 | { | 950 | { |
950 | return false; | 951 | return false; |
951 | } | 952 | } |
952 | 953 | ||
953 | if (oldLine.StartPoint.X == oldLine.EndPoint.X && oldLine.StartPoint.X == newLine.EndPoint.X) | 954 | if (oldLine.StartPoint.X == oldLine.EndPoint.X && oldLine.StartPoint.X == newLine.EndPoint.X) |
954 | { | 955 | { |
955 | return false; | 956 | return false; |
956 | } | 957 | } |
957 | 958 | ||
958 | return true; | 959 | return true; |
959 | } | 960 | } |
960 | 961 | ||
961 | /// <summary> | 962 | /// <summary> |
962 | /// Check timming to stop draw route | 963 | /// Check timming to stop draw route |
963 | /// </summary> | 964 | /// </summary> |
964 | /// <param name="e"></param> | 965 | /// <param name="e"></param> |
965 | /// <returns>true:stop; false:continue</returns> | 966 | /// <returns>true:stop; false:continue</returns> |
966 | private bool IsStopDrawRoute(MouseEventArgs e) | 967 | private bool IsStopDrawRoute(MouseEventArgs e) |
967 | { | 968 | { |
968 | if(e.RightButton == MouseButtonState.Pressed) | 969 | if(e.RightButton == MouseButtonState.Pressed) |
969 | { | 970 | { |
970 | return true; | 971 | return true; |
971 | } | 972 | } |
972 | 973 | ||
973 | return false; | 974 | return false; |
974 | } | 975 | } |
975 | 976 | ||
976 | //2017/03/05 NAM ADD START | 977 | //2017/03/05 NAM ADD START |
977 | private bool IsMouseLeftClick(MouseEventArgs e) | 978 | private bool IsMouseLeftClick(MouseEventArgs e) |
978 | { | 979 | { |
979 | if (e.LeftButton == MouseButtonState.Pressed) | 980 | if (e.LeftButton == MouseButtonState.Pressed) |
980 | { | 981 | { |
981 | return true; | 982 | return true; |
982 | } | 983 | } |
983 | 984 | ||
984 | return false; | 985 | return false; |
985 | } | 986 | } |
986 | //2017/03/05 NAM ADD END | 987 | //2017/03/05 NAM ADD END |
987 | 988 | ||
988 | /// <summary> | 989 | /// <summary> |
989 | /// Draw curver line and yellow node | 990 | /// Draw curver line and yellow node |
990 | /// </summary> | 991 | /// </summary> |
991 | /// <param name="oldLine">Old line</param> | 992 | /// <param name="oldLine">Old line</param> |
992 | /// <param name="newLine">New line</param> | 993 | /// <param name="newLine">New line</param> |
993 | private void DrawCurver(LineGeometry oldLine, LineGeometry newLine) | 994 | private void DrawCurver(LineGeometry oldLine, LineGeometry newLine) |
994 | { | 995 | { |
995 | double radius = RADIUS_CURVER_LINE; | 996 | double radius = RADIUS_CURVER_LINE; |
996 | 997 | ||
997 | Point startPoint ; | 998 | Point startPoint ; |
998 | Point endPoint ; | 999 | Point endPoint ; |
999 | 1000 | ||
1000 | // Get postion of yellow node on old line | 1001 | // Get postion of yellow node on old line |
1001 | if(IsVerticalLine(oldLine)) | 1002 | if(IsVerticalLine(oldLine)) |
1002 | { | 1003 | { |
1003 | if (oldLine.StartPoint.Y > oldLine.EndPoint.Y) | 1004 | if (oldLine.StartPoint.Y > oldLine.EndPoint.Y) |
1004 | startPoint = new Point(oldLine.EndPoint.X, oldLine.EndPoint.Y + radius); | 1005 | startPoint = new Point(oldLine.EndPoint.X, oldLine.EndPoint.Y + radius); |
1005 | else | 1006 | else |
1006 | startPoint = new Point(oldLine.EndPoint.X, oldLine.EndPoint.Y - radius); | 1007 | startPoint = new Point(oldLine.EndPoint.X, oldLine.EndPoint.Y - radius); |
1007 | }else | 1008 | }else |
1008 | { | 1009 | { |
1009 | if (oldLine.StartPoint.X > oldLine.EndPoint.X) | 1010 | if (oldLine.StartPoint.X > oldLine.EndPoint.X) |
1010 | startPoint = new Point(oldLine.EndPoint.X + radius, oldLine.EndPoint.Y); | 1011 | startPoint = new Point(oldLine.EndPoint.X + radius, oldLine.EndPoint.Y); |
1011 | else | 1012 | else |
1012 | startPoint = new Point(oldLine.EndPoint.X - radius, oldLine.EndPoint.Y); | 1013 | startPoint = new Point(oldLine.EndPoint.X - radius, oldLine.EndPoint.Y); |
1013 | } | 1014 | } |
1014 | 1015 | ||
1015 | // Get postion of yellow node on new line | 1016 | // Get postion of yellow node on new line |
1016 | if (IsVerticalLine(newLine)) | 1017 | if (IsVerticalLine(newLine)) |
1017 | { | 1018 | { |
1018 | if (newLine.StartPoint.Y > newLine.EndPoint.Y) | 1019 | if (newLine.StartPoint.Y > newLine.EndPoint.Y) |
1019 | endPoint = new Point(newLine.StartPoint.X, newLine.StartPoint.Y - radius); | 1020 | endPoint = new Point(newLine.StartPoint.X, newLine.StartPoint.Y - radius); |
1020 | else | 1021 | else |
1021 | endPoint = new Point(newLine.StartPoint.X, newLine.StartPoint.Y + radius); | 1022 | endPoint = new Point(newLine.StartPoint.X, newLine.StartPoint.Y + radius); |
1022 | } | 1023 | } |
1023 | else | 1024 | else |
1024 | { | 1025 | { |
1025 | if (newLine.StartPoint.X > newLine.EndPoint.X) | 1026 | if (newLine.StartPoint.X > newLine.EndPoint.X) |
1026 | endPoint = new Point(newLine.StartPoint.X - radius, newLine.StartPoint.Y); | 1027 | endPoint = new Point(newLine.StartPoint.X - radius, newLine.StartPoint.Y); |
1027 | else | 1028 | else |
1028 | endPoint = new Point(newLine.StartPoint.X + radius, newLine.StartPoint.Y); | 1029 | endPoint = new Point(newLine.StartPoint.X + radius, newLine.StartPoint.Y); |
1029 | } | 1030 | } |
1030 | 1031 | ||
1031 | //// Setting sweep direction | 1032 | //// Setting sweep direction |
1032 | //SweepDirection sweepDirection = SweepDirection.Clockwise; | 1033 | //SweepDirection sweepDirection = SweepDirection.Clockwise; |
1033 | //if (IsVerticalLine(oldLine) && ((startPoint.Y - endPoint.Y) * (startPoint.X - endPoint.X)) > 0) | 1034 | //if (IsVerticalLine(oldLine) && ((startPoint.Y - endPoint.Y) * (startPoint.X - endPoint.X)) > 0) |
1034 | //{ | 1035 | //{ |
1035 | // sweepDirection = SweepDirection.Counterclockwise; | 1036 | // sweepDirection = SweepDirection.Counterclockwise; |
1036 | //} | 1037 | //} |
1037 | 1038 | ||
1038 | //if (!IsVerticalLine(oldLine) && ((startPoint.Y - endPoint.Y) * (startPoint.X - endPoint.X)) < 0) | 1039 | //if (!IsVerticalLine(oldLine) && ((startPoint.Y - endPoint.Y) * (startPoint.X - endPoint.X)) < 0) |
1039 | //{ | 1040 | //{ |
1040 | // sweepDirection = SweepDirection.Counterclockwise; | 1041 | // sweepDirection = SweepDirection.Counterclockwise; |
1041 | //} | 1042 | //} |
1042 | 1043 | ||
1043 | //// Add curver line | 1044 | //// Add curver line |
1044 | //DrawCurverLine(startPoint, endPoint, sweepDirection, gGrpCurverLine); | 1045 | //DrawCurverLine(startPoint, endPoint, sweepDirection, gGrpCurverLine); |
1045 | 1046 | ||
1046 | // Add node to postion distance 1300mm | 1047 | // Add node to postion distance 1300mm |
1047 | if (GetDistance(oldLine.StartPoint, oldLine.EndPoint) > RADIUS_CURVER_LINE) | 1048 | if (GetDistance(oldLine.StartPoint, oldLine.EndPoint) > RADIUS_CURVER_LINE) |
1048 | { | 1049 | { |
1049 | AddNode(startPoint, gGrpYellowNode); | 1050 | AddNode(startPoint, gGrpYellowNode); |
1050 | } | 1051 | } |
1051 | 1052 | ||
1052 | if (GetDistance(newLine.StartPoint, newLine.EndPoint) > RADIUS_CURVER_LINE) | 1053 | if (GetDistance(newLine.StartPoint, newLine.EndPoint) > RADIUS_CURVER_LINE) |
1053 | { | 1054 | { |
1054 | AddNode(endPoint, gGrpYellowNode); | 1055 | AddNode(endPoint, gGrpYellowNode); |
1055 | } | 1056 | } |
1056 | } | 1057 | } |
1057 | 1058 | ||
1058 | /// <summary> | 1059 | /// <summary> |
1059 | /// Init data for draw route | 1060 | /// Init data for draw route |
1060 | /// </summary> | 1061 | /// </summary> |
1061 | private void InitDrawRoute() | 1062 | private void InitDrawRoute() |
1062 | { | 1063 | { |
1063 | //2017/03/04 NAM ADD START | 1064 | //2017/03/04 NAM ADD START |
1064 | pNewLine.Stroke = new SolidColorBrush(Colors.Red); | 1065 | pNewLine.Stroke = new SolidColorBrush(Colors.Red); |
1065 | pNewLine.StrokeThickness = STROKE_LINE; | 1066 | pNewLine.StrokeThickness = STROKE_LINE; |
1066 | pNewLine.Data = gGrpNewLine; | 1067 | pNewLine.Data = gGrpNewLine; |
1067 | //2017/03/04 NAM ADD END | 1068 | //2017/03/04 NAM ADD END |
1068 | 1069 | ||
1069 | pScheduleLine.Stroke = new SolidColorBrush(Colors.Red); | 1070 | pScheduleLine.Stroke = new SolidColorBrush(Colors.Red); |
1070 | pScheduleLine.StrokeThickness = STROKE_LINE; | 1071 | pScheduleLine.StrokeThickness = STROKE_LINE; |
1071 | pScheduleLine.Data = gGrpScheduleLine; | 1072 | pScheduleLine.Data = gGrpScheduleLine; |
1072 | 1073 | ||
1073 | // Setting for path line | 1074 | // Setting for path line |
1074 | pLine.Stroke = new SolidColorBrush(Colors.Blue); | 1075 | pLine.Stroke = new SolidColorBrush(Colors.Blue); |
1075 | pLine.StrokeThickness = STROKE_LINE; | 1076 | pLine.StrokeThickness = STROKE_LINE; |
1076 | pLine.Data = gGrpLine; | 1077 | pLine.Data = gGrpLine; |
1077 | 1078 | ||
1078 | // Setting for path of curver line | 1079 | // Setting for path of curver line |
1079 | pCurverLine.Stroke = Brushes.Red; | 1080 | pCurverLine.Stroke = Brushes.Red; |
1080 | pCurverLine.StrokeThickness = STROKE_LINE; | 1081 | pCurverLine.StrokeThickness = STROKE_LINE; |
1081 | pCurverLine.Data = gGrpCurverLine; | 1082 | pCurverLine.Data = gGrpCurverLine; |
1082 | 1083 | ||
1083 | // Setting for path of red node | 1084 | // Setting for path of red node |
1084 | pRedNode.Stroke = new SolidColorBrush(Colors.Blue); | 1085 | pRedNode.Stroke = new SolidColorBrush(Colors.Blue); |
1085 | pRedNode.Fill = new SolidColorBrush(Colors.Red); | 1086 | pRedNode.Fill = new SolidColorBrush(Colors.Red); |
1086 | pRedNode.StrokeThickness = STROKE_NODE; | 1087 | pRedNode.StrokeThickness = STROKE_NODE; |
1087 | pRedNode.Data = gGrpRedNode; | 1088 | pRedNode.Data = gGrpRedNode; |
1088 | 1089 | ||
1089 | // Setting for path of yellow node | 1090 | // Setting for path of yellow node |
1090 | pYellowNode.Stroke = new SolidColorBrush(Colors.Blue); | 1091 | pYellowNode.Stroke = new SolidColorBrush(Colors.Blue); |
1091 | pYellowNode.Fill = new SolidColorBrush(Colors.Yellow); | 1092 | pYellowNode.Fill = new SolidColorBrush(Colors.Yellow); |
1092 | pYellowNode.StrokeThickness = STROKE_NODE; | 1093 | pYellowNode.StrokeThickness = STROKE_NODE; |
1093 | pYellowNode.Data = gGrpYellowNode; | 1094 | pYellowNode.Data = gGrpYellowNode; |
1094 | 1095 | ||
1095 | // Setting for path of Blue node | 1096 | // Setting for path of Blue node |
1096 | pBlueNode.Stroke = new SolidColorBrush(Colors.Blue); | 1097 | pBlueNode.Stroke = new SolidColorBrush(Colors.Blue); |
1097 | pBlueNode.Fill = new SolidColorBrush(Colors.LightBlue); | 1098 | pBlueNode.Fill = new SolidColorBrush(Colors.LightBlue); |
1098 | pBlueNode.StrokeThickness = STROKE_NODE; | 1099 | pBlueNode.StrokeThickness = STROKE_NODE; |
1099 | pBlueNode.Data = gGrpBlueNode; | 1100 | pBlueNode.Data = gGrpBlueNode; |
1100 | 1101 | ||
1101 | // Setting for path of Free node | 1102 | // Setting for path of Free node |
1102 | //pFreeNode.Stroke = new SolidColorBrush(Colors.Blue); | 1103 | //pFreeNode.Stroke = new SolidColorBrush(Colors.Blue); |
1103 | //pFreeNode.Fill = new SolidColorBrush(Colors.LightBlue); | 1104 | //pFreeNode.Fill = new SolidColorBrush(Colors.LightBlue); |
1104 | //pFreeNode.StrokeThickness = STROKE_NODE; | 1105 | //pFreeNode.StrokeThickness = STROKE_NODE; |
1105 | //pFreeNode.Data = gGrpFreeNode; | 1106 | //pFreeNode.Data = gGrpFreeNode; |
1106 | 1107 | ||
1107 | // Add paths to canvas | 1108 | // Add paths to canvas |
1108 | this.Children.Add(pLine); | 1109 | this.Children.Add(pLine); |
1109 | this.Children.Add(pCurverLine); | 1110 | this.Children.Add(pCurverLine); |
1110 | this.Children.Add(pRedNode); | 1111 | this.Children.Add(pRedNode); |
1111 | this.Children.Add(pYellowNode); | 1112 | this.Children.Add(pYellowNode); |
1112 | 1113 | ||
1113 | //this.Children.Add(pBlueNode); | 1114 | //this.Children.Add(pBlueNode); |
1114 | //2017/03/04 NAM ADD START | 1115 | //2017/03/04 NAM ADD START |
1115 | this.Children.Add(pNewLine); | 1116 | this.Children.Add(pNewLine); |
1116 | //this.Children.Add(pScheduleLine); | 1117 | //this.Children.Add(pScheduleLine); |
1117 | scheduleCanvas.Children.Add(pScheduleLine); | 1118 | scheduleCanvas.Children.Add(pScheduleLine); |
1118 | //2017/03/04 NAM ADD END | 1119 | //2017/03/04 NAM ADD END |
1119 | } | 1120 | } |
1120 | 1121 | ||
1121 | /// <summary> | 1122 | /// <summary> |
1122 | /// Clear all route | 1123 | /// Clear all route |
1123 | /// </summary> | 1124 | /// </summary> |
1124 | public void ClearRoute() | 1125 | public void ClearRoute() |
1125 | { | 1126 | { |
1126 | isStartDrawRoute = false; | 1127 | isStartDrawRoute = false; |
1127 | isGoalDrawRoute = false; | 1128 | isGoalDrawRoute = false; |
1128 | 1129 | ||
1129 | gGrpLine.Children.Clear(); | 1130 | gGrpLine.Children.Clear(); |
1130 | gGrpRootLine.Children.Clear(); | 1131 | gGrpRootLine.Children.Clear(); |
1131 | gGrpCurverLine.Children.Clear(); | 1132 | gGrpCurverLine.Children.Clear(); |
1132 | gGrpRedNode.Children.Clear(); | 1133 | gGrpRedNode.Children.Clear(); |
1133 | gGrpYellowNode.Children.Clear(); | 1134 | gGrpYellowNode.Children.Clear(); |
1134 | gGrpBlueNode.Children.Clear(); | 1135 | gGrpBlueNode.Children.Clear(); |
1135 | 1136 | ||
1136 | this.Children.Remove(pLine); | 1137 | this.Children.Remove(pLine); |
1137 | this.Children.Remove(pRootLine); | 1138 | this.Children.Remove(pRootLine); |
1138 | this.Children.Remove(pCurverLine); | 1139 | this.Children.Remove(pCurverLine); |
1139 | this.Children.Remove(pRedNode); | 1140 | this.Children.Remove(pRedNode); |
1140 | this.Children.Remove(pYellowNode); | 1141 | this.Children.Remove(pYellowNode); |
1141 | this.Children.Remove(pBlueNode); | 1142 | this.Children.Remove(pBlueNode); |
1142 | } | 1143 | } |
1143 | 1144 | ||
1144 | /// <summary> | 1145 | /// <summary> |
1145 | /// Draw line for route | 1146 | /// Draw line for route |
1146 | /// </summary> | 1147 | /// </summary> |
1147 | /// <param name="startPoint">Start point</param> | 1148 | /// <param name="startPoint">Start point</param> |
1148 | /// <param name="endPoint">End point</param> | 1149 | /// <param name="endPoint">End point</param> |
1149 | /// <param name="geometryGroup">Geometry Group</param> | 1150 | /// <param name="geometryGroup">Geometry Group</param> |
1150 | private void DrawLine(Point startPoint, Point endPoint, GeometryGroup geometryGroup) | 1151 | private void DrawLine(Point startPoint, Point endPoint, GeometryGroup geometryGroup) |
1151 | { | 1152 | { |
1152 | LineGeometry lineGeometry = new LineGeometry(); | 1153 | LineGeometry lineGeometry = new LineGeometry(); |
1153 | lineGeometry.StartPoint = startPoint; | 1154 | lineGeometry.StartPoint = startPoint; |
1154 | lineGeometry.EndPoint = endPoint; | 1155 | lineGeometry.EndPoint = endPoint; |
1155 | geometryGroup.Children.Add(lineGeometry); | 1156 | geometryGroup.Children.Add(lineGeometry); |
1156 | } | 1157 | } |
1157 | 1158 | ||
1158 | /// <summary> | 1159 | /// <summary> |
1159 | /// Draw curver line | 1160 | /// Draw curver line |
1160 | /// </summary> | 1161 | /// </summary> |
1161 | /// <param name="startPoint">Point start curver line</param> | 1162 | /// <param name="startPoint">Point start curver line</param> |
1162 | /// <param name="endPoint">Point end curver line</param> | 1163 | /// <param name="endPoint">Point end curver line</param> |
1163 | /// <param name="radius">Radius</param> | 1164 | /// <param name="radius">Radius</param> |
1164 | /// <param name="geometryGroup">Geometry Group</param> | 1165 | /// <param name="geometryGroup">Geometry Group</param> |
1165 | private void DrawCurverLine(Point startPoint, Point endPoint, SweepDirection sweepDirection, GeometryGroup geometryGroup) | 1166 | private void DrawCurverLine(Point startPoint, Point endPoint, SweepDirection sweepDirection, GeometryGroup geometryGroup) |
1166 | { | 1167 | { |
1167 | PathGeometry pathGeometry = new PathGeometry(); | 1168 | PathGeometry pathGeometry = new PathGeometry(); |
1168 | PathFigure figure = new PathFigure(); | 1169 | PathFigure figure = new PathFigure(); |
1169 | figure.StartPoint = startPoint; | 1170 | figure.StartPoint = startPoint; |
1170 | figure.Segments.Add(new ArcSegment(endPoint, new Size(RADIUS_CURVER_LINE, RADIUS_CURVER_LINE), 90, false, sweepDirection, true)); | 1171 | figure.Segments.Add(new ArcSegment(endPoint, new Size(RADIUS_CURVER_LINE, RADIUS_CURVER_LINE), 90, false, sweepDirection, true)); |
1171 | pathGeometry.Figures.Add(figure); | 1172 | pathGeometry.Figures.Add(figure); |
1172 | geometryGroup.Children.Add(pathGeometry); | 1173 | geometryGroup.Children.Add(pathGeometry); |
1173 | } | 1174 | } |
1174 | 1175 | ||
1175 | /// <summary> | 1176 | /// <summary> |
1176 | /// Setting node | 1177 | /// Setting node |
1177 | /// </summary> | 1178 | /// </summary> |
1178 | /// <param name="centerPoit">Position of center node</param> | 1179 | /// <param name="centerPoit">Position of center node</param> |
1179 | /// <param name="geometryGroup">Geometry Group</param> | 1180 | /// <param name="geometryGroup">Geometry Group</param> |
1180 | private void AddNode(Point centerPoit, GeometryGroup geometryGroup) | 1181 | private void AddNode(Point centerPoit, GeometryGroup geometryGroup) |
1181 | { | 1182 | { |
1182 | double radius = RADIUS_NODE; | 1183 | double radius = RADIUS_NODE; |
1183 | geometryGroup.Children.Add(new EllipseGeometry(centerPoit, radius, radius)); | 1184 | geometryGroup.Children.Add(new EllipseGeometry(centerPoit, radius, radius)); |
1184 | } | 1185 | } |
1185 | 1186 | ||
1186 | /// <summary> | 1187 | /// <summary> |
1187 | /// Check line is vertical or horizontal | 1188 | /// Check line is vertical or horizontal |
1188 | /// </summary> | 1189 | /// </summary> |
1189 | /// <param name="line"></param> | 1190 | /// <param name="line"></param> |
1190 | /// <returns>true:Vertical, false:Horizontal</returns> | 1191 | /// <returns>true:Vertical, false:Horizontal</returns> |
1191 | private bool IsVerticalLine(LineGeometry line) | 1192 | private bool IsVerticalLine(LineGeometry line) |
1192 | { | 1193 | { |
1193 | if (line.StartPoint.X == line.EndPoint.X) | 1194 | if (line.StartPoint.X == line.EndPoint.X) |
1194 | { | 1195 | { |
1195 | // Vertical line | 1196 | // Vertical line |
1196 | return true; | 1197 | return true; |
1197 | } | 1198 | } |
1198 | 1199 | ||
1199 | // Horizontal line | 1200 | // Horizontal line |
1200 | return false; | 1201 | return false; |
1201 | } | 1202 | } |
1202 | 1203 | ||
1203 | /// <summary> | 1204 | /// <summary> |
1204 | /// Get distance between two point | 1205 | /// Get distance between two point |
1205 | /// </summary> | 1206 | /// </summary> |
1206 | /// <param name="point1">Point 1</param> | 1207 | /// <param name="point1">Point 1</param> |
1207 | /// <param name="point2">Point 2</param> | 1208 | /// <param name="point2">Point 2</param> |
1208 | /// <returns>Distance between two point</returns> | 1209 | /// <returns>Distance between two point</returns> |
1209 | private double GetDistance(Point point1, Point point2) | 1210 | private double GetDistance(Point point1, Point point2) |
1210 | { | 1211 | { |
1211 | //pythagorean theorem c^2 = a^2 + b^2 | 1212 | //pythagorean theorem c^2 = a^2 + b^2 |
1212 | //thus c = square root(a^2 + b^2) | 1213 | //thus c = square root(a^2 + b^2) |
1213 | double a = (double)(point2.X - point1.X); | 1214 | double a = (double)(point2.X - point1.X); |
1214 | double b = (double)(point2.Y - point1.Y); | 1215 | double b = (double)(point2.Y - point1.Y); |
1215 | 1216 | ||
1216 | return Math.Sqrt(a * a + b * b); | 1217 | return Math.Sqrt(a * a + b * b); |
1217 | } | 1218 | } |
1218 | 1219 | ||
1219 | /// <summary> | 1220 | /// <summary> |
1220 | /// Check point is valid for draw | 1221 | /// Check point is valid for draw |
1221 | /// </summary> | 1222 | /// </summary> |
1222 | /// <param name="point">Poit need check</param> | 1223 | /// <param name="point">Poit need check</param> |
1223 | /// <returns>true:Valid, false:Invalid</returns> | 1224 | /// <returns>true:Valid, false:Invalid</returns> |
1224 | private bool IsValidPoint(Point point) | 1225 | private bool IsValidPoint(Point point) |
1225 | { | 1226 | { |
1226 | return true; | 1227 | return true; |
1227 | } | 1228 | } |
1228 | 1229 | ||
1229 | /// <summary> | 1230 | /// <summary> |
1230 | /// Display coordinate position | 1231 | /// Display coordinate position |
1231 | /// </summary> | 1232 | /// </summary> |
1232 | /// <param name="point">Position to display</param> | 1233 | /// <param name="point">Position to display</param> |
1233 | private void DisplayCoordinate(Point point) | 1234 | private void DisplayCoordinate(Point point) |
1234 | { | 1235 | { |
1235 | if (_displayAxiPosition == null) | 1236 | if (_displayAxiPosition == null) |
1236 | { | 1237 | { |
1237 | _displayAxiPosition = new ucDisplayCoordinate(); | 1238 | _displayAxiPosition = new ucDisplayCoordinate(); |
1238 | this.Children.Add(_displayAxiPosition); | 1239 | this.Children.Add(_displayAxiPosition); |
1239 | } | 1240 | } |
1240 | _displayAxiPosition.Display(point); | 1241 | _displayAxiPosition.Display(point); |
1241 | } | 1242 | } |
1242 | 1243 | ||
1243 | #endregion | 1244 | #endregion |
1244 | 1245 | ||
1245 | #region Functions for Set Auto Nodes | 1246 | #region Functions for Set Auto Nodes |
1246 | 1247 | ||
1247 | /// <summary> | 1248 | /// <summary> |
1248 | /// SetAutoNodes | 1249 | /// SetAutoNodes |
1249 | /// </summary> | 1250 | /// </summary> |
1250 | public void SetAutoNodes() | 1251 | public void SetAutoNodes() |
1251 | { | 1252 | { |
1252 | double radiusStart = DISTANCE_START_NODES; | 1253 | double radiusStart = DISTANCE_START_NODES; |
1253 | double radiusEnd = DISTANCE_END_NODES; | 1254 | double radiusEnd = DISTANCE_END_NODES; |
1254 | double radiusCurver = RADIUS_CURVER_LINE; | 1255 | double radiusCurver = RADIUS_CURVER_LINE; |
1255 | 1256 | ||
1256 | Point startNode; | 1257 | Point startNode; |
1257 | Point endNode; | 1258 | Point endNode; |
1258 | 1259 | ||
1259 | gGrpBlueNode.Children.Clear(); | 1260 | gGrpBlueNode.Children.Clear(); |
1260 | 1261 | ||
1261 | if (gGrpLine.Children.Count == 1) | 1262 | if (gGrpLine.Children.Count == 1) |
1262 | radiusCurver = radiusEnd; | 1263 | radiusCurver = radiusEnd; |
1263 | 1264 | ||
1264 | if (gGrpLine.Children.Count > 0) | 1265 | if (gGrpLine.Children.Count > 0) |
1265 | { | 1266 | { |
1266 | for (int i = 0; i < gGrpLine.Children.Count; i++) | 1267 | for (int i = 0; i < gGrpLine.Children.Count; i++) |
1267 | { | 1268 | { |
1268 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[i]; | 1269 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[i]; |
1269 | if (i == 0) | 1270 | if (i == 0) |
1270 | { | 1271 | { |
1271 | startNode = lineGeometry.EndPoint; | 1272 | startNode = lineGeometry.EndPoint; |
1272 | endNode = lineGeometry.StartPoint; | 1273 | endNode = lineGeometry.StartPoint; |
1273 | DrawAutoNodes(startNode, endNode, radiusCurver, radiusStart); | 1274 | DrawAutoNodes(startNode, endNode, radiusCurver, radiusStart); |
1274 | } | 1275 | } |
1275 | else if (i == gGrpLine.Children.Count - 1 && i > 0) | 1276 | else if (i == gGrpLine.Children.Count - 1 && i > 0) |
1276 | { | 1277 | { |
1277 | startNode = lineGeometry.StartPoint; | 1278 | startNode = lineGeometry.StartPoint; |
1278 | endNode = lineGeometry.EndPoint; | 1279 | endNode = lineGeometry.EndPoint; |
1279 | DrawAutoNodes(startNode, endNode, radiusCurver, radiusEnd); | 1280 | DrawAutoNodes(startNode, endNode, radiusCurver, radiusEnd); |
1280 | } | 1281 | } |
1281 | else | 1282 | else |
1282 | { | 1283 | { |
1283 | startNode = lineGeometry.StartPoint; | 1284 | startNode = lineGeometry.StartPoint; |
1284 | endNode = lineGeometry.EndPoint; | 1285 | endNode = lineGeometry.EndPoint; |
1285 | DrawAutoNodes(startNode, endNode, radiusCurver, radiusCurver); | 1286 | DrawAutoNodes(startNode, endNode, radiusCurver, radiusCurver); |
1286 | } | 1287 | } |
1287 | } | 1288 | } |
1288 | } | 1289 | } |
1289 | } | 1290 | } |
1290 | 1291 | ||
1291 | 1292 | ||
1292 | /// <summary> | 1293 | /// <summary> |
1293 | /// DrawAutoNodes | 1294 | /// DrawAutoNodes |
1294 | /// </summary> | 1295 | /// </summary> |
1295 | /// <param name="startNode"></param> | 1296 | /// <param name="startNode"></param> |
1296 | /// <param name="endNode"></param> | 1297 | /// <param name="endNode"></param> |
1297 | /// <param name="radiusStart"></param> | 1298 | /// <param name="radiusStart"></param> |
1298 | /// <param name="radiusEnd"></param> | 1299 | /// <param name="radiusEnd"></param> |
1299 | private void DrawAutoNodes(Point startNode, Point endNode, double radiusStart, double radiusEnd) | 1300 | private void DrawAutoNodes(Point startNode, Point endNode, double radiusStart, double radiusEnd) |
1300 | { | 1301 | { |
1301 | double distance = DISTANCE_AUTO_NODES; | 1302 | double distance = DISTANCE_AUTO_NODES; |
1302 | double i; | 1303 | double i; |
1303 | 1304 | ||
1304 | Point node; | 1305 | Point node; |
1305 | 1306 | ||
1306 | // Get postion of blue node on line | 1307 | // Get postion of blue node on line |
1307 | if (startNode.X == endNode.X) | 1308 | if (startNode.X == endNode.X) |
1308 | { | 1309 | { |
1309 | if (startNode.Y > endNode.Y) | 1310 | if (startNode.Y > endNode.Y) |
1310 | { | 1311 | { |
1311 | i = startNode.Y - radiusStart; | 1312 | i = startNode.Y - radiusStart; |
1312 | if (i - distance > endNode.Y + radiusEnd) | 1313 | if (i - distance > endNode.Y + radiusEnd) |
1313 | { | 1314 | { |
1314 | do | 1315 | do |
1315 | { | 1316 | { |
1316 | i = i - distance; | 1317 | i = i - distance; |
1317 | node = new Point(endNode.X, i); | 1318 | node = new Point(endNode.X, i); |
1318 | // Add node to postion distance 1000mm | 1319 | // Add node to postion distance 1000mm |
1319 | AddNode(node, gGrpBlueNode); | 1320 | AddNode(node, gGrpBlueNode); |
1320 | 1321 | ||
1321 | } while (i > endNode.Y + radiusEnd + distance); | 1322 | } while (i > endNode.Y + radiusEnd + distance); |
1322 | } | 1323 | } |
1323 | } | 1324 | } |
1324 | else | 1325 | else |
1325 | { | 1326 | { |
1326 | i = startNode.Y + radiusStart; | 1327 | i = startNode.Y + radiusStart; |
1327 | if (i + distance < endNode.Y - radiusEnd) | 1328 | if (i + distance < endNode.Y - radiusEnd) |
1328 | { | 1329 | { |
1329 | do | 1330 | do |
1330 | { | 1331 | { |
1331 | i = i + distance; | 1332 | i = i + distance; |
1332 | node = new Point(endNode.X, i); | 1333 | node = new Point(endNode.X, i); |
1333 | // Add node to postion distance 1000mm | 1334 | // Add node to postion distance 1000mm |
1334 | AddNode(node, gGrpBlueNode); | 1335 | AddNode(node, gGrpBlueNode); |
1335 | } while (i < endNode.Y - radiusEnd - distance); | 1336 | } while (i < endNode.Y - radiusEnd - distance); |
1336 | } | 1337 | } |
1337 | } | 1338 | } |
1338 | } | 1339 | } |
1339 | else | 1340 | else |
1340 | { | 1341 | { |
1341 | if (startNode.X > endNode.X) | 1342 | if (startNode.X > endNode.X) |
1342 | { | 1343 | { |
1343 | i = startNode.X - radiusStart; | 1344 | i = startNode.X - radiusStart; |
1344 | if (i - distance > endNode.X + radiusEnd) | 1345 | if (i - distance > endNode.X + radiusEnd) |
1345 | { | 1346 | { |
1346 | do | 1347 | do |
1347 | { | 1348 | { |
1348 | i = i - distance; | 1349 | i = i - distance; |
1349 | node = new Point(i, endNode.Y); | 1350 | node = new Point(i, endNode.Y); |
1350 | // Add node to postion distance 1000mm | 1351 | // Add node to postion distance 1000mm |
1351 | AddNode(node, gGrpBlueNode); | 1352 | AddNode(node, gGrpBlueNode); |
1352 | } while (i > endNode.X + radiusEnd + distance); | 1353 | } while (i > endNode.X + radiusEnd + distance); |
1353 | } | 1354 | } |
1354 | } | 1355 | } |
1355 | else | 1356 | else |
1356 | { | 1357 | { |
1357 | i = startNode.X + radiusStart; | 1358 | i = startNode.X + radiusStart; |
1358 | if (i + distance < endNode.X - radiusEnd) | 1359 | if (i + distance < endNode.X - radiusEnd) |
1359 | { | 1360 | { |
1360 | do | 1361 | do |
1361 | { | 1362 | { |
1362 | i = i + distance; | 1363 | i = i + distance; |
1363 | node = new Point(i, endNode.Y); | 1364 | node = new Point(i, endNode.Y); |
1364 | // Add node to postion distance 1000mm | 1365 | // Add node to postion distance 1000mm |
1365 | AddNode(node, gGrpBlueNode); | 1366 | AddNode(node, gGrpBlueNode); |
1366 | } while (i < endNode.X - radiusEnd - distance); | 1367 | } while (i < endNode.X - radiusEnd - distance); |
1367 | } | 1368 | } |
1368 | } | 1369 | } |
1369 | } | 1370 | } |
1370 | 1371 | ||
1371 | } | 1372 | } |
1372 | 1373 | ||
1373 | #endregion | 1374 | #endregion |
1374 | 1375 | ||
1375 | #region Functions for Set Free Nodes | 1376 | #region Functions for Set Free Nodes |
1376 | /// <summary> | 1377 | /// <summary> |
1377 | /// Draw Auto Blue node | 1378 | /// Draw Auto Blue node |
1378 | /// </summary> | 1379 | /// </summary> |
1379 | 1380 | ||
1380 | public void SetFreeNodes(Point FreeNode, bool RightClick) | 1381 | public void SetFreeNodes(Point FreeNode, bool RightClick) |
1381 | { | 1382 | { |
1382 | double radiusStart = DISTANCE_START_NODES; | 1383 | double radiusStart = DISTANCE_START_NODES; |
1383 | double radiusEnd = DISTANCE_END_NODES; | 1384 | double radiusEnd = DISTANCE_END_NODES; |
1384 | double radiusNode = RADIUS_NODE; | 1385 | double radiusNode = RADIUS_NODE; |
1385 | double radiusCurver = RADIUS_CURVER_LINE + RADIUS_NODE; | 1386 | double radiusCurver = RADIUS_CURVER_LINE + RADIUS_NODE; |
1386 | 1387 | ||
1387 | EllipseGeometry ellipseGeometry; | 1388 | EllipseGeometry ellipseGeometry; |
1388 | Point node; | 1389 | Point node; |
1389 | bool deleteFlag = false; | 1390 | bool deleteFlag = false; |
1390 | 1391 | ||
1391 | 1392 | ||
1392 | if (RightClick) | 1393 | if (RightClick) |
1393 | { | 1394 | { |
1394 | if (gGrpBlueNode.Children.Count > 0) | 1395 | if (gGrpBlueNode.Children.Count > 0) |
1395 | { | 1396 | { |
1396 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 1397 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
1397 | { | 1398 | { |
1398 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; | 1399 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; |
1399 | node = ellipseGeometry.Center; | 1400 | node = ellipseGeometry.Center; |
1400 | if (FreeNode.X == node.X) | 1401 | if (FreeNode.X == node.X) |
1401 | { | 1402 | { |
1402 | if (CheckIsNode(FreeNode, node, radiusNode)) | 1403 | if (CheckIsNode(FreeNode, node, radiusNode)) |
1403 | { | 1404 | { |
1404 | deleteFlag = true; | 1405 | deleteFlag = true; |
1405 | } | 1406 | } |
1406 | } | 1407 | } |
1407 | else | 1408 | else |
1408 | { | 1409 | { |
1409 | if (CheckIsNode(FreeNode, node, radiusNode)) | 1410 | if (CheckIsNode(FreeNode, node, radiusNode)) |
1410 | { | 1411 | { |
1411 | deleteFlag = true; | 1412 | deleteFlag = true; |
1412 | } | 1413 | } |
1413 | } | 1414 | } |
1414 | if (deleteFlag) | 1415 | if (deleteFlag) |
1415 | { | 1416 | { |
1416 | MessageBoxResult result = MessageBox.Show("Do You Delete This Node?", "Delete Node", MessageBoxButton.OKCancel); | 1417 | MessageBoxResult result = MessageBox.Show("Do You Delete This Node?", "Delete Node", MessageBoxButton.OKCancel); |
1417 | if (result == MessageBoxResult.OK) | 1418 | if (result == MessageBoxResult.OK) |
1418 | { | 1419 | { |
1419 | gGrpBlueNode.Children.RemoveAt(i); | 1420 | gGrpBlueNode.Children.RemoveAt(i); |
1420 | 1421 | ||
1421 | this.Children.Remove(NodeNo[i]); | 1422 | this.Children.Remove(NodeNo[i]); |
1422 | return; | 1423 | return; |
1423 | } | 1424 | } |
1424 | else | 1425 | else |
1425 | { | 1426 | { |
1426 | return; | 1427 | return; |
1427 | } | 1428 | } |
1428 | } | 1429 | } |
1429 | } | 1430 | } |
1430 | } | 1431 | } |
1431 | } | 1432 | } |
1432 | else | 1433 | else |
1433 | { | 1434 | { |
1434 | 1435 | ||
1435 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 1436 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
1436 | { | 1437 | { |
1437 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; | 1438 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; |
1438 | node = ellipseGeometry.Center; | 1439 | node = ellipseGeometry.Center; |
1439 | bool isEditNode = CheckIsNode(FreeNode, node, RADIUS_NODE); | 1440 | bool isEditNode = CheckIsNode(FreeNode, node, RADIUS_NODE); |
1440 | 1441 | ||
1441 | if (isEditNode) | 1442 | if (isEditNode) |
1442 | { | 1443 | { |
1443 | EditNode(node); | 1444 | EditNode(node); |
1444 | return; | 1445 | return; |
1445 | } | 1446 | } |
1446 | } | 1447 | } |
1447 | 1448 | ||
1448 | 1449 | ||
1449 | MessageBoxResult result = MessageBox.Show("Do You Want To Add This Node?", "Add Node", MessageBoxButton.OKCancel); | 1450 | MessageBoxResult result = MessageBox.Show("Do You Want To Add This Node?", "Add Node", MessageBoxButton.OKCancel); |
1450 | if (result == MessageBoxResult.OK) | 1451 | if (result == MessageBoxResult.OK) |
1451 | { | 1452 | { |
1452 | AddNode(FreeNode, gGrpBlueNode); | 1453 | AddNode(FreeNode, gGrpBlueNode); |
1453 | 1454 | ||
1454 | TextBlock textBlock = new TextBlock(); | 1455 | TextBlock textBlock = new TextBlock(); |
1455 | textBlock.Text = stt.ToString(); | 1456 | textBlock.Text = stt.ToString(); |
1456 | textBlock.FontSize = 17; | 1457 | textBlock.FontSize = 17; |
1457 | textBlock.Foreground = new SolidColorBrush(Colors.Red); | 1458 | textBlock.Foreground = new SolidColorBrush(Colors.Red); |
1458 | Canvas.SetLeft(textBlock, FreeNode.X - RADIUS_NODE / 2); | 1459 | Canvas.SetLeft(textBlock, FreeNode.X - RADIUS_NODE / 2); |
1459 | Canvas.SetTop(textBlock, FreeNode.Y - 1.5 * RADIUS_NODE); | 1460 | Canvas.SetTop(textBlock, FreeNode.Y - 1.5 * RADIUS_NODE); |
1460 | 1461 | ||
1461 | this.Children.Add(textBlock); | 1462 | this.Children.Add(textBlock); |
1462 | NodeNo.Add(textBlock); | 1463 | NodeNo.Add(textBlock); |
1463 | 1464 | ||
1464 | if (stt > 1) | 1465 | if (stt > 1) |
1465 | { | 1466 | { |
1466 | int tmp = gGrpBlueNode.Children.Count; | 1467 | int tmp = gGrpBlueNode.Children.Count; |
1467 | 1468 | ||
1468 | EllipseGeometry elip = (EllipseGeometry)gGrpBlueNode.Children[tmp - 2]; | 1469 | EllipseGeometry elip = (EllipseGeometry)gGrpBlueNode.Children[tmp - 2]; |
1469 | Point node1 = elip.Center; | 1470 | Point node1 = elip.Center; |
1470 | elip = (EllipseGeometry)gGrpBlueNode.Children[tmp - 1]; | 1471 | elip = (EllipseGeometry)gGrpBlueNode.Children[tmp - 1]; |
1471 | Point node2 = elip.Center; | 1472 | Point node2 = elip.Center; |
1472 | DrawLine(node1, node2, gGrpCurverLine); | 1473 | DrawLine(node1, node2, gGrpCurverLine); |
1473 | } | 1474 | } |
1474 | 1475 | ||
1475 | 1476 | ||
1476 | stt++; | 1477 | stt++; |
1477 | } | 1478 | } |
1478 | } | 1479 | } |
1479 | 1480 | ||
1480 | if (gGrpLine.Children.Count > 0) | 1481 | if (gGrpLine.Children.Count > 0) |
1481 | { | 1482 | { |
1482 | for (int i = 0; i < gGrpLine.Children.Count; i++) | 1483 | for (int i = 0; i < gGrpLine.Children.Count; i++) |
1483 | { | 1484 | { |
1484 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[i]; | 1485 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[i]; |
1485 | 1486 | ||
1486 | // Get postion of node on line | 1487 | // Get postion of node on line |
1487 | if (IsVerticalLine(lineGeometry)) | 1488 | if (IsVerticalLine(lineGeometry)) |
1488 | { | 1489 | { |
1489 | if (FreeNode.X < lineGeometry.EndPoint.X + radiusNode && FreeNode.X > lineGeometry.EndPoint.X - radiusNode) | 1490 | if (FreeNode.X < lineGeometry.EndPoint.X + radiusNode && FreeNode.X > lineGeometry.EndPoint.X - radiusNode) |
1490 | { | 1491 | { |
1491 | FreeNode.X = lineGeometry.EndPoint.X; | 1492 | FreeNode.X = lineGeometry.EndPoint.X; |
1492 | 1493 | ||
1493 | if (i == 0) | 1494 | if (i == 0) |
1494 | { | 1495 | { |
1495 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusStart, radiusCurver)) | 1496 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusStart, radiusCurver)) |
1496 | { | 1497 | { |
1497 | 1498 | ||
1498 | AddNode(FreeNode, gGrpBlueNode); | 1499 | AddNode(FreeNode, gGrpBlueNode); |
1499 | } | 1500 | } |
1500 | } | 1501 | } |
1501 | else if (i == gGrpLine.Children.Count - 1 && i > 0) | 1502 | else if (i == gGrpLine.Children.Count - 1 && i > 0) |
1502 | { | 1503 | { |
1503 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusEnd)) | 1504 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusEnd)) |
1504 | { | 1505 | { |
1505 | 1506 | ||
1506 | AddNode(FreeNode, gGrpBlueNode); | 1507 | AddNode(FreeNode, gGrpBlueNode); |
1507 | } | 1508 | } |
1508 | } | 1509 | } |
1509 | else | 1510 | else |
1510 | { | 1511 | { |
1511 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusCurver)) | 1512 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusCurver)) |
1512 | { | 1513 | { |
1513 | 1514 | ||
1514 | AddNode(FreeNode, gGrpBlueNode); | 1515 | AddNode(FreeNode, gGrpBlueNode); |
1515 | } | 1516 | } |
1516 | } | 1517 | } |
1517 | 1518 | ||
1518 | } | 1519 | } |
1519 | } | 1520 | } |
1520 | else | 1521 | else |
1521 | { | 1522 | { |
1522 | if (FreeNode.Y < lineGeometry.EndPoint.Y + radiusNode && FreeNode.Y > lineGeometry.EndPoint.Y - radiusNode) | 1523 | if (FreeNode.Y < lineGeometry.EndPoint.Y + radiusNode && FreeNode.Y > lineGeometry.EndPoint.Y - radiusNode) |
1523 | { | 1524 | { |
1524 | FreeNode.Y = lineGeometry.EndPoint.Y; | 1525 | FreeNode.Y = lineGeometry.EndPoint.Y; |
1525 | if (i == 0) | 1526 | if (i == 0) |
1526 | { | 1527 | { |
1527 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusStart, radiusCurver)) | 1528 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusStart, radiusCurver)) |
1528 | { | 1529 | { |
1529 | 1530 | ||
1530 | AddNode(FreeNode, gGrpBlueNode); | 1531 | AddNode(FreeNode, gGrpBlueNode); |
1531 | } | 1532 | } |
1532 | } | 1533 | } |
1533 | else if (i == gGrpLine.Children.Count - 1 && i > 0) | 1534 | else if (i == gGrpLine.Children.Count - 1 && i > 0) |
1534 | { | 1535 | { |
1535 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusEnd)) | 1536 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusEnd)) |
1536 | { | 1537 | { |
1537 | 1538 | ||
1538 | AddNode(FreeNode, gGrpBlueNode); | 1539 | AddNode(FreeNode, gGrpBlueNode); |
1539 | } | 1540 | } |
1540 | } | 1541 | } |
1541 | else | 1542 | else |
1542 | { | 1543 | { |
1543 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusCurver)) | 1544 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusCurver)) |
1544 | { | 1545 | { |
1545 | 1546 | ||
1546 | AddNode(FreeNode, gGrpBlueNode); | 1547 | AddNode(FreeNode, gGrpBlueNode); |
1547 | } | 1548 | } |
1548 | } | 1549 | } |
1549 | 1550 | ||
1550 | } | 1551 | } |
1551 | } | 1552 | } |
1552 | } | 1553 | } |
1553 | } | 1554 | } |
1554 | } | 1555 | } |
1555 | 1556 | ||
1556 | 1557 | ||
1557 | public bool CheckFreeNodes(LineGeometry lineNode, Point Freenode, double radiusStart, double radiusEnd) | 1558 | public bool CheckFreeNodes(LineGeometry lineNode, Point Freenode, double radiusStart, double radiusEnd) |
1558 | { | 1559 | { |
1559 | 1560 | ||
1560 | double distanceFreeNode = DISTANCE_FREE_NODES; | 1561 | double distanceFreeNode = DISTANCE_FREE_NODES; |
1561 | double radiusNode = RADIUS_NODE; | 1562 | double radiusNode = RADIUS_NODE; |
1562 | EllipseGeometry ellipseGeometry; | 1563 | EllipseGeometry ellipseGeometry; |
1563 | Point node; | 1564 | Point node; |
1564 | 1565 | ||
1565 | if (IsVerticalLine(lineNode)) | 1566 | if (IsVerticalLine(lineNode)) |
1566 | { | 1567 | { |
1567 | if (lineNode.StartPoint.Y < lineNode.EndPoint.Y) | 1568 | if (lineNode.StartPoint.Y < lineNode.EndPoint.Y) |
1568 | { | 1569 | { |
1569 | if (Freenode.Y < lineNode.StartPoint.Y + radiusStart || Freenode.Y > lineNode.EndPoint.Y - radiusEnd) | 1570 | if (Freenode.Y < lineNode.StartPoint.Y + radiusStart || Freenode.Y > lineNode.EndPoint.Y - radiusEnd) |
1570 | { | 1571 | { |
1571 | return false; | 1572 | return false; |
1572 | } | 1573 | } |
1573 | } | 1574 | } |
1574 | else | 1575 | else |
1575 | { | 1576 | { |
1576 | if (Freenode.Y > lineNode.StartPoint.Y - radiusStart || Freenode.Y < lineNode.EndPoint.Y + radiusEnd) | 1577 | if (Freenode.Y > lineNode.StartPoint.Y - radiusStart || Freenode.Y < lineNode.EndPoint.Y + radiusEnd) |
1577 | { | 1578 | { |
1578 | return false; | 1579 | return false; |
1579 | } | 1580 | } |
1580 | } | 1581 | } |
1581 | } | 1582 | } |
1582 | else | 1583 | else |
1583 | { | 1584 | { |
1584 | if (lineNode.StartPoint.X < lineNode.EndPoint.X) | 1585 | if (lineNode.StartPoint.X < lineNode.EndPoint.X) |
1585 | { | 1586 | { |
1586 | if (Freenode.X < lineNode.StartPoint.X + radiusStart || Freenode.X > lineNode.EndPoint.X - radiusEnd) | 1587 | if (Freenode.X < lineNode.StartPoint.X + radiusStart || Freenode.X > lineNode.EndPoint.X - radiusEnd) |
1587 | { | 1588 | { |
1588 | return false; | 1589 | return false; |
1589 | } | 1590 | } |
1590 | } | 1591 | } |
1591 | else | 1592 | else |
1592 | { | 1593 | { |
1593 | if (Freenode.X > lineNode.StartPoint.X - radiusStart || Freenode.X < lineNode.EndPoint.X + radiusEnd) | 1594 | if (Freenode.X > lineNode.StartPoint.X - radiusStart || Freenode.X < lineNode.EndPoint.X + radiusEnd) |
1594 | { | 1595 | { |
1595 | return false; | 1596 | return false; |
1596 | } | 1597 | } |
1597 | } | 1598 | } |
1598 | } | 1599 | } |
1599 | 1600 | ||
1600 | if (gGrpBlueNode.Children.Count > 0) | 1601 | if (gGrpBlueNode.Children.Count > 0) |
1601 | { | 1602 | { |
1602 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 1603 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
1603 | { | 1604 | { |
1604 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; | 1605 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; |
1605 | node = ellipseGeometry.Center; | 1606 | node = ellipseGeometry.Center; |
1606 | if (Freenode.X == node.X) | 1607 | if (Freenode.X == node.X) |
1607 | { | 1608 | { |
1608 | if (CheckIsNode(Freenode, node, radiusNode)) | 1609 | if (CheckIsNode(Freenode, node, radiusNode)) |
1609 | { | 1610 | { |
1610 | return false; | 1611 | return false; |
1611 | } | 1612 | } |
1612 | else if (Freenode.Y < node.Y + distanceFreeNode && Freenode.Y > node.Y - distanceFreeNode) | 1613 | else if (Freenode.Y < node.Y + distanceFreeNode && Freenode.Y > node.Y - distanceFreeNode) |
1613 | { | 1614 | { |
1614 | return false; | 1615 | return false; |
1615 | } | 1616 | } |
1616 | } | 1617 | } |
1617 | else if (Freenode.Y == node.Y) | 1618 | else if (Freenode.Y == node.Y) |
1618 | { | 1619 | { |
1619 | if (CheckIsNode(Freenode, node, radiusNode)) | 1620 | if (CheckIsNode(Freenode, node, radiusNode)) |
1620 | { | 1621 | { |
1621 | return false; | 1622 | return false; |
1622 | } | 1623 | } |
1623 | else if (Freenode.X < node.X + distanceFreeNode && Freenode.X > node.X - distanceFreeNode) | 1624 | else if (Freenode.X < node.X + distanceFreeNode && Freenode.X > node.X - distanceFreeNode) |
1624 | { | 1625 | { |
1625 | return false; | 1626 | return false; |
1626 | } | 1627 | } |
1627 | } | 1628 | } |
1628 | } | 1629 | } |
1629 | } | 1630 | } |
1630 | 1631 | ||
1631 | return true; | 1632 | return true; |
1632 | } | 1633 | } |
1633 | 1634 | ||
1634 | public bool CheckIsNode(Point FreeNode, Point Node, double radiusNode) | 1635 | public bool CheckIsNode(Point FreeNode, Point Node, double radiusNode) |
1635 | { | 1636 | { |
1636 | if (FreeNode.X < Node.X + radiusNode && FreeNode.X > Node.X - radiusNode && FreeNode.Y < Node.Y + radiusNode && FreeNode.Y > Node.Y - radiusNode) | 1637 | if (FreeNode.X < Node.X + radiusNode && FreeNode.X > Node.X - radiusNode && FreeNode.Y < Node.Y + radiusNode && FreeNode.Y > Node.Y - radiusNode) |
1637 | { | 1638 | { |
1638 | return true; | 1639 | return true; |
1639 | } | 1640 | } |
1640 | return false; | 1641 | return false; |
1641 | } | 1642 | } |
1642 | 1643 | ||
1643 | #endregion | 1644 | #endregion |
1644 | 1645 | ||
1645 | #region Edit Node | 1646 | #region Edit Node |
1646 | public void InitNodeInfo_List() | 1647 | public void InitNodeInfo_List() |
1647 | { | 1648 | { |
1648 | //Reset List | 1649 | //Reset List |
1649 | NodeInfo_List = new List<NodeInfo>(); | 1650 | NodeInfo_List = new List<NodeInfo>(); |
1650 | 1651 | ||
1651 | if (gGrpBlueNode.Children.Count > 0) | 1652 | if (gGrpBlueNode.Children.Count > 0) |
1652 | { | 1653 | { |
1653 | // Get start point | 1654 | // Get start point |
1654 | LineGeometry lineGeometry = (LineGeometry)gGrpNewLine.Children[0]; | 1655 | LineGeometry lineGeometry = (LineGeometry)gGrpNewLine.Children[0]; |
1655 | Point startPoint = lineGeometry.StartPoint; | 1656 | Point startPoint = lineGeometry.StartPoint; |
1656 | 1657 | ||
1657 | NodeInfo n1 = new NodeInfo(); | 1658 | NodeInfo n1 = new NodeInfo(); |
1658 | n1.X = startPoint.X; | 1659 | n1.X = startPoint.X; |
1659 | n1.Y = startPoint.Y; | 1660 | n1.Y = startPoint.Y; |
1660 | n1.Mode1 = ""; | 1661 | n1.Mode1 = ""; |
1661 | n1.Mode2 = ""; | 1662 | n1.Mode2 = ""; |
1662 | n1.Mode3 = ""; | 1663 | n1.Mode3 = ""; |
1663 | NodeInfo_List.Add(n1); | 1664 | NodeInfo_List.Add(n1); |
1664 | 1665 | ||
1665 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 1666 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
1666 | { | 1667 | { |
1667 | Point point; | 1668 | Point point; |
1668 | EllipseGeometry eGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; | 1669 | EllipseGeometry eGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; |
1669 | point = eGeometry.Center; | 1670 | point = eGeometry.Center; |
1670 | 1671 | ||
1671 | NodeInfo Ninfo = new NodeInfo(); | 1672 | NodeInfo Ninfo = new NodeInfo(); |
1672 | Ninfo.X = point.X; | 1673 | Ninfo.X = point.X; |
1673 | Ninfo.Y = point.Y; | 1674 | Ninfo.Y = point.Y; |
1674 | 1675 | ||
1675 | Ninfo.Mode1 = ""; | 1676 | Ninfo.Mode1 = ""; |
1676 | Ninfo.Mode2 = ""; | 1677 | Ninfo.Mode2 = ""; |
1677 | Ninfo.Mode3 = ""; | 1678 | Ninfo.Mode3 = ""; |
1678 | 1679 | ||
1679 | NodeInfo_List.Add(Ninfo); | 1680 | NodeInfo_List.Add(Ninfo); |
1680 | } | 1681 | } |
1681 | 1682 | ||
1682 | // Get end point | 1683 | // Get end point |
1683 | lineGeometry = (LineGeometry)gGrpLine.Children[gGrpLine.Children.Count -1]; | 1684 | lineGeometry = (LineGeometry)gGrpLine.Children[gGrpLine.Children.Count -1]; |
1684 | Point endPoint = lineGeometry.EndPoint; | 1685 | Point endPoint = lineGeometry.EndPoint; |
1685 | 1686 | ||
1686 | NodeInfo n2 = new NodeInfo(); | 1687 | NodeInfo n2 = new NodeInfo(); |
1687 | n2.X = startPoint.X; | 1688 | n2.X = startPoint.X; |
1688 | n2.Y = startPoint.Y; | 1689 | n2.Y = startPoint.Y; |
1689 | n2.Mode1 = ""; | 1690 | n2.Mode1 = ""; |
1690 | n2.Mode2 = ""; | 1691 | n2.Mode2 = ""; |
1691 | n2.Mode3 = ""; | 1692 | n2.Mode3 = ""; |
1692 | NodeInfo_List.Add(n2); | 1693 | NodeInfo_List.Add(n2); |
1693 | 1694 | ||
1694 | //Resort NodeInfo_List From Start to Goal | 1695 | //Resort NodeInfo_List From Start to Goal |
1695 | LineGeometry firstLine = (LineGeometry)gGrpLine.Children[0]; | 1696 | LineGeometry firstLine = (LineGeometry)gGrpLine.Children[0]; |
1696 | Point startNode = firstLine.StartPoint; | 1697 | Point startNode = firstLine.StartPoint; |
1697 | Point endNode = firstLine.EndPoint; | 1698 | Point endNode = firstLine.EndPoint; |
1698 | 1699 | ||
1699 | 1700 | ||
1700 | List<NodeInfo> tmpLst = new List<NodeInfo>(); | 1701 | List<NodeInfo> tmpLst = new List<NodeInfo>(); |
1701 | 1702 | ||
1702 | // Create temp List | 1703 | // Create temp List |
1703 | if(startNode.X == endNode.X) | 1704 | if(startNode.X == endNode.X) |
1704 | { | 1705 | { |
1705 | for (int i = 1; i < NodeInfo_List.Count; i++) | 1706 | for (int i = 1; i < NodeInfo_List.Count; i++) |
1706 | { | 1707 | { |
1707 | if (NodeInfo_List[i].X != endNode.X) | 1708 | if (NodeInfo_List[i].X != endNode.X) |
1708 | { | 1709 | { |
1709 | break; | 1710 | break; |
1710 | } | 1711 | } |
1711 | else | 1712 | else |
1712 | { | 1713 | { |
1713 | tmpLst.Add(NodeInfo_List[i]); | 1714 | tmpLst.Add(NodeInfo_List[i]); |
1714 | } | 1715 | } |
1715 | } | 1716 | } |
1716 | } | 1717 | } |
1717 | 1718 | ||
1718 | if (startNode.Y == endNode.Y) | 1719 | if (startNode.Y == endNode.Y) |
1719 | { | 1720 | { |
1720 | for (int i = 1; i < NodeInfo_List.Count; i++) | 1721 | for (int i = 1; i < NodeInfo_List.Count; i++) |
1721 | { | 1722 | { |
1722 | if (NodeInfo_List[i].Y != endNode.Y) | 1723 | if (NodeInfo_List[i].Y != endNode.Y) |
1723 | { | 1724 | { |
1724 | break; | 1725 | break; |
1725 | } | 1726 | } |
1726 | else | 1727 | else |
1727 | { | 1728 | { |
1728 | tmpLst.Add(NodeInfo_List[i]); | 1729 | tmpLst.Add(NodeInfo_List[i]); |
1729 | } | 1730 | } |
1730 | } | 1731 | } |
1731 | } | 1732 | } |
1732 | 1733 | ||
1733 | // Sort NodeInfo_List | 1734 | // Sort NodeInfo_List |
1734 | for (int i = 0; i < tmpLst.Count; i++) | 1735 | for (int i = 0; i < tmpLst.Count; i++) |
1735 | { | 1736 | { |
1736 | NodeInfo_List[i + 1] = tmpLst[tmpLst.Count -1 - i]; | 1737 | NodeInfo_List[i + 1] = tmpLst[tmpLst.Count -1 - i]; |
1737 | } | 1738 | } |
1738 | 1739 | ||
1739 | } | 1740 | } |
1740 | } | 1741 | } |
1741 | 1742 | ||
1742 | 1743 | ||
1743 | public void EditNode(Point node_edited) | 1744 | public void EditNode(Point node_edited) |
1744 | { | 1745 | { |
1745 | EllipseGeometry ellipseGeometry; | 1746 | EllipseGeometry ellipseGeometry; |
1746 | Point node; | 1747 | Point node; |
1747 | double radiusNode = RADIUS_NODE; | 1748 | double radiusNode = RADIUS_NODE; |
1748 | 1749 | ||
1749 | bool flag = false; | 1750 | bool flag = false; |
1750 | 1751 | ||
1751 | if (gGrpBlueNode.Children.Count > 0) | 1752 | if (gGrpBlueNode.Children.Count > 0) |
1752 | { | 1753 | { |
1753 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 1754 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
1754 | { | 1755 | { |
1755 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; | 1756 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; |
1756 | node = ellipseGeometry.Center; | 1757 | node = ellipseGeometry.Center; |
1757 | 1758 | ||
1758 | if (CheckIsNode(node_edited, node, radiusNode)) | 1759 | if (CheckIsNode(node_edited, node, radiusNode)) |
1759 | { | 1760 | { |
1760 | flag = true; | 1761 | flag = true; |
1761 | } | 1762 | } |
1762 | 1763 | ||
1763 | if (flag) | 1764 | if (flag) |
1764 | { | 1765 | { |
1765 | node_edited.X = node.X; | 1766 | node_edited.X = node.X; |
1766 | node_edited.Y = node.Y; | 1767 | node_edited.Y = node.Y; |
1767 | 1768 | ||
1768 | // show form edit node | 1769 | // show form edit node |
1769 | EditNodeWindow edtNodeWindow = new EditNodeWindow(); | 1770 | EditNodeWindow edtNodeWindow = new EditNodeWindow(); |
1770 | edtNodeWindow.ShowDialog(); | 1771 | edtNodeWindow.ShowDialog(); |
1771 | 1772 | ||
1772 | string result1 = edtNodeWindow._txtMode1; | 1773 | string result1 = edtNodeWindow._txtMode1; |
1773 | string result2 = edtNodeWindow._txtMode2; | 1774 | string result2 = edtNodeWindow._txtMode2; |
1774 | string result3 = edtNodeWindow._txtMode3; | 1775 | string result3 = edtNodeWindow._txtMode3; |
1775 | bool exit = edtNodeWindow._ExitFlg; | 1776 | bool exit = edtNodeWindow._ExitFlg; |
1776 | 1777 | ||
1777 | if (!exit) { | 1778 | if (!exit) { |
1778 | SaveChanged(node_edited.X, node_edited.Y, result1, result2, result3); | 1779 | SaveChanged(node_edited.X, node_edited.Y, result1, result2, result3); |
1779 | } | 1780 | } |
1780 | 1781 | ||
1781 | return; | 1782 | return; |
1782 | } | 1783 | } |
1783 | } | 1784 | } |
1784 | } | 1785 | } |
1785 | } | 1786 | } |
1786 | 1787 | ||
1787 | public void SaveChanged(double x, double y, string st1, string st2, string st3) | 1788 | public void SaveChanged(double x, double y, string st1, string st2, string st3) |
1788 | { | 1789 | { |
1789 | for (int i = 0; i < NodeInfo_List.Count; i++) | 1790 | for (int i = 0; i < NodeInfo_List.Count; i++) |
1790 | { | 1791 | { |
1791 | NodeInfo ni = new NodeInfo(); | 1792 | NodeInfo ni = new NodeInfo(); |
1792 | ni = NodeInfo_List[i]; | 1793 | ni = NodeInfo_List[i]; |
1793 | 1794 | ||
1794 | if (ni.X == x && ni.Y == y) | 1795 | if (ni.X == x && ni.Y == y) |
1795 | { | 1796 | { |
1796 | 1797 | ||
1797 | ni.Mode1 = st1; | 1798 | ni.Mode1 = st1; |
1798 | ni.Mode2 = st2; | 1799 | ni.Mode2 = st2; |
1799 | ni.Mode3 = st3; | 1800 | ni.Mode3 = st3; |
1800 | 1801 | ||
1801 | NodeInfo_List[i] = ni; | 1802 | NodeInfo_List[i] = ni; |
1802 | return; | 1803 | return; |
1803 | } | 1804 | } |
1804 | } | 1805 | } |
1805 | } | 1806 | } |
1806 | 1807 | ||
1807 | 1808 | ||
1808 | #endregion | 1809 | #endregion |
1809 | 1810 | ||
1810 | #region Display RouteInfo | 1811 | #region Display RouteInfo |
1811 | 1812 | ||
1812 | public void DspRouteInfo() | 1813 | public void DspRouteInfo() |
1813 | { | 1814 | { |
1814 | //Clear Route Info Table | 1815 | //Clear Route Info Table |
1815 | ((RoboforkMenu)System.Windows.Application.Current.MainWindow).grdRouteInfo.Children.Clear(); | 1816 | ((RoboforkMenu)System.Windows.Application.Current.MainWindow).grdRouteInfo.Children.Clear(); |
1816 | 1817 | ||
1817 | if (NodeInfo_List.Count != 0) | 1818 | if (NodeInfo_List.Count != 0) |
1818 | { | 1819 | { |
1819 | int _RowIdx = 0; | 1820 | int _RowIdx = 0; |
1820 | string _Content = ""; | 1821 | string _Content = ""; |
1821 | 1822 | ||
1822 | for (int i = 0; i < NodeInfo_List.Count; i++) | 1823 | for (int i = 0; i < NodeInfo_List.Count; i++) |
1823 | { | 1824 | { |
1824 | 1825 | ||
1825 | NodeInfo ni = new NodeInfo(); | 1826 | NodeInfo ni = new NodeInfo(); |
1826 | ni = NodeInfo_List[i]; | 1827 | ni = NodeInfo_List[i]; |
1827 | 1828 | ||
1828 | //column 1 | 1829 | //column 1 |
1829 | if (i == 0) | 1830 | if (i == 0) |
1830 | { | 1831 | { |
1831 | _Content = "S"; | 1832 | _Content = "S"; |
1832 | } | 1833 | } |
1833 | else if (i == NodeInfo_List.Count - 1) | 1834 | else if (i == NodeInfo_List.Count - 1) |
1834 | { | 1835 | { |
1835 | _Content = "G"; | 1836 | _Content = "G"; |
1836 | } | 1837 | } |
1837 | else | 1838 | else |
1838 | { | 1839 | { |
1839 | _Content = i.ToString(); | 1840 | _Content = i.ToString(); |
1840 | } | 1841 | } |
1841 | AddLabeltoGrid(_RowIdx, 0, _Content); | 1842 | AddLabeltoGrid(_RowIdx, 0, _Content); |
1842 | 1843 | ||
1843 | //column 2 | 1844 | //column 2 |
1844 | // Display Node's Position | 1845 | // Display Node's Position |
1845 | _Content = ni.X + ", " + ni.Y; | 1846 | _Content = ni.X + ", " + ni.Y; |
1846 | AddLabeltoGrid(_RowIdx, 1, _Content); | 1847 | AddLabeltoGrid(_RowIdx, 1, _Content); |
1847 | 1848 | ||
1848 | // Display Node's Field | 1849 | // Display Node's Field |
1849 | if (ni.Mode1 != "" && ni.Mode1 != null) | 1850 | if (ni.Mode1 != "" && ni.Mode1 != null) |
1850 | { | 1851 | { |
1851 | char delimiterChars = '_'; | 1852 | char delimiterChars = '_'; |
1852 | string[] tmp = ni.Mode1.Split(delimiterChars); | 1853 | string[] tmp = ni.Mode1.Split(delimiterChars); |
1853 | foreach (string s in tmp) | 1854 | foreach (string s in tmp) |
1854 | { | 1855 | { |
1855 | _RowIdx++; | 1856 | _RowIdx++; |
1856 | delimiterChars = ':'; | 1857 | delimiterChars = ':'; |
1857 | 1858 | ||
1858 | if (s.Split(delimiterChars)[0] == "Mode") | 1859 | if (s.Split(delimiterChars)[0] == "Mode") |
1859 | { | 1860 | { |
1860 | double distance = 0; | 1861 | double distance = 0; |
1861 | if (i == NodeInfo_List.Count - 1) | 1862 | if (i == NodeInfo_List.Count - 1) |
1862 | { | 1863 | { |
1863 | distance = 0; | 1864 | distance = 0; |
1864 | } | 1865 | } |
1865 | else | 1866 | else |
1866 | { | 1867 | { |
1867 | distance = DistanceCalculate(NodeInfo_List[i].X, NodeInfo_List[i].Y, NodeInfo_List[i + 1].X, NodeInfo_List[i + 1].Y); | 1868 | distance = DistanceCalculate(NodeInfo_List[i].X, NodeInfo_List[i].Y, NodeInfo_List[i + 1].X, NodeInfo_List[i + 1].Y); |
1868 | } | 1869 | } |
1869 | _Content = "MOVE " + distance.ToString() + "mm"; | 1870 | _Content = "MOVE " + distance.ToString() + "mm"; |
1870 | } | 1871 | } |
1871 | else | 1872 | else |
1872 | { | 1873 | { |
1873 | _Content = s.Split(delimiterChars)[0] + " " + s.Split(delimiterChars)[1]; | 1874 | _Content = s.Split(delimiterChars)[0] + " " + s.Split(delimiterChars)[1]; |
1874 | } | 1875 | } |
1875 | 1876 | ||
1876 | AddLabeltoGrid(_RowIdx, 1, _Content); | 1877 | AddLabeltoGrid(_RowIdx, 1, _Content); |
1877 | } | 1878 | } |
1878 | } | 1879 | } |
1879 | 1880 | ||
1880 | if (ni.Mode2 != "" && ni.Mode2 != null) | 1881 | if (ni.Mode2 != "" && ni.Mode2 != null) |
1881 | { | 1882 | { |
1882 | char delimiterChars = '_'; | 1883 | char delimiterChars = '_'; |
1883 | string[] tmp = ni.Mode2.Split(delimiterChars); | 1884 | string[] tmp = ni.Mode2.Split(delimiterChars); |
1884 | foreach (string s in tmp) | 1885 | foreach (string s in tmp) |
1885 | { | 1886 | { |
1886 | _RowIdx++; | 1887 | _RowIdx++; |
1887 | delimiterChars = ':'; | 1888 | delimiterChars = ':'; |
1888 | 1889 | ||
1889 | if (s.Split(delimiterChars)[0] == "Mode") | 1890 | if (s.Split(delimiterChars)[0] == "Mode") |
1890 | { | 1891 | { |
1891 | double distance = 0; | 1892 | double distance = 0; |
1892 | if (i == NodeInfo_List.Count - 1) | 1893 | if (i == NodeInfo_List.Count - 1) |
1893 | { | 1894 | { |
1894 | distance = 0; | 1895 | distance = 0; |
1895 | } | 1896 | } |
1896 | else | 1897 | else |
1897 | { | 1898 | { |
1898 | distance = DistanceCalculate(NodeInfo_List[i].X, NodeInfo_List[i].Y, NodeInfo_List[i + 1].X, NodeInfo_List[i + 1].Y); | 1899 | distance = DistanceCalculate(NodeInfo_List[i].X, NodeInfo_List[i].Y, NodeInfo_List[i + 1].X, NodeInfo_List[i + 1].Y); |
1899 | } | 1900 | } |
1900 | _Content = "MOVE " + distance.ToString() + "mm"; | 1901 | _Content = "MOVE " + distance.ToString() + "mm"; |
1901 | } | 1902 | } |
1902 | else | 1903 | else |
1903 | { | 1904 | { |
1904 | _Content = s.Split(delimiterChars)[0] + " " + s.Split(delimiterChars)[1]; | 1905 | _Content = s.Split(delimiterChars)[0] + " " + s.Split(delimiterChars)[1]; |
1905 | } | 1906 | } |
1906 | 1907 | ||
1907 | AddLabeltoGrid(_RowIdx, 1, _Content); | 1908 | AddLabeltoGrid(_RowIdx, 1, _Content); |
1908 | } | 1909 | } |
1909 | } | 1910 | } |
1910 | 1911 | ||
1911 | if (ni.Mode3 != "" && ni.Mode3 != null) | 1912 | if (ni.Mode3 != "" && ni.Mode3 != null) |
1912 | { | 1913 | { |
1913 | char delimiterChars = '_'; | 1914 | char delimiterChars = '_'; |
1914 | string[] tmp = ni.Mode3.Split(delimiterChars); | 1915 | string[] tmp = ni.Mode3.Split(delimiterChars); |
1915 | foreach (string s in tmp) | 1916 | foreach (string s in tmp) |
1916 | { | 1917 | { |
1917 | _RowIdx++; | 1918 | _RowIdx++; |
1918 | delimiterChars = ':'; | 1919 | delimiterChars = ':'; |
1919 | 1920 | ||
1920 | if (s.Split(delimiterChars)[0] == "Mode") | 1921 | if (s.Split(delimiterChars)[0] == "Mode") |
1921 | { | 1922 | { |
1922 | double distance = 0; | 1923 | double distance = 0; |
1923 | if (i == NodeInfo_List.Count - 1) | 1924 | if (i == NodeInfo_List.Count - 1) |
1924 | { | 1925 | { |
1925 | distance = 0; | 1926 | distance = 0; |
1926 | } | 1927 | } |
1927 | else | 1928 | else |
1928 | { | 1929 | { |
1929 | distance = DistanceCalculate(NodeInfo_List[i].X, NodeInfo_List[i].Y, NodeInfo_List[i + 1].X, NodeInfo_List[i + 1].Y); | 1930 | distance = DistanceCalculate(NodeInfo_List[i].X, NodeInfo_List[i].Y, NodeInfo_List[i + 1].X, NodeInfo_List[i + 1].Y); |
1930 | } | 1931 | } |
1931 | _Content = "MOVE " + distance.ToString() + "mm"; | 1932 | _Content = "MOVE " + distance.ToString() + "mm"; |
1932 | } | 1933 | } |
1933 | else | 1934 | else |
1934 | { | 1935 | { |
1935 | _Content = s.Split(delimiterChars)[0] + " " + s.Split(delimiterChars)[1]; | 1936 | _Content = s.Split(delimiterChars)[0] + " " + s.Split(delimiterChars)[1]; |
1936 | } | 1937 | } |
1937 | 1938 | ||
1938 | AddLabeltoGrid(_RowIdx, 1, _Content); | 1939 | AddLabeltoGrid(_RowIdx, 1, _Content); |
1939 | } | 1940 | } |
1940 | } | 1941 | } |
1941 | _RowIdx++; | 1942 | _RowIdx++; |
1942 | } | 1943 | } |
1943 | } | 1944 | } |
1944 | } | 1945 | } |
1945 | 1946 | ||
1946 | public double DistanceCalculate(double _X1, double _Y1, double _X2, double _Y2) | 1947 | public double DistanceCalculate(double _X1, double _Y1, double _X2, double _Y2) |
1947 | { | 1948 | { |
1948 | double dist = 0; | 1949 | double dist = 0; |
1949 | 1950 | ||
1950 | if (_X1 == _X2) | 1951 | if (_X1 == _X2) |
1951 | { | 1952 | { |
1952 | dist = System.Math.Abs(_Y1 - _Y2) * DISTANCE_RATIO; | 1953 | dist = System.Math.Abs(_Y1 - _Y2) * DISTANCE_RATIO; |
1953 | } | 1954 | } |
1954 | else if (_Y1 == _Y2) | 1955 | else if (_Y1 == _Y2) |
1955 | { | 1956 | { |
1956 | dist = System.Math.Abs(_X1 - _X2) * DISTANCE_RATIO; | 1957 | dist = System.Math.Abs(_X1 - _X2) * DISTANCE_RATIO; |
1957 | } | 1958 | } |
1958 | return dist; | 1959 | return dist; |
1959 | } | 1960 | } |
1960 | 1961 | ||
1961 | public void AddLabeltoGrid(int RowIdx, int ColIdx, string Content) | 1962 | public void AddLabeltoGrid(int RowIdx, int ColIdx, string Content) |
1962 | { | 1963 | { |
1963 | //Add Row to Grid | 1964 | //Add Row to Grid |
1964 | RowDefinition _rd = new RowDefinition(); | 1965 | RowDefinition _rd = new RowDefinition(); |
1965 | ((RoboforkMenu)System.Windows.Application.Current.MainWindow).grdRouteInfo.RowDefinitions.Add(_rd); | 1966 | ((RoboforkMenu)System.Windows.Application.Current.MainWindow).grdRouteInfo.RowDefinitions.Add(_rd); |
1966 | 1967 | ||
1967 | // Add data to Grid | 1968 | // Add data to Grid |
1968 | Label dynamicLabel = new Label(); | 1969 | Label dynamicLabel = new Label(); |
1969 | 1970 | ||
1970 | dynamicLabel.Content = Content; | 1971 | dynamicLabel.Content = Content; |
1971 | dynamicLabel.Margin = new Thickness(0, 0, 0, 0); | 1972 | dynamicLabel.Margin = new Thickness(0, 0, 0, 0); |
1972 | dynamicLabel.Foreground = new SolidColorBrush(Colors.Black); | 1973 | dynamicLabel.Foreground = new SolidColorBrush(Colors.Black); |
1973 | dynamicLabel.Background = new SolidColorBrush(Colors.White); | 1974 | dynamicLabel.Background = new SolidColorBrush(Colors.White); |
1974 | dynamicLabel.BorderBrush = new SolidColorBrush(Colors.LightGray); | 1975 | dynamicLabel.BorderBrush = new SolidColorBrush(Colors.LightGray); |
1975 | dynamicLabel.BorderThickness = new Thickness(1); | 1976 | dynamicLabel.BorderThickness = new Thickness(1); |
1976 | 1977 | ||
1977 | Grid.SetRow(dynamicLabel, RowIdx); | 1978 | Grid.SetRow(dynamicLabel, RowIdx); |
1978 | Grid.SetColumn(dynamicLabel, ColIdx); | 1979 | Grid.SetColumn(dynamicLabel, ColIdx); |
1979 | ((RoboforkMenu)System.Windows.Application.Current.MainWindow).grdRouteInfo.Children.Add(dynamicLabel); | 1980 | ((RoboforkMenu)System.Windows.Application.Current.MainWindow).grdRouteInfo.Children.Add(dynamicLabel); |
1980 | } | 1981 | } |
1981 | #endregion | 1982 | #endregion |
1982 | 1983 | ||
1983 | 1984 | ||
1984 | public void CreateGoalPoint() | 1985 | public void CreateGoalPoint() |
1985 | { | 1986 | { |
1986 | if (isGoalDrawRoute) | 1987 | if (isGoalDrawRoute) |
1987 | { | 1988 | { |
1988 | return; | 1989 | return; |
1989 | } | 1990 | } |
1990 | 1991 | ||
1991 | isStartDrawRoute = false; | 1992 | isStartDrawRoute = false; |
1992 | if (_goalPoint == null) | 1993 | if (_goalPoint == null) |
1993 | { | 1994 | { |
1994 | _goalPoint = new ucStartEndButton(); | 1995 | _goalPoint = new ucStartEndButton(); |
1995 | _goalPoint.btnWidth = 50.0; | 1996 | _goalPoint.btnWidth = 50.0; |
1996 | _goalPoint.btnHeight = 50.0; | 1997 | _goalPoint.btnHeight = 50.0; |
1997 | _goalPoint.buttText = "G"; | 1998 | _goalPoint.buttText = "G"; |
1998 | Canvas.SetLeft(_goalPoint, 675); | 1999 | Canvas.SetLeft(_goalPoint, 675); |
1999 | Canvas.SetTop(_goalPoint, 75); | 2000 | Canvas.SetTop(_goalPoint, 75); |
2000 | this.Children.Add(_goalPoint); | 2001 | this.Children.Add(_goalPoint); |
2001 | } | 2002 | } |
2002 | } | 2003 | } |
2003 | 2004 | ||
2004 | public void CreateStartPoint() | 2005 | public void CreateStartPoint() |
2005 | { | 2006 | { |
2006 | if (isGoalDrawRoute) | 2007 | if (isGoalDrawRoute) |
2007 | { | 2008 | { |
2008 | return; | 2009 | return; |
2009 | } | 2010 | } |
2010 | 2011 | ||
2011 | isStartDrawRoute = false; | 2012 | isStartDrawRoute = false; |
2012 | if (_startPoint == null) | 2013 | if (_startPoint == null) |
2013 | { | 2014 | { |
2014 | _startPoint = new ucStartEndButton(); | 2015 | _startPoint = new ucStartEndButton(); |
2015 | _startPoint.btnWidth = 50.0; | 2016 | _startPoint.btnWidth = 50.0; |
2016 | _startPoint.btnHeight = 50.0; | 2017 | _startPoint.btnHeight = 50.0; |
2017 | _startPoint.buttText = "S"; | 2018 | _startPoint.buttText = "S"; |
2018 | Canvas.SetLeft(_startPoint, 75); | 2019 | Canvas.SetLeft(_startPoint, 75); |
2019 | Canvas.SetTop(_startPoint, 675); | 2020 | Canvas.SetTop(_startPoint, 675); |
2020 | this.Children.Add(_startPoint); | 2021 | this.Children.Add(_startPoint); |
2021 | } | 2022 | } |
2022 | } | 2023 | } |
2023 | 2024 | ||
2024 | 2025 | ||
2025 | 2026 | ||
2026 | 2027 | ||
2027 | 2028 | ||
2028 | 2029 | ||
2029 | 2030 | ||
2030 | #region Draw New FreeNode | 2031 | #region Draw New FreeNode |
2031 | 2032 | ||
2032 | /// <summary> | 2033 | /// <summary> |
2033 | /// Draw Auto Blue node | 2034 | /// Draw Auto Blue node |
2034 | /// </summary> | 2035 | /// </summary> |
2035 | 2036 | ||
2036 | 2037 | ||
2037 | public void NewSetFreeNodes(Point FreeNode, bool RightClick) | 2038 | public void NewSetFreeNodes(Point FreeNode, bool RightClick) |
2038 | { | 2039 | { |
2039 | double radiusNode = RADIUS_NODE; | 2040 | double radiusNode = RADIUS_NODE; |
2040 | 2041 | ||
2041 | EllipseGeometry ellipseGeometry; | 2042 | EllipseGeometry ellipseGeometry; |
2042 | Point node; | 2043 | Point node; |
2043 | bool deleteFlag = false; | 2044 | bool deleteFlag = false; |
2044 | 2045 | ||
2045 | 2046 | ||
2046 | if (RightClick) | 2047 | if (RightClick) |
2047 | { | 2048 | { |
2048 | if (gGrpBlueNode.Children.Count > 0) | 2049 | if (gGrpBlueNode.Children.Count > 0) |
2049 | { | 2050 | { |
2050 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 2051 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
2051 | { | 2052 | { |
2052 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; | 2053 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; |
2053 | node = ellipseGeometry.Center; | 2054 | node = ellipseGeometry.Center; |
2054 | if (FreeNode.X == node.X) | 2055 | if (FreeNode.X == node.X) |
2055 | { | 2056 | { |
2056 | if (CheckIsNode(FreeNode, node, radiusNode)) | 2057 | if (CheckIsNode(FreeNode, node, radiusNode)) |
2057 | { | 2058 | { |
2058 | deleteFlag = true; | 2059 | deleteFlag = true; |
2059 | } | 2060 | } |
2060 | } | 2061 | } |
2061 | else | 2062 | else |
2062 | { | 2063 | { |
2063 | if (CheckIsNode(FreeNode, node, radiusNode)) | 2064 | if (CheckIsNode(FreeNode, node, radiusNode)) |
2064 | { | 2065 | { |
2065 | deleteFlag = true; | 2066 | deleteFlag = true; |
2066 | } | 2067 | } |
2067 | } | 2068 | } |
2068 | if (deleteFlag) | 2069 | if (deleteFlag) |
2069 | { | 2070 | { |
2070 | MessageBoxResult result = MessageBox.Show("Do You Delete This Node?", "Delete Node", MessageBoxButton.OKCancel); | 2071 | MessageBoxResult result = MessageBox.Show("Do You Delete This Node?", "Delete Node", MessageBoxButton.OKCancel); |
2071 | if (result == MessageBoxResult.OK) | 2072 | if (result == MessageBoxResult.OK) |
2072 | { | 2073 | { |
2073 | 2074 | ||
2074 | //Call Function Delete Node | 2075 | //Call Function Delete Node |
2075 | DeleteNode(i); | 2076 | DeleteNode(i); |
2076 | 2077 | ||
2077 | //gGrpBlueNode.Children.RemoveAt(i); | 2078 | //gGrpBlueNode.Children.RemoveAt(i); |
2078 | 2079 | ||
2079 | //this.Children.Remove(NodeNo[i]); | 2080 | //this.Children.Remove(NodeNo[i]); |
2080 | return; | 2081 | return; |
2081 | } | 2082 | } |
2082 | else | 2083 | else |
2083 | { | 2084 | { |
2084 | return; | 2085 | return; |
2085 | } | 2086 | } |
2086 | } | 2087 | } |
2087 | } | 2088 | } |
2088 | } | 2089 | } |
2089 | } | 2090 | } |
2090 | else | 2091 | else |
2091 | { | 2092 | { |
2092 | //Check EditNode State | 2093 | //Check EditNode State |
2093 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 2094 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
2094 | { | 2095 | { |
2095 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; | 2096 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; |
2096 | node = ellipseGeometry.Center; | 2097 | node = ellipseGeometry.Center; |
2097 | bool isEditNode = CheckIsNode(FreeNode, node, RADIUS_NODE); | 2098 | bool isEditNode = CheckIsNode(FreeNode, node, RADIUS_NODE); |
2098 | 2099 | ||
2099 | if (isEditNode) | 2100 | if (isEditNode) |
2100 | { | 2101 | { |
2101 | NewEditNode(node); | 2102 | NewEditNode(node); |
2102 | NewDspRouteInfo(); | 2103 | NewDspRouteInfo(); |
2103 | return; | 2104 | return; |
2104 | } | 2105 | } |
2105 | } | 2106 | } |
2106 | 2107 | ||
2107 | 2108 | ||
2108 | MessageBoxResult result = MessageBox.Show("Do You Want To Add This Node?", "Add Node", MessageBoxButton.OKCancel); | 2109 | MessageBoxResult result = MessageBox.Show("Do You Want To Add This Node?", "Add Node", MessageBoxButton.OKCancel); |
2109 | if (result == MessageBoxResult.OK) | 2110 | if (result == MessageBoxResult.OK) |
2110 | { | 2111 | { |
2111 | AddNode(FreeNode, gGrpBlueNode); | 2112 | AddNode(FreeNode, gGrpBlueNode); |
2112 | 2113 | ||
2113 | TextBlock textBlock = new TextBlock(); | 2114 | TextBlock textBlock = new TextBlock(); |
2114 | textBlock.Text = stt.ToString(); | 2115 | textBlock.Text = stt.ToString(); |
2115 | textBlock.FontSize = 35; | 2116 | textBlock.FontSize = 35; |
2116 | textBlock.VerticalAlignment = VerticalAlignment.Center; | 2117 | textBlock.VerticalAlignment = VerticalAlignment.Center; |
2117 | textBlock.HorizontalAlignment = HorizontalAlignment.Center; | 2118 | textBlock.HorizontalAlignment = HorizontalAlignment.Center; |
2118 | textBlock.Foreground = new SolidColorBrush(Colors.Red); | 2119 | textBlock.Foreground = new SolidColorBrush(Colors.Red); |
2119 | 2120 | ||
2120 | Canvas.SetLeft(textBlock, FreeNode.X - RADIUS_NODE / 2); | 2121 | Canvas.SetLeft(textBlock, FreeNode.X - RADIUS_NODE / 2); |
2121 | Canvas.SetTop(textBlock, FreeNode.Y - 1.5 * RADIUS_NODE); | 2122 | Canvas.SetTop(textBlock, FreeNode.Y - 1.5 * RADIUS_NODE); |
2122 | 2123 | ||
2123 | 2124 | ||
2124 | this.Children.Add(textBlock); | 2125 | this.Children.Add(textBlock); |
2125 | NodeNo.Add(textBlock); | 2126 | NodeNo.Add(textBlock); |
2126 | 2127 | ||
2127 | if (stt > 1) | 2128 | if (stt > 1) |
2128 | { | 2129 | { |
2129 | int tmp = gGrpBlueNode.Children.Count; | 2130 | int tmp = gGrpBlueNode.Children.Count; |
2130 | 2131 | ||
2131 | EllipseGeometry elip = (EllipseGeometry)gGrpBlueNode.Children[tmp - 2]; | 2132 | EllipseGeometry elip = (EllipseGeometry)gGrpBlueNode.Children[tmp - 2]; |
2132 | Point node1 = elip.Center; | 2133 | Point node1 = elip.Center; |
2133 | elip = (EllipseGeometry)gGrpBlueNode.Children[tmp - 1]; | 2134 | elip = (EllipseGeometry)gGrpBlueNode.Children[tmp - 1]; |
2134 | Point node2 = elip.Center; | 2135 | Point node2 = elip.Center; |
2135 | DrawLine(node1, node2, gGrpNewLine); | 2136 | DrawLine(node1, node2, gGrpNewLine); |
2136 | 2137 | ||
2137 | 2138 | ||
2138 | this.Children.Remove(pBlueNode); | 2139 | this.Children.Remove(pBlueNode); |
2139 | for (int i = 0; i < tmp; i++) | 2140 | for (int i = 0; i < tmp; i++) |
2140 | { | 2141 | { |
2141 | this.Children.Remove(NodeNo[i]); | 2142 | this.Children.Remove(NodeNo[i]); |
2142 | } | 2143 | } |
2143 | 2144 | ||
2144 | this.Children.Add(pBlueNode); | 2145 | this.Children.Add(pBlueNode); |
2145 | for (int i = 0; i < tmp; i++) | 2146 | for (int i = 0; i < tmp; i++) |
2146 | { | 2147 | { |
2147 | this.Children.Add(NodeNo[i]); | 2148 | this.Children.Add(NodeNo[i]); |
2148 | } | 2149 | } |
2149 | } | 2150 | } |
2150 | 2151 | ||
2151 | stt++; | 2152 | stt++; |
2152 | NewInitNodeInfo_List(); | 2153 | NewInitNodeInfo_List(); |
2153 | NewDspRouteInfo(); | 2154 | NewDspRouteInfo(); |
2154 | } | 2155 | } |
2155 | } | 2156 | } |
2156 | } | 2157 | } |
2157 | 2158 | ||
2158 | public void DeleteNode(int i) | 2159 | public void DeleteNode(int i) |
2159 | { | 2160 | { |
2160 | //DrawLine(Point startPoint, Point endPoint, GeometryGroup geometryGroup) | 2161 | //DrawLine(Point startPoint, Point endPoint, GeometryGroup geometryGroup) |
2161 | 2162 | ||
2162 | LineGeometry lineGeometry = new LineGeometry(); | 2163 | LineGeometry lineGeometry = new LineGeometry(); |
2163 | EllipseGeometry ellip; | 2164 | EllipseGeometry ellip; |
2164 | 2165 | ||
2165 | 2166 | ||
2166 | if (i == gGrpBlueNode.Children.Count - 1) | 2167 | if (i == gGrpBlueNode.Children.Count - 1) |
2167 | { | 2168 | { |
2168 | // delete line | 2169 | // delete line |
2169 | if (gGrpNewLine.Children.Count > 0) | 2170 | if (gGrpNewLine.Children.Count > 0) |
2170 | { | 2171 | { |
2171 | gGrpNewLine.Children.RemoveAt(i - 1); | 2172 | gGrpNewLine.Children.RemoveAt(i - 1); |
2172 | } | 2173 | } |
2173 | 2174 | ||
2174 | // delete ucNode | 2175 | // delete ucNode |
2175 | ucNode _ucNode = new ucNode(); | 2176 | ucNode _ucNode = new ucNode(); |
2176 | _ucNode = ucNode_Lst[i]; | 2177 | _ucNode = ucNode_Lst[i]; |
2177 | this.Children.Remove(_ucNode); | 2178 | this.Children.Remove(_ucNode); |
2178 | ucNode_Lst.RemoveAt(i); | 2179 | ucNode_Lst.RemoveAt(i); |
2179 | 2180 | ||
2180 | // delete node | 2181 | // delete node |
2181 | gGrpBlueNode.Children.RemoveAt(i); | 2182 | gGrpBlueNode.Children.RemoveAt(i); |
2182 | NewNodeInfo_List.RemoveAt(i); | 2183 | NewNodeInfo_List.RemoveAt(i); |
2183 | 2184 | ||
2184 | } | 2185 | } |
2185 | else | 2186 | else |
2186 | { | 2187 | { |
2187 | // remove last Node | 2188 | // remove last Node |
2188 | int lastIdx = gGrpBlueNode.Children.Count - 1; | 2189 | int lastIdx = gGrpBlueNode.Children.Count - 1; |
2189 | 2190 | ||
2190 | NewNodeInfo_List.RemoveAt(lastIdx); | 2191 | NewNodeInfo_List.RemoveAt(lastIdx); |
2191 | gGrpBlueNode.Children.RemoveAt(lastIdx); | 2192 | gGrpBlueNode.Children.RemoveAt(lastIdx); |
2192 | gGrpNewLine.Children.RemoveAt(lastIdx - 1); | 2193 | gGrpNewLine.Children.RemoveAt(lastIdx - 1); |
2193 | 2194 | ||
2194 | ucNode _ucNode = new ucNode(); | 2195 | ucNode _ucNode = new ucNode(); |
2195 | _ucNode = ucNode_Lst[lastIdx]; | 2196 | _ucNode = ucNode_Lst[lastIdx]; |
2196 | this.Children.Remove(_ucNode); | 2197 | this.Children.Remove(_ucNode); |
2197 | 2198 | ||
2198 | ucNode_Lst.RemoveAt(lastIdx); | 2199 | ucNode_Lst.RemoveAt(lastIdx); |
2199 | 2200 | ||
2200 | 2201 | ||
2201 | 2202 | ||
2202 | 2203 | ||
2203 | // ellip = (EllipseGeometry)gGrpBlueNode.Children[i - 1]; | 2204 | // ellip = (EllipseGeometry)gGrpBlueNode.Children[i - 1]; |
2204 | //Point p1 = ellip.Center; | 2205 | //Point p1 = ellip.Center; |
2205 | //ellip = (EllipseGeometry)gGrpBlueNode.Children[i + 1]; | 2206 | //ellip = (EllipseGeometry)gGrpBlueNode.Children[i + 1]; |
2206 | //Point p2 = ellip.Center; | 2207 | //Point p2 = ellip.Center; |
2207 | 2208 | ||
2208 | //gGrpNewLine.Children.RemoveAt(i); | 2209 | //gGrpNewLine.Children.RemoveAt(i); |
2209 | //gGrpNewLine.Children.RemoveAt(i - 1); | 2210 | //gGrpNewLine.Children.RemoveAt(i - 1); |
2210 | 2211 | ||
2211 | 2212 | ||
2212 | //lineGeometry.StartPoint = p1; | 2213 | //lineGeometry.StartPoint = p1; |
2213 | //lineGeometry.EndPoint = p2; | 2214 | //lineGeometry.EndPoint = p2; |
2214 | //gGrpNewLine.Children.Add(lineGeometry); | 2215 | //gGrpNewLine.Children.Add(lineGeometry); |
2215 | 2216 | ||
2216 | ////gGrpNewLine.Children.Clear(); | 2217 | ////gGrpNewLine.Children.Clear(); |
2217 | 2218 | ||
2218 | //this.Children.Remove(pNewLine); | 2219 | //this.Children.Remove(pNewLine); |
2219 | //this.Children.Add(pNewLine); | 2220 | //this.Children.Add(pNewLine); |
2220 | 2221 | ||
2221 | //gGrpBlueNode.Children.RemoveAt(i); | 2222 | //gGrpBlueNode.Children.RemoveAt(i); |
2222 | } | 2223 | } |
2223 | 2224 | ||
2224 | 2225 | ||
2225 | 2226 | ||
2226 | //NewInitNodeInfo_List(); | 2227 | //NewInitNodeInfo_List(); |
2227 | 2228 | ||
2228 | 2229 | ||
2229 | NewDspRouteInfo(); | 2230 | NewDspRouteInfo(); |
2230 | stt--; | 2231 | stt--; |
2231 | 2232 | ||
2232 | 2233 | ||
2233 | } | 2234 | } |
2234 | 2235 | ||
2235 | 2236 | ||
2236 | 2237 | ||
2237 | 2238 | ||
2238 | public void NewInitNodeInfo_List() | 2239 | public void NewInitNodeInfo_List() |
2239 | { | 2240 | { |
2240 | //Reset List | 2241 | //Reset List |
2241 | //NewNodeInfo_List = new List<NewNodeInfo>(); | 2242 | //NewNodeInfo_List = new List<NewNodeInfo>(); |
2242 | 2243 | ||
2243 | if (gGrpBlueNode.Children.Count > 0) | 2244 | if (gGrpBlueNode.Children.Count > 0) |
2244 | { | 2245 | { |
2245 | //for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 2246 | //for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
2246 | //{ | 2247 | //{ |
2247 | int i = gGrpBlueNode.Children.Count - 1; | 2248 | int i = gGrpBlueNode.Children.Count - 1; |
2248 | Point point; | 2249 | Point point; |
2249 | EllipseGeometry eGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; | 2250 | EllipseGeometry eGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; |
2250 | point = eGeometry.Center; | 2251 | point = eGeometry.Center; |
2251 | 2252 | ||
2252 | NewNodeInfo Ninfo = new NewNodeInfo(); | 2253 | NewNodeInfo Ninfo = new NewNodeInfo(); |
2253 | Ninfo.X = point.X; | 2254 | Ninfo.X = point.X; |
2254 | Ninfo.Y = point.Y; | 2255 | Ninfo.Y = point.Y; |
2255 | 2256 | ||
2256 | Ninfo.Mode = ""; | 2257 | Ninfo.Mode = ""; |
2257 | 2258 | ||
2258 | NewNodeInfo_List.Add(Ninfo); | 2259 | NewNodeInfo_List.Add(Ninfo); |
2259 | //} | 2260 | //} |
2260 | 2261 | ||
2261 | } | 2262 | } |
2262 | } | 2263 | } |
2263 | 2264 | ||
2264 | public void NewEditNode(Point node_edited) | 2265 | public void NewEditNode(Point node_edited) |
2265 | { | 2266 | { |
2266 | EllipseGeometry ellipseGeometry; | 2267 | EllipseGeometry ellipseGeometry; |
2267 | Point node; | 2268 | Point node; |
2268 | double radiusNode = RADIUS_NODE; | 2269 | double radiusNode = RADIUS_NODE; |
2269 | 2270 | ||
2270 | bool flag = false; | 2271 | bool flag = false; |
2271 | 2272 | ||
2272 | if (gGrpBlueNode.Children.Count > 0) | 2273 | if (gGrpBlueNode.Children.Count > 0) |
2273 | { | 2274 | { |
2274 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 2275 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
2275 | { | 2276 | { |
2276 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; | 2277 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; |
2277 | node = ellipseGeometry.Center; | 2278 | node = ellipseGeometry.Center; |
2278 | 2279 | ||
2279 | if (CheckIsNode(node_edited, node, radiusNode)) | 2280 | if (CheckIsNode(node_edited, node, radiusNode)) |
2280 | { | 2281 | { |
2281 | flag = true; | 2282 | flag = true; |
2282 | } | 2283 | } |
2283 | 2284 | ||
2284 | if (flag) | 2285 | if (flag) |
2285 | { | 2286 | { |
2286 | node_edited.X = node.X; | 2287 | node_edited.X = node.X; |
2287 | node_edited.Y = node.Y; | 2288 | node_edited.Y = node.Y; |
2288 | 2289 | ||
2289 | // show form edit node | 2290 | // show form edit node |
2290 | EditNodeWindow edtNodeWindow = new EditNodeWindow(); | 2291 | EditNodeWindow edtNodeWindow = new EditNodeWindow(); |
2291 | edtNodeWindow.ShowDialog(); | 2292 | edtNodeWindow.ShowDialog(); |
2292 | 2293 | ||
2293 | string result = edtNodeWindow._txtMode; | 2294 | string result = edtNodeWindow._txtMode; |
2294 | bool exit = edtNodeWindow._ExitFlg; | 2295 | bool exit = edtNodeWindow._ExitFlg; |
2295 | 2296 | ||
2296 | if (!exit) | 2297 | if (!exit) |
2297 | { | 2298 | { |
2298 | NewSaveChanged(node_edited.X, node_edited.Y, result); | 2299 | NewSaveChanged(node_edited.X, node_edited.Y, result); |
2299 | } | 2300 | } |
2300 | 2301 | ||
2301 | return; | 2302 | return; |
2302 | } | 2303 | } |
2303 | } | 2304 | } |
2304 | } | 2305 | } |
2305 | } | 2306 | } |
2306 | 2307 | ||
2307 | //Save Node's Data Edited | 2308 | //Save Node's Data Edited |
2308 | public void NewSaveChanged(double x, double y, string st) | 2309 | public void NewSaveChanged(double x, double y, string st) |
2309 | { | 2310 | { |
2310 | for (int i = 0; i < NewNodeInfo_List.Count; i++) | 2311 | for (int i = 0; i < NewNodeInfo_List.Count; i++) |
2311 | { | 2312 | { |
2312 | NewNodeInfo ni = new NewNodeInfo(); | 2313 | NewNodeInfo ni = new NewNodeInfo(); |
2313 | ni = NewNodeInfo_List[i]; | 2314 | ni = NewNodeInfo_List[i]; |
2314 | 2315 | ||
2315 | if (ni.X == x && ni.Y == y) | 2316 | if (ni.X == x && ni.Y == y) |
2316 | { | 2317 | { |
2317 | ni.Mode = st; | 2318 | ni.Mode = st; |
2318 | 2319 | ||
2319 | NewNodeInfo_List[i] = ni; | 2320 | NewNodeInfo_List[i] = ni; |
2320 | return; | 2321 | return; |
2321 | } | 2322 | } |
2322 | } | 2323 | } |
2323 | } | 2324 | } |
2324 | 2325 | ||
2325 | public void NewDspRouteInfo() | 2326 | public void NewDspRouteInfo() |
2326 | { | 2327 | { |
2327 | //Clear Route Info Table | 2328 | //Clear Route Info Table |
2328 | ((RoboforkMenu)System.Windows.Application.Current.MainWindow).grdRouteInfo.Children.Clear(); | 2329 | ((RoboforkMenu)System.Windows.Application.Current.MainWindow).grdRouteInfo.Children.Clear(); |
2329 | 2330 | ||
2330 | if (NewNodeInfo_List.Count != 0) | 2331 | if (NewNodeInfo_List.Count != 0) |
2331 | { | 2332 | { |
2332 | int _RowIdx = 0; | 2333 | int _RowIdx = 0; |
2333 | string _Content = ""; | 2334 | string _Content = ""; |
2334 | 2335 | ||
2335 | for (int i = 0; i < NewNodeInfo_List.Count; i++) | 2336 | for (int i = 0; i < NewNodeInfo_List.Count; i++) |
2336 | { | 2337 | { |
2337 | 2338 | ||
2338 | NewNodeInfo ni = new NewNodeInfo(); | 2339 | NewNodeInfo ni = new NewNodeInfo(); |
2339 | ni = NewNodeInfo_List[i]; | 2340 | ni = NewNodeInfo_List[i]; |
2340 | 2341 | ||
2341 | //column 1 | 2342 | //column 1 |
2342 | _Content = (i +1).ToString(); | 2343 | _Content = (i +1).ToString(); |
2343 | AddLabeltoGrid(_RowIdx, 0, _Content); | 2344 | AddLabeltoGrid(_RowIdx, 0, _Content); |
2344 | 2345 | ||
2345 | //column 2 | 2346 | //column 2 |
2346 | // Display Node's Position | 2347 | // Display Node's Position |
2347 | _Content = "LAT " + ni.X; | 2348 | _Content = "LAT " + ni.X; |
2348 | AddLabeltoGrid(_RowIdx, 1, _Content); | 2349 | AddLabeltoGrid(_RowIdx, 1, _Content); |
2349 | _RowIdx++; | 2350 | _RowIdx++; |
2350 | 2351 | ||
2351 | _Content = "LOC " + ni.Y; | 2352 | _Content = "LOC " + ni.Y; |
2352 | AddLabeltoGrid(_RowIdx, 1, _Content); | 2353 | AddLabeltoGrid(_RowIdx, 1, _Content); |
2353 | 2354 | ||
2354 | // Display Node's Field | 2355 | // Display Node's Field |
2355 | if (ni.Mode != "" && ni.Mode != null) | 2356 | if (ni.Mode != "" && ni.Mode != null) |
2356 | { | 2357 | { |
2357 | char delimiterChars = '_'; | 2358 | char delimiterChars = '_'; |
2358 | string[] tmp = ni.Mode.Split(delimiterChars); | 2359 | string[] tmp = ni.Mode.Split(delimiterChars); |
2359 | foreach (string s in tmp) | 2360 | foreach (string s in tmp) |
2360 | { | 2361 | { |
2361 | _RowIdx++; | 2362 | _RowIdx++; |
2362 | delimiterChars = ':'; | 2363 | delimiterChars = ':'; |
2363 | 2364 | ||
2364 | if (s.Split(delimiterChars)[0] == "Speed") | 2365 | if (s.Split(delimiterChars)[0] == "Speed") |
2365 | { | 2366 | { |
2366 | _Content = "SPD " + s.Split(delimiterChars)[1]; | 2367 | _Content = "SPD " + s.Split(delimiterChars)[1]; |
2367 | AddLabeltoGrid(_RowIdx, 1, _Content); | 2368 | AddLabeltoGrid(_RowIdx, 1, _Content); |
2368 | } | 2369 | } |
2369 | } | 2370 | } |
2370 | } | 2371 | } |
2371 | _RowIdx++; | 2372 | _RowIdx++; |
2372 | } | 2373 | } |
2373 | } | 2374 | } |
2374 | } | 2375 | } |
2375 | 2376 | ||
2376 | 2377 | ||
2377 | private void CreateNode(Point FreeNode, bool LeftClick, bool RightClick) | 2378 | private void CreateNode(Point FreeNode, bool LeftClick, bool RightClick) |
2378 | { | 2379 | { |
2379 | double radiusNode = RADIUS_NODE; | 2380 | double radiusNode = RADIUS_NODE; |
2380 | 2381 | ||
2381 | EllipseGeometry ellipseGeometry; | 2382 | EllipseGeometry ellipseGeometry; |
2382 | Point node; | 2383 | Point node; |
2383 | bool deleteFlag = false; | 2384 | bool deleteFlag = false; |
2384 | 2385 | ||
2385 | //Su kien bam chuot phai | 2386 | //Su kien bam chuot phai |
2386 | if (RightClick) | 2387 | if (RightClick) |
2387 | { | 2388 | { |
2388 | if (gGrpBlueNode.Children.Count > 0) | 2389 | if (gGrpBlueNode.Children.Count > 0) |
2389 | { | 2390 | { |
2390 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 2391 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
2391 | { | 2392 | { |
2392 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; | 2393 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; |
2393 | node = ellipseGeometry.Center; | 2394 | node = ellipseGeometry.Center; |
2394 | if (FreeNode.X == node.X) | 2395 | if (FreeNode.X == node.X) |
2395 | { | 2396 | { |
2396 | if (CheckIsNode(FreeNode, node, radiusNode)) | 2397 | if (CheckIsNode(FreeNode, node, radiusNode)) |
2397 | { | 2398 | { |
2398 | deleteFlag = true; | 2399 | deleteFlag = true; |
2399 | } | 2400 | } |
2400 | } | 2401 | } |
2401 | else | 2402 | else |
2402 | { | 2403 | { |
2403 | if (CheckIsNode(FreeNode, node, radiusNode)) | 2404 | if (CheckIsNode(FreeNode, node, radiusNode)) |
2404 | { | 2405 | { |
2405 | deleteFlag = true; | 2406 | deleteFlag = true; |
2406 | } | 2407 | } |
2407 | } | 2408 | } |
2408 | if (deleteFlag) | 2409 | if (deleteFlag) |
2409 | { | 2410 | { |
2410 | MessageBoxResult result = MessageBox.Show("Do You Delete This Node?", "Delete Node", MessageBoxButton.OKCancel); | 2411 | MessageBoxResult result = MessageBox.Show("Do You Delete This Node?", "Delete Node", MessageBoxButton.OKCancel); |
2411 | if (result == MessageBoxResult.OK) | 2412 | if (result == MessageBoxResult.OK) |
2412 | { | 2413 | { |
2413 | 2414 | ||
2414 | DeleteNode(i); | 2415 | DeleteNode(i); |
2415 | 2416 | ||
2417 | SetScheduleRoute(); | ||
2418 | |||
2416 | return; | 2419 | return; |
2417 | } | 2420 | } |
2418 | else | 2421 | else |
2419 | { | 2422 | { |
2420 | return; | 2423 | return; |
2421 | } | 2424 | } |
2422 | } | 2425 | } |
2423 | } | 2426 | } |
2424 | } | 2427 | } |
2425 | } | 2428 | } |
2426 | 2429 | ||
2427 | // them nut | 2430 | // them nut |
2428 | else | 2431 | else |
2429 | { | 2432 | { |
2430 | //Check EditNode State | 2433 | //Check EditNode State |
2431 | if(LeftClick) | 2434 | if(LeftClick) |
2432 | { | 2435 | { |
2433 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 2436 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
2434 | { | 2437 | { |
2435 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; | 2438 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; |
2436 | node = ellipseGeometry.Center; | 2439 | node = ellipseGeometry.Center; |
2437 | bool isEditNode = CheckIsNode(FreeNode, node, RADIUS_NODE); | 2440 | bool isEditNode = CheckIsNode(FreeNode, node, RADIUS_NODE); |
2438 | 2441 | ||
2439 | if (isEditNode) | 2442 | if (isEditNode) |
2440 | { | 2443 | { |
2441 | NewEditNode(node); | 2444 | NewEditNode(node); |
2442 | NewDspRouteInfo(); | 2445 | NewDspRouteInfo(); |
2443 | return; | 2446 | return; |
2444 | } | 2447 | } |
2445 | } | 2448 | } |
2446 | } | 2449 | } |
2447 | 2450 | ||
2448 | 2451 | ||
2449 | // them nut | 2452 | // them nut |
2450 | MessageBoxResult result = MessageBox.Show("Do You Want To Add This Node?", "Add Node", MessageBoxButton.OKCancel); | 2453 | MessageBoxResult result = MessageBox.Show("Do You Want To Add This Node?", "Add Node", MessageBoxButton.OKCancel); |
2451 | if (result == MessageBoxResult.OK) | 2454 | if (result == MessageBoxResult.OK) |
2452 | { | 2455 | { |
2453 | ucNode _ucNode = new ucNode(); | 2456 | ucNode _ucNode = new ucNode(); |
2454 | _ucNode.btnWidth = 50.0; | 2457 | _ucNode.btnWidth = 50.0; |
2455 | _ucNode.btnHeight = 50.0; | 2458 | _ucNode.btnHeight = 50.0; |
2456 | _ucNode.txtNode = stt.ToString(); | 2459 | _ucNode.txtNode = stt.ToString(); |
2457 | Canvas.SetLeft(_ucNode, FreeNode.X); | 2460 | Canvas.SetLeft(_ucNode, FreeNode.X); |
2458 | Canvas.SetTop(_ucNode, FreeNode.Y); | 2461 | Canvas.SetTop(_ucNode, FreeNode.Y); |
2459 | this.Children.Add(_ucNode); | 2462 | this.Children.Add(_ucNode); |
2460 | ucNode_Lst.Add(_ucNode); | 2463 | ucNode_Lst.Add(_ucNode); |
2461 | 2464 | ||
2462 | double XXX = FreeNode.X + _ucNode.btnWidth / 2; | 2465 | double XXX = FreeNode.X + _ucNode.btnWidth / 2; |
2463 | double YYY = FreeNode.Y + _ucNode.btnWidth / 2; | 2466 | double YYY = FreeNode.Y + _ucNode.btnWidth / 2; |
2464 | FreeNode.X = XXX; | 2467 | FreeNode.X = XXX; |
2465 | FreeNode.Y = YYY; | 2468 | FreeNode.Y = YYY; |
2466 | AddNode(FreeNode, gGrpBlueNode); | 2469 | AddNode(FreeNode, gGrpBlueNode); |
2470 | |||
2471 | SetScheduleRoute(); | ||
2467 | 2472 | ||
2468 | //ve line | 2473 | //ve line |
2469 | if (stt > 1) | 2474 | if (stt > 1) |
2470 | { | 2475 | { |
2471 | int tmp = ucNode_Lst.Count; | 2476 | int tmp = ucNode_Lst.Count; |
2472 | 2477 | ||
2473 | EllipseGeometry elip = new EllipseGeometry(); | 2478 | EllipseGeometry elip = new EllipseGeometry(); |
2474 | 2479 | ||
2475 | elip = (EllipseGeometry)gGrpBlueNode.Children[tmp - 2]; | 2480 | elip = (EllipseGeometry)gGrpBlueNode.Children[tmp - 2]; |
2476 | Point node1 = elip.Center; | 2481 | Point node1 = elip.Center; |
2477 | elip = (EllipseGeometry)gGrpBlueNode.Children[tmp - 1]; | 2482 | elip = (EllipseGeometry)gGrpBlueNode.Children[tmp - 1]; |
2478 | Point node2 = elip.Center; | 2483 | Point node2 = elip.Center; |
2479 | DrawLine(node1, node2, gGrpNewLine); | 2484 | DrawLine(node1, node2, gGrpNewLine); |
2480 | 2485 | ||
2481 | } | 2486 | } |
2482 | 2487 | ||
2483 | stt++; | 2488 | stt++; |
2484 | NewInitNodeInfo_List(); | 2489 | NewInitNodeInfo_List(); |
2485 | NewDspRouteInfo(); | 2490 | NewDspRouteInfo(); |
2486 | } | 2491 | } |
2487 | } | 2492 | } |
2488 | 2493 | ||
2489 | } | 2494 | } |
2490 | #endregion | 2495 | #endregion |
2491 | 2496 | ||
2492 | #region Schedule | 2497 | #region Schedule |
2493 | 2498 | ||
2494 | public void SetScheduleRoute() | 2499 | public void SetScheduleRoute() |
2495 | { | 2500 | { |
2496 | 2501 | ||
2497 | EllipseGeometry ellipseGeometry_1; | 2502 | EllipseGeometry ellipseGeometry_1; |
2498 | EllipseGeometry ellipseGeometry_2; | 2503 | EllipseGeometry ellipseGeometry_2; |
2499 | Point node_1; | 2504 | Point node_1; |
2500 | Point node_2; | 2505 | Point node_2; |
2501 | Point node_Schedule = new Point(); | 2506 | Point node_Schedule = new Point(); |
2507 | double x_1 = 50; | ||
2508 | double y_1 = 80; | ||
2509 | double Totaldistance = 1270; | ||
2502 | 2510 | ||
2503 | 2511 | ||
2512 | if (ucScheduleNode_Lst.Count > 0) | ||
2513 | { | ||
2514 | for (int i = 0; i < ucScheduleNode_Lst.Count; i++) | ||
2515 | { | ||
2516 | ucNode _ucNode = new ucNode(); | ||
2517 | _ucNode = ucScheduleNode_Lst[i]; | ||
2518 | scheduleCanvas.Children.Remove(_ucNode); | ||
2519 | |||
2520 | } | ||
2521 | ucScheduleNode_Lst.Clear(); | ||
2522 | } | ||
2523 | |||
2504 | gGrpScheduleNode.Children.Clear(); | 2524 | gGrpScheduleNode.Children.Clear(); |
2505 | gGrpScheduleLine.Children.Clear(); | 2525 | gGrpScheduleLine.Children.Clear(); |
2506 | 2526 | ||
2507 | double Totaldistance = 1000; | ||
2508 | 2527 | ||
2509 | List<double> distance = new List<double>(); | 2528 | List<double> distance = new List<double>(); |
2510 | double addDistance; | 2529 | double addDistance; |
2511 | 2530 | ||
2512 | if (gGrpBlueNode.Children.Count > 0) | 2531 | if (gGrpBlueNode.Children.Count > 0) |
2513 | { | 2532 | { |
2514 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 2533 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
2515 | { | 2534 | { |
2516 | ellipseGeometry_2 = (EllipseGeometry)gGrpBlueNode.Children[i]; | 2535 | ellipseGeometry_2 = (EllipseGeometry)gGrpBlueNode.Children[i]; |
2517 | node_2 = ellipseGeometry_2.Center; | 2536 | node_2 = ellipseGeometry_2.Center; |
2518 | 2537 | ||
2519 | if (i >= 1) | 2538 | if (i >= 1) |
2520 | { | 2539 | { |
2521 | ellipseGeometry_1 = (EllipseGeometry)gGrpBlueNode.Children[i - 1]; | 2540 | ellipseGeometry_1 = (EllipseGeometry)gGrpBlueNode.Children[i - 1]; |
2522 | node_1 = ellipseGeometry_1.Center; | 2541 | node_1 = ellipseGeometry_1.Center; |
2523 | if (node_1.X == node_2.X) | 2542 | if (node_1.X == node_2.X) |
2524 | { | 2543 | { |
2525 | addDistance = Math.Abs(node_1.Y - node_2.Y); | 2544 | addDistance = Math.Abs(node_1.Y - node_2.Y); |
2526 | distance.Add(addDistance); | 2545 | distance.Add(addDistance); |
2527 | } | 2546 | } |
2528 | else if (node_1.Y == node_2.Y) | 2547 | else if (node_1.Y == node_2.Y) |
2529 | { | 2548 | { |
2530 | addDistance = Math.Abs(node_1.X - node_2.X); | 2549 | addDistance = Math.Abs(node_1.X - node_2.X); |
2531 | distance.Add(addDistance); | 2550 | distance.Add(addDistance); |
2532 | } | 2551 | } |
2533 | else | 2552 | else |
2534 | { | 2553 | { |
2535 | var a = (double)(node_2.X - node_1.X); | 2554 | var a = (double)(node_2.X - node_1.X); |
2536 | var b = (double)(node_2.Y - node_1.Y); | 2555 | var b = (double)(node_2.Y - node_1.Y); |
2537 | addDistance = Math.Sqrt(a * a + b * b); | 2556 | addDistance = Math.Sqrt(a * a + b * b); |
2538 | distance.Add(addDistance); | 2557 | distance.Add(addDistance); |
2539 | } | 2558 | } |
2540 | } | 2559 | } |
2541 | } | 2560 | } |
2542 | } | 2561 | } |
2543 | if (distance.Count > 0) | 2562 | if (distance.Count > 0) |
2544 | { | 2563 | { |
2545 | double total = 0; | 2564 | double total = 0; |
2546 | double distance_i; | 2565 | double distance_i; |
2547 | 2566 | ||
2548 | for (int i = 0; i < distance.Count; i++) | 2567 | for (int i = 0; i < distance.Count; i++) |
2549 | { | 2568 | { |
2550 | total = total + distance[i]; | 2569 | total = total + distance[i]; |
2551 | } | 2570 | } |
2552 | 2571 | ||
2553 | for (int i = 0; i < distance.Count; i++) | 2572 | for (int i = 0; i < distance.Count; i++) |
2554 | { | 2573 | { |
2555 | distance_i = distance[i] * (Totaldistance / total); | 2574 | distance_i = distance[i] * (Totaldistance / total); |
2556 | distance[i] = distance_i; | 2575 | distance[i] = distance_i; |
2557 | } | 2576 | } |
2558 | } | 2577 | } |
2559 | 2578 | ||
2560 | node_Schedule.X = 50; | 2579 | node_Schedule.X = x_1; |
2561 | node_Schedule.Y = 100; | 2580 | node_Schedule.Y = y_1; |
2562 | AddNode(node_Schedule, gGrpScheduleNode); | 2581 | AddNode(node_Schedule, gGrpScheduleNode); |
2563 | 2582 | ||
2564 | addDistance = 0; | 2583 | addDistance = 0; |
2565 | for (int i = 0; i < distance.Count; i++) | 2584 | for (int i = 0; i < distance.Count; i++) |
2566 | { | 2585 | { |
2567 | 2586 | ||
2568 | node_Schedule.Y = 100; | 2587 | node_Schedule.Y = y_1; |
2569 | addDistance = addDistance + distance[i]; | 2588 | addDistance = addDistance + distance[i]; |
2570 | node_Schedule.X = addDistance; | 2589 | node_Schedule.X = addDistance; |
2571 | AddNode(node_Schedule, gGrpScheduleNode); | 2590 | AddNode(node_Schedule, gGrpScheduleNode); |
2572 | } | 2591 | } |
2573 | 2592 | ||
2574 | if (gGrpScheduleNode.Children.Count > 0) | 2593 | if (gGrpScheduleNode.Children.Count > 0) |
2575 | { | 2594 | { |
2576 | for (int i = 0; i < gGrpScheduleNode.Children.Count; i++) | 2595 | for (int i = 0; i < gGrpScheduleNode.Children.Count; i++) |
2577 | { | 2596 | { |
2578 | ellipseGeometry_1 = (EllipseGeometry)gGrpScheduleNode.Children[i]; | 2597 | ellipseGeometry_1 = (EllipseGeometry)gGrpScheduleNode.Children[i]; |
2579 | node_1 = ellipseGeometry_1.Center; | 2598 | node_1 = ellipseGeometry_1.Center; |
2580 | if (i > 0) | 2599 | if (i > 0) |
2581 | { | 2600 | { |
2582 | ellipseGeometry_2 = (EllipseGeometry)gGrpScheduleNode.Children[i -1]; | 2601 | ellipseGeometry_2 = (EllipseGeometry)gGrpScheduleNode.Children[i -1]; |
2583 | node_2 = ellipseGeometry_2.Center; | 2602 | node_2 = ellipseGeometry_2.Center; |
2584 | DrawLine(node_1, node_2, gGrpScheduleLine); | 2603 | DrawLine(node_1, node_2, gGrpScheduleLine); |
2585 | } | 2604 | } |
2586 | CreateScheduleNode(node_1, i + 1); | 2605 | CreateScheduleNode(node_1, i + 1); |
2587 | } | 2606 | } |
2588 | } | 2607 | } |
2589 | } | 2608 | } |
2590 | 2609 | ||
2591 | 2610 | ||
2592 | private void CreateNode(Point point, int indexNode) | 2611 | private void CreateNode(Point point, int indexNode) |
2593 | { | 2612 | { |
2594 | ucNode _ucNode = new ucNode(); | 2613 | ucNode _ucNode = new ucNode(); |
2595 | _ucNode.btnWidth = 20.0; | 2614 | _ucNode.btnWidth = 20.0; |
2596 | _ucNode.btnHeight = 20.0; | 2615 | _ucNode.btnHeight = 20.0; |
2597 | _ucNode.txtNode = indexNode.ToString(); | 2616 | _ucNode.txtNode = indexNode.ToString(); |
2598 | Canvas.SetLeft(_ucNode, point.X); | 2617 | Canvas.SetLeft(_ucNode, point.X); |
2599 | Canvas.SetTop(_ucNode, point.Y); | 2618 | Canvas.SetTop(_ucNode, point.Y); |
2600 | this.Children.Add(_ucNode); | 2619 | this.Children.Add(_ucNode); |
2601 | } | 2620 | } |
2602 | 2621 | ||
2603 | private void CreateScheduleNode(Point point, int indexNode) | 2622 | private void CreateScheduleNode(Point point, int indexNode) |
2604 | { | 2623 | { |
2605 | ucNode _ucNode = new ucNode(); | 2624 | ucNode _ucNode = new ucNode(); |
2606 | _ucNode.btnWidth = 20.0; | 2625 | _ucNode.btnWidth = 20.0; |
2607 | _ucNode.btnHeight = 20.0; | 2626 | _ucNode.btnHeight = 20.0; |
2608 | _ucNode.txtNode = indexNode.ToString(); | 2627 | _ucNode.txtNode = indexNode.ToString(); |
2609 | Canvas.SetLeft(_ucNode, point.X - 25); | 2628 | Canvas.SetLeft(_ucNode, point.X - 25); |
2610 | Canvas.SetTop(_ucNode, point.Y - 25); | 2629 | Canvas.SetTop(_ucNode, point.Y - 25); |
2611 | scheduleCanvas.Children.Add(_ucNode); | 2630 | scheduleCanvas.Children.Add(_ucNode); |
2631 | ucScheduleNode_Lst.Add(_ucNode); | ||
2612 | } | 2632 | } |
2613 | 2633 | ||
2614 | #endregion | 2634 | #endregion |
2615 | 2635 | ||
2616 | } | 2636 | } |
2617 | } | 2637 | } |
sources/RoboforkApp/RoboforkApp.csproj
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 2 | <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
3 | <PropertyGroup> | 3 | <PropertyGroup> |
4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
6 | <ProductVersion>9.0.30729</ProductVersion> | 6 | <ProductVersion>9.0.30729</ProductVersion> |
7 | <SchemaVersion>2.0</SchemaVersion> | 7 | <SchemaVersion>2.0</SchemaVersion> |
8 | <ProjectGuid>{4946722F-CFFF-4FC6-B1C1-A6107316A58C}</ProjectGuid> | 8 | <ProjectGuid>{4946722F-CFFF-4FC6-B1C1-A6107316A58C}</ProjectGuid> |
9 | <OutputType>WinExe</OutputType> | 9 | <OutputType>WinExe</OutputType> |
10 | <AppDesignerFolder>Properties</AppDesignerFolder> | 10 | <AppDesignerFolder>Properties</AppDesignerFolder> |
11 | <RootNamespace>RoboforkApp</RootNamespace> | 11 | <RootNamespace>RoboforkApp</RootNamespace> |
12 | <AssemblyName>RboforkApp</AssemblyName> | 12 | <AssemblyName>RboforkApp</AssemblyName> |
13 | <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | 13 | <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> |
14 | <FileAlignment>512</FileAlignment> | 14 | <FileAlignment>512</FileAlignment> |
15 | <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | 15 | <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> |
16 | <WarningLevel>4</WarningLevel> | 16 | <WarningLevel>4</WarningLevel> |
17 | <FileUpgradeFlags> | 17 | <FileUpgradeFlags> |
18 | </FileUpgradeFlags> | 18 | </FileUpgradeFlags> |
19 | <UpgradeBackupLocation> | 19 | <UpgradeBackupLocation> |
20 | </UpgradeBackupLocation> | 20 | </UpgradeBackupLocation> |
21 | <OldToolsVersion>3.5</OldToolsVersion> | 21 | <OldToolsVersion>3.5</OldToolsVersion> |
22 | <SccProjectName>SAK</SccProjectName> | 22 | <SccProjectName>SAK</SccProjectName> |
23 | <SccLocalPath>SAK</SccLocalPath> | 23 | <SccLocalPath>SAK</SccLocalPath> |
24 | <SccAuxPath>SAK</SccAuxPath> | 24 | <SccAuxPath>SAK</SccAuxPath> |
25 | <SccProvider>SAK</SccProvider> | 25 | <SccProvider>SAK</SccProvider> |
26 | <IsWebBootstrapper>false</IsWebBootstrapper> | 26 | <IsWebBootstrapper>false</IsWebBootstrapper> |
27 | <TargetFrameworkProfile /> | 27 | <TargetFrameworkProfile /> |
28 | <PublishUrl>publish\</PublishUrl> | 28 | <PublishUrl>publish\</PublishUrl> |
29 | <Install>true</Install> | 29 | <Install>true</Install> |
30 | <InstallFrom>Disk</InstallFrom> | 30 | <InstallFrom>Disk</InstallFrom> |
31 | <UpdateEnabled>false</UpdateEnabled> | 31 | <UpdateEnabled>false</UpdateEnabled> |
32 | <UpdateMode>Foreground</UpdateMode> | 32 | <UpdateMode>Foreground</UpdateMode> |
33 | <UpdateInterval>7</UpdateInterval> | 33 | <UpdateInterval>7</UpdateInterval> |
34 | <UpdateIntervalUnits>Days</UpdateIntervalUnits> | 34 | <UpdateIntervalUnits>Days</UpdateIntervalUnits> |
35 | <UpdatePeriodically>false</UpdatePeriodically> | 35 | <UpdatePeriodically>false</UpdatePeriodically> |
36 | <UpdateRequired>false</UpdateRequired> | 36 | <UpdateRequired>false</UpdateRequired> |
37 | <MapFileExtensions>true</MapFileExtensions> | 37 | <MapFileExtensions>true</MapFileExtensions> |
38 | <ApplicationRevision>0</ApplicationRevision> | 38 | <ApplicationRevision>0</ApplicationRevision> |
39 | <ApplicationVersion>1.0.0.%2a</ApplicationVersion> | 39 | <ApplicationVersion>1.0.0.%2a</ApplicationVersion> |
40 | <UseApplicationTrust>false</UseApplicationTrust> | 40 | <UseApplicationTrust>false</UseApplicationTrust> |
41 | <BootstrapperEnabled>true</BootstrapperEnabled> | 41 | <BootstrapperEnabled>true</BootstrapperEnabled> |
42 | </PropertyGroup> | 42 | </PropertyGroup> |
43 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | 43 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
44 | <DebugSymbols>true</DebugSymbols> | 44 | <DebugSymbols>true</DebugSymbols> |
45 | <DebugType>full</DebugType> | 45 | <DebugType>full</DebugType> |
46 | <Optimize>false</Optimize> | 46 | <Optimize>false</Optimize> |
47 | <OutputPath>bin\Debug\</OutputPath> | 47 | <OutputPath>bin\Debug\</OutputPath> |
48 | <DefineConstants>DEBUG;TRACE</DefineConstants> | 48 | <DefineConstants>DEBUG;TRACE</DefineConstants> |
49 | <ErrorReport>prompt</ErrorReport> | 49 | <ErrorReport>prompt</ErrorReport> |
50 | <WarningLevel>4</WarningLevel> | 50 | <WarningLevel>4</WarningLevel> |
51 | <Prefer32Bit>false</Prefer32Bit> | 51 | <Prefer32Bit>false</Prefer32Bit> |
52 | </PropertyGroup> | 52 | </PropertyGroup> |
53 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | 53 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
54 | <DebugType>pdbonly</DebugType> | 54 | <DebugType>pdbonly</DebugType> |
55 | <Optimize>true</Optimize> | 55 | <Optimize>true</Optimize> |
56 | <OutputPath>bin\Release\</OutputPath> | 56 | <OutputPath>bin\Release\</OutputPath> |
57 | <DefineConstants>TRACE</DefineConstants> | 57 | <DefineConstants>TRACE</DefineConstants> |
58 | <ErrorReport>prompt</ErrorReport> | 58 | <ErrorReport>prompt</ErrorReport> |
59 | <WarningLevel>4</WarningLevel> | 59 | <WarningLevel>4</WarningLevel> |
60 | <Prefer32Bit>false</Prefer32Bit> | 60 | <Prefer32Bit>false</Prefer32Bit> |
61 | </PropertyGroup> | 61 | </PropertyGroup> |
62 | <PropertyGroup> | 62 | <PropertyGroup> |
63 | <StartupObject>RoboforkApp.App</StartupObject> | 63 | <StartupObject>RoboforkApp.App</StartupObject> |
64 | </PropertyGroup> | 64 | </PropertyGroup> |
65 | <ItemGroup> | 65 | <ItemGroup> |
66 | <Reference Include="System" /> | 66 | <Reference Include="System" /> |
67 | <Reference Include="System.Core"> | 67 | <Reference Include="System.Core"> |
68 | <RequiredTargetFramework>3.5</RequiredTargetFramework> | 68 | <RequiredTargetFramework>3.5</RequiredTargetFramework> |
69 | </Reference> | 69 | </Reference> |
70 | <Reference Include="System.Xaml" /> | 70 | <Reference Include="System.Xaml" /> |
71 | <Reference Include="System.Xml.Linq"> | 71 | <Reference Include="System.Xml.Linq"> |
72 | <RequiredTargetFramework>3.5</RequiredTargetFramework> | 72 | <RequiredTargetFramework>3.5</RequiredTargetFramework> |
73 | </Reference> | 73 | </Reference> |
74 | <Reference Include="System.Data.DataSetExtensions"> | 74 | <Reference Include="System.Data.DataSetExtensions"> |
75 | <RequiredTargetFramework>3.5</RequiredTargetFramework> | 75 | <RequiredTargetFramework>3.5</RequiredTargetFramework> |
76 | </Reference> | 76 | </Reference> |
77 | <Reference Include="System.Data" /> | 77 | <Reference Include="System.Data" /> |
78 | <Reference Include="System.Xml" /> | 78 | <Reference Include="System.Xml" /> |
79 | <Reference Include="UIAutomationProvider"> | 79 | <Reference Include="UIAutomationProvider"> |
80 | <RequiredTargetFramework>3.0</RequiredTargetFramework> | 80 | <RequiredTargetFramework>3.0</RequiredTargetFramework> |
81 | </Reference> | 81 | </Reference> |
82 | <Reference Include="WindowsBase"> | 82 | <Reference Include="WindowsBase"> |
83 | <RequiredTargetFramework>3.0</RequiredTargetFramework> | 83 | <RequiredTargetFramework>3.0</RequiredTargetFramework> |
84 | </Reference> | 84 | </Reference> |
85 | <Reference Include="PresentationCore"> | 85 | <Reference Include="PresentationCore"> |
86 | <RequiredTargetFramework>3.0</RequiredTargetFramework> | 86 | <RequiredTargetFramework>3.0</RequiredTargetFramework> |
87 | </Reference> | 87 | </Reference> |
88 | <Reference Include="PresentationFramework"> | 88 | <Reference Include="PresentationFramework"> |
89 | <RequiredTargetFramework>3.0</RequiredTargetFramework> | 89 | <RequiredTargetFramework>3.0</RequiredTargetFramework> |
90 | </Reference> | 90 | </Reference> |
91 | </ItemGroup> | 91 | </ItemGroup> |
92 | <ItemGroup> | 92 | <ItemGroup> |
93 | <ApplicationDefinition Include="App.xaml"> | 93 | <ApplicationDefinition Include="App.xaml"> |
94 | <Generator>MSBuild:Compile</Generator> | 94 | <Generator>MSBuild:Compile</Generator> |
95 | <SubType>Designer</SubType> | 95 | <SubType>Designer</SubType> |
96 | <Generator>MSBuild:Compile</Generator> | 96 | <Generator>MSBuild:Compile</Generator> |
97 | <SubType>Designer</SubType> | 97 | <SubType>Designer</SubType> |
98 | </ApplicationDefinition> | 98 | </ApplicationDefinition> |
99 | <Compile Include="App.xaml.cs"> | 99 | <Compile Include="App.xaml.cs"> |
100 | <DependentUpon>App.xaml</DependentUpon> | 100 | <DependentUpon>App.xaml</DependentUpon> |
101 | <SubType>Code</SubType> | 101 | <SubType>Code</SubType> |
102 | </Compile> | 102 | </Compile> |
103 | </ItemGroup> | 103 | </ItemGroup> |
104 | <ItemGroup> | 104 | <ItemGroup> |
105 | <Compile Include="Adorners\ResizeAdorner.cs" /> | 105 | <Compile Include="Adorners\ResizeAdorner.cs" /> |
106 | <Compile Include="Adorners\ResizeChrome.cs" /> | 106 | <Compile Include="Adorners\ResizeChrome.cs" /> |
107 | <Compile Include="Adorners\RubberbandAdorner.cs" /> | 107 | <Compile Include="Adorners\RubberbandAdorner.cs" /> |
108 | <Compile Include="DesignerCanvas.cs" /> | 108 | <Compile Include="DesignerCanvas.cs" /> |
109 | <Compile Include="DesignerItem.cs" /> | 109 | <Compile Include="DesignerItem.cs" /> |
110 | <Compile Include="EditNodeWindow.xaml.cs"> | 110 | <Compile Include="EditNodeWindow.xaml.cs"> |
111 | <DependentUpon>EditNodeWindow.xaml</DependentUpon> | 111 | <DependentUpon>EditNodeWindow.xaml</DependentUpon> |
112 | </Compile> | 112 | </Compile> |
113 | <Compile Include="MoveThumb.cs" /> | 113 | <Compile Include="MoveThumb.cs" /> |
114 | <Compile Include="Properties\AssemblyInfo.cs"> | 114 | <Compile Include="Properties\AssemblyInfo.cs"> |
115 | <SubType>Code</SubType> | 115 | <SubType>Code</SubType> |
116 | </Compile> | 116 | </Compile> |
117 | <Compile Include="Properties\Settings.Designer.cs"> | 117 | <Compile Include="Properties\Settings.Designer.cs"> |
118 | <AutoGen>True</AutoGen> | 118 | <AutoGen>True</AutoGen> |
119 | <DependentUpon>Settings.settings</DependentUpon> | 119 | <DependentUpon>Settings.settings</DependentUpon> |
120 | <DesignTimeSharedInput>True</DesignTimeSharedInput> | 120 | <DesignTimeSharedInput>True</DesignTimeSharedInput> |
121 | </Compile> | 121 | </Compile> |
122 | <Compile Include="ResizeDecorator.cs" /> | 122 | <Compile Include="ResizeDecorator.cs" /> |
123 | <Compile Include="ResizeThumb.cs" /> | 123 | <Compile Include="ResizeThumb.cs" /> |
124 | <Compile Include="RoboforkMenu.xaml.cs"> | 124 | <Compile Include="RoboforkMenu.xaml.cs"> |
125 | <DependentUpon>RoboforkMenu.xaml</DependentUpon> | 125 | <DependentUpon>RoboforkMenu.xaml</DependentUpon> |
126 | </Compile> | 126 | </Compile> |
127 | <Compile Include="ScheduleCanvas.cs" /> | ||
127 | <Compile Include="UserControls\ucDisplayCoordinate.xaml.cs"> | 128 | <Compile Include="UserControls\ucDisplayCoordinate.xaml.cs"> |
128 | <DependentUpon>ucDisplayCoordinate.xaml</DependentUpon> | 129 | <DependentUpon>ucDisplayCoordinate.xaml</DependentUpon> |
129 | </Compile> | 130 | </Compile> |
130 | <Compile Include="UserControls\ucNode.xaml.cs"> | 131 | <Compile Include="UserControls\ucNode.xaml.cs"> |
131 | <DependentUpon>ucNode.xaml</DependentUpon> | 132 | <DependentUpon>ucNode.xaml</DependentUpon> |
132 | </Compile> | 133 | </Compile> |
133 | <Compile Include="UserControls\ucStartEndButton.xaml.cs"> | 134 | <Compile Include="UserControls\ucStartEndButton.xaml.cs"> |
134 | <DependentUpon>ucStartEndButton.xaml</DependentUpon> | 135 | <DependentUpon>ucStartEndButton.xaml</DependentUpon> |
135 | </Compile> | 136 | </Compile> |
136 | <Compile Include="Toolbox.cs" /> | 137 | <Compile Include="Toolbox.cs" /> |
137 | <Compile Include="ToolboxItem.cs" /> | 138 | <Compile Include="ToolboxItem.cs" /> |
138 | <Compile Include="MainWindow.xaml.cs"> | 139 | <Compile Include="MainWindow.xaml.cs"> |
139 | <DependentUpon>MainWindow.xaml</DependentUpon> | 140 | <DependentUpon>MainWindow.xaml</DependentUpon> |
140 | </Compile> | 141 | </Compile> |
141 | <Compile Include="ZoomBox.cs" /> | 142 | <Compile Include="ZoomBox.cs" /> |
142 | <None Include="app.config" /> | 143 | <None Include="app.config" /> |
143 | <None Include="Properties\Settings.settings"> | 144 | <None Include="Properties\Settings.settings"> |
144 | <Generator>SettingsSingleFileGenerator</Generator> | 145 | <Generator>SettingsSingleFileGenerator</Generator> |
145 | <LastGenOutput>Settings.Designer.cs</LastGenOutput> | 146 | <LastGenOutput>Settings.Designer.cs</LastGenOutput> |
146 | </None> | 147 | </None> |
147 | <AppDesigner Include="Properties\" /> | 148 | <AppDesigner Include="Properties\" /> |
148 | </ItemGroup> | 149 | </ItemGroup> |
149 | <ItemGroup> | 150 | <ItemGroup> |
150 | <Page Include="EditNodeWindow.xaml"> | 151 | <Page Include="EditNodeWindow.xaml"> |
151 | <SubType>Designer</SubType> | 152 | <SubType>Designer</SubType> |
152 | <Generator>MSBuild:Compile</Generator> | 153 | <Generator>MSBuild:Compile</Generator> |
153 | </Page> | 154 | </Page> |
154 | <Page Include="Resources\Brushes.xaml"> | 155 | <Page Include="Resources\Brushes.xaml"> |
155 | <Generator>MSBuild:Compile</Generator> | 156 | <Generator>MSBuild:Compile</Generator> |
156 | <SubType>Designer</SubType> | 157 | <SubType>Designer</SubType> |
157 | <Generator>MSBuild:Compile</Generator> | 158 | <Generator>MSBuild:Compile</Generator> |
158 | <SubType>Designer</SubType> | 159 | <SubType>Designer</SubType> |
159 | </Page> | 160 | </Page> |
160 | <Page Include="Resources\DesignerItem.xaml"> | 161 | <Page Include="Resources\DesignerItem.xaml"> |
161 | <Generator>MSBuild:Compile</Generator> | 162 | <Generator>MSBuild:Compile</Generator> |
162 | <SubType>Designer</SubType> | 163 | <SubType>Designer</SubType> |
163 | <Generator>MSBuild:Compile</Generator> | 164 | <Generator>MSBuild:Compile</Generator> |
164 | <SubType>Designer</SubType> | 165 | <SubType>Designer</SubType> |
165 | </Page> | 166 | </Page> |
166 | <Page Include="Resources\Expander.xaml"> | 167 | <Page Include="Resources\Expander.xaml"> |
167 | <Generator>MSBuild:Compile</Generator> | 168 | <Generator>MSBuild:Compile</Generator> |
168 | <SubType>Designer</SubType> | 169 | <SubType>Designer</SubType> |
169 | <Generator>MSBuild:Compile</Generator> | 170 | <Generator>MSBuild:Compile</Generator> |
170 | <SubType>Designer</SubType> | 171 | <SubType>Designer</SubType> |
171 | </Page> | 172 | </Page> |
172 | <Page Include="Resources\LangResources.xaml"> | 173 | <Page Include="Resources\LangResources.xaml"> |
173 | <SubType>Designer</SubType> | 174 | <SubType>Designer</SubType> |
174 | <Generator>MSBuild:Compile</Generator> | 175 | <Generator>MSBuild:Compile</Generator> |
175 | </Page> | 176 | </Page> |
176 | <Page Include="Resources\ResizeChrome.xaml"> | 177 | <Page Include="Resources\ResizeChrome.xaml"> |
177 | <Generator>MSBuild:Compile</Generator> | 178 | <Generator>MSBuild:Compile</Generator> |
178 | <SubType>Designer</SubType> | 179 | <SubType>Designer</SubType> |
179 | <Generator>MSBuild:Compile</Generator> | 180 | <Generator>MSBuild:Compile</Generator> |
180 | <SubType>Designer</SubType> | 181 | <SubType>Designer</SubType> |
181 | </Page> | 182 | </Page> |
182 | <Page Include="Resources\ScrollBar.xaml"> | 183 | <Page Include="Resources\ScrollBar.xaml"> |
183 | <Generator>MSBuild:Compile</Generator> | 184 | <Generator>MSBuild:Compile</Generator> |
184 | <SubType>Designer</SubType> | 185 | <SubType>Designer</SubType> |
185 | <Generator>MSBuild:Compile</Generator> | 186 | <Generator>MSBuild:Compile</Generator> |
186 | <SubType>Designer</SubType> | 187 | <SubType>Designer</SubType> |
187 | </Page> | 188 | </Page> |
188 | <Page Include="Resources\ScrollViewer.xaml"> | 189 | <Page Include="Resources\ScrollViewer.xaml"> |
189 | <Generator>MSBuild:Compile</Generator> | 190 | <Generator>MSBuild:Compile</Generator> |
190 | <SubType>Designer</SubType> | 191 | <SubType>Designer</SubType> |
191 | <Generator>MSBuild:Compile</Generator> | 192 | <Generator>MSBuild:Compile</Generator> |
192 | <SubType>Designer</SubType> | 193 | <SubType>Designer</SubType> |
193 | </Page> | 194 | </Page> |
194 | <Page Include="Resources\Slider.xaml"> | 195 | <Page Include="Resources\Slider.xaml"> |
195 | <Generator>MSBuild:Compile</Generator> | 196 | <Generator>MSBuild:Compile</Generator> |
196 | <SubType>Designer</SubType> | 197 | <SubType>Designer</SubType> |
197 | <Generator>MSBuild:Compile</Generator> | 198 | <Generator>MSBuild:Compile</Generator> |
198 | <SubType>Designer</SubType> | 199 | <SubType>Designer</SubType> |
199 | </Page> | 200 | </Page> |
200 | <Page Include="Resources\StatusBar.xaml"> | 201 | <Page Include="Resources\StatusBar.xaml"> |
201 | <Generator>MSBuild:Compile</Generator> | 202 | <Generator>MSBuild:Compile</Generator> |
202 | <SubType>Designer</SubType> | 203 | <SubType>Designer</SubType> |
203 | <Generator>MSBuild:Compile</Generator> | 204 | <Generator>MSBuild:Compile</Generator> |
204 | <SubType>Designer</SubType> | 205 | <SubType>Designer</SubType> |
205 | </Page> | 206 | </Page> |
206 | <Page Include="Resources\Styles.xaml"> | 207 | <Page Include="Resources\Styles.xaml"> |
207 | <SubType>Designer</SubType> | 208 | <SubType>Designer</SubType> |
208 | <Generator>MSBuild:Compile</Generator> | 209 | <Generator>MSBuild:Compile</Generator> |
209 | </Page> | 210 | </Page> |
210 | <Page Include="Resources\ToolBar.xaml"> | 211 | <Page Include="Resources\ToolBar.xaml"> |
211 | <Generator>MSBuild:Compile</Generator> | 212 | <Generator>MSBuild:Compile</Generator> |
212 | <SubType>Designer</SubType> | 213 | <SubType>Designer</SubType> |
213 | <Generator>MSBuild:Compile</Generator> | 214 | <Generator>MSBuild:Compile</Generator> |
214 | <SubType>Designer</SubType> | 215 | <SubType>Designer</SubType> |
215 | </Page> | 216 | </Page> |
216 | <Page Include="Resources\Toolbox.xaml"> | 217 | <Page Include="Resources\Toolbox.xaml"> |
217 | <Generator>MSBuild:Compile</Generator> | 218 | <Generator>MSBuild:Compile</Generator> |
218 | <SubType>Designer</SubType> | 219 | <SubType>Designer</SubType> |
219 | <Generator>MSBuild:Compile</Generator> | 220 | <Generator>MSBuild:Compile</Generator> |
220 | <SubType>Designer</SubType> | 221 | <SubType>Designer</SubType> |
221 | </Page> | 222 | </Page> |
222 | <Page Include="Resources\Tooltip.xaml"> | 223 | <Page Include="Resources\Tooltip.xaml"> |
223 | <Generator>MSBuild:Compile</Generator> | 224 | <Generator>MSBuild:Compile</Generator> |
224 | <SubType>Designer</SubType> | 225 | <SubType>Designer</SubType> |
225 | <Generator>MSBuild:Compile</Generator> | 226 | <Generator>MSBuild:Compile</Generator> |
226 | <SubType>Designer</SubType> | 227 | <SubType>Designer</SubType> |
227 | </Page> | 228 | </Page> |
228 | <Page Include="Resources\ZoomBox.xaml"> | 229 | <Page Include="Resources\ZoomBox.xaml"> |
229 | <Generator>MSBuild:Compile</Generator> | 230 | <Generator>MSBuild:Compile</Generator> |
230 | <SubType>Designer</SubType> | 231 | <SubType>Designer</SubType> |
231 | <Generator>MSBuild:Compile</Generator> | 232 | <Generator>MSBuild:Compile</Generator> |
232 | <SubType>Designer</SubType> | 233 | <SubType>Designer</SubType> |
233 | </Page> | 234 | </Page> |
234 | <Page Include="RoboforkMenu.xaml"> | 235 | <Page Include="RoboforkMenu.xaml"> |
235 | <SubType>Designer</SubType> | 236 | <SubType>Designer</SubType> |
236 | <Generator>MSBuild:Compile</Generator> | 237 | <Generator>MSBuild:Compile</Generator> |
237 | </Page> | 238 | </Page> |
238 | <Page Include="UserControls\ucDisplayCoordinate.xaml"> | 239 | <Page Include="UserControls\ucDisplayCoordinate.xaml"> |
239 | <Generator>MSBuild:Compile</Generator> | 240 | <Generator>MSBuild:Compile</Generator> |
240 | <SubType>Designer</SubType> | 241 | <SubType>Designer</SubType> |
241 | </Page> | 242 | </Page> |
242 | <Page Include="UserControls\ucNode.xaml"> | 243 | <Page Include="UserControls\ucNode.xaml"> |
243 | <SubType>Designer</SubType> | 244 | <SubType>Designer</SubType> |
244 | <Generator>MSBuild:Compile</Generator> | 245 | <Generator>MSBuild:Compile</Generator> |
245 | </Page> | 246 | </Page> |
246 | <Page Include="UserControls\ucStartEndButton.xaml"> | 247 | <Page Include="UserControls\ucStartEndButton.xaml"> |
247 | <SubType>Designer</SubType> | 248 | <SubType>Designer</SubType> |
248 | <Generator>MSBuild:Compile</Generator> | 249 | <Generator>MSBuild:Compile</Generator> |
249 | </Page> | 250 | </Page> |
250 | <Page Include="Stencils\BasicShapes.xaml"> | 251 | <Page Include="Stencils\BasicShapes.xaml"> |
251 | <Generator>MSBuild:Compile</Generator> | 252 | <Generator>MSBuild:Compile</Generator> |
252 | <SubType>Designer</SubType> | 253 | <SubType>Designer</SubType> |
253 | <Generator>MSBuild:Compile</Generator> | 254 | <Generator>MSBuild:Compile</Generator> |
254 | <SubType>Designer</SubType> | 255 | <SubType>Designer</SubType> |
255 | </Page> | 256 | </Page> |
256 | <Page Include="Stencils\FlowChartSymbols.xaml"> | 257 | <Page Include="Stencils\FlowChartSymbols.xaml"> |
257 | <SubType>Designer</SubType> | 258 | <SubType>Designer</SubType> |
258 | <Generator>MSBuild:Compile</Generator> | 259 | <Generator>MSBuild:Compile</Generator> |
259 | <Generator>MSBuild:Compile</Generator> | 260 | <Generator>MSBuild:Compile</Generator> |
260 | <SubType>Designer</SubType> | 261 | <SubType>Designer</SubType> |
261 | </Page> | 262 | </Page> |
262 | <Page Include="Stencils\RegelungstechnikSymbole.xaml"> | 263 | <Page Include="Stencils\RegelungstechnikSymbole.xaml"> |
263 | <SubType>Designer</SubType> | 264 | <SubType>Designer</SubType> |
264 | <Generator>MSBuild:Compile</Generator> | 265 | <Generator>MSBuild:Compile</Generator> |
265 | <Generator>MSBuild:Compile</Generator> | 266 | <Generator>MSBuild:Compile</Generator> |
266 | <SubType>Designer</SubType> | 267 | <SubType>Designer</SubType> |
267 | </Page> | 268 | </Page> |
268 | <Page Include="Stencils\SymbolStencils.xaml"> | 269 | <Page Include="Stencils\SymbolStencils.xaml"> |
269 | <Generator>MSBuild:Compile</Generator> | 270 | <Generator>MSBuild:Compile</Generator> |
270 | <SubType>Designer</SubType> | 271 | <SubType>Designer</SubType> |
271 | <Generator>MSBuild:Compile</Generator> | 272 | <Generator>MSBuild:Compile</Generator> |
272 | <SubType>Designer</SubType> | 273 | <SubType>Designer</SubType> |
273 | </Page> | 274 | </Page> |
274 | <Page Include="MainWindow.xaml"> | 275 | <Page Include="MainWindow.xaml"> |
275 | <SubType>Designer</SubType> | 276 | <SubType>Designer</SubType> |
276 | <Generator>MSBuild:Compile</Generator> | 277 | <Generator>MSBuild:Compile</Generator> |
277 | <Generator>MSBuild:Compile</Generator> | 278 | <Generator>MSBuild:Compile</Generator> |
278 | <SubType>Designer</SubType> | 279 | <SubType>Designer</SubType> |
279 | </Page> | 280 | </Page> |
280 | </ItemGroup> | 281 | </ItemGroup> |
281 | <ItemGroup> | 282 | <ItemGroup> |
282 | <Resource Include="Images\rt2.png" /> | 283 | <Resource Include="Images\rt2.png" /> |
283 | <Resource Include="Images\rt1.png" /> | 284 | <Resource Include="Images\rt1.png" /> |
284 | <Resource Include="Images\rt3.png" /> | 285 | <Resource Include="Images\rt3.png" /> |
285 | <Resource Include="Images\rt4.png" /> | 286 | <Resource Include="Images\rt4.png" /> |
286 | <Resource Include="Images\rt5.png" /> | 287 | <Resource Include="Images\rt5.png" /> |
287 | <Resource Include="Images\rt6.png" /> | 288 | <Resource Include="Images\rt6.png" /> |
288 | </ItemGroup> | 289 | </ItemGroup> |
289 | <ItemGroup> | 290 | <ItemGroup> |
290 | <Resource Include="Images\attention.png" /> | 291 | <Resource Include="Images\attention.png" /> |
291 | <Resource Include="Images\chart1.png" /> | 292 | <Resource Include="Images\chart1.png" /> |
292 | <Resource Include="Images\chart2.png" /> | 293 | <Resource Include="Images\chart2.png" /> |
293 | <Resource Include="Images\chart3.png" /> | 294 | <Resource Include="Images\chart3.png" /> |
294 | <Resource Include="Images\cross.png" /> | 295 | <Resource Include="Images\cross.png" /> |
295 | <Resource Include="Images\mail.png" /> | 296 | <Resource Include="Images\mail.png" /> |
296 | <Resource Include="Images\nuclear.png" /> | 297 | <Resource Include="Images\nuclear.png" /> |
297 | <Resource Include="Images\plus.png" /> | 298 | <Resource Include="Images\plus.png" /> |
298 | <Resource Include="Images\ring.png" /> | 299 | <Resource Include="Images\ring.png" /> |
299 | <Resource Include="Images\software.png" /> | 300 | <Resource Include="Images\software.png" /> |
300 | <Resource Include="Images\walk.png" /> | 301 | <Resource Include="Images\walk.png" /> |
301 | <Resource Include="Images\world.png" /> | 302 | <Resource Include="Images\world.png" /> |
302 | </ItemGroup> | 303 | </ItemGroup> |
303 | <ItemGroup> | 304 | <ItemGroup> |
304 | <Resource Include="Images\rotateRight.png" /> | 305 | <Resource Include="Images\rotateRight.png" /> |
305 | <Resource Include="Images\rotateLeft.png" /> | 306 | <Resource Include="Images\rotateLeft.png" /> |
306 | </ItemGroup> | 307 | </ItemGroup> |
307 | <ItemGroup> | 308 | <ItemGroup> |
308 | <Resource Include="Images\new.png" /> | 309 | <Resource Include="Images\new.png" /> |
309 | </ItemGroup> | 310 | </ItemGroup> |
310 | <ItemGroup> | 311 | <ItemGroup> |
311 | <Resource Include="Images\newBold.png" /> | 312 | <Resource Include="Images\newBold.png" /> |
312 | </ItemGroup> | 313 | </ItemGroup> |
313 | <ItemGroup> | 314 | <ItemGroup> |
314 | <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> | 315 | <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> |
315 | <Visible>False</Visible> | 316 | <Visible>False</Visible> |
316 | <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> | 317 | <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> |
317 | <Install>false</Install> | 318 | <Install>false</Install> |
318 | </BootstrapperPackage> | 319 | </BootstrapperPackage> |
319 | <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> | 320 | <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> |
320 | <Visible>False</Visible> | 321 | <Visible>False</Visible> |
321 | <ProductName>.NET Framework 3.5 SP1</ProductName> | 322 | <ProductName>.NET Framework 3.5 SP1</ProductName> |
322 | <Install>true</Install> | 323 | <Install>true</Install> |
323 | </BootstrapperPackage> | 324 | </BootstrapperPackage> |
324 | </ItemGroup> | 325 | </ItemGroup> |
325 | <ItemGroup> | 326 | <ItemGroup> |
326 | <Resource Include="Images\quitApp.png" /> | 327 | <Resource Include="Images\quitApp.png" /> |
327 | </ItemGroup> | 328 | </ItemGroup> |
328 | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | 329 | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
329 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | 330 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
330 | Other similar extension points exist, see Microsoft.Common.targets. | 331 | Other similar extension points exist, see Microsoft.Common.targets. |
331 | <Target Name="BeforeBuild"> | 332 | <Target Name="BeforeBuild"> |
332 | </Target> | 333 | </Target> |
333 | <Target Name="AfterBuild"> | 334 | <Target Name="AfterBuild"> |
334 | </Target> | 335 | </Target> |
335 | --> | 336 | --> |
336 | </Project> | 337 | </Project> |
sources/RoboforkApp/RoboforkApp.csproj.user
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 2 | <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
3 | <PropertyGroup> | 3 | <PropertyGroup> |
4 | <PublishUrlHistory>publish\</PublishUrlHistory> | 4 | <PublishUrlHistory>publish\</PublishUrlHistory> |
5 | <InstallUrlHistory /> | 5 | <InstallUrlHistory /> |
6 | <SupportUrlHistory /> | 6 | <SupportUrlHistory /> |
7 | <UpdateUrlHistory /> | 7 | <UpdateUrlHistory /> |
8 | <BootstrapperUrlHistory /> | 8 | <BootstrapperUrlHistory /> |
9 | <ErrorReportUrlHistory /> | 9 | <ErrorReportUrlHistory /> |
10 | <FallbackCulture>en-US</FallbackCulture> | 10 | <FallbackCulture>en-US</FallbackCulture> |
11 | <VerifyUploadedFiles>false</VerifyUploadedFiles> | 11 | <VerifyUploadedFiles>false</VerifyUploadedFiles> |
12 | <ProjectView>ShowAllFiles</ProjectView> | ||
12 | </PropertyGroup> | 13 | </PropertyGroup> |
13 | </Project> | 14 | </Project> |
sources/RoboforkApp/RoboforkMenu.xaml
1 | <Window x:Class="RoboforkApp.RoboforkMenu" | 1 | <Window x:Class="RoboforkApp.RoboforkMenu" |
2 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | 2 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
3 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | 3 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
4 | xmlns:s="clr-namespace:RoboforkApp" | 4 | xmlns:s="clr-namespace:RoboforkApp" |
5 | Title="Robofork App" | 5 | Title="Robofork App" |
6 | ResizeMode="NoResize" | 6 | ResizeMode="NoResize" |
7 | WindowStartupLocation="CenterScreen" | 7 | WindowStartupLocation="CenterScreen" |
8 | Height="1000" Width="1300"> | 8 | Height="1000" Width="1300"> |
9 | <Grid ShowGridLines="False" Margin="20,20,20,20"> | 9 | <Grid ShowGridLines="False" Margin="20,20,20,20"> |
10 | 10 | ||
11 | <Grid.RowDefinitions> | 11 | <Grid.RowDefinitions> |
12 | <RowDefinition Height="0.8*"/> | 12 | <RowDefinition Height="0.8*"/> |
13 | <RowDefinition Height="10*"/> | 13 | <RowDefinition Height="10*"/> |
14 | </Grid.RowDefinitions> | 14 | </Grid.RowDefinitions> |
15 | <Border Grid.Row="0" BorderThickness="1" BorderBrush="Gray" Margin="0,0,0,5"> | 15 | <Border Grid.Row="0" BorderThickness="1" BorderBrush="Gray" Margin="0,0,0,5"> |
16 | <Grid ShowGridLines="False"> | 16 | <Grid ShowGridLines="False"> |
17 | <Grid.RowDefinitions> | 17 | <Grid.RowDefinitions> |
18 | <RowDefinition Height="*"/> | 18 | <RowDefinition Height="*"/> |
19 | <RowDefinition Height="*"/> | 19 | <RowDefinition Height="*"/> |
20 | </Grid.RowDefinitions> | 20 | </Grid.RowDefinitions> |
21 | <Label Grid.Row="0" Content="Autonomous Planning Tool" Margin="10,0,0,0" | 21 | <Label Grid.Row="0" Content="Autonomous Planning Tool" Margin="10,0,0,0" |
22 | FontSize="16"/> | 22 | FontSize="16"/> |
23 | </Grid> | 23 | </Grid> |
24 | </Border> | 24 | </Border> |
25 | 25 | ||
26 | <Grid ShowGridLines="False" Grid.Row="1"> | 26 | <Grid ShowGridLines="False" Grid.Row="1"> |
27 | 27 | ||
28 | <Grid.ColumnDefinitions> | 28 | <Grid.ColumnDefinitions> |
29 | <ColumnDefinition Width="1.2*"/> | 29 | <ColumnDefinition Width="1.2*"/> |
30 | <ColumnDefinition Width="20"/> | 30 | <ColumnDefinition Width="20"/> |
31 | <ColumnDefinition Width="3*"/> | 31 | <ColumnDefinition Width="3*"/> |
32 | </Grid.ColumnDefinitions> | 32 | </Grid.ColumnDefinitions> |
33 | 33 | ||
34 | <Grid ShowGridLines="False" Grid.Column="0"> | 34 | <Grid ShowGridLines="False" Grid.Column="0"> |
35 | <Grid.RowDefinitions> | 35 | <Grid.RowDefinitions> |
36 | <RowDefinition Height="3*"/> | 36 | <RowDefinition Height="3*"/> |
37 | <RowDefinition Height="1*"/> | 37 | <RowDefinition Height="1*"/> |
38 | </Grid.RowDefinitions> | 38 | </Grid.RowDefinitions> |
39 | <Border Grid.Row="0" BorderThickness="1" BorderBrush="White" Margin="0,0,0,5"> | 39 | <Border Grid.Row="0" BorderThickness="1" BorderBrush="White" Margin="0,0,0,5"> |
40 | <TreeView > | 40 | <TreeView > |
41 | <TreeViewItem IsExpanded="True" Header="Project [AAA工場]" FontSize="17" > | 41 | <TreeViewItem IsExpanded="True" Header="Project [AAA工場]" FontSize="17" > |
42 | <TreeViewItem IsExpanded="True" Header="MAP" FontSize="17"> | 42 | <TreeViewItem IsExpanded="True" Header="MAP" FontSize="17"> |
43 | <TreeViewItem Header="Pass plan" FontSize="17" Name="PassplanTree" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="PassplanTree"> | 43 | <TreeViewItem Header="Pass plan" FontSize="17" Name="PassplanTree" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="PassplanTree"> |
44 | <TreeViewItem Header="Set Start" FontSize="17" Name="btnSetStart" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="SetStart"></TreeViewItem> | 44 | <TreeViewItem Header="Set Start" FontSize="17" Name="btnSetStart" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="SetStart"></TreeViewItem> |
45 | <TreeViewItem Header="Set Goal" FontSize="17" Name="btnSetGoal" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="SetGoal"></TreeViewItem> | 45 | <TreeViewItem Header="Set Goal" FontSize="17" Name="btnSetGoal" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="SetGoal"></TreeViewItem> |
46 | <TreeViewItem Header="Set Route" FontSize="17" Name="btnSetRoute" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="SetupRoute"></TreeViewItem> | 46 | <TreeViewItem Header="Set Route" FontSize="17" Name="btnSetRoute" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="SetupRoute"></TreeViewItem> |
47 | <TreeViewItem Header="Make Root" FontSize="17" Name="btnMakeRoot" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="MakeRoot"></TreeViewItem> | 47 | <TreeViewItem Header="Make Root" FontSize="17" Name="btnMakeRoot" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="MakeRoot"></TreeViewItem> |
48 | <TreeViewItem Header="Delete Route" FontSize="17" Name="btnDeleteRoute" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="DeleteRoute"></TreeViewItem> | 48 | <TreeViewItem Header="Delete Route" FontSize="17" Name="btnDeleteRoute" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="DeleteRoute"></TreeViewItem> |
49 | </TreeViewItem> | 49 | </TreeViewItem> |
50 | <TreeViewItem IsExpanded="True" Header="Node" FontSize="17" Name="NodeTree" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="NodeTree"> | 50 | <TreeViewItem IsExpanded="True" Header="Node" FontSize="17" Name="NodeTree" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="NodeTree"> |
51 | </TreeViewItem> | 51 | </TreeViewItem> |
52 | <TreeViewItem Header="--------------------" FontSize="17"> | 52 | <TreeViewItem Header="--------------------" FontSize="17"> |
53 | </TreeViewItem> | 53 | </TreeViewItem> |
54 | </TreeViewItem> | 54 | </TreeViewItem> |
55 | 55 | ||
56 | <TreeViewItem Header="Vehicle" FontSize="17"> | 56 | <TreeViewItem Header="Vehicle" FontSize="17"> |
57 | <TreeViewItem Header="FK15_#1" | 57 | <TreeViewItem Header="FK15_#1" |
58 | FontSize="17" | 58 | FontSize="17" |
59 | Name="FK15Tree" | 59 | Name="FK15Tree" |
60 | Selected="GetFK15Tree" | 60 | Selected="GetFK15Tree" |
61 | Unselected="SetFK15Tree"> | 61 | Unselected="SetFK15Tree"> |
62 | </TreeViewItem> | 62 | </TreeViewItem> |
63 | <TreeViewItem Header="[+]" | 63 | <TreeViewItem Header="[+]" |
64 | FontSize="17" | 64 | FontSize="17" |
65 | Name="VehicleAddTree" | 65 | Name="VehicleAddTree" |
66 | Selected="GetVehicleAddTree" | 66 | Selected="GetVehicleAddTree" |
67 | Unselected="SetVehicleAddTree"> | 67 | Unselected="SetVehicleAddTree"> |
68 | </TreeViewItem> | 68 | </TreeViewItem> |
69 | <TreeViewItem Header="--------------------"> | 69 | <TreeViewItem Header="--------------------"> |
70 | </TreeViewItem> | 70 | </TreeViewItem> |
71 | </TreeViewItem> | 71 | </TreeViewItem> |
72 | 72 | ||
73 | <TreeViewItem Header="Work" | 73 | <TreeViewItem Header="Work" |
74 | FontSize="17"> | 74 | FontSize="17"> |
75 | <TreeViewItem Header="Task patterm [FK15_#1]" | 75 | <TreeViewItem Header="Task patterm [FK15_#1]" |
76 | FontSize="17" | 76 | FontSize="17" |
77 | Name="TaskpattermTree" | 77 | Name="TaskpattermTree" |
78 | Selected="GetTaskpattermTree" | 78 | Selected="GetTaskpattermTree" |
79 | Unselected="SetTaskpattermTree"> | 79 | Unselected="SetTaskpattermTree"> |
80 | </TreeViewItem> | 80 | </TreeViewItem> |
81 | <TreeViewItem Header="[+]" | 81 | <TreeViewItem Header="[+]" |
82 | FontSize="17" | 82 | FontSize="17" |
83 | Name="WorkAddTree" | 83 | Name="WorkAddTree" |
84 | Selected="GetWorkAddTree" | 84 | Selected="GetWorkAddTree" |
85 | Unselected="SetWorkAddTree"> | 85 | Unselected="SetWorkAddTree"> |
86 | </TreeViewItem> | 86 | </TreeViewItem> |
87 | <TreeViewItem Header="--------------------" | 87 | <TreeViewItem Header="--------------------" |
88 | FontSize="17"> | 88 | FontSize="17"> |
89 | </TreeViewItem> | 89 | </TreeViewItem> |
90 | </TreeViewItem> | 90 | </TreeViewItem> |
91 | 91 | ||
92 | <TreeViewItem Header="Setting" | 92 | <TreeViewItem Header="Setting" |
93 | FontSize="17"> | 93 | FontSize="17"> |
94 | <TreeViewItem Header="Connect [Wi-Fi]" | 94 | <TreeViewItem Header="Connect [Wi-Fi]" |
95 | FontSize="17" | 95 | FontSize="17" |
96 | Name="ConnectTree" | 96 | Name="ConnectTree" |
97 | Selected="GetConnectTree" | 97 | Selected="GetConnectTree" |
98 | Unselected="SetConnectTree"> | 98 | Unselected="SetConnectTree"> |
99 | </TreeViewItem> | 99 | </TreeViewItem> |
100 | <TreeViewItem Header="Parameter" | 100 | <TreeViewItem Header="Parameter" |
101 | FontSize="17" | 101 | FontSize="17" |
102 | Name="ParameterTree" | 102 | Name="ParameterTree" |
103 | Selected="GetParameterTree" | 103 | Selected="GetParameterTree" |
104 | Unselected="SetParameterTree"> | 104 | Unselected="SetParameterTree"> |
105 | </TreeViewItem> | 105 | </TreeViewItem> |
106 | <TreeViewItem Header="--------------------" | 106 | <TreeViewItem Header="--------------------" |
107 | FontSize="17"> | 107 | FontSize="17"> |
108 | </TreeViewItem> | 108 | </TreeViewItem> |
109 | </TreeViewItem> | 109 | </TreeViewItem> |
110 | <TreeViewItem Header="Schedule" FontSize="17" Name="ScheduleTree" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="ScheduleRoute"></TreeViewItem> | 110 | <TreeViewItem Header="Schedule" FontSize="17" Name="ScheduleTree" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="ScheduleRoute"></TreeViewItem> |
111 | <TreeViewItem Header="Logging" | 111 | <TreeViewItem Header="Logging" |
112 | FontSize="17" | 112 | FontSize="17" |
113 | Name="LoggingTree" | 113 | Name="LoggingTree" |
114 | Selected="GetLoggingTree" | 114 | Selected="GetLoggingTree" |
115 | Unselected="SetLoggingTree"> | 115 | Unselected="SetLoggingTree"> |
116 | </TreeViewItem> | 116 | </TreeViewItem> |
117 | <TreeViewItem Header=" --------------------"> | 117 | <TreeViewItem Header=" --------------------"> |
118 | </TreeViewItem> | 118 | </TreeViewItem> |
119 | </TreeViewItem> | 119 | </TreeViewItem> |
120 | <TreeViewItem Header="Alert" | 120 | <TreeViewItem Header="Alert" |
121 | FontSize="17" | 121 | FontSize="17" |
122 | Name="AlertTree" | 122 | Name="AlertTree" |
123 | Selected="GetAlertTree" | 123 | Selected="GetAlertTree" |
124 | Unselected="SetAlertTree"> | 124 | Unselected="SetAlertTree"> |
125 | </TreeViewItem> | 125 | </TreeViewItem> |
126 | <TreeViewItem Header="Help" | 126 | <TreeViewItem Header="Help" |
127 | FontSize="17" | 127 | FontSize="17" |
128 | Name="HelpTree" | 128 | Name="HelpTree" |
129 | Selected="GetHelpTree" | 129 | Selected="GetHelpTree" |
130 | Unselected="SetHelpTree"> | 130 | Unselected="SetHelpTree"> |
131 | </TreeViewItem> | 131 | </TreeViewItem> |
132 | <TreeViewItem Header="[+New Project]" | 132 | <TreeViewItem Header="[+New Project]" |
133 | FontSize="17" | 133 | FontSize="17" |
134 | Name="NewProjectTree" | 134 | Name="NewProjectTree" |
135 | Selected="GetNewProjectTree" | 135 | Selected="GetNewProjectTree" |
136 | Unselected="SetNewProjectTree"> | 136 | Unselected="SetNewProjectTree"> |
137 | </TreeViewItem> | 137 | </TreeViewItem> |
138 | </TreeView> | 138 | </TreeView> |
139 | </Border> | 139 | </Border> |
140 | <Border Grid.Row="1" BorderThickness="1" BorderBrush="Gray" Margin="0,5,0,0"> | 140 | <Border Grid.Row="1" BorderThickness="1" BorderBrush="Gray" Margin="0,5,0,0"> |
141 | 141 | ||
142 | <Grid ShowGridLines="False"> | 142 | <Grid ShowGridLines="False"> |
143 | <Grid.RowDefinitions> | 143 | <Grid.RowDefinitions> |
144 | <RowDefinition Height="1*"/> | 144 | <RowDefinition Height="1*"/> |
145 | <RowDefinition Height="5*"/> | 145 | <RowDefinition Height="5*"/> |
146 | </Grid.RowDefinitions> | 146 | </Grid.RowDefinitions> |
147 | <Label Grid.Row="0" Content="Viewer" Margin="10,0,0,0" | 147 | <Label Grid.Row="0" Content="Viewer" Margin="10,0,0,0" |
148 | FontSize="17"/> | 148 | FontSize="17"/> |
149 | </Grid> | 149 | </Grid> |
150 | </Border> | 150 | </Border> |
151 | </Grid> | 151 | </Grid> |
152 | <TabControl x:Name="MainTab" | 152 | <TabControl x:Name="MainTab" |
153 | Margin="0,0,0,0" | 153 | Margin="0,0,0,0" |
154 | Grid.Column="2" > | 154 | Grid.Column="2" > |
155 | <TabItem x:Name="TabMap" > | 155 | <TabItem x:Name="TabMap" > |
156 | <TabItem.Header> | 156 | <TabItem.Header> |
157 | <StackPanel Orientation="Horizontal"> | 157 | <StackPanel Orientation="Horizontal"> |
158 | <TextBlock Text="MAP " VerticalAlignment="Center" FontSize="17"></TextBlock> | 158 | <TextBlock Text="MAP " VerticalAlignment="Center" FontSize="17"></TextBlock> |
159 | </StackPanel> | 159 | </StackPanel> |
160 | </TabItem.Header> | 160 | </TabItem.Header> |
161 | <Grid ShowGridLines="False"> | 161 | <Grid ShowGridLines="False"> |
162 | <Grid.RowDefinitions> | 162 | <Grid.RowDefinitions> |
163 | <RowDefinition Height="5*"/> | 163 | <RowDefinition Height="5*"/> |
164 | <RowDefinition Height="1*"/> | 164 | <RowDefinition Height="1*"/> |
165 | <RowDefinition Height="1*"/> | 165 | <RowDefinition Height="1*"/> |
166 | </Grid.RowDefinitions> | 166 | </Grid.RowDefinitions> |
167 | 167 | ||
168 | <Grid ShowGridLines="False" Grid.Row="0" Name="GridMap"> | 168 | <Grid ShowGridLines="False" Grid.Row="0" Name="GridMap"> |
169 | <Grid > | 169 | <Grid > |
170 | <Grid.ColumnDefinitions> | 170 | <Grid.ColumnDefinitions> |
171 | <ColumnDefinition Width="{Binding ActualHeight, ElementName=GridMap}"/> | 171 | <ColumnDefinition Width="{Binding ActualHeight, ElementName=GridMap}"/> |
172 | <ColumnDefinition Width="*"/> | 172 | <ColumnDefinition Width="*"/> |
173 | </Grid.ColumnDefinitions> | 173 | </Grid.ColumnDefinitions> |
174 | <Border Grid.Column="0" BorderThickness="1" BorderBrush="Red" Margin="5,5,5,5"> | 174 | <Border Grid.Column="0" BorderThickness="1" BorderBrush="Red" Margin="5,5,5,5"> |
175 | 175 | ||
176 | <s:DesignerCanvas x:Name="MyDesignerCanvas" | 176 | <s:DesignerCanvas x:Name="MyDesignerCanvas" |
177 | AllowDrop="True" | 177 | AllowDrop="True" |
178 | Background="White" HorizontalAlignment="Stretch"> | 178 | Background="White" HorizontalAlignment="Stretch"> |
179 | <Canvas.LayoutTransform> | 179 | <Canvas.LayoutTransform> |
180 | <!--Adjust ScaleX and ScaleY in lock-step to zoom--> | 180 | <!--Adjust ScaleX and ScaleY in lock-step to zoom--> |
181 | <ScaleTransform ScaleX=".57" ScaleY=".57" CenterX=".57" CenterY=".57" /> | 181 | <ScaleTransform ScaleX=".57" ScaleY=".57" CenterX=".57" CenterY=".57" /> |
182 | </Canvas.LayoutTransform> | 182 | </Canvas.LayoutTransform> |
183 | <Grid Name="MCGrid" Background="White" ShowGridLines="True" | 183 | <Grid Name="MCGrid" Background="White" ShowGridLines="True" |
184 | Width="{Binding ActualWidth, ElementName=MyDesignerCanvas}" | 184 | Width="{Binding ActualWidth, ElementName=MyDesignerCanvas}" |
185 | Height="{Binding ActualHeight, ElementName=MyDesignerCanvas}"> | 185 | Height="{Binding ActualHeight, ElementName=MyDesignerCanvas}"> |
186 | 186 | ||
187 | <Grid.RowDefinitions> | 187 | <Grid.RowDefinitions> |
188 | <RowDefinition Height="1*"/> | 188 | <RowDefinition Height="1*"/> |
189 | <RowDefinition Height="1*"/> | 189 | <RowDefinition Height="1*"/> |
190 | <RowDefinition Height="1*"/> | 190 | <RowDefinition Height="1*"/> |
191 | <RowDefinition Height="1*"/> | 191 | <RowDefinition Height="1*"/> |
192 | <RowDefinition Height="1*"/> | 192 | <RowDefinition Height="1*"/> |
193 | <RowDefinition Height="1*"/> | 193 | <RowDefinition Height="1*"/> |
194 | <RowDefinition Height="1*"/> | 194 | <RowDefinition Height="1*"/> |
195 | <RowDefinition Height="1*"/> | 195 | <RowDefinition Height="1*"/> |
196 | <RowDefinition Height="1*"/> | 196 | <RowDefinition Height="1*"/> |
197 | <RowDefinition Height="1*"/> | 197 | <RowDefinition Height="1*"/> |
198 | </Grid.RowDefinitions> | 198 | </Grid.RowDefinitions> |
199 | <Grid.ColumnDefinitions> | 199 | <Grid.ColumnDefinitions> |
200 | <ColumnDefinition Width="*"/> | 200 | <ColumnDefinition Width="*"/> |
201 | <ColumnDefinition Width="*"/> | 201 | <ColumnDefinition Width="*"/> |
202 | <ColumnDefinition Width="*"/> | 202 | <ColumnDefinition Width="*"/> |
203 | <ColumnDefinition Width="*"/> | 203 | <ColumnDefinition Width="*"/> |
204 | <ColumnDefinition Width="*"/> | 204 | <ColumnDefinition Width="*"/> |
205 | <ColumnDefinition Width="*"/> | 205 | <ColumnDefinition Width="*"/> |
206 | <ColumnDefinition Width="*"/> | 206 | <ColumnDefinition Width="*"/> |
207 | <ColumnDefinition Width="*"/> | 207 | <ColumnDefinition Width="*"/> |
208 | <ColumnDefinition Width="*"/> | 208 | <ColumnDefinition Width="*"/> |
209 | <ColumnDefinition Width="*"/> | 209 | <ColumnDefinition Width="*"/> |
210 | </Grid.ColumnDefinitions> | 210 | </Grid.ColumnDefinitions> |
211 | <TextBlock Grid.Row="0" Grid.Column="1" Foreground="SkyBlue">100</TextBlock> | 211 | <TextBlock Grid.Row="0" Grid.Column="1" Foreground="SkyBlue">100</TextBlock> |
212 | <TextBlock Grid.Row="0" Grid.Column="2" Foreground="SkyBlue">200</TextBlock> | 212 | <TextBlock Grid.Row="0" Grid.Column="2" Foreground="SkyBlue">200</TextBlock> |
213 | <TextBlock Grid.Row="0" Grid.Column="3" Foreground="SkyBlue">300</TextBlock> | 213 | <TextBlock Grid.Row="0" Grid.Column="3" Foreground="SkyBlue">300</TextBlock> |
214 | <TextBlock Grid.Row="0" Grid.Column="4" Foreground="SkyBlue">400</TextBlock> | 214 | <TextBlock Grid.Row="0" Grid.Column="4" Foreground="SkyBlue">400</TextBlock> |
215 | <TextBlock Grid.Row="0" Grid.Column="5" Foreground="SkyBlue">500</TextBlock> | 215 | <TextBlock Grid.Row="0" Grid.Column="5" Foreground="SkyBlue">500</TextBlock> |
216 | <TextBlock Grid.Row="0" Grid.Column="6" Foreground="SkyBlue">600</TextBlock> | 216 | <TextBlock Grid.Row="0" Grid.Column="6" Foreground="SkyBlue">600</TextBlock> |
217 | <TextBlock Grid.Row="0" Grid.Column="7" Foreground="SkyBlue">700</TextBlock> | 217 | <TextBlock Grid.Row="0" Grid.Column="7" Foreground="SkyBlue">700</TextBlock> |
218 | <TextBlock Grid.Row="0" Grid.Column="8" Foreground="SkyBlue">800</TextBlock> | 218 | <TextBlock Grid.Row="0" Grid.Column="8" Foreground="SkyBlue">800</TextBlock> |
219 | <TextBlock Grid.Row="0" Grid.Column="9" Foreground="SkyBlue">900</TextBlock> | 219 | <TextBlock Grid.Row="0" Grid.Column="9" Foreground="SkyBlue">900</TextBlock> |
220 | 220 | ||
221 | <TextBlock Grid.Row="1" Grid.Column="0" Foreground="SkyBlue">100</TextBlock> | 221 | <TextBlock Grid.Row="1" Grid.Column="0" Foreground="SkyBlue">100</TextBlock> |
222 | <TextBlock Grid.Row="2" Grid.Column="0" Foreground="SkyBlue">200</TextBlock> | 222 | <TextBlock Grid.Row="2" Grid.Column="0" Foreground="SkyBlue">200</TextBlock> |
223 | <TextBlock Grid.Row="3" Grid.Column="0" Foreground="SkyBlue">300</TextBlock> | 223 | <TextBlock Grid.Row="3" Grid.Column="0" Foreground="SkyBlue">300</TextBlock> |
224 | <TextBlock Grid.Row="4" Grid.Column="0" Foreground="SkyBlue">400</TextBlock> | 224 | <TextBlock Grid.Row="4" Grid.Column="0" Foreground="SkyBlue">400</TextBlock> |
225 | <TextBlock Grid.Row="5" Grid.Column="0" Foreground="SkyBlue">500</TextBlock> | 225 | <TextBlock Grid.Row="5" Grid.Column="0" Foreground="SkyBlue">500</TextBlock> |
226 | <TextBlock Grid.Row="6" Grid.Column="0" Foreground="SkyBlue">600</TextBlock> | 226 | <TextBlock Grid.Row="6" Grid.Column="0" Foreground="SkyBlue">600</TextBlock> |
227 | <TextBlock Grid.Row="7" Grid.Column="0" Foreground="SkyBlue">700</TextBlock> | 227 | <TextBlock Grid.Row="7" Grid.Column="0" Foreground="SkyBlue">700</TextBlock> |
228 | <TextBlock Grid.Row="8" Grid.Column="0" Foreground="SkyBlue">800</TextBlock> | 228 | <TextBlock Grid.Row="8" Grid.Column="0" Foreground="SkyBlue">800</TextBlock> |
229 | <TextBlock Grid.Row="9" Grid.Column="0" Foreground="SkyBlue">900</TextBlock> | 229 | <TextBlock Grid.Row="9" Grid.Column="0" Foreground="SkyBlue">900</TextBlock> |
230 | </Grid> | 230 | </Grid> |
231 | 231 | ||
232 | </s:DesignerCanvas> | 232 | </s:DesignerCanvas> |
233 | 233 | ||
234 | </Border> | 234 | </Border> |
235 | 235 | ||
236 | <Border Grid.Column="1" BorderThickness="1" BorderBrush="Gray" Margin="5,5,5,5"> | 236 | <Border Grid.Column="1" BorderThickness="1" BorderBrush="Gray" Margin="5,5,5,5"> |
237 | 237 | ||
238 | <DockPanel > | 238 | <DockPanel > |
239 | <ScrollViewer> | 239 | <ScrollViewer> |
240 | <Grid Name="grdRouteInfo"> | 240 | <Grid Name="grdRouteInfo"> |
241 | <Grid.RowDefinitions> | 241 | <Grid.RowDefinitions> |
242 | <RowDefinition Height="1*"/> | 242 | <RowDefinition Height="1*"/> |
243 | <RowDefinition Height="1*"/> | 243 | <RowDefinition Height="1*"/> |
244 | <RowDefinition Height="1*"/> | 244 | <RowDefinition Height="1*"/> |
245 | <RowDefinition Height="1*"/> | 245 | <RowDefinition Height="1*"/> |
246 | <RowDefinition Height="1*"/> | 246 | <RowDefinition Height="1*"/> |
247 | <RowDefinition Height="1*"/> | 247 | <RowDefinition Height="1*"/> |
248 | <RowDefinition Height="1*"/> | 248 | <RowDefinition Height="1*"/> |
249 | <RowDefinition Height="1*"/> | 249 | <RowDefinition Height="1*"/> |
250 | <RowDefinition Height="1*"/> | 250 | <RowDefinition Height="1*"/> |
251 | <RowDefinition Height="1*"/> | 251 | <RowDefinition Height="1*"/> |
252 | <RowDefinition Height="1*"/> | 252 | <RowDefinition Height="1*"/> |
253 | <RowDefinition Height="1*"/> | 253 | <RowDefinition Height="1*"/> |
254 | <RowDefinition Height="1*"/> | 254 | <RowDefinition Height="1*"/> |
255 | <RowDefinition Height="1*"/> | 255 | <RowDefinition Height="1*"/> |
256 | <RowDefinition Height="1*"/> | 256 | <RowDefinition Height="1*"/> |
257 | 257 | ||
258 | </Grid.RowDefinitions> | 258 | </Grid.RowDefinitions> |
259 | <Grid.ColumnDefinitions> | 259 | <Grid.ColumnDefinitions> |
260 | <ColumnDefinition Width="0.5*"/> | 260 | <ColumnDefinition Width="0.5*"/> |
261 | <ColumnDefinition Width="6*"/> | 261 | <ColumnDefinition Width="6*"/> |
262 | </Grid.ColumnDefinitions> | 262 | </Grid.ColumnDefinitions> |
263 | <Border Grid.Row="0" Grid.Column="0" BorderThickness="1" /> | 263 | <Border Grid.Row="0" Grid.Column="0" BorderThickness="1" /> |
264 | <Border Grid.Row="1" Grid.Column="0" BorderThickness="1" /> | 264 | <Border Grid.Row="1" Grid.Column="0" BorderThickness="1" /> |
265 | <Border Grid.Row="2" Grid.Column="0" BorderThickness="1" /> | 265 | <Border Grid.Row="2" Grid.Column="0" BorderThickness="1" /> |
266 | <Border Grid.Row="3" Grid.Column="0" BorderThickness="1" /> | 266 | <Border Grid.Row="3" Grid.Column="0" BorderThickness="1" /> |
267 | <Border Grid.Row="4" Grid.Column="0" BorderThickness="1" /> | 267 | <Border Grid.Row="4" Grid.Column="0" BorderThickness="1" /> |
268 | <Border Grid.Row="5" Grid.Column="0" BorderThickness="1" /> | 268 | <Border Grid.Row="5" Grid.Column="0" BorderThickness="1" /> |
269 | <Border Grid.Row="6" Grid.Column="0" BorderThickness="1" /> | 269 | <Border Grid.Row="6" Grid.Column="0" BorderThickness="1" /> |
270 | <Border Grid.Row="7" Grid.Column="0" BorderThickness="1" /> | 270 | <Border Grid.Row="7" Grid.Column="0" BorderThickness="1" /> |
271 | <Border Grid.Row="8" Grid.Column="0" BorderThickness="1" /> | 271 | <Border Grid.Row="8" Grid.Column="0" BorderThickness="1" /> |
272 | <Border Grid.Row="9" Grid.Column="0" BorderThickness="1" /> | 272 | <Border Grid.Row="9" Grid.Column="0" BorderThickness="1" /> |
273 | <Border Grid.Row="10" Grid.Column="0" BorderThickness="1" /> | 273 | <Border Grid.Row="10" Grid.Column="0" BorderThickness="1" /> |
274 | <Border Grid.Row="11" Grid.Column="0" BorderThickness="1" /> | 274 | <Border Grid.Row="11" Grid.Column="0" BorderThickness="1" /> |
275 | <Border Grid.Row="12" Grid.Column="0" BorderThickness="1" /> | 275 | <Border Grid.Row="12" Grid.Column="0" BorderThickness="1" /> |
276 | <Border Grid.Row="13" Grid.Column="0" BorderThickness="1" /> | 276 | <Border Grid.Row="13" Grid.Column="0" BorderThickness="1" /> |
277 | <Border Grid.Row="14" Grid.Column="0" BorderThickness="1" /> | 277 | <Border Grid.Row="14" Grid.Column="0" BorderThickness="1" /> |
278 | <Border Grid.Row="15" Grid.Column="0" BorderThickness="1" /> | 278 | <Border Grid.Row="15" Grid.Column="0" BorderThickness="1" /> |
279 | 279 | ||
280 | 280 | ||
281 | 281 | ||
282 | <Label Grid.Row="0" Grid.Column="1" Content="Monitor" FontSize="17"/> | 282 | <Label Grid.Row="0" Grid.Column="1" Content="Monitor" FontSize="17"/> |
283 | <Label Grid.Row="1" Grid.Column="1" Content="AOR 28249 [kg/h]" FontSize="17"/> | 283 | <Label Grid.Row="1" Grid.Column="1" Content="AOR 28249 [kg/h]" FontSize="17"/> |
284 | <Label Grid.Row="2" Grid.Column="1" Content="ABC 4738 [trq]" FontSize="17"/> | 284 | <Label Grid.Row="2" Grid.Column="1" Content="ABC 4738 [trq]" FontSize="17"/> |
285 | <Label Grid.Row="3" Grid.Column="1" Content="ATR 49593 [%]" FontSize="17"/> | 285 | <Label Grid.Row="3" Grid.Column="1" Content="ATR 49593 [%]" FontSize="17"/> |
286 | <Label Grid.Row="4" Grid.Column="1" Content="DEK 50403 [G]" FontSize="17"/> | 286 | <Label Grid.Row="4" Grid.Column="1" Content="DEK 50403 [G]" FontSize="17"/> |
287 | <Label Grid.Row="5" Grid.Column="1" Content="SKG 2739 [kg]" FontSize="17"/> | 287 | <Label Grid.Row="5" Grid.Column="1" Content="SKG 2739 [kg]" FontSize="17"/> |
288 | <Label Grid.Row="6" Grid.Column="1" Content="SOC 86 [%]" FontSize="17"/> | 288 | <Label Grid.Row="6" Grid.Column="1" Content="SOC 86 [%]" FontSize="17"/> |
289 | <Label Grid.Row="7" Grid.Column="1" Content=" :" FontSize="17"/> | 289 | <Label Grid.Row="7" Grid.Column="1" Content=" :" FontSize="17"/> |
290 | <Label Grid.Row="8" Grid.Column="1" Content=" :" FontSize="17"/> | 290 | <Label Grid.Row="8" Grid.Column="1" Content=" :" FontSize="17"/> |
291 | <Label Grid.Row="9" Grid.Column="1" Content=" :" FontSize="17"/> | 291 | <Label Grid.Row="9" Grid.Column="1" Content=" :" FontSize="17"/> |
292 | <Label Grid.Row="10" Grid.Column="1" Content=" :" FontSize="17"/> | 292 | <Label Grid.Row="10" Grid.Column="1" Content=" :" FontSize="17"/> |
293 | <Label Grid.Row="11" Grid.Column="1" Content=" :" FontSize="17"/> | 293 | <Label Grid.Row="11" Grid.Column="1" Content=" :" FontSize="17"/> |
294 | </Grid> | 294 | </Grid> |
295 | </ScrollViewer> | 295 | </ScrollViewer> |
296 | </DockPanel > | 296 | </DockPanel > |
297 | </Border> | 297 | </Border> |
298 | </Grid> | 298 | </Grid> |
299 | 299 | ||
300 | </Grid> | 300 | </Grid> |
301 | <Border Grid.Row="1" BorderThickness="1" BorderBrush="Gray" Margin="5,5,5,5"> | 301 | <Border Grid.Row="1" BorderThickness="1" BorderBrush="Gray" Margin="5,5,5,5"> |
302 | <Grid ShowGridLines="False"> | 302 | <Grid ShowGridLines="False"> |
303 | <Grid.ColumnDefinitions> | 303 | <Grid.ColumnDefinitions> |
304 | <ColumnDefinition Width="1*"/> | 304 | <ColumnDefinition Width="1*"/> |
305 | <ColumnDefinition Width="8*"/> | 305 | <ColumnDefinition Width="8*"/> |
306 | </Grid.ColumnDefinitions> | 306 | </Grid.ColumnDefinitions> |
307 | <Grid ShowGridLines="False" Grid.Column="0"> | 307 | <Grid ShowGridLines="False" Grid.Column="0"> |
308 | <Grid.RowDefinitions> | 308 | <Grid.RowDefinitions> |
309 | <RowDefinition Height="1*"/> | 309 | <RowDefinition Height="1*"/> |
310 | <RowDefinition Height="1*"/> | 310 | <RowDefinition Height="1*"/> |
311 | <RowDefinition Height="1*"/> | 311 | <RowDefinition Height="1*"/> |
312 | </Grid.RowDefinitions> | 312 | </Grid.RowDefinitions> |
313 | <Label Grid.Row="0" Content="Schedule" Margin="10,0,0,0" FontSize="17"/> | 313 | <Label Grid.Row="0" Content="Schedule" Margin="10,0,0,0" FontSize="17"/> |
314 | <Label Grid.Row="1" Content="FK15_#1" Margin="10,0,0,0" FontSize="17"/> | 314 | <Label Grid.Row="1" Content="FK15_#1" Margin="10,0,0,0" FontSize="17"/> |
315 | </Grid> | 315 | </Grid> |
316 | <Border Grid.Column="1" BorderThickness="1" BorderBrush="Red" Margin="5,5,5,5"> | 316 | <Border Grid.Column="1" BorderThickness="1" BorderBrush="Red" Margin="5,5,5,5"> |
317 | 317 | ||
318 | <s:ScheduleCanvas x:Name="MyScheduleCanvas" | 318 | <s:ScheduleCanvas x:Name="MyScheduleCanvas" |
319 | AllowDrop="True" | 319 | AllowDrop="True" |
320 | Background="White" HorizontalAlignment="Stretch"> | 320 | Background="White" HorizontalAlignment="Stretch"> |
321 | <Canvas.LayoutTransform> | 321 | <Canvas.LayoutTransform> |
322 | <!--Adjust ScaleX and ScaleY in lock-step to zoom--> | 322 | <!--Adjust ScaleX and ScaleY in lock-step to zoom--> |
323 | <ScaleTransform ScaleX=".57" ScaleY=".57" CenterX=".57" CenterY=".57" /> | 323 | <ScaleTransform ScaleX=".57" ScaleY=".57" CenterX=".57" CenterY=".57" /> |
324 | </Canvas.LayoutTransform> | 324 | </Canvas.LayoutTransform> |
325 | 325 | ||
326 | <Grid Name="MCGridShedule" Background="White" ShowGridLines="True" | 326 | <Grid Name="MCGridShedule" Background="White" ShowGridLines="True" |
327 | Width="{Binding ActualWidth, ElementName=MyScheduleCanvas}" | 327 | Width="{Binding ActualWidth, ElementName=MyScheduleCanvas}" |
328 | Height="{Binding ActualHeight, ElementName=MyScheduleCanvas}"> | 328 | Height="{Binding ActualHeight, ElementName=MyScheduleCanvas}"> |
329 | 329 | ||
330 | <Grid.RowDefinitions> | 330 | <Grid.RowDefinitions> |
331 | <RowDefinition Height="1*"/> | 331 | <RowDefinition Height="1*"/> |
332 | <RowDefinition Height="1*"/> | 332 | <RowDefinition Height="1*"/> |
333 | </Grid.RowDefinitions> | 333 | </Grid.RowDefinitions> |
334 | <Grid.ColumnDefinitions> | 334 | <Grid.ColumnDefinitions> |
335 | <ColumnDefinition Width="*"/> | 335 | <ColumnDefinition Width="*"/> |
336 | <ColumnDefinition Width="*"/> | ||
337 | <ColumnDefinition Width="*"/> | ||
338 | <ColumnDefinition Width="*"/> | ||
339 | <ColumnDefinition Width="*"/> | ||
340 | <ColumnDefinition Width="*"/> | ||
341 | <ColumnDefinition Width="*"/> | ||
342 | <ColumnDefinition Width="*"/> | ||
343 | <ColumnDefinition Width="*"/> | ||
344 | <ColumnDefinition Width="*"/> | ||
345 | </Grid.ColumnDefinitions> | 336 | </Grid.ColumnDefinitions> |
346 | <TextBlock Grid.Row="0" Grid.Column="1" Foreground="SkyBlue">100</TextBlock> | ||
347 | <TextBlock Grid.Row="0" Grid.Column="2" Foreground="SkyBlue">200</TextBlock> | ||
348 | <TextBlock Grid.Row="0" Grid.Column="3" Foreground="SkyBlue">300</TextBlock> | ||
349 | <TextBlock Grid.Row="0" Grid.Column="4" Foreground="SkyBlue">400</TextBlock> | ||
350 | <TextBlock Grid.Row="0" Grid.Column="5" Foreground="SkyBlue">500</TextBlock> | ||
351 | <TextBlock Grid.Row="0" Grid.Column="6" Foreground="SkyBlue">600</TextBlock> | ||
352 | <TextBlock Grid.Row="0" Grid.Column="7" Foreground="SkyBlue">700</TextBlock> | ||
353 | <TextBlock Grid.Row="0" Grid.Column="8" Foreground="SkyBlue">800</TextBlock> | ||
354 | <TextBlock Grid.Row="0" Grid.Column="9" Foreground="SkyBlue">900</TextBlock> | ||
355 | 337 | ||
356 | <TextBlock Grid.Row="1" Grid.Column="0" Foreground="SkyBlue">100</TextBlock> | 338 | <TextBlock Grid.Row="1" Grid.Column="0" Foreground="SkyBlue">100</TextBlock> |
357 | <!--<TextBlock Grid.Row="2" Grid.Column="0" Foreground="SkyBlue">200</TextBlock>--> | 339 | <!--<TextBlock Grid.Row="2" Grid.Column="0" Foreground="SkyBlue">200</TextBlock>--> |
358 | </Grid> | 340 | </Grid> |
359 | </s:ScheduleCanvas> | 341 | </s:ScheduleCanvas> |
360 | 342 | ||
361 | </Border> | 343 | </Border> |
362 | </Grid> | 344 | </Grid> |
363 | </Border> | 345 | </Border> |
364 | <Border Grid.Row="2" BorderThickness="1" BorderBrush="Gray" Margin="5,5,5,5"> | 346 | <Border Grid.Row="2" BorderThickness="1" BorderBrush="Gray" Margin="5,5,5,5"> |
365 | <Grid ShowGridLines="False"> | 347 | <Grid ShowGridLines="False"> |
366 | <Grid.RowDefinitions> | 348 | <Grid.RowDefinitions> |
367 | <RowDefinition Height="1*"/> | 349 | <RowDefinition Height="1*"/> |
368 | <RowDefinition Height="2*"/> | 350 | <RowDefinition Height="2*"/> |
369 | </Grid.RowDefinitions> | 351 | </Grid.RowDefinitions> |
370 | <Label Grid.Row="0" Content="Work [FK15_#1]" Margin="10,0,0,0" FontSize="17"/> | 352 | <Label Grid.Row="0" Content="Work [FK15_#1]" Margin="10,0,0,0" FontSize="17"/> |
371 | </Grid> | 353 | </Grid> |
372 | </Border> | 354 | </Border> |
373 | </Grid> | 355 | </Grid> |
374 | </TabItem> | 356 | </TabItem> |
375 | <TabItem x:Name="TabWork" > | 357 | <TabItem x:Name="TabWork" > |
376 | <TabItem.Header> | 358 | <TabItem.Header> |
377 | <StackPanel Orientation="Horizontal"> | 359 | <StackPanel Orientation="Horizontal"> |
378 | <TextBlock Text=" Work " VerticalAlignment="Center" FontSize="17"></TextBlock> | 360 | <TextBlock Text=" Work " VerticalAlignment="Center" FontSize="17"></TextBlock> |
379 | </StackPanel> | 361 | </StackPanel> |
380 | </TabItem.Header> | 362 | </TabItem.Header> |
381 | </TabItem> | 363 | </TabItem> |
382 | <TabItem x:Name="TabSchedule" > | 364 | <TabItem x:Name="TabSchedule" > |
383 | <TabItem.Header> | 365 | <TabItem.Header> |
384 | <StackPanel Orientation="Horizontal"> | 366 | <StackPanel Orientation="Horizontal"> |
385 | <TextBlock Text=" Schedule " VerticalAlignment="Center" FontSize="17"></TextBlock> | 367 | <TextBlock Text=" Schedule " VerticalAlignment="Center" FontSize="17"></TextBlock> |
386 | </StackPanel> | 368 | </StackPanel> |
387 | </TabItem.Header> | 369 | </TabItem.Header> |
388 | </TabItem> | 370 | </TabItem> |
389 | </TabControl> | 371 | </TabControl> |
390 | </Grid> | 372 | </Grid> |
391 | </Grid> | 373 | </Grid> |
392 | </Window> | 374 | </Window> |
393 | 375 |