Commit fa577fd8d4e73e258ededa6462f80bb5c0358898
1 parent
6870a03e36
Exists in
master
2036: Update follow new map
Showing 3 changed files with 154 additions and 52 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 = 8d; | 17 | const double RADIUS_NODE = 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 Auto Nodes | 61 | // Add variable for Set Auto Nodes |
62 | public Path pBlueNode = new Path(); | 62 | public Path pBlueNode = new Path(); |
63 | private GeometryGroup gGrpBlueNode = new GeometryGroup(); | 63 | private GeometryGroup gGrpBlueNode = new GeometryGroup(); |
64 | 64 | ||
65 | // Add variable for Set Free Nodes | 65 | // Add variable for Set Free Nodes |
66 | public Path pFreeNode = new Path(); | 66 | public Path pFreeNode = new Path(); |
67 | //private GeometryGroup gGrpFreeNode = new GeometryGroup(); | 67 | //private GeometryGroup gGrpFreeNode = new GeometryGroup(); |
68 | 68 | ||
69 | // The part of the rectangle the mouse is over. | 69 | // The part of the rectangle the mouse is over. |
70 | private enum HitType | 70 | private enum HitType |
71 | { | 71 | { |
72 | None, Body, UL, UR, LR, LL, L, R, T, B | 72 | None, Body, UL, UR, LR, LL, L, R, T, B |
73 | }; | 73 | }; |
74 | public enum OperationState | 74 | public enum OperationState |
75 | { | 75 | { |
76 | None, DrawObstract, DrawRoute, DrawSetFreeNode, EditNode | 76 | None, DrawObstract, DrawRoute, DrawSetFreeNode, EditNode |
77 | }; | 77 | }; |
78 | public enum MouseState | 78 | public enum MouseState |
79 | { | 79 | { |
80 | None, Draw, Drag, | 80 | None, Draw, Drag, |
81 | } | 81 | } |
82 | public OperationState Operation = OperationState.None; | 82 | public OperationState Operation = OperationState.None; |
83 | public MouseState mouseState = MouseState.None; | 83 | public MouseState mouseState = MouseState.None; |
84 | 84 | ||
85 | // The draw start point. | 85 | // The draw start point. |
86 | private Point StartDrawPoint; | 86 | private Point StartDrawPoint; |
87 | 87 | ||
88 | // The drag's last point. | 88 | // The drag's last point. |
89 | private Point LastPoint; | 89 | private Point LastPoint; |
90 | 90 | ||
91 | // The part of the rectangle under the mouse. | 91 | // The part of the rectangle under the mouse. |
92 | HitType MouseHitType = HitType.None; | 92 | HitType MouseHitType = HitType.None; |
93 | 93 | ||
94 | public void Init() { | 94 | public void Init() { |
95 | if (shapePosIndicator == null) | 95 | if (shapePosIndicator == null) |
96 | { | 96 | { |
97 | shapePosIndicator = new TextBlock() | 97 | shapePosIndicator = new TextBlock() |
98 | { | 98 | { |
99 | Foreground = Brushes.Black, | 99 | Foreground = Brushes.Black, |
100 | Background = Brushes.Transparent, | 100 | Background = Brushes.Transparent, |
101 | FontSize = 20, | 101 | FontSize = 20, |
102 | }; | 102 | }; |
103 | } | 103 | } |
104 | if (shapeSizeIndicator == null) | 104 | if (shapeSizeIndicator == null) |
105 | { | 105 | { |
106 | shapeSizeIndicator = new TextBlock() | 106 | shapeSizeIndicator = new TextBlock() |
107 | { | 107 | { |
108 | Foreground = Brushes.Black, | 108 | Foreground = Brushes.Black, |
109 | Background = Brushes.Transparent, | 109 | Background = Brushes.Transparent, |
110 | FontSize = 20, | 110 | FontSize = 20, |
111 | }; | 111 | }; |
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | // Return a HitType value to indicate what is at the point. | 115 | // Return a HitType value to indicate what is at the point. |
116 | private HitType SetHitType(Point point) | 116 | private HitType SetHitType(Point point) |
117 | { | 117 | { |
118 | if (shapeList.Count == 0) | 118 | if (shapeList.Count == 0) |
119 | { | 119 | { |
120 | currentShape = 0; | 120 | currentShape = 0; |
121 | return HitType.None; | 121 | return HitType.None; |
122 | } | 122 | } |
123 | for (int i = 0; i < shapeList.Count; i++) | 123 | for (int i = 0; i < shapeList.Count; i++) |
124 | { | 124 | { |
125 | Rectangle rect = shapeList[i]; | 125 | Rectangle rect = shapeList[i]; |
126 | double left = Canvas.GetLeft(rect); | 126 | double left = Canvas.GetLeft(rect); |
127 | double top = Canvas.GetTop(rect); | 127 | double top = Canvas.GetTop(rect); |
128 | double right = left + rect.Width; | 128 | double right = left + rect.Width; |
129 | double bottom = top + rect.Height; | 129 | double bottom = top + rect.Height; |
130 | if (point.X < left) continue; | 130 | if (point.X < left) continue; |
131 | if (point.X > right) continue; | 131 | if (point.X > right) continue; |
132 | if (point.Y < top) continue; | 132 | if (point.Y < top) continue; |
133 | if (point.Y > bottom) continue; | 133 | if (point.Y > bottom) continue; |
134 | currentShape = i; | 134 | currentShape = i; |
135 | 135 | ||
136 | const double GAP = 10; | 136 | const double GAP = 10; |
137 | if (point.X - left < GAP) | 137 | if (point.X - left < GAP) |
138 | { | 138 | { |
139 | // Left edge. | 139 | // Left edge. |
140 | if (point.Y - top < GAP) return HitType.UL; | 140 | if (point.Y - top < GAP) return HitType.UL; |
141 | if (bottom - point.Y < GAP) return HitType.LL; | 141 | if (bottom - point.Y < GAP) return HitType.LL; |
142 | return HitType.L; | 142 | return HitType.L; |
143 | } | 143 | } |
144 | if (right - point.X < GAP) | 144 | if (right - point.X < GAP) |
145 | { | 145 | { |
146 | // Right edge. | 146 | // Right edge. |
147 | if (point.Y - top < GAP) return HitType.UR; | 147 | if (point.Y - top < GAP) return HitType.UR; |
148 | if (bottom - point.Y < GAP) return HitType.LR; | 148 | if (bottom - point.Y < GAP) return HitType.LR; |
149 | return HitType.R; | 149 | return HitType.R; |
150 | } | 150 | } |
151 | if (point.Y - top < GAP) return HitType.T; | 151 | if (point.Y - top < GAP) return HitType.T; |
152 | if (bottom - point.Y < GAP) return HitType.B; | 152 | if (bottom - point.Y < GAP) return HitType.B; |
153 | return HitType.Body; | 153 | return HitType.Body; |
154 | } | 154 | } |
155 | currentShape = 0; | 155 | currentShape = 0; |
156 | return HitType.None; | 156 | return HitType.None; |
157 | } | 157 | } |
158 | 158 | ||
159 | // Set a mouse cursor appropriate for the current hit type. | 159 | // Set a mouse cursor appropriate for the current hit type. |
160 | private void SetMouseCursor() | 160 | private void SetMouseCursor() |
161 | { | 161 | { |
162 | // See what cursor we should display. | 162 | // See what cursor we should display. |
163 | Cursor desired_cursor = Cursors.Arrow; | 163 | Cursor desired_cursor = Cursors.Arrow; |
164 | switch (MouseHitType) | 164 | switch (MouseHitType) |
165 | { | 165 | { |
166 | case HitType.None: | 166 | case HitType.None: |
167 | desired_cursor = Cursors.Arrow; | 167 | desired_cursor = Cursors.Arrow; |
168 | break; | 168 | break; |
169 | case HitType.Body: | 169 | case HitType.Body: |
170 | desired_cursor = Cursors.ScrollAll; | 170 | desired_cursor = Cursors.ScrollAll; |
171 | break; | 171 | break; |
172 | case HitType.UL: | 172 | case HitType.UL: |
173 | case HitType.LR: | 173 | case HitType.LR: |
174 | desired_cursor = Cursors.SizeNWSE; | 174 | desired_cursor = Cursors.SizeNWSE; |
175 | break; | 175 | break; |
176 | case HitType.LL: | 176 | case HitType.LL: |
177 | case HitType.UR: | 177 | case HitType.UR: |
178 | desired_cursor = Cursors.SizeNESW; | 178 | desired_cursor = Cursors.SizeNESW; |
179 | break; | 179 | break; |
180 | case HitType.T: | 180 | case HitType.T: |
181 | case HitType.B: | 181 | case HitType.B: |
182 | desired_cursor = Cursors.SizeNS; | 182 | desired_cursor = Cursors.SizeNS; |
183 | break; | 183 | break; |
184 | case HitType.L: | 184 | case HitType.L: |
185 | case HitType.R: | 185 | case HitType.R: |
186 | desired_cursor = Cursors.SizeWE; | 186 | desired_cursor = Cursors.SizeWE; |
187 | break; | 187 | break; |
188 | } | 188 | } |
189 | 189 | ||
190 | // Display the desired cursor. | 190 | // Display the desired cursor. |
191 | if (Cursor != desired_cursor) Cursor = desired_cursor; | 191 | if (Cursor != desired_cursor) Cursor = desired_cursor; |
192 | } | 192 | } |
193 | 193 | ||
194 | // constance | 194 | // constance |
195 | int indicatorAligment = 2; | 195 | int indicatorAligment = 2; |
196 | 196 | ||
197 | /* | 197 | /* |
198 | private Point? dragStartPoint = null; | 198 | private Point? dragStartPoint = null; |
199 | 199 | ||
200 | */ | 200 | */ |
201 | public IEnumerable<DesignerItem> SelectedItems | 201 | public IEnumerable<DesignerItem> SelectedItems |
202 | { | 202 | { |
203 | get | 203 | get |
204 | { | 204 | { |
205 | var selectedItems = from item in this.Children.OfType<DesignerItem>() | 205 | var selectedItems = from item in this.Children.OfType<DesignerItem>() |
206 | where item.IsSelected == true | 206 | where item.IsSelected == true |
207 | select item; | 207 | select item; |
208 | 208 | ||
209 | return selectedItems; | 209 | return selectedItems; |
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | public void DeselectAll() | 213 | public void DeselectAll() |
214 | { | 214 | { |
215 | /* | 215 | /* |
216 | foreach (DesignerItem item in this.SelectedItems) | 216 | foreach (DesignerItem item in this.SelectedItems) |
217 | { | 217 | { |
218 | item.IsSelected = false; | 218 | item.IsSelected = false; |
219 | }*/ | 219 | }*/ |
220 | } | 220 | } |
221 | 221 | ||
222 | protected override void OnMouseDown(MouseButtonEventArgs e) | 222 | protected override void OnMouseDown(MouseButtonEventArgs e) |
223 | { | 223 | { |
224 | base.OnMouseDown(e); | 224 | base.OnMouseDown(e); |
225 | 225 | ||
226 | MouseHitType = SetHitType(Mouse.GetPosition(this)); | 226 | MouseHitType = SetHitType(Mouse.GetPosition(this)); |
227 | SetMouseCursor(); | 227 | SetMouseCursor(); |
228 | if (Operation == OperationState.DrawRoute && isStartDrawRoute) | 228 | if (Operation == OperationState.DrawRoute && isStartDrawRoute) |
229 | { | 229 | { |
230 | if (isGoalDrawRoute) | 230 | if (isGoalDrawRoute) |
231 | { | 231 | { |
232 | return; | 232 | return; |
233 | } | 233 | } |
234 | 234 | ||
235 | // Check state draw | 235 | // Check state draw |
236 | if (MouseHitType == HitType.None) | 236 | if (MouseHitType == HitType.None) |
237 | { | 237 | { |
238 | if (gGrpLine.Children.Count == 1) | 238 | if (gGrpLine.Children.Count == 1) |
239 | { | 239 | { |
240 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[0]; | 240 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[0]; |
241 | lineGeometry.EndPoint = LastPoint; | 241 | lineGeometry.EndPoint = LastPoint; |
242 | 242 | ||
243 | // Check end route | 243 | // Check end route |
244 | if (IsEndRoute(_goalPoint, lineGeometry)) | 244 | if (IsEndRoute(_goalPoint, lineGeometry)) |
245 | { | 245 | { |
246 | isGoalDrawRoute = true; | 246 | isGoalDrawRoute = true; |
247 | ProcessEndRoute(); | 247 | ProcessEndRoute(); |
248 | return; | 248 | return; |
249 | } | 249 | } |
250 | } | 250 | } |
251 | else if (IsCurverNode((LineGeometry)gGrpLine.Children[currentLine - 1] | 251 | else if (IsCurverNode((LineGeometry)gGrpLine.Children[currentLine - 1] |
252 | , (LineGeometry)gGrpLine.Children[currentLine])) | 252 | , (LineGeometry)gGrpLine.Children[currentLine])) |
253 | { | 253 | { |
254 | // Set end point to finish draw line | 254 | // Set end point to finish draw line |
255 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[currentLine]; | 255 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[currentLine]; |
256 | lineGeometry.EndPoint = LastPoint; | 256 | lineGeometry.EndPoint = LastPoint; |
257 | 257 | ||
258 | // Check end route | 258 | // Check end route |
259 | if (IsEndRoute(_goalPoint, lineGeometry)) | 259 | if (IsEndRoute(_goalPoint, lineGeometry)) |
260 | { | 260 | { |
261 | isGoalDrawRoute = true; | 261 | isGoalDrawRoute = true; |
262 | ProcessEndRoute(); | 262 | ProcessEndRoute(); |
263 | return; | 263 | return; |
264 | } | 264 | } |
265 | 265 | ||
266 | // Add node to curver postion | 266 | // Add node to curver postion |
267 | AddNode(lineGeometry.StartPoint, gGrpRedNode); | 267 | AddNode(lineGeometry.StartPoint, gGrpRedNode); |
268 | 268 | ||
269 | // Draw curver line | 269 | // Draw curver line |
270 | DrawCurver((LineGeometry)gGrpLine.Children[currentLine - 1], (LineGeometry)gGrpLine.Children[currentLine]); | 270 | DrawCurver((LineGeometry)gGrpLine.Children[currentLine - 1], (LineGeometry)gGrpLine.Children[currentLine]); |
271 | } | 271 | } |
272 | else | 272 | else |
273 | { | 273 | { |
274 | // Remove current line | 274 | // Remove current line |
275 | gGrpLine.Children.RemoveAt(currentLine); | 275 | gGrpLine.Children.RemoveAt(currentLine); |
276 | // Remove yellow node | 276 | // Remove yellow node |
277 | if (gGrpYellowNode.Children.Count > 0) | 277 | if (gGrpYellowNode.Children.Count > 0) |
278 | { | 278 | { |
279 | gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); | 279 | gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); |
280 | gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); | 280 | gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); |
281 | } | 281 | } |
282 | // Remove curver line | 282 | // Remove curver line |
283 | if (gGrpCurverLine.Children.Count > 0) | 283 | if (gGrpCurverLine.Children.Count > 0) |
284 | { | 284 | { |
285 | gGrpCurverLine.Children.RemoveAt(gGrpCurverLine.Children.Count - 1); | 285 | gGrpCurverLine.Children.RemoveAt(gGrpCurverLine.Children.Count - 1); |
286 | } | 286 | } |
287 | 287 | ||
288 | // Set end point to finish draw line | 288 | // Set end point to finish draw line |
289 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[currentLine - 1]; | 289 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[currentLine - 1]; |
290 | lineGeometry.EndPoint = LastPoint; | 290 | lineGeometry.EndPoint = LastPoint; |
291 | 291 | ||
292 | // Check end route | 292 | // Check end route |
293 | if (IsEndRoute(_goalPoint, lineGeometry)) | 293 | if (IsEndRoute(_goalPoint, lineGeometry)) |
294 | { | 294 | { |
295 | isGoalDrawRoute = true; | 295 | isGoalDrawRoute = true; |
296 | ProcessEndRoute(); | 296 | ProcessEndRoute(); |
297 | return; | 297 | return; |
298 | } | 298 | } |
299 | 299 | ||
300 | // Re-draw cuver line | 300 | // Re-draw cuver line |
301 | if (currentLine > 1) | 301 | if (currentLine > 1) |
302 | { | 302 | { |
303 | if (IsCurverNode((LineGeometry)gGrpLine.Children[currentLine - 2] | 303 | if (IsCurverNode((LineGeometry)gGrpLine.Children[currentLine - 2] |
304 | , (LineGeometry)gGrpLine.Children[currentLine - 1])) | 304 | , (LineGeometry)gGrpLine.Children[currentLine - 1])) |
305 | DrawCurver((LineGeometry)gGrpLine.Children[currentLine - 2], (LineGeometry)gGrpLine.Children[currentLine - 1]); | 305 | DrawCurver((LineGeometry)gGrpLine.Children[currentLine - 2], (LineGeometry)gGrpLine.Children[currentLine - 1]); |
306 | } | 306 | } |
307 | } | 307 | } |
308 | 308 | ||
309 | // Draw new line | 309 | // Draw new line |
310 | DrawLine(LastPoint, LastPoint, gGrpLine); | 310 | DrawLine(LastPoint, LastPoint, gGrpLine); |
311 | // Setting start point for new line | 311 | // Setting start point for new line |
312 | StartDrawPoint = LastPoint; | 312 | StartDrawPoint = LastPoint; |
313 | 313 | ||
314 | mouseState = MouseState.Draw; | 314 | mouseState = MouseState.Draw; |
315 | currentLine = gGrpLine.Children.Count - 1; | 315 | currentLine = gGrpLine.Children.Count - 1; |
316 | return; | 316 | return; |
317 | } | 317 | } |
318 | } | 318 | } |
319 | else if (Operation == OperationState.DrawSetFreeNode) | 319 | else if (Operation == OperationState.DrawSetFreeNode) |
320 | { | 320 | { |
321 | bool RightClick = false; | 321 | bool RightClick = false; |
322 | if (IsStopDrawRoute(e)) | 322 | if (IsStopDrawRoute(e)) |
323 | RightClick = true; | 323 | RightClick = true; |
324 | 324 | ||
325 | StartDrawPoint = e.MouseDevice.GetPosition(this); | 325 | StartDrawPoint = e.MouseDevice.GetPosition(this); |
326 | SetFreeNodes(StartDrawPoint, RightClick); | 326 | SetFreeNodes(StartDrawPoint, RightClick); |
327 | } | 327 | } |
328 | else if (Operation == OperationState.EditNode) | 328 | else if (Operation == OperationState.EditNode) |
329 | { | 329 | { |
330 | Point node_edited = e.MouseDevice.GetPosition(this); | 330 | Point node_edited = e.MouseDevice.GetPosition(this); |
331 | 331 | ||
332 | // start Edit Node Infor | 332 | // start Edit Node Infor |
333 | EditNode(node_edited); | 333 | EditNode(node_edited); |
334 | 334 | ||
335 | } | 335 | } |
336 | else if (Operation == OperationState.DrawObstract) | 336 | else if (Operation == OperationState.DrawObstract) |
337 | { | 337 | { |
338 | if (MouseHitType == HitType.None) | 338 | if (MouseHitType == HitType.None) |
339 | { | 339 | { |
340 | Rectangle shape = new Rectangle(); | 340 | Rectangle shape = new Rectangle(); |
341 | shape.Width = 1; | 341 | shape.Width = 1; |
342 | shape.Height = 1; | 342 | shape.Height = 1; |
343 | // Create a SolidColorBrush and use it to | 343 | // Create a SolidColorBrush and use it to |
344 | // paint the rectangle. | 344 | // paint the rectangle. |
345 | shape.Stroke = Brushes.Blue; | 345 | shape.Stroke = Brushes.Blue; |
346 | shape.StrokeThickness = 1; | 346 | shape.StrokeThickness = 1; |
347 | shape.Fill = new SolidColorBrush(Colors.LightCyan); | 347 | shape.Fill = new SolidColorBrush(Colors.LightCyan); |
348 | StartDrawPoint = e.MouseDevice.GetPosition(this); | 348 | StartDrawPoint = e.MouseDevice.GetPosition(this); |
349 | shape.SetValue(Canvas.LeftProperty, StartDrawPoint.X); | 349 | shape.SetValue(Canvas.LeftProperty, StartDrawPoint.X); |
350 | shape.SetValue(Canvas.TopProperty, StartDrawPoint.Y); | 350 | shape.SetValue(Canvas.TopProperty, StartDrawPoint.Y); |
351 | this.Children.Add(shape); | 351 | this.Children.Add(shape); |
352 | shapeList.Add(shape); | 352 | shapeList.Add(shape); |
353 | 353 | ||
354 | mouseState = MouseState.Draw; | 354 | mouseState = MouseState.Draw; |
355 | currentShape = shapeList.Count() - 1; | 355 | currentShape = shapeList.Count() - 1; |
356 | 356 | ||
357 | double shapeX = Canvas.GetLeft(shapeList[currentShape]); | 357 | double shapeX = Canvas.GetLeft(shapeList[currentShape]); |
358 | double shapeY = Canvas.GetTop(shapeList[currentShape]); | 358 | double shapeY = Canvas.GetTop(shapeList[currentShape]); |
359 | shapePosIndicator.Text = "(" + Math.Round(shapeX, 0) + "," + Math.Round(shapeY, 0) + ")"; | 359 | shapePosIndicator.Text = "(" + Math.Round(shapeX, 0) + "," + Math.Round(shapeY, 0) + ")"; |
360 | shapePosIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment); | 360 | shapePosIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment); |
361 | shapePosIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment); | 361 | shapePosIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment); |
362 | 362 | ||
363 | double width = (int)shapeList[currentShape].Width; | 363 | double width = (int)shapeList[currentShape].Width; |
364 | double height = (int)shapeList[currentShape].Height; | 364 | double height = (int)shapeList[currentShape].Height; |
365 | shapeSizeIndicator.Text = "(" + Math.Round(width, 0) + "," + Math.Round(height, 0) + ")"; | 365 | shapeSizeIndicator.Text = "(" + Math.Round(width, 0) + "," + Math.Round(height, 0) + ")"; |
366 | shapeSizeIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment + width); | 366 | shapeSizeIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment + width); |
367 | shapeSizeIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment + height); | 367 | shapeSizeIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment + height); |
368 | 368 | ||
369 | this.Children.Add(shapePosIndicator); | 369 | this.Children.Add(shapePosIndicator); |
370 | this.Children.Add(shapeSizeIndicator); | 370 | this.Children.Add(shapeSizeIndicator); |
371 | 371 | ||
372 | 372 | ||
373 | return; | 373 | return; |
374 | } | 374 | } |
375 | else | 375 | else |
376 | { | 376 | { |
377 | if (shapeList.Count() != 0) | 377 | if (shapeList.Count() != 0) |
378 | shapeList[currentShape].Fill = new SolidColorBrush(Colors.LightCyan); | 378 | shapeList[currentShape].Fill = new SolidColorBrush(Colors.LightCyan); |
379 | 379 | ||
380 | double shapeX = Canvas.GetLeft(shapeList[currentShape]); | 380 | double shapeX = Canvas.GetLeft(shapeList[currentShape]); |
381 | double shapeY = Canvas.GetTop(shapeList[currentShape]); | 381 | double shapeY = Canvas.GetTop(shapeList[currentShape]); |
382 | shapePosIndicator.Text = "(" + Math.Round(shapeX, 0) + "," + Math.Round(shapeY, 0) + ")"; | 382 | shapePosIndicator.Text = "(" + Math.Round(shapeX, 0) + "," + Math.Round(shapeY, 0) + ")"; |
383 | shapePosIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment); | 383 | shapePosIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment); |
384 | shapePosIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment); | 384 | shapePosIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment); |
385 | 385 | ||
386 | double width = (int)shapeList[currentShape].Width; | 386 | double width = (int)shapeList[currentShape].Width; |
387 | double height = (int)shapeList[currentShape].Height; | 387 | double height = (int)shapeList[currentShape].Height; |
388 | shapeSizeIndicator.Text = "(" + Math.Round(width, 0) + "," + Math.Round(height, 0) + ")"; | 388 | shapeSizeIndicator.Text = "(" + Math.Round(width, 0) + "," + Math.Round(height, 0) + ")"; |
389 | shapeSizeIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment + width); | 389 | shapeSizeIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment + width); |
390 | shapeSizeIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment + height); | 390 | shapeSizeIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment + height); |
391 | 391 | ||
392 | this.Children.Add(shapePosIndicator); | 392 | this.Children.Add(shapePosIndicator); |
393 | this.Children.Add(shapeSizeIndicator); | 393 | this.Children.Add(shapeSizeIndicator); |
394 | } | 394 | } |
395 | 395 | ||
396 | LastPoint = Mouse.GetPosition(this); | 396 | LastPoint = Mouse.GetPosition(this); |
397 | mouseState = MouseState.Drag; | 397 | mouseState = MouseState.Drag; |
398 | } | 398 | } |
399 | e.Handled = true; | 399 | e.Handled = true; |
400 | } | 400 | } |
401 | 401 | ||
402 | protected override void OnMouseMove(MouseEventArgs e) | 402 | protected override void OnMouseMove(MouseEventArgs e) |
403 | { | 403 | { |
404 | base.OnMouseMove(e); | 404 | base.OnMouseMove(e); |
405 | 405 | ||
406 | if (mouseState == MouseState.None) | 406 | if (mouseState == MouseState.None) |
407 | { | 407 | { |
408 | MouseHitType = SetHitType(Mouse.GetPosition(this)); | 408 | MouseHitType = SetHitType(Mouse.GetPosition(this)); |
409 | SetMouseCursor(); | 409 | SetMouseCursor(); |
410 | } | 410 | } |
411 | else if (Operation == OperationState.DrawRoute && isStartDrawRoute) | 411 | else if (Operation == OperationState.DrawRoute && isStartDrawRoute) |
412 | { | 412 | { |
413 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[currentLine]; | 413 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[currentLine]; |
414 | 414 | ||
415 | // See how much the mouse has moved. | 415 | // See how much the mouse has moved. |
416 | Point point = Mouse.GetPosition(this); | 416 | Point point = Mouse.GetPosition(this); |
417 | double offset_x = point.X - StartDrawPoint.X; | 417 | double offset_x = point.X - StartDrawPoint.X; |
418 | double offset_y = point.Y - StartDrawPoint.Y; | 418 | double offset_y = point.Y - StartDrawPoint.Y; |
419 | 419 | ||
420 | // Get the line's current position. | 420 | // Get the line's current position. |
421 | double new_x = lineGeometry.StartPoint.X; | 421 | double new_x = lineGeometry.StartPoint.X; |
422 | double new_y = lineGeometry.StartPoint.Y; | 422 | double new_y = lineGeometry.StartPoint.Y; |
423 | 423 | ||
424 | if (offset_x != 0 || offset_y != 0) | 424 | if (offset_x != 0 || offset_y != 0) |
425 | { | 425 | { |
426 | if (Math.Abs(offset_x) >= Math.Abs(offset_y)) | 426 | if (Math.Abs(offset_x) >= Math.Abs(offset_y)) |
427 | { | 427 | { |
428 | new_x = point.X; | 428 | new_x = point.X; |
429 | } | 429 | } |
430 | else | 430 | else |
431 | { | 431 | { |
432 | new_y = point.Y; | 432 | new_y = point.Y; |
433 | } | 433 | } |
434 | } | 434 | } |
435 | 435 | ||
436 | // Set end point of current line | 436 | // Set end point of current line |
437 | LastPoint = new Point(new_x, new_y); | 437 | LastPoint = new Point(new_x, new_y); |
438 | lineGeometry.EndPoint = LastPoint; | 438 | lineGeometry.EndPoint = LastPoint; |
439 | DisplayCoordinate(LastPoint); | 439 | DisplayCoordinate(LastPoint); |
440 | } | 440 | } |
441 | else if (Operation == OperationState.DrawObstract) | 441 | else if (Operation == OperationState.DrawObstract) |
442 | { | 442 | { |
443 | if (mouseState == MouseState.Drag) | 443 | if (mouseState == MouseState.Drag) |
444 | { | 444 | { |
445 | // See how much the mouse has moved. | 445 | // See how much the mouse has moved. |
446 | Point point = Mouse.GetPosition(this); | 446 | Point point = Mouse.GetPosition(this); |
447 | double offset_x = point.X - LastPoint.X; | 447 | double offset_x = point.X - LastPoint.X; |
448 | double offset_y = point.Y - LastPoint.Y; | 448 | double offset_y = point.Y - LastPoint.Y; |
449 | 449 | ||
450 | // Get the rectangle's current position. | 450 | // Get the rectangle's current position. |
451 | double new_x = Canvas.GetLeft(shapeList[currentShape]); | 451 | double new_x = Canvas.GetLeft(shapeList[currentShape]); |
452 | double new_y = Canvas.GetTop(shapeList[currentShape]); | 452 | double new_y = Canvas.GetTop(shapeList[currentShape]); |
453 | double new_width = shapeList[currentShape].Width; | 453 | double new_width = shapeList[currentShape].Width; |
454 | double new_height = shapeList[currentShape].Height; | 454 | double new_height = shapeList[currentShape].Height; |
455 | 455 | ||
456 | // Update the rectangle. | 456 | // Update the rectangle. |
457 | switch (MouseHitType) | 457 | switch (MouseHitType) |
458 | { | 458 | { |
459 | case HitType.Body: | 459 | case HitType.Body: |
460 | new_x += offset_x; | 460 | new_x += offset_x; |
461 | new_y += offset_y; | 461 | new_y += offset_y; |
462 | break; | 462 | break; |
463 | case HitType.UL: | 463 | case HitType.UL: |
464 | new_x += offset_x; | 464 | new_x += offset_x; |
465 | new_y += offset_y; | 465 | new_y += offset_y; |
466 | new_width -= offset_x; | 466 | new_width -= offset_x; |
467 | new_height -= offset_y; | 467 | new_height -= offset_y; |
468 | break; | 468 | break; |
469 | case HitType.UR: | 469 | case HitType.UR: |
470 | new_y += offset_y; | 470 | new_y += offset_y; |
471 | new_width += offset_x; | 471 | new_width += offset_x; |
472 | new_height -= offset_y; | 472 | new_height -= offset_y; |
473 | break; | 473 | break; |
474 | case HitType.LR: | 474 | case HitType.LR: |
475 | new_width += offset_x; | 475 | new_width += offset_x; |
476 | new_height += offset_y; | 476 | new_height += offset_y; |
477 | break; | 477 | break; |
478 | case HitType.LL: | 478 | case HitType.LL: |
479 | new_x += offset_x; | 479 | new_x += offset_x; |
480 | new_width -= offset_x; | 480 | new_width -= offset_x; |
481 | new_height += offset_y; | 481 | new_height += offset_y; |
482 | break; | 482 | break; |
483 | case HitType.L: | 483 | case HitType.L: |
484 | new_x += offset_x; | 484 | new_x += offset_x; |
485 | new_width -= offset_x; | 485 | new_width -= offset_x; |
486 | break; | 486 | break; |
487 | case HitType.R: | 487 | case HitType.R: |
488 | new_width += offset_x; | 488 | new_width += offset_x; |
489 | break; | 489 | break; |
490 | case HitType.B: | 490 | case HitType.B: |
491 | new_height += offset_y; | 491 | new_height += offset_y; |
492 | break; | 492 | break; |
493 | case HitType.T: | 493 | case HitType.T: |
494 | new_y += offset_y; | 494 | new_y += offset_y; |
495 | new_height -= offset_y; | 495 | new_height -= offset_y; |
496 | break; | 496 | break; |
497 | } | 497 | } |
498 | // Don't use negative width or height. | 498 | // Don't use negative width or height. |
499 | if ((new_width > 0) && (new_height > 0)) | 499 | if ((new_width > 0) && (new_height > 0)) |
500 | { | 500 | { |
501 | // Update the rectangle. | 501 | // Update the rectangle. |
502 | Canvas.SetLeft(shapeList[currentShape], new_x); | 502 | Canvas.SetLeft(shapeList[currentShape], new_x); |
503 | Canvas.SetTop(shapeList[currentShape], new_y); | 503 | Canvas.SetTop(shapeList[currentShape], new_y); |
504 | shapeList[currentShape].Width = new_width; | 504 | shapeList[currentShape].Width = new_width; |
505 | shapeList[currentShape].Height = new_height; | 505 | shapeList[currentShape].Height = new_height; |
506 | 506 | ||
507 | // Save the mouse's new location. | 507 | // Save the mouse's new location. |
508 | LastPoint = point; | 508 | LastPoint = point; |
509 | 509 | ||
510 | } | 510 | } |
511 | } | 511 | } |
512 | else if (mouseState == MouseState.Draw) | 512 | else if (mouseState == MouseState.Draw) |
513 | { | 513 | { |
514 | 514 | ||
515 | // See how much the mouse has moved. | 515 | // See how much the mouse has moved. |
516 | Point point = Mouse.GetPosition(this); | 516 | Point point = Mouse.GetPosition(this); |
517 | 517 | ||
518 | 518 | ||
519 | double offset_x = point.X - StartDrawPoint.X; | 519 | double offset_x = point.X - StartDrawPoint.X; |
520 | double offset_y = point.Y - StartDrawPoint.Y; | 520 | double offset_y = point.Y - StartDrawPoint.Y; |
521 | 521 | ||
522 | // Get the rectangle's current position. | 522 | // Get the rectangle's current position. |
523 | double start_x = Canvas.GetLeft(shapeList[currentShape]); | 523 | double start_x = Canvas.GetLeft(shapeList[currentShape]); |
524 | double start_y = Canvas.GetTop(shapeList[currentShape]); | 524 | double start_y = Canvas.GetTop(shapeList[currentShape]); |
525 | double new_x = Canvas.GetLeft(shapeList[currentShape]); | 525 | double new_x = Canvas.GetLeft(shapeList[currentShape]); |
526 | double new_y = Canvas.GetTop(shapeList[currentShape]); | 526 | double new_y = Canvas.GetTop(shapeList[currentShape]); |
527 | double new_width = offset_x; | 527 | double new_width = offset_x; |
528 | double new_height = offset_y; | 528 | double new_height = offset_y; |
529 | if (offset_x < 0) | 529 | if (offset_x < 0) |
530 | { | 530 | { |
531 | new_x = point.X; | 531 | new_x = point.X; |
532 | new_width = -offset_x; | 532 | new_width = -offset_x; |
533 | } | 533 | } |
534 | if (offset_y < 0) | 534 | if (offset_y < 0) |
535 | { | 535 | { |
536 | new_y = point.Y; | 536 | new_y = point.Y; |
537 | new_height = -offset_y; | 537 | new_height = -offset_y; |
538 | } | 538 | } |
539 | Canvas.SetLeft(shapeList[currentShape], new_x); | 539 | Canvas.SetLeft(shapeList[currentShape], new_x); |
540 | Canvas.SetTop(shapeList[currentShape], new_y); | 540 | Canvas.SetTop(shapeList[currentShape], new_y); |
541 | shapeList[currentShape].Width = new_width; | 541 | shapeList[currentShape].Width = new_width; |
542 | shapeList[currentShape].Height = new_height; | 542 | shapeList[currentShape].Height = new_height; |
543 | 543 | ||
544 | } | 544 | } |
545 | 545 | ||
546 | double shapeX = Canvas.GetLeft(shapeList[currentShape]); | 546 | double shapeX = Canvas.GetLeft(shapeList[currentShape]); |
547 | double shapeY = Canvas.GetTop(shapeList[currentShape]); | 547 | double shapeY = Canvas.GetTop(shapeList[currentShape]); |
548 | shapePosIndicator.Text = "(" + Math.Round(shapeX, 0) + "," + Math.Round(shapeY, 0) + ")"; | 548 | shapePosIndicator.Text = "(" + Math.Round(shapeX, 0) + "," + Math.Round(shapeY, 0) + ")"; |
549 | shapePosIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment); | 549 | shapePosIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment); |
550 | shapePosIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment); | 550 | shapePosIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment); |
551 | 551 | ||
552 | double width = (int)shapeList[currentShape].Width; | 552 | double width = (int)shapeList[currentShape].Width; |
553 | double height = (int)shapeList[currentShape].Height; | 553 | double height = (int)shapeList[currentShape].Height; |
554 | shapeSizeIndicator.Text = "(" + Math.Round(width, 0) + "," + Math.Round(height, 0) + ")"; | 554 | shapeSizeIndicator.Text = "(" + Math.Round(width, 0) + "," + Math.Round(height, 0) + ")"; |
555 | shapeSizeIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment + width); | 555 | shapeSizeIndicator.SetValue(Canvas.LeftProperty, shapeX + indicatorAligment + width); |
556 | shapeSizeIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment + height); | 556 | shapeSizeIndicator.SetValue(Canvas.TopProperty, shapeY + indicatorAligment + height); |
557 | } | 557 | } |
558 | e.Handled = true; | 558 | e.Handled = true; |
559 | } | 559 | } |
560 | 560 | ||
561 | protected override void OnMouseUp(MouseButtonEventArgs e) | 561 | protected override void OnMouseUp(MouseButtonEventArgs e) |
562 | { | 562 | { |
563 | base.OnMouseUp(e); | 563 | base.OnMouseUp(e); |
564 | if (Operation == OperationState.DrawObstract) | 564 | if (Operation == OperationState.DrawObstract) |
565 | { | 565 | { |
566 | if (shapeList.Count() != 0) | 566 | if (shapeList.Count() != 0) |
567 | shapeList[currentShape].Fill = new SolidColorBrush(Colors.Blue); | 567 | shapeList[currentShape].Fill = new SolidColorBrush(Colors.Blue); |
568 | shapePosIndicator.Text = ""; | 568 | shapePosIndicator.Text = ""; |
569 | shapeSizeIndicator.Text = ""; | 569 | shapeSizeIndicator.Text = ""; |
570 | this.Children.Remove(shapePosIndicator); | 570 | this.Children.Remove(shapePosIndicator); |
571 | this.Children.Remove(shapeSizeIndicator); | 571 | this.Children.Remove(shapeSizeIndicator); |
572 | 572 | ||
573 | mouseState = MouseState.None; | 573 | mouseState = MouseState.None; |
574 | currentShape = 0; | 574 | currentShape = 0; |
575 | } | 575 | } |
576 | e.Handled = true; | 576 | e.Handled = true; |
577 | } | 577 | } |
578 | 578 | ||
579 | /// <summary> | 579 | /// <summary> |
580 | /// On Preview Mouse Down | 580 | /// On Preview Mouse Down |
581 | /// </summary> | 581 | /// </summary> |
582 | /// <param name="e"></param> | 582 | /// <param name="e"></param> |
583 | protected override void OnPreviewMouseDown(MouseButtonEventArgs e) | 583 | protected override void OnPreviewMouseDown(MouseButtonEventArgs e) |
584 | { | 584 | { |
585 | base.OnPreviewMouseDown(e); | 585 | base.OnPreviewMouseDown(e); |
586 | if (Operation != OperationState.DrawRoute) | 586 | if (Operation != OperationState.DrawRoute) |
587 | { | 587 | { |
588 | return; | 588 | return; |
589 | } | 589 | } |
590 | 590 | ||
591 | Point currentPoint = e.MouseDevice.GetPosition(this); | 591 | Point currentPoint = e.MouseDevice.GetPosition(this); |
592 | bool _isStart = IsStartEndRoute(_startPoint, currentPoint); | 592 | bool _isStart = IsStartEndRoute(_startPoint, currentPoint); |
593 | 593 | ||
594 | if (_isStart && isStartDrawRoute == false) | 594 | if (_isStart && isStartDrawRoute == false) |
595 | { | 595 | { |
596 | double centerY = Canvas.GetTop(_startPoint); | 596 | double centerY = Canvas.GetTop(_startPoint); |
597 | double centerX = Canvas.GetLeft(_startPoint); | 597 | double centerX = Canvas.GetLeft(_startPoint); |
598 | 598 | ||
599 | isStartDrawRoute = true; | 599 | isStartDrawRoute = true; |
600 | InitDrawRoute(); | 600 | InitDrawRoute(); |
601 | DrawLine(new Point(centerX + 25, centerY + 25), new Point(centerX + 25, centerY + 25), gGrpLine); | 601 | DrawLine(new Point(centerX + 25, centerY + 25), new Point(centerX + 25, centerY + 25), gGrpLine); |
602 | mouseState = MouseState.Draw; | 602 | mouseState = MouseState.Draw; |
603 | currentLine = gGrpLine.Children.Count - 1; | 603 | currentLine = gGrpLine.Children.Count - 1; |
604 | StartDrawPoint = new Point(centerX + 25, centerY + 25); | 604 | StartDrawPoint = new Point(centerX + 25, centerY + 25); |
605 | 605 | ||
606 | this.Children.Remove(_startPoint); | 606 | this.Children.Remove(_startPoint); |
607 | this.Children.Add(_startPoint); | 607 | this.Children.Add(_startPoint); |
608 | 608 | ||
609 | return; | 609 | return; |
610 | } | 610 | } |
611 | 611 | ||
612 | bool _isgoal = IsStartEndRoute(_goalPoint, LastPoint); | 612 | bool _isgoal = IsStartEndRoute(_goalPoint, LastPoint); |
613 | if (_isgoal && isGoalDrawRoute == false) | 613 | if (_isgoal && isGoalDrawRoute == false) |
614 | { | 614 | { |
615 | isGoalDrawRoute = true; | 615 | isGoalDrawRoute = true; |
616 | ProcessEndRoute(); | 616 | ProcessEndRoute(); |
617 | } | 617 | } |
618 | } | 618 | } |
619 | 619 | ||
620 | #region Functions for draw route | 620 | #region Functions for draw route |
621 | 621 | ||
622 | /// <summary> | 622 | /// <summary> |
623 | /// Check start or end draw route | 623 | /// Check start or end draw route |
624 | /// </summary> | 624 | /// </summary> |
625 | /// <param name="_ucStartEndButton">Button start</param> | 625 | /// <param name="_ucStartEndButton">Button start</param> |
626 | /// <param name="currentPoint">Position for check</param> | 626 | /// <param name="currentPoint">Position for check</param> |
627 | /// <returns>true: start, false: not start</returns> | 627 | /// <returns>true: start, false: not start</returns> |
628 | private bool IsStartEndRoute(ucStartEndButton _ucStartEndButton, Point currentPoint) | 628 | private bool IsStartEndRoute(ucStartEndButton _ucStartEndButton, Point currentPoint) |
629 | { | 629 | { |
630 | if(_ucStartEndButton == null) | 630 | if(_ucStartEndButton == null) |
631 | { | 631 | { |
632 | return false; | 632 | return false; |
633 | } | 633 | } |
634 | 634 | ||
635 | double centerX = Canvas.GetLeft(_ucStartEndButton); | 635 | double centerX = Canvas.GetLeft(_ucStartEndButton); |
636 | double centerY = Canvas.GetTop(_ucStartEndButton); | 636 | double centerY = Canvas.GetTop(_ucStartEndButton); |
637 | 637 | ||
638 | if (currentPoint.X < centerX + 50 && currentPoint.X > centerX | 638 | if (currentPoint.X < centerX + 50 && currentPoint.X > centerX |
639 | && currentPoint.Y < centerY + 50 && currentPoint.Y > centerY) | 639 | && currentPoint.Y < centerY + 50 && currentPoint.Y > centerY) |
640 | { | 640 | { |
641 | return true; | 641 | return true; |
642 | } | 642 | } |
643 | return false; | 643 | return false; |
644 | } | 644 | } |
645 | 645 | ||
646 | /// <summary> | 646 | /// <summary> |
647 | /// Process when end draw route | 647 | /// Process when end draw route |
648 | /// </summary> | 648 | /// </summary> |
649 | private void ProcessEndRoute() | 649 | private void ProcessEndRoute() |
650 | { | 650 | { |
651 | Operation = OperationState.None; | 651 | Operation = OperationState.None; |
652 | AutoEditLine(); | 652 | AutoEditLine(); |
653 | this.Children.Remove(_displayAxiPosition); | 653 | this.Children.Remove(_displayAxiPosition); |
654 | this.Children.Remove(_goalPoint); | 654 | this.Children.Remove(_goalPoint); |
655 | this.Children.Add(_goalPoint); | 655 | this.Children.Add(_goalPoint); |
656 | } | 656 | } |
657 | 657 | ||
658 | /// <summary> | 658 | /// <summary> |
659 | /// Check end draw route | 659 | /// Check end draw route |
660 | /// </summary> | 660 | /// </summary> |
661 | /// <param name="_ucStartEndButton">Button end</param> | 661 | /// <param name="_ucStartEndButton">Button end</param> |
662 | /// <param name="currentPoint">Position for check</param> | 662 | /// <param name="currentPoint">Position for check</param> |
663 | /// <returns>true: end, false: not end</returns> | 663 | /// <returns>true: end, false: not end</returns> |
664 | private bool IsEndRoute(ucStartEndButton _ucStartEndButton, LineGeometry lineGeometry) | 664 | private bool IsEndRoute(ucStartEndButton _ucStartEndButton, LineGeometry lineGeometry) |
665 | { | 665 | { |
666 | if (_ucStartEndButton == null) | 666 | if (_ucStartEndButton == null) |
667 | { | 667 | { |
668 | return false; | 668 | return false; |
669 | } | 669 | } |
670 | 670 | ||
671 | double centerX = Canvas.GetLeft(_ucStartEndButton); | 671 | double centerX = Canvas.GetLeft(_ucStartEndButton); |
672 | double centerY = Canvas.GetTop(_ucStartEndButton); | 672 | double centerY = Canvas.GetTop(_ucStartEndButton); |
673 | Point startPoint = lineGeometry.StartPoint; | 673 | Point startPoint = lineGeometry.StartPoint; |
674 | Point endPoint = lineGeometry.EndPoint; | 674 | Point endPoint = lineGeometry.EndPoint; |
675 | 675 | ||
676 | if(IsVerticalLine(lineGeometry)) | 676 | if(IsVerticalLine(lineGeometry)) |
677 | { | 677 | { |
678 | if(endPoint.X < centerX || endPoint.X > centerX + 50) | 678 | if(endPoint.X < centerX || endPoint.X > centerX + 50) |
679 | return false; | 679 | return false; |
680 | 680 | ||
681 | if (startPoint.Y > centerY + 50 && endPoint.Y > centerY + 50) | 681 | if (startPoint.Y > centerY + 50 && endPoint.Y > centerY + 50) |
682 | return false; | 682 | return false; |
683 | 683 | ||
684 | if (startPoint.Y < centerY && endPoint.Y < centerY) | 684 | if (startPoint.Y < centerY && endPoint.Y < centerY) |
685 | return false; | 685 | return false; |
686 | }else | 686 | }else |
687 | { | 687 | { |
688 | if (endPoint.Y < centerY || endPoint.Y > centerY + 50) | 688 | if (endPoint.Y < centerY || endPoint.Y > centerY + 50) |
689 | return false; | 689 | return false; |
690 | 690 | ||
691 | if (startPoint.X > centerX + 50 && endPoint.X > centerX + 50) | 691 | if (startPoint.X > centerX + 50 && endPoint.X > centerX + 50) |
692 | return false; | 692 | return false; |
693 | 693 | ||
694 | if (startPoint.X < centerX && endPoint.X < centerX) | 694 | if (startPoint.X < centerX && endPoint.X < centerX) |
695 | return false; | 695 | return false; |
696 | } | 696 | } |
697 | 697 | ||
698 | return true; | 698 | return true; |
699 | } | 699 | } |
700 | 700 | ||
701 | /// <summary> | 701 | /// <summary> |
702 | /// Make root | 702 | /// Make root |
703 | /// </summary> | 703 | /// </summary> |
704 | public void MakeRoot() | 704 | public void MakeRoot() |
705 | { | 705 | { |
706 | LineGeometry lineGeometry; | 706 | //LineGeometry lineGeometry; |
707 | EllipseGeometry ellipseGeometry; | 707 | //EllipseGeometry ellipseGeometry; |
708 | Point startPoint; | 708 | //Point startPoint; |
709 | Point endPoint; | 709 | //Point endPoint; |
710 | 710 | ||
711 | // If still not route | 711 | // If still not route |
712 | if (gGrpLine.Children.Count == 0) | 712 | if (gGrpLine.Children.Count == 0) |
713 | return; | 713 | return; |
714 | 714 | ||
715 | // Setting for path line | 715 | pLine.Stroke = new SolidColorBrush(Colors.Red); |
716 | pRootLine.Stroke = new SolidColorBrush(Colors.Red); | 716 | pLine.StrokeThickness = STROKE_ROOT_LINE; |
717 | pRootLine.StrokeThickness = STROKE_ROOT_LINE; | ||
718 | pRootLine.Data = gGrpRootLine; | ||
719 | this.Children.Add(pRootLine); | ||
720 | 717 | ||
718 | //// Setting for path line | ||
719 | //pRootLine.Stroke = new SolidColorBrush(Colors.Red); | ||
720 | //pRootLine.StrokeThickness = STROKE_ROOT_LINE; | ||
721 | //pRootLine.Data = gGrpRootLine; | ||
722 | //this.Children.Add(pRootLine); | ||
723 | |||
721 | // Setting for path curver line | 724 | // Setting for path curver line |
722 | pCurverLine.StrokeThickness = STROKE_ROOT_LINE; | 725 | //pCurverLine.StrokeThickness = STROKE_ROOT_LINE; |
723 | 726 | ||
724 | // Get start point | 727 | //// Get start point |
725 | lineGeometry = (LineGeometry)gGrpLine.Children[0]; | 728 | //lineGeometry = (LineGeometry)gGrpLine.Children[0]; |
726 | startPoint = lineGeometry.StartPoint; | 729 | //startPoint = lineGeometry.StartPoint; |
727 | 730 | ||
728 | for (int i = 0; i < gGrpYellowNode.Children.Count; i = i + 2) | 731 | //for (int i = 0; i < gGrpYellowNode.Children.Count; i = i + 2) |
729 | { | 732 | //{ |
730 | ellipseGeometry = (EllipseGeometry)gGrpYellowNode.Children[i]; | 733 | // ellipseGeometry = (EllipseGeometry)gGrpYellowNode.Children[i]; |
731 | endPoint = ellipseGeometry.Center; | 734 | // endPoint = ellipseGeometry.Center; |
732 | 735 | ||
733 | DrawLine(startPoint, endPoint, gGrpRootLine); | 736 | // DrawLine(startPoint, endPoint, gGrpRootLine); |
734 | 737 | ||
735 | ellipseGeometry = (EllipseGeometry)gGrpYellowNode.Children[i + 1]; | 738 | // ellipseGeometry = (EllipseGeometry)gGrpYellowNode.Children[i + 1]; |
736 | startPoint = ellipseGeometry.Center; | 739 | // startPoint = ellipseGeometry.Center; |
737 | } | 740 | //} |
738 | 741 | ||
739 | lineGeometry = (LineGeometry)gGrpLine.Children[gGrpLine.Children.Count - 1]; | 742 | //lineGeometry = (LineGeometry)gGrpLine.Children[gGrpLine.Children.Count - 1]; |
740 | endPoint = lineGeometry.EndPoint; | 743 | //endPoint = lineGeometry.EndPoint; |
741 | 744 | ||
742 | DrawLine(startPoint, endPoint, gGrpRootLine); | 745 | //DrawLine(startPoint, endPoint, gGrpRootLine); |
743 | 746 | ||
744 | this.Children.Remove(pYellowNode); | 747 | //this.Children.Remove(pYellowNode); |
745 | this.Children.Remove(pBlueNode); | 748 | //this.Children.Remove(pBlueNode); |
746 | this.Children.Remove(_startPoint); | 749 | //this.Children.Remove(_startPoint); |
747 | this.Children.Remove(_goalPoint); | 750 | //this.Children.Remove(_goalPoint); |
748 | this.Children.Add(pYellowNode); | 751 | //this.Children.Add(pYellowNode); |
749 | this.Children.Add(pBlueNode); | 752 | //this.Children.Add(pBlueNode); |
750 | this.Children.Add(_startPoint); | 753 | //this.Children.Add(_startPoint); |
751 | this.Children.Add(_goalPoint); | 754 | //this.Children.Add(_goalPoint); |
752 | } | 755 | } |
753 | 756 | ||
754 | /// <summary> | 757 | /// <summary> |
755 | /// Auto edit leght of line | 758 | /// Auto edit leght of line |
756 | /// </summary> | 759 | /// </summary> |
757 | private void AutoEditLine() | 760 | private void AutoEditLine() |
758 | { | 761 | { |
759 | double temp; | 762 | double temp; |
760 | int index = gGrpLine.Children.Count - 1; | 763 | int index = gGrpLine.Children.Count - 1; |
761 | double centerY = Canvas.GetTop(_goalPoint) + 25; | 764 | double centerY = Canvas.GetTop(_goalPoint) + 25; |
762 | double centerX = Canvas.GetLeft(_goalPoint) + 25; | 765 | double centerX = Canvas.GetLeft(_goalPoint) + 25; |
763 | LineGeometry lastLine = (LineGeometry)gGrpLine.Children[index]; | 766 | LineGeometry lastLine = (LineGeometry)gGrpLine.Children[index]; |
764 | LineGeometry beforeLastLine = (LineGeometry)gGrpLine.Children[index]; | 767 | LineGeometry beforeLastLine = (LineGeometry)gGrpLine.Children[index]; |
765 | 768 | ||
766 | if(gGrpLine.Children.Count > 1) | 769 | if(gGrpLine.Children.Count > 1) |
767 | { | 770 | { |
768 | beforeLastLine = (LineGeometry)gGrpLine.Children[index - 1]; | 771 | beforeLastLine = (LineGeometry)gGrpLine.Children[index - 1]; |
769 | 772 | ||
770 | if (!IsCurverNode(beforeLastLine, lastLine)) | 773 | if (!IsCurverNode(beforeLastLine, lastLine)) |
771 | { | 774 | { |
772 | beforeLastLine.EndPoint = lastLine.EndPoint; | 775 | beforeLastLine.EndPoint = lastLine.EndPoint; |
773 | gGrpLine.Children.RemoveAt(index); | 776 | gGrpLine.Children.RemoveAt(index); |
774 | // Remove yellow node | 777 | // Remove yellow node |
775 | if (gGrpYellowNode.Children.Count > 0) | 778 | if (gGrpYellowNode.Children.Count > 0) |
776 | { | 779 | { |
777 | gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); | 780 | gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); |
778 | gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); | 781 | gGrpYellowNode.Children.RemoveAt(gGrpYellowNode.Children.Count - 1); |
779 | } | 782 | } |
780 | // Remove curver line | 783 | // Remove curver line |
781 | if (gGrpCurverLine.Children.Count > 0) | 784 | if (gGrpCurverLine.Children.Count > 0) |
782 | { | 785 | { |
783 | gGrpCurverLine.Children.RemoveAt(gGrpCurverLine.Children.Count - 1); | 786 | gGrpCurverLine.Children.RemoveAt(gGrpCurverLine.Children.Count - 1); |
784 | } | 787 | } |
785 | index = index - 1; | 788 | index = index - 1; |
786 | lastLine = (LineGeometry)gGrpLine.Children[index]; | 789 | lastLine = (LineGeometry)gGrpLine.Children[index]; |
787 | } | 790 | } |
788 | } | 791 | } |
789 | 792 | ||
790 | if (lastLine.EndPoint.X == centerX && lastLine.EndPoint.Y == centerY) | 793 | if (lastLine.EndPoint.X == centerX && lastLine.EndPoint.Y == centerY) |
791 | return; | 794 | return; |
792 | 795 | ||
793 | if(IsVerticalLine(lastLine)) | 796 | if(IsVerticalLine(lastLine)) |
794 | { | 797 | { |
795 | temp = lastLine.StartPoint.Y; | 798 | temp = lastLine.StartPoint.Y; |
796 | lastLine.StartPoint = new Point(centerX, temp); | 799 | lastLine.StartPoint = new Point(centerX, temp); |
797 | lastLine.EndPoint = new Point(centerX, centerY); | 800 | lastLine.EndPoint = new Point(centerX, centerY); |
798 | 801 | ||
799 | if(gGrpLine.Children.Count > 1){ | 802 | if(gGrpLine.Children.Count > 1){ |
800 | beforeLastLine = (LineGeometry)gGrpLine.Children[index - 1]; | 803 | beforeLastLine = (LineGeometry)gGrpLine.Children[index - 1]; |
801 | temp = beforeLastLine.EndPoint.Y; | 804 | temp = beforeLastLine.EndPoint.Y; |
802 | beforeLastLine.EndPoint = new Point(centerX, temp); | 805 | beforeLastLine.EndPoint = new Point(centerX, temp); |
803 | } | 806 | } |
804 | }else | 807 | }else |
805 | { | 808 | { |
806 | temp = lastLine.StartPoint.X; | 809 | temp = lastLine.StartPoint.X; |
807 | lastLine.StartPoint = new Point(temp, centerY); | 810 | lastLine.StartPoint = new Point(temp, centerY); |
808 | lastLine.EndPoint = new Point(centerX, centerY); | 811 | lastLine.EndPoint = new Point(centerX, centerY); |
809 | if (gGrpLine.Children.Count > 1) | 812 | if (gGrpLine.Children.Count > 1) |
810 | { | 813 | { |
811 | beforeLastLine = (LineGeometry)gGrpLine.Children[index - 1]; | 814 | beforeLastLine = (LineGeometry)gGrpLine.Children[index - 1]; |
812 | temp = beforeLastLine.EndPoint.X; | 815 | temp = beforeLastLine.EndPoint.X; |
813 | beforeLastLine.EndPoint = new Point(temp, centerY); | 816 | beforeLastLine.EndPoint = new Point(temp, centerY); |
814 | } | 817 | } |
815 | } | 818 | } |
816 | 819 | ||
817 | // Draw curver line | 820 | // Draw curver line |
818 | if (IsCurverNode(beforeLastLine, lastLine)) | 821 | if (IsCurverNode(beforeLastLine, lastLine)) |
819 | { | 822 | { |
820 | AddNode(beforeLastLine.EndPoint, gGrpRedNode); | 823 | AddNode(beforeLastLine.EndPoint, gGrpRedNode); |
821 | if (GetDistance(lastLine.StartPoint, lastLine.EndPoint) > RADIUS_CURVER_LINE + 25) | 824 | if (GetDistance(lastLine.StartPoint, lastLine.EndPoint) > RADIUS_CURVER_LINE + 25) |
822 | { | 825 | { |
823 | DrawCurver(beforeLastLine, lastLine); | 826 | DrawCurver(beforeLastLine, lastLine); |
824 | } | 827 | } |
825 | } | 828 | } |
826 | } | 829 | } |
827 | 830 | ||
828 | /// <summary> | 831 | /// <summary> |
829 | /// Check draw curver node | 832 | /// Check draw curver node |
830 | /// </summary> | 833 | /// </summary> |
831 | /// <param name="oldLine">Old line</param> | 834 | /// <param name="oldLine">Old line</param> |
832 | /// <param name="newLine">New line</param> | 835 | /// <param name="newLine">New line</param> |
833 | /// <returns>true:is curver, fasle: not curver</returns> | 836 | /// <returns>true:is curver, fasle: not curver</returns> |
834 | private bool IsCurverNode(LineGeometry oldLine, LineGeometry newLine) | 837 | private bool IsCurverNode(LineGeometry oldLine, LineGeometry newLine) |
835 | { | 838 | { |
836 | if (oldLine.StartPoint.Y == oldLine.EndPoint.Y && oldLine.StartPoint.Y == newLine.EndPoint.Y) | 839 | if (oldLine.StartPoint.Y == oldLine.EndPoint.Y && oldLine.StartPoint.Y == newLine.EndPoint.Y) |
837 | { | 840 | { |
838 | return false; | 841 | return false; |
839 | } | 842 | } |
840 | 843 | ||
841 | if (oldLine.StartPoint.X == oldLine.EndPoint.X && oldLine.StartPoint.X == newLine.EndPoint.X) | 844 | if (oldLine.StartPoint.X == oldLine.EndPoint.X && oldLine.StartPoint.X == newLine.EndPoint.X) |
842 | { | 845 | { |
843 | return false; | 846 | return false; |
844 | } | 847 | } |
845 | 848 | ||
846 | return true; | 849 | return true; |
847 | } | 850 | } |
848 | 851 | ||
849 | /// <summary> | 852 | /// <summary> |
850 | /// Check timming to stop draw route | 853 | /// Check timming to stop draw route |
851 | /// </summary> | 854 | /// </summary> |
852 | /// <param name="e"></param> | 855 | /// <param name="e"></param> |
853 | /// <returns>true:stop; false:continue</returns> | 856 | /// <returns>true:stop; false:continue</returns> |
854 | private bool IsStopDrawRoute(MouseEventArgs e) | 857 | private bool IsStopDrawRoute(MouseEventArgs e) |
855 | { | 858 | { |
856 | if(e.RightButton == MouseButtonState.Pressed) | 859 | if(e.RightButton == MouseButtonState.Pressed) |
857 | { | 860 | { |
858 | return true; | 861 | return true; |
859 | } | 862 | } |
860 | 863 | ||
861 | return false; | 864 | return false; |
862 | } | 865 | } |
863 | 866 | ||
864 | /// <summary> | 867 | /// <summary> |
865 | /// Draw curver line and yellow node | 868 | /// Draw curver line and yellow node |
866 | /// </summary> | 869 | /// </summary> |
867 | /// <param name="oldLine">Old line</param> | 870 | /// <param name="oldLine">Old line</param> |
868 | /// <param name="newLine">New line</param> | 871 | /// <param name="newLine">New line</param> |
869 | private void DrawCurver(LineGeometry oldLine, LineGeometry newLine) | 872 | private void DrawCurver(LineGeometry oldLine, LineGeometry newLine) |
870 | { | 873 | { |
871 | double radius = RADIUS_CURVER_LINE; | 874 | double radius = RADIUS_CURVER_LINE; |
872 | 875 | ||
873 | Point startPoint ; | 876 | Point startPoint ; |
874 | Point endPoint ; | 877 | Point endPoint ; |
875 | 878 | ||
876 | // Get postion of yellow node on old line | 879 | // Get postion of yellow node on old line |
877 | if(IsVerticalLine(oldLine)) | 880 | if(IsVerticalLine(oldLine)) |
878 | { | 881 | { |
879 | if (oldLine.StartPoint.Y > oldLine.EndPoint.Y) | 882 | if (oldLine.StartPoint.Y > oldLine.EndPoint.Y) |
880 | startPoint = new Point(oldLine.EndPoint.X, oldLine.EndPoint.Y + radius); | 883 | startPoint = new Point(oldLine.EndPoint.X, oldLine.EndPoint.Y + radius); |
881 | else | 884 | else |
882 | startPoint = new Point(oldLine.EndPoint.X, oldLine.EndPoint.Y - radius); | 885 | startPoint = new Point(oldLine.EndPoint.X, oldLine.EndPoint.Y - radius); |
883 | }else | 886 | }else |
884 | { | 887 | { |
885 | if (oldLine.StartPoint.X > oldLine.EndPoint.X) | 888 | if (oldLine.StartPoint.X > oldLine.EndPoint.X) |
886 | startPoint = new Point(oldLine.EndPoint.X + radius, oldLine.EndPoint.Y); | 889 | startPoint = new Point(oldLine.EndPoint.X + radius, oldLine.EndPoint.Y); |
887 | else | 890 | else |
888 | startPoint = new Point(oldLine.EndPoint.X - radius, oldLine.EndPoint.Y); | 891 | startPoint = new Point(oldLine.EndPoint.X - radius, oldLine.EndPoint.Y); |
889 | } | 892 | } |
890 | 893 | ||
891 | // Get postion of yellow node on new line | 894 | // Get postion of yellow node on new line |
892 | if (IsVerticalLine(newLine)) | 895 | if (IsVerticalLine(newLine)) |
893 | { | 896 | { |
894 | if (newLine.StartPoint.Y > newLine.EndPoint.Y) | 897 | if (newLine.StartPoint.Y > newLine.EndPoint.Y) |
895 | endPoint = new Point(newLine.StartPoint.X, newLine.StartPoint.Y - radius); | 898 | endPoint = new Point(newLine.StartPoint.X, newLine.StartPoint.Y - radius); |
896 | else | 899 | else |
897 | endPoint = new Point(newLine.StartPoint.X, newLine.StartPoint.Y + radius); | 900 | endPoint = new Point(newLine.StartPoint.X, newLine.StartPoint.Y + radius); |
898 | } | 901 | } |
899 | else | 902 | else |
900 | { | 903 | { |
901 | if (newLine.StartPoint.X > newLine.EndPoint.X) | 904 | if (newLine.StartPoint.X > newLine.EndPoint.X) |
902 | endPoint = new Point(newLine.StartPoint.X - radius, newLine.StartPoint.Y); | 905 | endPoint = new Point(newLine.StartPoint.X - radius, newLine.StartPoint.Y); |
903 | else | 906 | else |
904 | endPoint = new Point(newLine.StartPoint.X + radius, newLine.StartPoint.Y); | 907 | endPoint = new Point(newLine.StartPoint.X + radius, newLine.StartPoint.Y); |
905 | } | 908 | } |
906 | 909 | ||
907 | // Setting sweep direction | 910 | //// Setting sweep direction |
908 | SweepDirection sweepDirection = SweepDirection.Clockwise; | 911 | //SweepDirection sweepDirection = SweepDirection.Clockwise; |
909 | if (IsVerticalLine(oldLine) && ((startPoint.Y - endPoint.Y) * (startPoint.X - endPoint.X)) > 0) | 912 | //if (IsVerticalLine(oldLine) && ((startPoint.Y - endPoint.Y) * (startPoint.X - endPoint.X)) > 0) |
910 | { | 913 | //{ |
911 | sweepDirection = SweepDirection.Counterclockwise; | 914 | // sweepDirection = SweepDirection.Counterclockwise; |
912 | } | 915 | //} |
913 | 916 | ||
914 | if (!IsVerticalLine(oldLine) && ((startPoint.Y - endPoint.Y) * (startPoint.X - endPoint.X)) < 0) | 917 | //if (!IsVerticalLine(oldLine) && ((startPoint.Y - endPoint.Y) * (startPoint.X - endPoint.X)) < 0) |
915 | { | 918 | //{ |
916 | sweepDirection = SweepDirection.Counterclockwise; | 919 | // sweepDirection = SweepDirection.Counterclockwise; |
917 | } | 920 | //} |
918 | 921 | ||
919 | // Add curver line | 922 | //// Add curver line |
920 | DrawCurverLine(startPoint, endPoint, sweepDirection, gGrpCurverLine); | 923 | //DrawCurverLine(startPoint, endPoint, sweepDirection, gGrpCurverLine); |
921 | 924 | ||
922 | // Add node to postion distance 1300mm | 925 | // Add node to postion distance 1300mm |
923 | AddNode(startPoint, gGrpYellowNode); | 926 | AddNode(startPoint, gGrpYellowNode); |
924 | AddNode(endPoint, gGrpYellowNode); | 927 | AddNode(endPoint, gGrpYellowNode); |
925 | } | 928 | } |
926 | 929 | ||
927 | /// <summary> | 930 | /// <summary> |
928 | /// Init data for draw route | 931 | /// Init data for draw route |
929 | /// </summary> | 932 | /// </summary> |
930 | private void InitDrawRoute() | 933 | private void InitDrawRoute() |
931 | { | 934 | { |
932 | // Setting for path line | 935 | // Setting for path line |
933 | pLine.Stroke = new SolidColorBrush(Colors.Blue); | 936 | pLine.Stroke = new SolidColorBrush(Colors.Blue); |
934 | pLine.StrokeThickness = STROKE_LINE; | 937 | pLine.StrokeThickness = STROKE_LINE; |
935 | pLine.Data = gGrpLine; | 938 | pLine.Data = gGrpLine; |
936 | 939 | ||
937 | // Setting for path of curver line | 940 | // Setting for path of curver line |
938 | pCurverLine.Stroke = Brushes.Red; | 941 | pCurverLine.Stroke = Brushes.Red; |
939 | pCurverLine.StrokeThickness = STROKE_LINE; | 942 | pCurverLine.StrokeThickness = STROKE_LINE; |
940 | pCurverLine.Data = gGrpCurverLine; | 943 | pCurverLine.Data = gGrpCurverLine; |
941 | 944 | ||
942 | // Setting for path of red node | 945 | // Setting for path of red node |
943 | pRedNode.Stroke = new SolidColorBrush(Colors.Blue); | 946 | pRedNode.Stroke = new SolidColorBrush(Colors.Blue); |
944 | pRedNode.Fill = new SolidColorBrush(Colors.Red); | 947 | pRedNode.Fill = new SolidColorBrush(Colors.Red); |
945 | pRedNode.StrokeThickness = STROKE_NODE; | 948 | pRedNode.StrokeThickness = STROKE_NODE; |
946 | pRedNode.Data = gGrpRedNode; | 949 | pRedNode.Data = gGrpRedNode; |
947 | 950 | ||
948 | // Setting for path of yellow node | 951 | // Setting for path of yellow node |
949 | pYellowNode.Stroke = new SolidColorBrush(Colors.Blue); | 952 | pYellowNode.Stroke = new SolidColorBrush(Colors.Blue); |
950 | pYellowNode.Fill = new SolidColorBrush(Colors.Yellow); | 953 | pYellowNode.Fill = new SolidColorBrush(Colors.Yellow); |
951 | pYellowNode.StrokeThickness = STROKE_NODE; | 954 | pYellowNode.StrokeThickness = STROKE_NODE; |
952 | pYellowNode.Data = gGrpYellowNode; | 955 | pYellowNode.Data = gGrpYellowNode; |
953 | 956 | ||
954 | // Setting for path of Blue node | 957 | // Setting for path of Blue node |
955 | pBlueNode.Stroke = new SolidColorBrush(Colors.Blue); | 958 | pBlueNode.Stroke = new SolidColorBrush(Colors.Blue); |
956 | pBlueNode.Fill = new SolidColorBrush(Colors.LightBlue); | 959 | pBlueNode.Fill = new SolidColorBrush(Colors.LightBlue); |
957 | pBlueNode.StrokeThickness = STROKE_NODE; | 960 | pBlueNode.StrokeThickness = STROKE_NODE; |
958 | pBlueNode.Data = gGrpBlueNode; | 961 | pBlueNode.Data = gGrpBlueNode; |
959 | 962 | ||
960 | // Setting for path of Free node | 963 | // Setting for path of Free node |
961 | //pFreeNode.Stroke = new SolidColorBrush(Colors.Blue); | 964 | //pFreeNode.Stroke = new SolidColorBrush(Colors.Blue); |
962 | //pFreeNode.Fill = new SolidColorBrush(Colors.LightBlue); | 965 | //pFreeNode.Fill = new SolidColorBrush(Colors.LightBlue); |
963 | //pFreeNode.StrokeThickness = STROKE_NODE; | 966 | //pFreeNode.StrokeThickness = STROKE_NODE; |
964 | //pFreeNode.Data = gGrpFreeNode; | 967 | //pFreeNode.Data = gGrpFreeNode; |
965 | 968 | ||
966 | // Add paths to canvas | 969 | // Add paths to canvas |
967 | this.Children.Add(pLine); | 970 | this.Children.Add(pLine); |
968 | this.Children.Add(pCurverLine); | 971 | this.Children.Add(pCurverLine); |
969 | this.Children.Add(pRedNode); | 972 | this.Children.Add(pRedNode); |
970 | this.Children.Add(pYellowNode); | 973 | this.Children.Add(pYellowNode); |
971 | this.Children.Add(pBlueNode); | 974 | this.Children.Add(pBlueNode); |
972 | } | 975 | } |
973 | 976 | ||
974 | /// <summary> | 977 | /// <summary> |
975 | /// Clear all route | 978 | /// Clear all route |
976 | /// </summary> | 979 | /// </summary> |
977 | public void ClearRoute() | 980 | public void ClearRoute() |
978 | { | 981 | { |
979 | isStartDrawRoute = false; | 982 | isStartDrawRoute = false; |
980 | isGoalDrawRoute = false; | 983 | isGoalDrawRoute = false; |
981 | 984 | ||
982 | gGrpLine.Children.Clear(); | 985 | gGrpLine.Children.Clear(); |
983 | gGrpRootLine.Children.Clear(); | 986 | gGrpRootLine.Children.Clear(); |
984 | gGrpCurverLine.Children.Clear(); | 987 | gGrpCurverLine.Children.Clear(); |
985 | gGrpRedNode.Children.Clear(); | 988 | gGrpRedNode.Children.Clear(); |
986 | gGrpYellowNode.Children.Clear(); | 989 | gGrpYellowNode.Children.Clear(); |
987 | gGrpBlueNode.Children.Clear(); | 990 | gGrpBlueNode.Children.Clear(); |
988 | 991 | ||
989 | this.Children.Remove(pLine); | 992 | this.Children.Remove(pLine); |
990 | this.Children.Remove(pRootLine); | 993 | this.Children.Remove(pRootLine); |
991 | this.Children.Remove(pCurverLine); | 994 | this.Children.Remove(pCurverLine); |
992 | this.Children.Remove(pRedNode); | 995 | this.Children.Remove(pRedNode); |
993 | this.Children.Remove(pYellowNode); | 996 | this.Children.Remove(pYellowNode); |
994 | this.Children.Remove(pBlueNode); | 997 | this.Children.Remove(pBlueNode); |
995 | } | 998 | } |
996 | 999 | ||
997 | /// <summary> | 1000 | /// <summary> |
998 | /// Draw line for route | 1001 | /// Draw line for route |
999 | /// </summary> | 1002 | /// </summary> |
1000 | /// <param name="startPoint">Start point</param> | 1003 | /// <param name="startPoint">Start point</param> |
1001 | /// <param name="endPoint">End point</param> | 1004 | /// <param name="endPoint">End point</param> |
1002 | /// <param name="geometryGroup">Geometry Group</param> | 1005 | /// <param name="geometryGroup">Geometry Group</param> |
1003 | private void DrawLine(Point startPoint, Point endPoint, GeometryGroup geometryGroup) | 1006 | private void DrawLine(Point startPoint, Point endPoint, GeometryGroup geometryGroup) |
1004 | { | 1007 | { |
1005 | LineGeometry lineGeometry = new LineGeometry(); | 1008 | LineGeometry lineGeometry = new LineGeometry(); |
1006 | lineGeometry.StartPoint = startPoint; | 1009 | lineGeometry.StartPoint = startPoint; |
1007 | lineGeometry.EndPoint = endPoint; | 1010 | lineGeometry.EndPoint = endPoint; |
1008 | geometryGroup.Children.Add(lineGeometry); | 1011 | geometryGroup.Children.Add(lineGeometry); |
1009 | } | 1012 | } |
1010 | 1013 | ||
1011 | /// <summary> | 1014 | /// <summary> |
1012 | /// Draw curver line | 1015 | /// Draw curver line |
1013 | /// </summary> | 1016 | /// </summary> |
1014 | /// <param name="startPoint">Point start curver line</param> | 1017 | /// <param name="startPoint">Point start curver line</param> |
1015 | /// <param name="endPoint">Point end curver line</param> | 1018 | /// <param name="endPoint">Point end curver line</param> |
1016 | /// <param name="radius">Radius</param> | 1019 | /// <param name="radius">Radius</param> |
1017 | /// <param name="geometryGroup">Geometry Group</param> | 1020 | /// <param name="geometryGroup">Geometry Group</param> |
1018 | private void DrawCurverLine(Point startPoint, Point endPoint, SweepDirection sweepDirection, GeometryGroup geometryGroup) | 1021 | private void DrawCurverLine(Point startPoint, Point endPoint, SweepDirection sweepDirection, GeometryGroup geometryGroup) |
1019 | { | 1022 | { |
1020 | PathGeometry pathGeometry = new PathGeometry(); | 1023 | PathGeometry pathGeometry = new PathGeometry(); |
1021 | PathFigure figure = new PathFigure(); | 1024 | PathFigure figure = new PathFigure(); |
1022 | figure.StartPoint = startPoint; | 1025 | figure.StartPoint = startPoint; |
1023 | figure.Segments.Add(new ArcSegment(endPoint, new Size(RADIUS_CURVER_LINE, RADIUS_CURVER_LINE), 90, false, sweepDirection, true)); | 1026 | figure.Segments.Add(new ArcSegment(endPoint, new Size(RADIUS_CURVER_LINE, RADIUS_CURVER_LINE), 90, false, sweepDirection, true)); |
1024 | pathGeometry.Figures.Add(figure); | 1027 | pathGeometry.Figures.Add(figure); |
1025 | geometryGroup.Children.Add(pathGeometry); | 1028 | geometryGroup.Children.Add(pathGeometry); |
1026 | } | 1029 | } |
1027 | 1030 | ||
1028 | /// <summary> | 1031 | /// <summary> |
1029 | /// Setting node | 1032 | /// Setting node |
1030 | /// </summary> | 1033 | /// </summary> |
1031 | /// <param name="centerPoit">Position of center node</param> | 1034 | /// <param name="centerPoit">Position of center node</param> |
1032 | /// <param name="geometryGroup">Geometry Group</param> | 1035 | /// <param name="geometryGroup">Geometry Group</param> |
1033 | private void AddNode(Point centerPoit, GeometryGroup geometryGroup) | 1036 | private void AddNode(Point centerPoit, GeometryGroup geometryGroup) |
1034 | { | 1037 | { |
1035 | double radius = RADIUS_NODE; | 1038 | double radius = RADIUS_NODE; |
1036 | geometryGroup.Children.Add(new EllipseGeometry(centerPoit, radius, radius)); | 1039 | geometryGroup.Children.Add(new EllipseGeometry(centerPoit, radius, radius)); |
1037 | } | 1040 | } |
1038 | 1041 | ||
1039 | /// <summary> | 1042 | /// <summary> |
1040 | /// Check line is vertical or horizontal | 1043 | /// Check line is vertical or horizontal |
1041 | /// </summary> | 1044 | /// </summary> |
1042 | /// <param name="line"></param> | 1045 | /// <param name="line"></param> |
1043 | /// <returns>true:Vertical, false:Horizontal</returns> | 1046 | /// <returns>true:Vertical, false:Horizontal</returns> |
1044 | private bool IsVerticalLine(LineGeometry line) | 1047 | private bool IsVerticalLine(LineGeometry line) |
1045 | { | 1048 | { |
1046 | if (line.StartPoint.X == line.EndPoint.X) | 1049 | if (line.StartPoint.X == line.EndPoint.X) |
1047 | { | 1050 | { |
1048 | // Vertical line | 1051 | // Vertical line |
1049 | return true; | 1052 | return true; |
1050 | } | 1053 | } |
1051 | 1054 | ||
1052 | // Horizontal line | 1055 | // Horizontal line |
1053 | return false; | 1056 | return false; |
1054 | } | 1057 | } |
1055 | 1058 | ||
1056 | /// <summary> | 1059 | /// <summary> |
1057 | /// Get distance between two point | 1060 | /// Get distance between two point |
1058 | /// </summary> | 1061 | /// </summary> |
1059 | /// <param name="point1">Point 1</param> | 1062 | /// <param name="point1">Point 1</param> |
1060 | /// <param name="point2">Point 2</param> | 1063 | /// <param name="point2">Point 2</param> |
1061 | /// <returns>Distance between two point</returns> | 1064 | /// <returns>Distance between two point</returns> |
1062 | private double GetDistance(Point point1, Point point2) | 1065 | private double GetDistance(Point point1, Point point2) |
1063 | { | 1066 | { |
1064 | //pythagorean theorem c^2 = a^2 + b^2 | 1067 | //pythagorean theorem c^2 = a^2 + b^2 |
1065 | //thus c = square root(a^2 + b^2) | 1068 | //thus c = square root(a^2 + b^2) |
1066 | double a = (double)(point2.X - point1.X); | 1069 | double a = (double)(point2.X - point1.X); |
1067 | double b = (double)(point2.Y - point1.Y); | 1070 | double b = (double)(point2.Y - point1.Y); |
1068 | 1071 | ||
1069 | return Math.Sqrt(a * a + b * b); | 1072 | return Math.Sqrt(a * a + b * b); |
1070 | } | 1073 | } |
1071 | 1074 | ||
1072 | /// <summary> | 1075 | /// <summary> |
1073 | /// Check point is valid for draw | 1076 | /// Check point is valid for draw |
1074 | /// </summary> | 1077 | /// </summary> |
1075 | /// <param name="point">Poit need check</param> | 1078 | /// <param name="point">Poit need check</param> |
1076 | /// <returns>true:Valid, false:Invalid</returns> | 1079 | /// <returns>true:Valid, false:Invalid</returns> |
1077 | private bool IsValidPoint(Point point) | 1080 | private bool IsValidPoint(Point point) |
1078 | { | 1081 | { |
1079 | return true; | 1082 | return true; |
1080 | } | 1083 | } |
1081 | 1084 | ||
1082 | /// <summary> | 1085 | /// <summary> |
1083 | /// Display coordinate position | 1086 | /// Display coordinate position |
1084 | /// </summary> | 1087 | /// </summary> |
1085 | /// <param name="point">Position to display</param> | 1088 | /// <param name="point">Position to display</param> |
1086 | private void DisplayCoordinate(Point point) | 1089 | private void DisplayCoordinate(Point point) |
1087 | { | 1090 | { |
1088 | if (_displayAxiPosition == null) | 1091 | if (_displayAxiPosition == null) |
1089 | { | 1092 | { |
1090 | _displayAxiPosition = new ucDisplayCoordinate(); | 1093 | _displayAxiPosition = new ucDisplayCoordinate(); |
1091 | this.Children.Add(_displayAxiPosition); | 1094 | this.Children.Add(_displayAxiPosition); |
1092 | } | 1095 | } |
1093 | _displayAxiPosition.Display(point); | 1096 | _displayAxiPosition.Display(point); |
1094 | } | 1097 | } |
1095 | 1098 | ||
1096 | #endregion | 1099 | #endregion |
1097 | 1100 | ||
1098 | #region Functions for Set Auto Nodes | 1101 | #region Functions for Set Auto Nodes |
1099 | 1102 | ||
1100 | /// <summary> | 1103 | /// <summary> |
1101 | /// SetAutoNodes | 1104 | /// SetAutoNodes |
1102 | /// </summary> | 1105 | /// </summary> |
1103 | public void SetAutoNodes() | 1106 | public void SetAutoNodes() |
1104 | { | 1107 | { |
1105 | double radiusStart = DISTANCE_START_NODES; | 1108 | double radiusStart = DISTANCE_START_NODES; |
1106 | double radiusEnd = DISTANCE_END_NODES; | 1109 | double radiusEnd = DISTANCE_END_NODES; |
1107 | double radiusCurver = RADIUS_CURVER_LINE; | 1110 | double radiusCurver = RADIUS_CURVER_LINE; |
1108 | 1111 | ||
1109 | Point startNode; | 1112 | Point startNode; |
1110 | Point endNode; | 1113 | Point endNode; |
1111 | 1114 | ||
1112 | gGrpBlueNode.Children.Clear(); | 1115 | gGrpBlueNode.Children.Clear(); |
1113 | 1116 | ||
1114 | if (gGrpLine.Children.Count == 1) | 1117 | if (gGrpLine.Children.Count == 1) |
1115 | radiusCurver = radiusEnd; | 1118 | radiusCurver = radiusEnd; |
1116 | 1119 | ||
1117 | if (gGrpLine.Children.Count > 0) | 1120 | if (gGrpLine.Children.Count > 0) |
1118 | { | 1121 | { |
1119 | for (int i = 0; i < gGrpLine.Children.Count; i++) | 1122 | for (int i = 0; i < gGrpLine.Children.Count; i++) |
1120 | { | 1123 | { |
1121 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[i]; | 1124 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[i]; |
1122 | if (i == 0) | 1125 | if (i == 0) |
1123 | { | 1126 | { |
1124 | startNode = lineGeometry.EndPoint; | 1127 | startNode = lineGeometry.EndPoint; |
1125 | endNode = lineGeometry.StartPoint; | 1128 | endNode = lineGeometry.StartPoint; |
1126 | DrawAutoNodes(startNode, endNode, radiusCurver, radiusStart); | 1129 | DrawAutoNodes(startNode, endNode, radiusCurver, radiusStart); |
1127 | } | 1130 | } |
1128 | else if (i == gGrpLine.Children.Count - 1 && i > 0) | 1131 | else if (i == gGrpLine.Children.Count - 1 && i > 0) |
1129 | { | 1132 | { |
1130 | startNode = lineGeometry.StartPoint; | 1133 | startNode = lineGeometry.StartPoint; |
1131 | endNode = lineGeometry.EndPoint; | 1134 | endNode = lineGeometry.EndPoint; |
1132 | DrawAutoNodes(startNode, endNode, radiusCurver, radiusEnd); | 1135 | DrawAutoNodes(startNode, endNode, radiusCurver, radiusEnd); |
1133 | } | 1136 | } |
1134 | else | 1137 | else |
1135 | { | 1138 | { |
1136 | startNode = lineGeometry.StartPoint; | 1139 | startNode = lineGeometry.StartPoint; |
1137 | endNode = lineGeometry.EndPoint; | 1140 | endNode = lineGeometry.EndPoint; |
1138 | DrawAutoNodes(startNode, endNode, radiusCurver, radiusCurver); | 1141 | DrawAutoNodes(startNode, endNode, radiusCurver, radiusCurver); |
1139 | } | 1142 | } |
1140 | } | 1143 | } |
1141 | } | 1144 | } |
1142 | } | 1145 | } |
1143 | 1146 | ||
1144 | 1147 | ||
1145 | /// <summary> | 1148 | /// <summary> |
1146 | /// DrawAutoNodes | 1149 | /// DrawAutoNodes |
1147 | /// </summary> | 1150 | /// </summary> |
1148 | /// <param name="startNode"></param> | 1151 | /// <param name="startNode"></param> |
1149 | /// <param name="endNode"></param> | 1152 | /// <param name="endNode"></param> |
1150 | /// <param name="radiusStart"></param> | 1153 | /// <param name="radiusStart"></param> |
1151 | /// <param name="radiusEnd"></param> | 1154 | /// <param name="radiusEnd"></param> |
1152 | private void DrawAutoNodes(Point startNode, Point endNode, double radiusStart, double radiusEnd) | 1155 | private void DrawAutoNodes(Point startNode, Point endNode, double radiusStart, double radiusEnd) |
1153 | { | 1156 | { |
1154 | double distance = DISTANCE_AUTO_NODES; | 1157 | double distance = DISTANCE_AUTO_NODES; |
1155 | double i; | 1158 | double i; |
1156 | 1159 | ||
1157 | Point node; | 1160 | Point node; |
1158 | 1161 | ||
1159 | // Get postion of blue node on line | 1162 | // Get postion of blue node on line |
1160 | if (startNode.X == endNode.X) | 1163 | if (startNode.X == endNode.X) |
1161 | { | 1164 | { |
1162 | if (startNode.Y > endNode.Y) | 1165 | if (startNode.Y > endNode.Y) |
1163 | { | 1166 | { |
1164 | i = startNode.Y - radiusStart; | 1167 | i = startNode.Y - radiusStart; |
1165 | if (i - distance > endNode.Y + radiusEnd) | 1168 | if (i - distance > endNode.Y + radiusEnd) |
1166 | { | 1169 | { |
1167 | do | 1170 | do |
1168 | { | 1171 | { |
1169 | i = i - distance; | 1172 | i = i - distance; |
1170 | node = new Point(endNode.X, i); | 1173 | node = new Point(endNode.X, i); |
1171 | // Add node to postion distance 1000mm | 1174 | // Add node to postion distance 1000mm |
1172 | AddNode(node, gGrpBlueNode); | 1175 | AddNode(node, gGrpBlueNode); |
1173 | 1176 | ||
1174 | } while (i > endNode.Y + radiusEnd + distance); | 1177 | } while (i > endNode.Y + radiusEnd + distance); |
1175 | } | 1178 | } |
1176 | } | 1179 | } |
1177 | else | 1180 | else |
1178 | { | 1181 | { |
1179 | i = startNode.Y + radiusStart; | 1182 | i = startNode.Y + radiusStart; |
1180 | if (i + distance < endNode.Y - radiusEnd) | 1183 | if (i + distance < endNode.Y - radiusEnd) |
1181 | { | 1184 | { |
1182 | do | 1185 | do |
1183 | { | 1186 | { |
1184 | i = i + distance; | 1187 | i = i + distance; |
1185 | node = new Point(endNode.X, i); | 1188 | node = new Point(endNode.X, i); |
1186 | // Add node to postion distance 1000mm | 1189 | // Add node to postion distance 1000mm |
1187 | AddNode(node, gGrpBlueNode); | 1190 | AddNode(node, gGrpBlueNode); |
1188 | } while (i < endNode.Y - radiusEnd - distance); | 1191 | } while (i < endNode.Y - radiusEnd - distance); |
1189 | } | 1192 | } |
1190 | } | 1193 | } |
1191 | } | 1194 | } |
1192 | else | 1195 | else |
1193 | { | 1196 | { |
1194 | if (startNode.X > endNode.X) | 1197 | if (startNode.X > endNode.X) |
1195 | { | 1198 | { |
1196 | i = startNode.X - radiusStart; | 1199 | i = startNode.X - radiusStart; |
1197 | if (i - distance > endNode.X + radiusEnd) | 1200 | if (i - distance > endNode.X + radiusEnd) |
1198 | { | 1201 | { |
1199 | do | 1202 | do |
1200 | { | 1203 | { |
1201 | i = i - distance; | 1204 | i = i - distance; |
1202 | node = new Point(i, endNode.Y); | 1205 | node = new Point(i, endNode.Y); |
1203 | // Add node to postion distance 1000mm | 1206 | // Add node to postion distance 1000mm |
1204 | AddNode(node, gGrpBlueNode); | 1207 | AddNode(node, gGrpBlueNode); |
1205 | } while (i > endNode.X + radiusEnd + distance); | 1208 | } while (i > endNode.X + radiusEnd + distance); |
1206 | } | 1209 | } |
1207 | } | 1210 | } |
1208 | else | 1211 | else |
1209 | { | 1212 | { |
1210 | i = startNode.X + radiusStart; | 1213 | i = startNode.X + radiusStart; |
1211 | if (i + distance < endNode.X - radiusEnd) | 1214 | if (i + distance < endNode.X - radiusEnd) |
1212 | { | 1215 | { |
1213 | do | 1216 | do |
1214 | { | 1217 | { |
1215 | i = i + distance; | 1218 | i = i + distance; |
1216 | node = new Point(i, endNode.Y); | 1219 | node = new Point(i, endNode.Y); |
1217 | // Add node to postion distance 1000mm | 1220 | // Add node to postion distance 1000mm |
1218 | AddNode(node, gGrpBlueNode); | 1221 | AddNode(node, gGrpBlueNode); |
1219 | } while (i < endNode.X - radiusEnd - distance); | 1222 | } while (i < endNode.X - radiusEnd - distance); |
1220 | } | 1223 | } |
1221 | } | 1224 | } |
1222 | } | 1225 | } |
1223 | 1226 | ||
1224 | } | 1227 | } |
1225 | 1228 | ||
1226 | #endregion | 1229 | #endregion |
1227 | 1230 | ||
1228 | #region Functions for Set Free Nodes | 1231 | #region Functions for Set Free Nodes |
1229 | /// <summary> | 1232 | /// <summary> |
1230 | /// Draw Auto Blue node | 1233 | /// Draw Auto Blue node |
1231 | /// </summary> | 1234 | /// </summary> |
1232 | public void SetFreeNodes(Point FreeNode, bool RightClick) | 1235 | public void SetFreeNodes(Point FreeNode, bool RightClick) |
1233 | { | 1236 | { |
1234 | double radiusStart = DISTANCE_START_NODES; | 1237 | double radiusStart = DISTANCE_START_NODES; |
1235 | double radiusEnd = DISTANCE_END_NODES; | 1238 | double radiusEnd = DISTANCE_END_NODES; |
1236 | double radiusNode = RADIUS_NODE; | 1239 | double radiusNode = RADIUS_NODE; |
1237 | double radiusCurver = RADIUS_CURVER_LINE + RADIUS_NODE; | 1240 | double radiusCurver = RADIUS_CURVER_LINE + RADIUS_NODE; |
1238 | 1241 | ||
1239 | EllipseGeometry ellipseGeometry; | 1242 | EllipseGeometry ellipseGeometry; |
1240 | Point node; | 1243 | Point node; |
1241 | bool deleteFlag = false; | 1244 | bool deleteFlag = false; |
1242 | 1245 | ||
1243 | if (RightClick) | 1246 | if (RightClick) |
1244 | { | 1247 | { |
1245 | if (gGrpBlueNode.Children.Count > 0) | 1248 | if (gGrpBlueNode.Children.Count > 0) |
1246 | { | 1249 | { |
1247 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 1250 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
1248 | { | 1251 | { |
1249 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; | 1252 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; |
1250 | node = ellipseGeometry.Center; | 1253 | node = ellipseGeometry.Center; |
1251 | if (FreeNode.X == node.X) | 1254 | if (FreeNode.X == node.X) |
1252 | { | 1255 | { |
1253 | if (CheckIsNode(FreeNode, node, radiusNode)) | 1256 | if (CheckIsNode(FreeNode, node, radiusNode)) |
1254 | { | 1257 | { |
1255 | deleteFlag = true; | 1258 | deleteFlag = true; |
1256 | } | 1259 | } |
1257 | } | 1260 | } |
1258 | else | 1261 | else |
1259 | { | 1262 | { |
1260 | if (CheckIsNode(FreeNode, node, radiusNode)) | 1263 | if (CheckIsNode(FreeNode, node, radiusNode)) |
1261 | { | 1264 | { |
1262 | deleteFlag = true; | 1265 | deleteFlag = true; |
1263 | } | 1266 | } |
1264 | } | 1267 | } |
1265 | if (deleteFlag) | 1268 | if (deleteFlag) |
1266 | { | 1269 | { |
1267 | MessageBoxResult result = MessageBox.Show("Do You Delete This Node?", "Delete Node", MessageBoxButton.OKCancel); | 1270 | MessageBoxResult result = MessageBox.Show("Do You Delete This Node?", "Delete Node", MessageBoxButton.OKCancel); |
1268 | if (result == MessageBoxResult.OK) | 1271 | if (result == MessageBoxResult.OK) |
1269 | { | 1272 | { |
1270 | gGrpBlueNode.Children.RemoveAt(i); | 1273 | gGrpBlueNode.Children.RemoveAt(i); |
1271 | return; | 1274 | return; |
1272 | } | 1275 | } |
1273 | else | 1276 | else |
1274 | { | 1277 | { |
1275 | return; | 1278 | return; |
1276 | } | 1279 | } |
1277 | } | 1280 | } |
1278 | } | 1281 | } |
1279 | } | 1282 | } |
1280 | } | 1283 | } |
1281 | 1284 | ||
1282 | if (gGrpLine.Children.Count > 0) | 1285 | if (gGrpLine.Children.Count > 0) |
1283 | { | 1286 | { |
1284 | for (int i = 0; i < gGrpLine.Children.Count; i++) | 1287 | for (int i = 0; i < gGrpLine.Children.Count; i++) |
1285 | { | 1288 | { |
1286 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[i]; | 1289 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[i]; |
1287 | 1290 | ||
1288 | // Get postion of node on line | 1291 | // Get postion of node on line |
1289 | if (IsVerticalLine(lineGeometry)) | 1292 | if (IsVerticalLine(lineGeometry)) |
1290 | { | 1293 | { |
1291 | if (FreeNode.X < lineGeometry.EndPoint.X + radiusNode && FreeNode.X > lineGeometry.EndPoint.X - radiusNode) | 1294 | if (FreeNode.X < lineGeometry.EndPoint.X + radiusNode && FreeNode.X > lineGeometry.EndPoint.X - radiusNode) |
1292 | { | 1295 | { |
1293 | FreeNode.X = lineGeometry.EndPoint.X; | 1296 | FreeNode.X = lineGeometry.EndPoint.X; |
1294 | 1297 | ||
1295 | if (i == 0) | 1298 | if (i == 0) |
1296 | { | 1299 | { |
1297 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusStart, radiusCurver)) | 1300 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusStart, radiusCurver)) |
1298 | { | 1301 | { |
1299 | 1302 | ||
1300 | AddNode(FreeNode, gGrpBlueNode); | 1303 | AddNode(FreeNode, gGrpBlueNode); |
1301 | } | 1304 | } |
1302 | } | 1305 | } |
1303 | else if (i == gGrpLine.Children.Count - 1 && i > 0) | 1306 | else if (i == gGrpLine.Children.Count - 1 && i > 0) |
1304 | { | 1307 | { |
1305 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusEnd)) | 1308 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusEnd)) |
1306 | { | 1309 | { |
1307 | 1310 | ||
1308 | AddNode(FreeNode, gGrpBlueNode); | 1311 | AddNode(FreeNode, gGrpBlueNode); |
1309 | } | 1312 | } |
1310 | } | 1313 | } |
1311 | else | 1314 | else |
1312 | { | 1315 | { |
1313 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusCurver)) | 1316 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusCurver)) |
1314 | { | 1317 | { |
1315 | 1318 | ||
1316 | AddNode(FreeNode, gGrpBlueNode); | 1319 | AddNode(FreeNode, gGrpBlueNode); |
1317 | } | 1320 | } |
1318 | } | 1321 | } |
1319 | 1322 | ||
1320 | } | 1323 | } |
1321 | } | 1324 | } |
1322 | else | 1325 | else |
1323 | { | 1326 | { |
1324 | if (FreeNode.Y < lineGeometry.EndPoint.Y + radiusNode && FreeNode.Y > lineGeometry.EndPoint.Y - radiusNode) | 1327 | if (FreeNode.Y < lineGeometry.EndPoint.Y + radiusNode && FreeNode.Y > lineGeometry.EndPoint.Y - radiusNode) |
1325 | { | 1328 | { |
1326 | FreeNode.Y = lineGeometry.EndPoint.Y; | 1329 | FreeNode.Y = lineGeometry.EndPoint.Y; |
1327 | if (i == 0) | 1330 | if (i == 0) |
1328 | { | 1331 | { |
1329 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusStart, radiusCurver)) | 1332 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusStart, radiusCurver)) |
1330 | { | 1333 | { |
1331 | 1334 | ||
1332 | AddNode(FreeNode, gGrpBlueNode); | 1335 | AddNode(FreeNode, gGrpBlueNode); |
1333 | } | 1336 | } |
1334 | } | 1337 | } |
1335 | else if (i == gGrpLine.Children.Count - 1 && i > 0) | 1338 | else if (i == gGrpLine.Children.Count - 1 && i > 0) |
1336 | { | 1339 | { |
1337 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusEnd)) | 1340 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusEnd)) |
1338 | { | 1341 | { |
1339 | 1342 | ||
1340 | AddNode(FreeNode, gGrpBlueNode); | 1343 | AddNode(FreeNode, gGrpBlueNode); |
1341 | } | 1344 | } |
1342 | } | 1345 | } |
1343 | else | 1346 | else |
1344 | { | 1347 | { |
1345 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusCurver)) | 1348 | if (CheckFreeNodes(lineGeometry, FreeNode, radiusCurver, radiusCurver)) |
1346 | { | 1349 | { |
1347 | 1350 | ||
1348 | AddNode(FreeNode, gGrpBlueNode); | 1351 | AddNode(FreeNode, gGrpBlueNode); |
1349 | } | 1352 | } |
1350 | } | 1353 | } |
1351 | 1354 | ||
1352 | } | 1355 | } |
1353 | } | 1356 | } |
1354 | } | 1357 | } |
1355 | } | 1358 | } |
1356 | } | 1359 | } |
1357 | 1360 | ||
1358 | 1361 | ||
1359 | public bool CheckFreeNodes(LineGeometry lineNode, Point Freenode, double radiusStart, double radiusEnd) | 1362 | public bool CheckFreeNodes(LineGeometry lineNode, Point Freenode, double radiusStart, double radiusEnd) |
1360 | { | 1363 | { |
1361 | 1364 | ||
1362 | double distanceFreeNode = DISTANCE_FREE_NODES; | 1365 | double distanceFreeNode = DISTANCE_FREE_NODES; |
1363 | double radiusNode = RADIUS_NODE; | 1366 | double radiusNode = RADIUS_NODE; |
1364 | EllipseGeometry ellipseGeometry; | 1367 | EllipseGeometry ellipseGeometry; |
1365 | Point node; | 1368 | Point node; |
1366 | 1369 | ||
1367 | if (IsVerticalLine(lineNode)) | 1370 | if (IsVerticalLine(lineNode)) |
1368 | { | 1371 | { |
1369 | if (lineNode.StartPoint.Y < lineNode.EndPoint.Y) | 1372 | if (lineNode.StartPoint.Y < lineNode.EndPoint.Y) |
1370 | { | 1373 | { |
1371 | if (Freenode.Y < lineNode.StartPoint.Y + radiusStart || Freenode.Y > lineNode.EndPoint.Y - radiusEnd) | 1374 | if (Freenode.Y < lineNode.StartPoint.Y + radiusStart || Freenode.Y > lineNode.EndPoint.Y - radiusEnd) |
1372 | { | 1375 | { |
1373 | return false; | 1376 | return false; |
1374 | } | 1377 | } |
1375 | } | 1378 | } |
1376 | else | 1379 | else |
1377 | { | 1380 | { |
1378 | if (Freenode.Y > lineNode.StartPoint.Y - radiusStart || Freenode.Y < lineNode.EndPoint.Y + radiusEnd) | 1381 | if (Freenode.Y > lineNode.StartPoint.Y - radiusStart || Freenode.Y < lineNode.EndPoint.Y + radiusEnd) |
1379 | { | 1382 | { |
1380 | return false; | 1383 | return false; |
1381 | } | 1384 | } |
1382 | } | 1385 | } |
1383 | } | 1386 | } |
1384 | else | 1387 | else |
1385 | { | 1388 | { |
1386 | if (lineNode.StartPoint.X < lineNode.EndPoint.X) | 1389 | if (lineNode.StartPoint.X < lineNode.EndPoint.X) |
1387 | { | 1390 | { |
1388 | if (Freenode.X < lineNode.StartPoint.X + radiusStart || Freenode.X > lineNode.EndPoint.X - radiusEnd) | 1391 | if (Freenode.X < lineNode.StartPoint.X + radiusStart || Freenode.X > lineNode.EndPoint.X - radiusEnd) |
1389 | { | 1392 | { |
1390 | return false; | 1393 | return false; |
1391 | } | 1394 | } |
1392 | } | 1395 | } |
1393 | else | 1396 | else |
1394 | { | 1397 | { |
1395 | if (Freenode.X > lineNode.StartPoint.X - radiusStart || Freenode.X < lineNode.EndPoint.X + radiusEnd) | 1398 | if (Freenode.X > lineNode.StartPoint.X - radiusStart || Freenode.X < lineNode.EndPoint.X + radiusEnd) |
1396 | { | 1399 | { |
1397 | return false; | 1400 | return false; |
1398 | } | 1401 | } |
1399 | } | 1402 | } |
1400 | } | 1403 | } |
1401 | 1404 | ||
1402 | if (gGrpBlueNode.Children.Count > 0) | 1405 | if (gGrpBlueNode.Children.Count > 0) |
1403 | { | 1406 | { |
1404 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 1407 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
1405 | { | 1408 | { |
1406 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; | 1409 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; |
1407 | node = ellipseGeometry.Center; | 1410 | node = ellipseGeometry.Center; |
1408 | if (Freenode.X == node.X) | 1411 | if (Freenode.X == node.X) |
1409 | { | 1412 | { |
1410 | if (CheckIsNode(Freenode, node, radiusNode)) | 1413 | if (CheckIsNode(Freenode, node, radiusNode)) |
1411 | { | 1414 | { |
1412 | return false; | 1415 | return false; |
1413 | } | 1416 | } |
1414 | else if (Freenode.Y < node.Y + distanceFreeNode && Freenode.Y > node.Y - distanceFreeNode) | 1417 | else if (Freenode.Y < node.Y + distanceFreeNode && Freenode.Y > node.Y - distanceFreeNode) |
1415 | { | 1418 | { |
1416 | return false; | 1419 | return false; |
1417 | } | 1420 | } |
1418 | } | 1421 | } |
1419 | else if (Freenode.Y == node.Y) | 1422 | else if (Freenode.Y == node.Y) |
1420 | { | 1423 | { |
1421 | if (CheckIsNode(Freenode, node, radiusNode)) | 1424 | if (CheckIsNode(Freenode, node, radiusNode)) |
1422 | { | 1425 | { |
1423 | return false; | 1426 | return false; |
1424 | } | 1427 | } |
1425 | else if (Freenode.X < node.X + distanceFreeNode && Freenode.X > node.X - distanceFreeNode) | 1428 | else if (Freenode.X < node.X + distanceFreeNode && Freenode.X > node.X - distanceFreeNode) |
1426 | { | 1429 | { |
1427 | return false; | 1430 | return false; |
1428 | } | 1431 | } |
1429 | } | 1432 | } |
1430 | } | 1433 | } |
1431 | } | 1434 | } |
1432 | 1435 | ||
1433 | return true; | 1436 | return true; |
1434 | } | 1437 | } |
1435 | 1438 | ||
1436 | public bool CheckIsNode(Point FreeNode, Point Node, double radiusNode) | 1439 | public bool CheckIsNode(Point FreeNode, Point Node, double radiusNode) |
1437 | { | 1440 | { |
1438 | if (FreeNode.X < Node.X + radiusNode && FreeNode.X > Node.X - radiusNode && FreeNode.Y < Node.Y + radiusNode && FreeNode.Y > Node.Y - radiusNode) | 1441 | if (FreeNode.X < Node.X + radiusNode && FreeNode.X > Node.X - radiusNode && FreeNode.Y < Node.Y + radiusNode && FreeNode.Y > Node.Y - radiusNode) |
1439 | { | 1442 | { |
1440 | return true; | 1443 | return true; |
1441 | } | 1444 | } |
1442 | return false; | 1445 | return false; |
1443 | } | 1446 | } |
1444 | 1447 | ||
1445 | #endregion | 1448 | #endregion |
1446 | 1449 | ||
1447 | #region Edit Node | 1450 | #region Edit Node |
1448 | public void InitNodeInfo_List() | 1451 | public void InitNodeInfo_List() |
1449 | { | 1452 | { |
1450 | //Reset List | 1453 | //Reset List |
1451 | NodeInfo_List = new List<NodeInfo>(); | 1454 | NodeInfo_List = new List<NodeInfo>(); |
1452 | 1455 | ||
1453 | if (gGrpBlueNode.Children.Count > 0) | 1456 | if (gGrpBlueNode.Children.Count > 0) |
1454 | { | 1457 | { |
1455 | // Get start point | 1458 | // Get start point |
1456 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[0]; | 1459 | LineGeometry lineGeometry = (LineGeometry)gGrpLine.Children[0]; |
1457 | Point startPoint = lineGeometry.StartPoint; | 1460 | Point startPoint = lineGeometry.StartPoint; |
1458 | 1461 | ||
1459 | NodeInfo n1 = new NodeInfo(); | 1462 | NodeInfo n1 = new NodeInfo(); |
1460 | n1.X = startPoint.X; | 1463 | n1.X = startPoint.X; |
1461 | n1.Y = startPoint.Y; | 1464 | n1.Y = startPoint.Y; |
1462 | n1.Mode1 = ""; | 1465 | n1.Mode1 = ""; |
1463 | n1.Mode2 = ""; | 1466 | n1.Mode2 = ""; |
1464 | n1.Mode3 = ""; | 1467 | n1.Mode3 = ""; |
1465 | NodeInfo_List.Add(n1); | 1468 | NodeInfo_List.Add(n1); |
1466 | 1469 | ||
1467 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 1470 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
1468 | { | 1471 | { |
1469 | Point point; | 1472 | Point point; |
1470 | EllipseGeometry eGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; | 1473 | EllipseGeometry eGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; |
1471 | point = eGeometry.Center; | 1474 | point = eGeometry.Center; |
1472 | 1475 | ||
1473 | NodeInfo Ninfo = new NodeInfo(); | 1476 | NodeInfo Ninfo = new NodeInfo(); |
1474 | Ninfo.X = point.X; | 1477 | Ninfo.X = point.X; |
1475 | Ninfo.Y = point.Y; | 1478 | Ninfo.Y = point.Y; |
1476 | 1479 | ||
1477 | Ninfo.Mode1 = ""; | 1480 | Ninfo.Mode1 = ""; |
1478 | Ninfo.Mode2 = ""; | 1481 | Ninfo.Mode2 = ""; |
1479 | Ninfo.Mode3 = ""; | 1482 | Ninfo.Mode3 = ""; |
1480 | 1483 | ||
1481 | NodeInfo_List.Add(Ninfo); | 1484 | NodeInfo_List.Add(Ninfo); |
1482 | } | 1485 | } |
1483 | 1486 | ||
1484 | // Get end point | 1487 | // Get end point |
1485 | lineGeometry = (LineGeometry)gGrpLine.Children[gGrpLine.Children.Count -1]; | 1488 | lineGeometry = (LineGeometry)gGrpLine.Children[gGrpLine.Children.Count -1]; |
1486 | Point endPoint = lineGeometry.EndPoint; | 1489 | Point endPoint = lineGeometry.EndPoint; |
1487 | 1490 | ||
1488 | NodeInfo n2 = new NodeInfo(); | 1491 | NodeInfo n2 = new NodeInfo(); |
1489 | n2.X = startPoint.X; | 1492 | n2.X = startPoint.X; |
1490 | n2.Y = startPoint.Y; | 1493 | n2.Y = startPoint.Y; |
1491 | n2.Mode1 = ""; | 1494 | n2.Mode1 = ""; |
1492 | n2.Mode2 = ""; | 1495 | n2.Mode2 = ""; |
1493 | n2.Mode3 = ""; | 1496 | n2.Mode3 = ""; |
1494 | NodeInfo_List.Add(n2); | 1497 | NodeInfo_List.Add(n2); |
1495 | 1498 | ||
1496 | // Resort NodeInfo_List From Start to Goal | 1499 | // Resort NodeInfo_List From Start to Goal |
1497 | LineGeometry firstLine = (LineGeometry)gGrpLine.Children[0]; | 1500 | LineGeometry firstLine = (LineGeometry)gGrpLine.Children[0]; |
1498 | Point startNode = firstLine.StartPoint; | 1501 | Point startNode = firstLine.StartPoint; |
1499 | Point endNode = firstLine.EndPoint; | 1502 | Point endNode = firstLine.EndPoint; |
1500 | 1503 | ||
1501 | 1504 | ||
1502 | List<NodeInfo> tmpLst = new List<NodeInfo>(); | 1505 | List<NodeInfo> tmpLst = new List<NodeInfo>(); |
1503 | 1506 | ||
1504 | // Create temp List | 1507 | // Create temp List |
1505 | if(startNode.X == endNode.X) | 1508 | if(startNode.X == endNode.X) |
1506 | { | 1509 | { |
1507 | for (int i = 1; i < NodeInfo_List.Count; i++) | 1510 | for (int i = 1; i < NodeInfo_List.Count; i++) |
1508 | { | 1511 | { |
1509 | if (NodeInfo_List[i].X != endNode.X) | 1512 | if (NodeInfo_List[i].X != endNode.X) |
1510 | { | 1513 | { |
1511 | break; | 1514 | break; |
1512 | } | 1515 | } |
1513 | else | 1516 | else |
1514 | { | 1517 | { |
1515 | tmpLst.Add(NodeInfo_List[i]); | 1518 | tmpLst.Add(NodeInfo_List[i]); |
1516 | } | 1519 | } |
1517 | } | 1520 | } |
1518 | } | 1521 | } |
1519 | 1522 | ||
1520 | if (startNode.Y == endNode.Y) | 1523 | if (startNode.Y == endNode.Y) |
1521 | { | 1524 | { |
1522 | for (int i = 1; i < NodeInfo_List.Count; i++) | 1525 | for (int i = 1; i < NodeInfo_List.Count; i++) |
1523 | { | 1526 | { |
1524 | if (NodeInfo_List[i].Y != endNode.Y) | 1527 | if (NodeInfo_List[i].Y != endNode.Y) |
1525 | { | 1528 | { |
1526 | break; | 1529 | break; |
1527 | } | 1530 | } |
1528 | else | 1531 | else |
1529 | { | 1532 | { |
1530 | tmpLst.Add(NodeInfo_List[i]); | 1533 | tmpLst.Add(NodeInfo_List[i]); |
1531 | } | 1534 | } |
1532 | } | 1535 | } |
1533 | } | 1536 | } |
1534 | 1537 | ||
1535 | // Sort NodeInfo_List | 1538 | // Sort NodeInfo_List |
1536 | for (int i = 0; i < tmpLst.Count; i++) | 1539 | for (int i = 0; i < tmpLst.Count; i++) |
1537 | { | 1540 | { |
1538 | NodeInfo_List[i + 1] = tmpLst[tmpLst.Count -1 - i]; | 1541 | NodeInfo_List[i + 1] = tmpLst[tmpLst.Count -1 - i]; |
1539 | } | 1542 | } |
1540 | 1543 | ||
1541 | } | 1544 | } |
1542 | } | 1545 | } |
1543 | 1546 | ||
1544 | 1547 | ||
1545 | public void EditNode(Point node_edited) | 1548 | public void EditNode(Point node_edited) |
1546 | { | 1549 | { |
1547 | EllipseGeometry ellipseGeometry; | 1550 | EllipseGeometry ellipseGeometry; |
1548 | Point node; | 1551 | Point node; |
1549 | double radiusNode = RADIUS_NODE; | 1552 | double radiusNode = RADIUS_NODE; |
1550 | 1553 | ||
1551 | bool flag = false; | 1554 | bool flag = false; |
1552 | 1555 | ||
1553 | if (gGrpBlueNode.Children.Count > 0) | 1556 | if (gGrpBlueNode.Children.Count > 0) |
1554 | { | 1557 | { |
1555 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) | 1558 | for (int i = 0; i < gGrpBlueNode.Children.Count; i++) |
1556 | { | 1559 | { |
1557 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; | 1560 | ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i]; |
1558 | node = ellipseGeometry.Center; | 1561 | node = ellipseGeometry.Center; |
1559 | 1562 | ||
1560 | if (CheckIsNode(node_edited, node, radiusNode)) | 1563 | if (CheckIsNode(node_edited, node, radiusNode)) |
1561 | { | 1564 | { |
1562 | flag = true; | 1565 | flag = true; |
1563 | } | 1566 | } |
1564 | 1567 | ||
1565 | if (flag) | 1568 | if (flag) |
1566 | { | 1569 | { |
1567 | node_edited.X = node.X; | 1570 | node_edited.X = node.X; |
1568 | node_edited.Y = node.Y; | 1571 | node_edited.Y = node.Y; |
1569 | 1572 | ||
1570 | // show form edit node | 1573 | // show form edit node |
1571 | EditNodeWindow edtNodeWindow = new EditNodeWindow(); | 1574 | EditNodeWindow edtNodeWindow = new EditNodeWindow(); |
1572 | edtNodeWindow.ShowDialog(); | 1575 | edtNodeWindow.ShowDialog(); |
1573 | 1576 | ||
1574 | string result1 = edtNodeWindow._txtMode1; | 1577 | string result1 = edtNodeWindow._txtMode1; |
1575 | string result2 = edtNodeWindow._txtMode2; | 1578 | string result2 = edtNodeWindow._txtMode2; |
1576 | string result3 = edtNodeWindow._txtMode3; | 1579 | string result3 = edtNodeWindow._txtMode3; |
1577 | bool exit = edtNodeWindow._ExitFlg; | 1580 | bool exit = edtNodeWindow._ExitFlg; |
1578 | 1581 | ||
1579 | if (!exit) { | 1582 | if (!exit) { |
1580 | SaveChanged(node_edited.X, node_edited.Y, result1, result2, result3); | 1583 | SaveChanged(node_edited.X, node_edited.Y, result1, result2, result3); |
1581 | } | 1584 | } |
1582 | 1585 | ||
1583 | return; | 1586 | return; |
1584 | } | 1587 | } |
1585 | } | 1588 | } |
1586 | } | 1589 | } |
1587 | } | 1590 | } |
1588 | 1591 | ||
1589 | public void SaveChanged(double x, double y, string st1, string st2, string st3) | 1592 | public void SaveChanged(double x, double y, string st1, string st2, string st3) |
1590 | { | 1593 | { |
1591 | for (int i = 0; i < NodeInfo_List.Count; i++) | 1594 | for (int i = 0; i < NodeInfo_List.Count; i++) |
1592 | { | 1595 | { |
1593 | NodeInfo ni = new NodeInfo(); | 1596 | NodeInfo ni = new NodeInfo(); |
1594 | ni = NodeInfo_List[i]; | 1597 | ni = NodeInfo_List[i]; |
1595 | 1598 | ||
1596 | if (ni.X == x && ni.Y == y) | 1599 | if (ni.X == x && ni.Y == y) |
1597 | { | 1600 | { |
1598 | 1601 | ||
1599 | ni.Mode1 = st1; | 1602 | ni.Mode1 = st1; |
1600 | ni.Mode2 = st2; | 1603 | ni.Mode2 = st2; |
1601 | ni.Mode3 = st3; | 1604 | ni.Mode3 = st3; |
1602 | 1605 | ||
1603 | NodeInfo_List[i] = ni; | 1606 | NodeInfo_List[i] = ni; |
1604 | return; | 1607 | return; |
1605 | } | 1608 | } |
1606 | } | 1609 | } |
1607 | } | 1610 | } |
1608 | #endregion | 1611 | #endregion |
1609 | 1612 | ||
1610 | #region Display RouteInfo | 1613 | #region Display RouteInfo |
1611 | public void DspRouteInfo() | 1614 | public void DspRouteInfo() |
1612 | { | 1615 | { |
1613 | //Clear Route Info Table | 1616 | //Clear Route Info Table |
1614 | ((MainWindow)System.Windows.Application.Current.MainWindow).grdRouteInfo.Children.Clear(); | 1617 | ((MainWindow)System.Windows.Application.Current.MainWindow).grdRouteInfo.Children.Clear(); |
1615 | 1618 | ||
1616 | if (NodeInfo_List.Count != 0) { | 1619 | if (NodeInfo_List.Count != 0) { |
1617 | int _RowIdx = 0; | 1620 | int _RowIdx = 0; |
1618 | string _Content = ""; | 1621 | string _Content = ""; |
1619 | 1622 | ||
1620 | for (int i = 0; i < NodeInfo_List.Count; i++) { | 1623 | for (int i = 0; i < NodeInfo_List.Count; i++) { |
1621 | 1624 | ||
1622 | NodeInfo ni = new NodeInfo(); | 1625 | NodeInfo ni = new NodeInfo(); |
1623 | ni = NodeInfo_List[i]; | 1626 | ni = NodeInfo_List[i]; |
1624 | 1627 | ||
1625 | //column 1 | 1628 | //column 1 |
1626 | if (i == 0) | 1629 | if (i == 0) |
1627 | { | 1630 | { |
1628 | _Content = "S"; | 1631 | _Content = "S"; |
1629 | } | 1632 | } |
1630 | else if (i == NodeInfo_List.Count - 1) | 1633 | else if (i == NodeInfo_List.Count - 1) |
1631 | { | 1634 | { |
1632 | _Content = "G"; | 1635 | _Content = "G"; |
1633 | } | 1636 | } |
1634 | else | 1637 | else |
1635 | { | 1638 | { |
1636 | _Content = i.ToString(); | 1639 | _Content = i.ToString(); |
1637 | } | 1640 | } |
1638 | AddLabeltoGrid(_RowIdx, 0, _Content); | 1641 | AddLabeltoGrid(_RowIdx, 0, _Content); |
1639 | 1642 | ||
1640 | //column 2 | 1643 | //column 2 |
1641 | // Display Node's Position | 1644 | // Display Node's Position |
1642 | _Content = ni.X + ", " + ni.Y; | 1645 | _Content = ni.X + ", " + ni.Y; |
1643 | AddLabeltoGrid(_RowIdx, 1, _Content); | 1646 | AddLabeltoGrid(_RowIdx, 1, _Content); |
1644 | 1647 | ||
1645 | // Display Node's Field | 1648 | // Display Node's Field |
1646 | if (ni.Mode1 != "" && ni.Mode1 != null) | 1649 | if (ni.Mode1 != "" && ni.Mode1 != null) |
1647 | { | 1650 | { |
1648 | char delimiterChars = '_'; | 1651 | char delimiterChars = '_'; |
1649 | string[] tmp = ni.Mode1.Split(delimiterChars); | 1652 | string[] tmp = ni.Mode1.Split(delimiterChars); |
1650 | foreach (string s in tmp) | 1653 | foreach (string s in tmp) |
1651 | { | 1654 | { |
1652 | _RowIdx++; | 1655 | _RowIdx++; |
1653 | delimiterChars = ':'; | 1656 | delimiterChars = ':'; |
1654 | 1657 | ||
1655 | if (s.Split(delimiterChars)[0] == "Mode") | 1658 | if (s.Split(delimiterChars)[0] == "Mode") |
1656 | { | 1659 | { |
1657 | double distance = 0; | 1660 | double distance = 0; |
1658 | if (i == NodeInfo_List.Count - 1) | 1661 | if (i == NodeInfo_List.Count - 1) |
1659 | { | 1662 | { |
1660 | distance = 0; | 1663 | distance = 0; |
1661 | } | 1664 | } |
1662 | else | 1665 | else |
1663 | { | 1666 | { |
1664 | distance = DistanceCalculate(NodeInfo_List[i].X, NodeInfo_List[i].Y, NodeInfo_List[i + 1].X, NodeInfo_List[i + 1].Y); | 1667 | distance = DistanceCalculate(NodeInfo_List[i].X, NodeInfo_List[i].Y, NodeInfo_List[i + 1].X, NodeInfo_List[i + 1].Y); |
1665 | } | 1668 | } |
1666 | _Content = "MOVE " + distance.ToString() + "mm"; | 1669 | _Content = "MOVE " + distance.ToString() + "mm"; |
1667 | } | 1670 | } |
1668 | else | 1671 | else |
1669 | { | 1672 | { |
1670 | _Content = s.Split(delimiterChars)[0] + " " + s.Split(delimiterChars)[1]; | 1673 | _Content = s.Split(delimiterChars)[0] + " " + s.Split(delimiterChars)[1]; |
1671 | } | 1674 | } |
1672 | 1675 | ||
1673 | AddLabeltoGrid(_RowIdx, 1, _Content); | 1676 | AddLabeltoGrid(_RowIdx, 1, _Content); |
1674 | } | 1677 | } |
1675 | } | 1678 | } |
1676 | 1679 | ||
1677 | if (ni.Mode2 != "" && ni.Mode2 != null) | 1680 | if (ni.Mode2 != "" && ni.Mode2 != null) |
1678 | { | 1681 | { |
1679 | char delimiterChars = '_'; | 1682 | char delimiterChars = '_'; |
1680 | string[] tmp = ni.Mode2.Split(delimiterChars); | 1683 | string[] tmp = ni.Mode2.Split(delimiterChars); |
1681 | foreach (string s in tmp) | 1684 | foreach (string s in tmp) |
1682 | { | 1685 | { |
1683 | _RowIdx++; | 1686 | _RowIdx++; |
1684 | delimiterChars = ':'; | 1687 | delimiterChars = ':'; |
1685 | 1688 | ||
1686 | if (s.Split(delimiterChars)[0] == "Mode") | 1689 | if (s.Split(delimiterChars)[0] == "Mode") |
1687 | { | 1690 | { |
1688 | double distance = 0; | 1691 | double distance = 0; |
1689 | if (i == NodeInfo_List.Count - 1) | 1692 | if (i == NodeInfo_List.Count - 1) |
1690 | { | 1693 | { |
1691 | distance = 0; | 1694 | distance = 0; |
1692 | } | 1695 | } |
1693 | else | 1696 | else |
1694 | { | 1697 | { |
1695 | distance = DistanceCalculate(NodeInfo_List[i].X, NodeInfo_List[i].Y, NodeInfo_List[i + 1].X, NodeInfo_List[i + 1].Y); | 1698 | distance = DistanceCalculate(NodeInfo_List[i].X, NodeInfo_List[i].Y, NodeInfo_List[i + 1].X, NodeInfo_List[i + 1].Y); |
1696 | } | 1699 | } |
1697 | _Content = "MOVE " + distance.ToString() + "mm"; | 1700 | _Content = "MOVE " + distance.ToString() + "mm"; |
1698 | } | 1701 | } |
1699 | else | 1702 | else |
1700 | { | 1703 | { |
1701 | _Content = s.Split(delimiterChars)[0] + " " + s.Split(delimiterChars)[1]; | 1704 | _Content = s.Split(delimiterChars)[0] + " " + s.Split(delimiterChars)[1]; |
1702 | } | 1705 | } |
1703 | 1706 | ||
1704 | AddLabeltoGrid(_RowIdx, 1, _Content); | 1707 | AddLabeltoGrid(_RowIdx, 1, _Content); |
1705 | } | 1708 | } |
1706 | } | 1709 | } |
1707 | 1710 | ||
1708 | if (ni.Mode3 != "" && ni.Mode3 != null) | 1711 | if (ni.Mode3 != "" && ni.Mode3 != null) |
1709 | { | 1712 | { |
1710 | char delimiterChars = '_'; | 1713 | char delimiterChars = '_'; |
1711 | string[] tmp = ni.Mode3.Split(delimiterChars); | 1714 | string[] tmp = ni.Mode3.Split(delimiterChars); |
1712 | foreach (string s in tmp) | 1715 | foreach (string s in tmp) |
1713 | { | 1716 | { |
1714 | _RowIdx++; | 1717 | _RowIdx++; |
1715 | delimiterChars = ':'; | 1718 | delimiterChars = ':'; |
1716 | 1719 | ||
1717 | if (s.Split(delimiterChars)[0] == "Mode") | 1720 | if (s.Split(delimiterChars)[0] == "Mode") |
1718 | { | 1721 | { |
1719 | double distance = 0; | 1722 | double distance = 0; |
1720 | if (i == NodeInfo_List.Count - 1) | 1723 | if (i == NodeInfo_List.Count - 1) |
1721 | { | 1724 | { |
1722 | distance = 0; | 1725 | distance = 0; |
1723 | } | 1726 | } |
1724 | else | 1727 | else |
1725 | { | 1728 | { |
1726 | distance = DistanceCalculate(NodeInfo_List[i].X, NodeInfo_List[i].Y, NodeInfo_List[i + 1].X, NodeInfo_List[i + 1].Y); | 1729 | distance = DistanceCalculate(NodeInfo_List[i].X, NodeInfo_List[i].Y, NodeInfo_List[i + 1].X, NodeInfo_List[i + 1].Y); |
1727 | } | 1730 | } |
1728 | _Content = "MOVE " + distance.ToString() + "mm"; | 1731 | _Content = "MOVE " + distance.ToString() + "mm"; |
1729 | } | 1732 | } |
1730 | else | 1733 | else |
1731 | { | 1734 | { |
1732 | _Content = s.Split(delimiterChars)[0] + " " + s.Split(delimiterChars)[1]; | 1735 | _Content = s.Split(delimiterChars)[0] + " " + s.Split(delimiterChars)[1]; |
1733 | } | 1736 | } |
1734 | 1737 | ||
1735 | AddLabeltoGrid(_RowIdx, 1, _Content); | 1738 | AddLabeltoGrid(_RowIdx, 1, _Content); |
1736 | } | 1739 | } |
1737 | } | 1740 | } |
1738 | _RowIdx ++; | 1741 | _RowIdx ++; |
1739 | } | 1742 | } |
1740 | } | 1743 | } |
1741 | } | 1744 | } |
1742 | 1745 | ||
1743 | public double DistanceCalculate(double _X1, double _Y1, double _X2, double _Y2) | 1746 | public double DistanceCalculate(double _X1, double _Y1, double _X2, double _Y2) |
1744 | { | 1747 | { |
1745 | double dist = 0; | 1748 | double dist = 0; |
1746 | 1749 | ||
1747 | if (_X1 == _X2) | 1750 | if (_X1 == _X2) |
1748 | { | 1751 | { |
1749 | dist = System.Math.Abs(_Y1 - _Y2) * DISTANCE_RATIO; | 1752 | dist = System.Math.Abs(_Y1 - _Y2) * DISTANCE_RATIO; |
1750 | } | 1753 | } |
1751 | else if (_Y1 == _Y2) | 1754 | else if (_Y1 == _Y2) |
1752 | { | 1755 | { |
1753 | dist = System.Math.Abs(_X1 - _X2) * DISTANCE_RATIO; | 1756 | dist = System.Math.Abs(_X1 - _X2) * DISTANCE_RATIO; |
1754 | } | 1757 | } |
1755 | return dist; | 1758 | return dist; |
1756 | } | 1759 | } |
1757 | 1760 | ||
1758 | public void AddLabeltoGrid(int RowIdx, int ColIdx, string Content) | 1761 | public void AddLabeltoGrid(int RowIdx, int ColIdx, string Content) |
1759 | { | 1762 | { |
1760 | //Add Row to Grid | 1763 | //Add Row to Grid |
1761 | RowDefinition _rd = new RowDefinition(); | 1764 | RowDefinition _rd = new RowDefinition(); |
1762 | ((MainWindow)System.Windows.Application.Current.MainWindow).grdRouteInfo.RowDefinitions.Add(_rd); | 1765 | ((MainWindow)System.Windows.Application.Current.MainWindow).grdRouteInfo.RowDefinitions.Add(_rd); |
1763 | 1766 | ||
1764 | // Add data to Grid | 1767 | // Add data to Grid |
1765 | Label dynamicLabel = new Label(); | 1768 | Label dynamicLabel = new Label(); |
1766 | 1769 | ||
1767 | dynamicLabel.Content = Content; | 1770 | dynamicLabel.Content = Content; |
1768 | dynamicLabel.Margin = new Thickness(0, 0, 0, 0); | 1771 | dynamicLabel.Margin = new Thickness(0, 0, 0, 0); |
1769 | dynamicLabel.Foreground = new SolidColorBrush(Colors.Black); | 1772 | dynamicLabel.Foreground = new SolidColorBrush(Colors.Black); |
1770 | dynamicLabel.Background = new SolidColorBrush(Colors.White); | 1773 | dynamicLabel.Background = new SolidColorBrush(Colors.White); |
1771 | dynamicLabel.BorderBrush = new SolidColorBrush(Colors.LightGray); | 1774 | dynamicLabel.BorderBrush = new SolidColorBrush(Colors.LightGray); |
1772 | dynamicLabel.BorderThickness = new Thickness(1); | 1775 | dynamicLabel.BorderThickness = new Thickness(1); |
1773 | 1776 | ||
1774 | Grid.SetRow(dynamicLabel, RowIdx); | 1777 | Grid.SetRow(dynamicLabel, RowIdx); |
1775 | Grid.SetColumn(dynamicLabel, ColIdx); | 1778 | Grid.SetColumn(dynamicLabel, ColIdx); |
1776 | ((MainWindow)System.Windows.Application.Current.MainWindow).grdRouteInfo.Children.Add(dynamicLabel); | 1779 | ((MainWindow)System.Windows.Application.Current.MainWindow).grdRouteInfo.Children.Add(dynamicLabel); |
1777 | } | 1780 | } |
1778 | #endregion | 1781 | #endregion |
1779 | 1782 | ||
1780 | 1783 | ||
1781 | public void CreateGoalPoint() | 1784 | public void CreateGoalPoint() |
1782 | { | 1785 | { |
1783 | isStartDrawRoute = false; | 1786 | isStartDrawRoute = false; |
1784 | if (_goalPoint == null) | 1787 | if (_goalPoint == null) |
1785 | { | 1788 | { |
1786 | _goalPoint = new ucStartEndButton(); | 1789 | _goalPoint = new ucStartEndButton(); |
1787 | _goalPoint.btnWidth = 50.0; | 1790 | _goalPoint.btnWidth = 50.0; |
1788 | _goalPoint.btnHeight = 50.0; | 1791 | _goalPoint.btnHeight = 50.0; |
1789 | _goalPoint.buttText = "G"; | 1792 | _goalPoint.buttText = "G"; |
1790 | Canvas.SetLeft(_goalPoint, 675); | 1793 | Canvas.SetLeft(_goalPoint, 675); |
1791 | Canvas.SetTop(_goalPoint, 75); | 1794 | Canvas.SetTop(_goalPoint, 75); |
1792 | this.Children.Add(_goalPoint); | 1795 | this.Children.Add(_goalPoint); |
1793 | } | 1796 | } |
1794 | } | 1797 | } |
1795 | 1798 | ||
1796 | public void CreateStartPoint() | 1799 | public void CreateStartPoint() |
1797 | { | 1800 | { |
1798 | isStartDrawRoute = false; | 1801 | isStartDrawRoute = false; |
1799 | if (_startPoint == null) | 1802 | if (_startPoint == null) |
1800 | { | 1803 | { |
1801 | _startPoint = new ucStartEndButton(); | 1804 | _startPoint = new ucStartEndButton(); |
1802 | _startPoint.btnWidth = 50.0; | 1805 | _startPoint.btnWidth = 50.0; |
1803 | _startPoint.btnHeight = 50.0; | 1806 | _startPoint.btnHeight = 50.0; |
1804 | _startPoint.buttText = "S"; | 1807 | _startPoint.buttText = "S"; |
1805 | Canvas.SetLeft(_startPoint, 75); | 1808 | Canvas.SetLeft(_startPoint, 75); |
1806 | Canvas.SetTop(_startPoint, 675); | 1809 | Canvas.SetTop(_startPoint, 675); |
1807 | this.Children.Add(_startPoint); | 1810 | this.Children.Add(_startPoint); |
1808 | } | 1811 | } |
1809 | } | 1812 | } |
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 Header="Project [AAA工場]" FontSize="17"> | 41 | <TreeViewItem Header="Project [AAA工場]" FontSize="17"> |
42 | <TreeViewItem Header="MAP" FontSize="17"> | 42 | <TreeViewItem Header="MAP" FontSize="17"> |
43 | <TreeViewItem Header="Pass plan" | 43 | <TreeViewItem Header="Pass plan" FontSize="17" Name="PassplanTree" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="PassplanTree"> |
44 | FontSize="17" | 44 | <TreeViewItem Header="Set Start" FontSize="17" Name="btnSetStart" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="SetStart"></TreeViewItem> |
45 | Name="PassplanTree" | 45 | <TreeViewItem Header="Set Goal" FontSize="17" Name="btnSetGoal" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="SetGoal"></TreeViewItem> |
46 | Selected="GetPassplanTree" | 46 | <TreeViewItem Header="Set Route" FontSize="17" Name="btnSetRoute" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="SetupRoute"></TreeViewItem> |
47 | Unselected="SetPassplanTree" | 47 | <TreeViewItem Header="Make Root" FontSize="17" Name="btnMakeRoot" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="MakeRoot"></TreeViewItem> |
48 | > | 48 | <TreeViewItem Header="Delete Route" FontSize="17" Name="btnDeleteRoute" Selected="btnMenu_Selected" Unselected="btnMenu_UnselectedSet" Tag="DeleteRoute"></TreeViewItem> |
49 | </TreeViewItem> | 49 | </TreeViewItem> |
50 | <TreeViewItem Header="Node" | 50 | <TreeViewItem Header="Node" |
51 | FontSize="17" | 51 | FontSize="17" |
52 | Name="NodeTree" | 52 | Name="NodeTree" |
53 | Selected="GetNodeTree" | 53 | Selected="GetNodeTree" |
54 | Unselected="SetNodeTree" | 54 | Unselected="SetNodeTree" |
55 | > | 55 | > |
56 | </TreeViewItem> | 56 | </TreeViewItem> |
57 | <TreeViewItem Header="--------------------" FontSize="17"> | 57 | <TreeViewItem Header="--------------------" FontSize="17"> |
58 | </TreeViewItem> | 58 | </TreeViewItem> |
59 | </TreeViewItem> | 59 | </TreeViewItem> |
60 | 60 | ||
61 | <TreeViewItem Header="Vehicle" FontSize="17"> | 61 | <TreeViewItem Header="Vehicle" FontSize="17"> |
62 | <TreeViewItem Header="FK15_#1" | 62 | <TreeViewItem Header="FK15_#1" |
63 | FontSize="17" | 63 | FontSize="17" |
64 | Name="FK15Tree" | 64 | Name="FK15Tree" |
65 | Selected="GetFK15Tree" | 65 | Selected="GetFK15Tree" |
66 | Unselected="SetFK15Tree"> | 66 | Unselected="SetFK15Tree"> |
67 | </TreeViewItem> | 67 | </TreeViewItem> |
68 | <TreeViewItem Header="[+]" | 68 | <TreeViewItem Header="[+]" |
69 | FontSize="17" | 69 | FontSize="17" |
70 | Name="VehicleAddTree" | 70 | Name="VehicleAddTree" |
71 | Selected="GetVehicleAddTree" | 71 | Selected="GetVehicleAddTree" |
72 | Unselected="SetVehicleAddTree"> | 72 | Unselected="SetVehicleAddTree"> |
73 | </TreeViewItem> | 73 | </TreeViewItem> |
74 | <TreeViewItem Header="--------------------"> | 74 | <TreeViewItem Header="--------------------"> |
75 | </TreeViewItem> | 75 | </TreeViewItem> |
76 | </TreeViewItem> | 76 | </TreeViewItem> |
77 | 77 | ||
78 | <TreeViewItem Header="Work" | 78 | <TreeViewItem Header="Work" |
79 | FontSize="17"> | 79 | FontSize="17"> |
80 | <TreeViewItem Header="Task patterm [FK15_#1]" | 80 | <TreeViewItem Header="Task patterm [FK15_#1]" |
81 | FontSize="17" | 81 | FontSize="17" |
82 | Name="TaskpattermTree" | 82 | Name="TaskpattermTree" |
83 | Selected="GetTaskpattermTree" | 83 | Selected="GetTaskpattermTree" |
84 | Unselected="SetTaskpattermTree"> | 84 | Unselected="SetTaskpattermTree"> |
85 | </TreeViewItem> | 85 | </TreeViewItem> |
86 | <TreeViewItem Header="[+]" | 86 | <TreeViewItem Header="[+]" |
87 | FontSize="17" | 87 | FontSize="17" |
88 | Name="WorkAddTree" | 88 | Name="WorkAddTree" |
89 | Selected="GetWorkAddTree" | 89 | Selected="GetWorkAddTree" |
90 | Unselected="SetWorkAddTree"> | 90 | Unselected="SetWorkAddTree"> |
91 | </TreeViewItem> | 91 | </TreeViewItem> |
92 | <TreeViewItem Header="--------------------" | 92 | <TreeViewItem Header="--------------------" |
93 | FontSize="17"> | 93 | FontSize="17"> |
94 | </TreeViewItem> | 94 | </TreeViewItem> |
95 | </TreeViewItem> | 95 | </TreeViewItem> |
96 | 96 | ||
97 | <TreeViewItem Header="Setting" | 97 | <TreeViewItem Header="Setting" |
98 | FontSize="17"> | 98 | FontSize="17"> |
99 | <TreeViewItem Header="Connect [Wi-Fi]" | 99 | <TreeViewItem Header="Connect [Wi-Fi]" |
100 | FontSize="17" | 100 | FontSize="17" |
101 | Name="ConnectTree" | 101 | Name="ConnectTree" |
102 | Selected="GetConnectTree" | 102 | Selected="GetConnectTree" |
103 | Unselected="SetConnectTree"> | 103 | Unselected="SetConnectTree"> |
104 | </TreeViewItem> | 104 | </TreeViewItem> |
105 | <TreeViewItem Header="Parameter" | 105 | <TreeViewItem Header="Parameter" |
106 | FontSize="17" | 106 | FontSize="17" |
107 | Name="ParameterTree" | 107 | Name="ParameterTree" |
108 | Selected="GetParameterTree" | 108 | Selected="GetParameterTree" |
109 | Unselected="SetParameterTree"> | 109 | Unselected="SetParameterTree"> |
110 | </TreeViewItem> | 110 | </TreeViewItem> |
111 | <TreeViewItem Header="--------------------" | 111 | <TreeViewItem Header="--------------------" |
112 | FontSize="17"> | 112 | FontSize="17"> |
113 | </TreeViewItem> | 113 | </TreeViewItem> |
114 | </TreeViewItem> | 114 | </TreeViewItem> |
115 | <TreeViewItem Header="Schedule" | 115 | <TreeViewItem Header="Schedule" |
116 | FontSize="17" | 116 | FontSize="17" |
117 | Name="ScheduleTree" | 117 | Name="ScheduleTree" |
118 | Selected="GetScheduleTree" | 118 | Selected="GetScheduleTree" |
119 | Unselected="SetScheduleTree"> | 119 | Unselected="SetScheduleTree"> |
120 | </TreeViewItem> | 120 | </TreeViewItem> |
121 | <TreeViewItem Header="Logging" | 121 | <TreeViewItem Header="Logging" |
122 | FontSize="17" | 122 | FontSize="17" |
123 | Name="LoggingTree" | 123 | Name="LoggingTree" |
124 | Selected="GetLoggingTree" | 124 | Selected="GetLoggingTree" |
125 | Unselected="SetLoggingTree"> | 125 | Unselected="SetLoggingTree"> |
126 | </TreeViewItem> | 126 | </TreeViewItem> |
127 | <TreeViewItem Header=" --------------------"> | 127 | <TreeViewItem Header=" --------------------"> |
128 | </TreeViewItem> | 128 | </TreeViewItem> |
129 | </TreeViewItem> | 129 | </TreeViewItem> |
130 | <TreeViewItem Header="Alert" | 130 | <TreeViewItem Header="Alert" |
131 | FontSize="17" | 131 | FontSize="17" |
132 | Name="AlertTree" | 132 | Name="AlertTree" |
133 | Selected="GetAlertTree" | 133 | Selected="GetAlertTree" |
134 | Unselected="SetAlertTree"> | 134 | Unselected="SetAlertTree"> |
135 | </TreeViewItem> | 135 | </TreeViewItem> |
136 | <TreeViewItem Header="Help" | 136 | <TreeViewItem Header="Help" |
137 | FontSize="17" | 137 | FontSize="17" |
138 | Name="HelpTree" | 138 | Name="HelpTree" |
139 | Selected="GetHelpTree" | 139 | Selected="GetHelpTree" |
140 | Unselected="SetHelpTree"> | 140 | Unselected="SetHelpTree"> |
141 | </TreeViewItem> | 141 | </TreeViewItem> |
142 | <TreeViewItem Header="[+New Project]" | 142 | <TreeViewItem Header="[+New Project]" |
143 | FontSize="17" | 143 | FontSize="17" |
144 | Name="NewProjectTree" | 144 | Name="NewProjectTree" |
145 | Selected="GetNewProjectTree" | 145 | Selected="GetNewProjectTree" |
146 | Unselected="SetNewProjectTree"> | 146 | Unselected="SetNewProjectTree"> |
147 | </TreeViewItem> | 147 | </TreeViewItem> |
148 | </TreeView> | 148 | </TreeView> |
149 | </Border> | 149 | </Border> |
150 | <Border Grid.Row="1" BorderThickness="1" BorderBrush="Gray" Margin="0,5,0,0"> | 150 | <Border Grid.Row="1" BorderThickness="1" BorderBrush="Gray" Margin="0,5,0,0"> |
151 | 151 | ||
152 | <Grid ShowGridLines="False"> | 152 | <Grid ShowGridLines="False"> |
153 | <Grid.RowDefinitions> | 153 | <Grid.RowDefinitions> |
154 | <RowDefinition Height="1*"/> | 154 | <RowDefinition Height="1*"/> |
155 | <RowDefinition Height="5*"/> | 155 | <RowDefinition Height="5*"/> |
156 | </Grid.RowDefinitions> | 156 | </Grid.RowDefinitions> |
157 | <Label Grid.Row="0" Content="Viewer" Margin="10,0,0,0" | 157 | <Label Grid.Row="0" Content="Viewer" Margin="10,0,0,0" |
158 | FontSize="17"/> | 158 | FontSize="17"/> |
159 | </Grid> | 159 | </Grid> |
160 | </Border> | 160 | </Border> |
161 | </Grid> | 161 | </Grid> |
162 | <TabControl x:Name="MainTab" | 162 | <TabControl x:Name="MainTab" |
163 | Margin="0,0,0,0" | 163 | Margin="0,0,0,0" |
164 | Grid.Column="2" > | 164 | Grid.Column="2" > |
165 | <TabItem x:Name="TabMap" > | 165 | <TabItem x:Name="TabMap" > |
166 | <TabItem.Header> | 166 | <TabItem.Header> |
167 | <StackPanel Orientation="Horizontal"> | 167 | <StackPanel Orientation="Horizontal"> |
168 | <TextBlock Text="MAP " VerticalAlignment="Center" FontSize="17"></TextBlock> | 168 | <TextBlock Text="MAP " VerticalAlignment="Center" FontSize="17"></TextBlock> |
169 | </StackPanel> | 169 | </StackPanel> |
170 | </TabItem.Header> | 170 | </TabItem.Header> |
171 | <Grid ShowGridLines="False"> | 171 | <Grid ShowGridLines="False"> |
172 | <Grid.RowDefinitions> | 172 | <Grid.RowDefinitions> |
173 | <RowDefinition Height="5*"/> | 173 | <RowDefinition Height="5*"/> |
174 | <RowDefinition Height="1*"/> | 174 | <RowDefinition Height="1*"/> |
175 | <RowDefinition Height="1*"/> | 175 | <RowDefinition Height="1*"/> |
176 | </Grid.RowDefinitions> | 176 | </Grid.RowDefinitions> |
177 | 177 | ||
178 | <Grid ShowGridLines="False" Grid.Row="0" Name="GridMap"> | 178 | <Grid ShowGridLines="False" Grid.Row="0" Name="GridMap"> |
179 | <Grid > | 179 | <Grid > |
180 | <Grid.ColumnDefinitions> | 180 | <Grid.ColumnDefinitions> |
181 | <ColumnDefinition Width="{Binding ActualHeight, ElementName=GridMap}"/> | 181 | <ColumnDefinition Width="{Binding ActualHeight, ElementName=GridMap}"/> |
182 | <ColumnDefinition Width="*"/> | 182 | <ColumnDefinition Width="*"/> |
183 | </Grid.ColumnDefinitions> | 183 | </Grid.ColumnDefinitions> |
184 | <Border Grid.Column="0" BorderThickness="1" BorderBrush="Red" Margin="5,5,5,5"> | 184 | <Border Grid.Column="0" BorderThickness="1" BorderBrush="Red" Margin="5,5,5,5"> |
185 | 185 | ||
186 | <s:DesignerCanvas x:Name="MyDesignerCanvas" | 186 | <s:DesignerCanvas x:Name="MyDesignerCanvas" |
187 | AllowDrop="True" | 187 | AllowDrop="True" |
188 | Background="White" HorizontalAlignment="Stretch"> | 188 | Background="White" HorizontalAlignment="Stretch"> |
189 | <Canvas.LayoutTransform> | 189 | <Canvas.LayoutTransform> |
190 | <!--Adjust ScaleX and ScaleY in lock-step to zoom--> | 190 | <!--Adjust ScaleX and ScaleY in lock-step to zoom--> |
191 | <ScaleTransform ScaleX=".8" ScaleY=".8" CenterX=".8" CenterY=".8" /> | 191 | <ScaleTransform ScaleX=".67" ScaleY=".59" CenterX=".67" CenterY=".59" /> |
192 | </Canvas.LayoutTransform> | 192 | </Canvas.LayoutTransform> |
193 | <Grid Name="MCGrid" Background="White" ShowGridLines="True" | 193 | <Grid Name="MCGrid" Background="White" ShowGridLines="True" |
194 | Width="{Binding ActualWidth, ElementName=MyDesignerCanvas}" | 194 | Width="{Binding ActualWidth, ElementName=MyDesignerCanvas}" |
195 | Height="{Binding ActualHeight, ElementName=MyDesignerCanvas}"> | 195 | Height="{Binding ActualHeight, ElementName=MyDesignerCanvas}"> |
196 | 196 | ||
197 | <Grid.RowDefinitions> | 197 | <Grid.RowDefinitions> |
198 | <RowDefinition Height="1*"/> | 198 | <RowDefinition Height="1*"/> |
199 | <RowDefinition Height="1*"/> | 199 | <RowDefinition Height="1*"/> |
200 | <RowDefinition Height="1*"/> | 200 | <RowDefinition Height="1*"/> |
201 | <RowDefinition Height="1*"/> | 201 | <RowDefinition Height="1*"/> |
202 | <RowDefinition Height="1*"/> | 202 | <RowDefinition Height="1*"/> |
203 | <RowDefinition Height="1*"/> | 203 | <RowDefinition Height="1*"/> |
204 | <RowDefinition Height="1*"/> | 204 | <RowDefinition Height="1*"/> |
205 | <RowDefinition Height="1*"/> | 205 | <RowDefinition Height="1*"/> |
206 | <RowDefinition Height="1*"/> | 206 | <RowDefinition Height="1*"/> |
207 | <RowDefinition Height="1*"/> | 207 | <RowDefinition Height="1*"/> |
208 | </Grid.RowDefinitions> | 208 | </Grid.RowDefinitions> |
209 | <Grid.ColumnDefinitions> | 209 | <Grid.ColumnDefinitions> |
210 | <ColumnDefinition Width="*"/> | 210 | <ColumnDefinition Width="*"/> |
211 | <ColumnDefinition Width="*"/> | 211 | <ColumnDefinition Width="*"/> |
212 | <ColumnDefinition Width="*"/> | 212 | <ColumnDefinition Width="*"/> |
213 | <ColumnDefinition Width="*"/> | 213 | <ColumnDefinition Width="*"/> |
214 | <ColumnDefinition Width="*"/> | 214 | <ColumnDefinition Width="*"/> |
215 | <ColumnDefinition Width="*"/> | 215 | <ColumnDefinition Width="*"/> |
216 | <ColumnDefinition Width="*"/> | 216 | <ColumnDefinition Width="*"/> |
217 | <ColumnDefinition Width="*"/> | 217 | <ColumnDefinition Width="*"/> |
218 | <ColumnDefinition Width="*"/> | 218 | <ColumnDefinition Width="*"/> |
219 | <ColumnDefinition Width="*"/> | 219 | <ColumnDefinition Width="*"/> |
220 | </Grid.ColumnDefinitions> | 220 | </Grid.ColumnDefinitions> |
221 | <TextBlock Grid.Row="0" Grid.Column="1" Foreground="SkyBlue">100</TextBlock> | 221 | <TextBlock Grid.Row="0" Grid.Column="1" Foreground="SkyBlue">100</TextBlock> |
222 | <TextBlock Grid.Row="0" Grid.Column="2" Foreground="SkyBlue">200</TextBlock> | 222 | <TextBlock Grid.Row="0" Grid.Column="2" Foreground="SkyBlue">200</TextBlock> |
223 | <TextBlock Grid.Row="0" Grid.Column="3" Foreground="SkyBlue">300</TextBlock> | 223 | <TextBlock Grid.Row="0" Grid.Column="3" Foreground="SkyBlue">300</TextBlock> |
224 | <TextBlock Grid.Row="0" Grid.Column="4" Foreground="SkyBlue">400</TextBlock> | 224 | <TextBlock Grid.Row="0" Grid.Column="4" Foreground="SkyBlue">400</TextBlock> |
225 | <TextBlock Grid.Row="0" Grid.Column="5" Foreground="SkyBlue">500</TextBlock> | 225 | <TextBlock Grid.Row="0" Grid.Column="5" Foreground="SkyBlue">500</TextBlock> |
226 | <TextBlock Grid.Row="0" Grid.Column="6" Foreground="SkyBlue">600</TextBlock> | 226 | <TextBlock Grid.Row="0" Grid.Column="6" Foreground="SkyBlue">600</TextBlock> |
227 | <TextBlock Grid.Row="0" Grid.Column="7" Foreground="SkyBlue">700</TextBlock> | 227 | <TextBlock Grid.Row="0" Grid.Column="7" Foreground="SkyBlue">700</TextBlock> |
228 | <TextBlock Grid.Row="0" Grid.Column="8" Foreground="SkyBlue">800</TextBlock> | 228 | <TextBlock Grid.Row="0" Grid.Column="8" Foreground="SkyBlue">800</TextBlock> |
229 | <TextBlock Grid.Row="0" Grid.Column="9" Foreground="SkyBlue">900</TextBlock> | 229 | <TextBlock Grid.Row="0" Grid.Column="9" Foreground="SkyBlue">900</TextBlock> |
230 | 230 | ||
231 | <TextBlock Grid.Row="1" Grid.Column="0" Foreground="SkyBlue">100</TextBlock> | 231 | <TextBlock Grid.Row="1" Grid.Column="0" Foreground="SkyBlue">100</TextBlock> |
232 | <TextBlock Grid.Row="2" Grid.Column="0" Foreground="SkyBlue">200</TextBlock> | 232 | <TextBlock Grid.Row="2" Grid.Column="0" Foreground="SkyBlue">200</TextBlock> |
233 | <TextBlock Grid.Row="3" Grid.Column="0" Foreground="SkyBlue">300</TextBlock> | 233 | <TextBlock Grid.Row="3" Grid.Column="0" Foreground="SkyBlue">300</TextBlock> |
234 | <TextBlock Grid.Row="4" Grid.Column="0" Foreground="SkyBlue">400</TextBlock> | 234 | <TextBlock Grid.Row="4" Grid.Column="0" Foreground="SkyBlue">400</TextBlock> |
235 | <TextBlock Grid.Row="5" Grid.Column="0" Foreground="SkyBlue">500</TextBlock> | 235 | <TextBlock Grid.Row="5" Grid.Column="0" Foreground="SkyBlue">500</TextBlock> |
236 | <TextBlock Grid.Row="6" Grid.Column="0" Foreground="SkyBlue">600</TextBlock> | 236 | <TextBlock Grid.Row="6" Grid.Column="0" Foreground="SkyBlue">600</TextBlock> |
237 | <TextBlock Grid.Row="7" Grid.Column="0" Foreground="SkyBlue">700</TextBlock> | 237 | <TextBlock Grid.Row="7" Grid.Column="0" Foreground="SkyBlue">700</TextBlock> |
238 | <TextBlock Grid.Row="8" Grid.Column="0" Foreground="SkyBlue">800</TextBlock> | 238 | <TextBlock Grid.Row="8" Grid.Column="0" Foreground="SkyBlue">800</TextBlock> |
239 | <TextBlock Grid.Row="9" Grid.Column="0" Foreground="SkyBlue">900</TextBlock> | 239 | <TextBlock Grid.Row="9" Grid.Column="0" Foreground="SkyBlue">900</TextBlock> |
240 | </Grid> | 240 | </Grid> |
241 | 241 | ||
242 | </s:DesignerCanvas> | 242 | </s:DesignerCanvas> |
243 | 243 | ||
244 | </Border> | 244 | </Border> |
245 | 245 | ||
246 | <Border Grid.Column="1" BorderThickness="1" BorderBrush="Gray" Margin="5,5,5,5"> | 246 | <Border Grid.Column="1" BorderThickness="1" BorderBrush="Gray" Margin="5,5,5,5"> |
247 | 247 | ||
248 | <DockPanel > | 248 | <DockPanel > |
249 | <!--<ScrollViewer>--> | 249 | <!--<ScrollViewer>--> |
250 | <Grid Name="grdRouteInfo"> | 250 | <Grid Name="grdRouteInfo"> |
251 | <Grid.RowDefinitions> | 251 | <Grid.RowDefinitions> |
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 | <RowDefinition Height="1*"/> | 257 | <RowDefinition Height="1*"/> |
258 | <RowDefinition Height="1*"/> | 258 | <RowDefinition Height="1*"/> |
259 | <RowDefinition Height="1*"/> | 259 | <RowDefinition Height="1*"/> |
260 | <RowDefinition Height="1*"/> | 260 | <RowDefinition Height="1*"/> |
261 | <RowDefinition Height="1*"/> | 261 | <RowDefinition Height="1*"/> |
262 | <RowDefinition Height="1*"/> | 262 | <RowDefinition Height="1*"/> |
263 | <RowDefinition Height="1*"/> | 263 | <RowDefinition Height="1*"/> |
264 | <RowDefinition Height="1*"/> | 264 | <RowDefinition Height="1*"/> |
265 | <RowDefinition Height="1*"/> | 265 | <RowDefinition Height="1*"/> |
266 | <RowDefinition Height="1*"/> | 266 | <RowDefinition Height="1*"/> |
267 | 267 | ||
268 | </Grid.RowDefinitions> | 268 | </Grid.RowDefinitions> |
269 | <Grid.ColumnDefinitions> | 269 | <Grid.ColumnDefinitions> |
270 | <ColumnDefinition Width="0.5*"/> | 270 | <ColumnDefinition Width="0.5*"/> |
271 | <ColumnDefinition Width="6*"/> | 271 | <ColumnDefinition Width="6*"/> |
272 | </Grid.ColumnDefinitions> | 272 | </Grid.ColumnDefinitions> |
273 | <Border Grid.Row="0" Grid.Column="0" BorderThickness="1" /> | 273 | <Border Grid.Row="0" Grid.Column="0" BorderThickness="1" /> |
274 | <Border Grid.Row="1" Grid.Column="0" BorderThickness="1" /> | 274 | <Border Grid.Row="1" Grid.Column="0" BorderThickness="1" /> |
275 | <Border Grid.Row="2" Grid.Column="0" BorderThickness="1" /> | 275 | <Border Grid.Row="2" Grid.Column="0" BorderThickness="1" /> |
276 | <Border Grid.Row="3" Grid.Column="0" BorderThickness="1" /> | 276 | <Border Grid.Row="3" Grid.Column="0" BorderThickness="1" /> |
277 | <Border Grid.Row="4" Grid.Column="0" BorderThickness="1" /> | 277 | <Border Grid.Row="4" Grid.Column="0" BorderThickness="1" /> |
278 | <Border Grid.Row="5" Grid.Column="0" BorderThickness="1" /> | 278 | <Border Grid.Row="5" Grid.Column="0" BorderThickness="1" /> |
279 | <Border Grid.Row="6" Grid.Column="0" BorderThickness="1" /> | 279 | <Border Grid.Row="6" Grid.Column="0" BorderThickness="1" /> |
280 | <Border Grid.Row="7" Grid.Column="0" BorderThickness="1" /> | 280 | <Border Grid.Row="7" Grid.Column="0" BorderThickness="1" /> |
281 | <Border Grid.Row="8" Grid.Column="0" BorderThickness="1" /> | 281 | <Border Grid.Row="8" Grid.Column="0" BorderThickness="1" /> |
282 | <Border Grid.Row="9" Grid.Column="0" BorderThickness="1" /> | 282 | <Border Grid.Row="9" Grid.Column="0" BorderThickness="1" /> |
283 | <Border Grid.Row="10" Grid.Column="0" BorderThickness="1" /> | 283 | <Border Grid.Row="10" Grid.Column="0" BorderThickness="1" /> |
284 | <Border Grid.Row="11" Grid.Column="0" BorderThickness="1" /> | 284 | <Border Grid.Row="11" Grid.Column="0" BorderThickness="1" /> |
285 | <Border Grid.Row="12" Grid.Column="0" BorderThickness="1" /> | 285 | <Border Grid.Row="12" Grid.Column="0" BorderThickness="1" /> |
286 | <Border Grid.Row="13" Grid.Column="0" BorderThickness="1" /> | 286 | <Border Grid.Row="13" Grid.Column="0" BorderThickness="1" /> |
287 | <Border Grid.Row="14" Grid.Column="0" BorderThickness="1" /> | 287 | <Border Grid.Row="14" Grid.Column="0" BorderThickness="1" /> |
288 | <Border Grid.Row="15" Grid.Column="0" BorderThickness="1" /> | 288 | <Border Grid.Row="15" Grid.Column="0" BorderThickness="1" /> |
289 | 289 | ||
290 | 290 | ||
291 | 291 | ||
292 | <Label Grid.Row="0" Grid.Column="1" Content="Monitor" FontSize="17"/> | 292 | <Label Grid.Row="0" Grid.Column="1" Content="Monitor" FontSize="17"/> |
293 | <Label Grid.Row="1" Grid.Column="1" Content="AOR 28249 [kg/h]" FontSize="17"/> | 293 | <Label Grid.Row="1" Grid.Column="1" Content="AOR 28249 [kg/h]" FontSize="17"/> |
294 | <Label Grid.Row="2" Grid.Column="1" Content="ABC 4738 [trq]" FontSize="17"/> | 294 | <Label Grid.Row="2" Grid.Column="1" Content="ABC 4738 [trq]" FontSize="17"/> |
295 | <Label Grid.Row="3" Grid.Column="1" Content="ATR 49593 [%]" FontSize="17"/> | 295 | <Label Grid.Row="3" Grid.Column="1" Content="ATR 49593 [%]" FontSize="17"/> |
296 | <Label Grid.Row="4" Grid.Column="1" Content="DEK 50403 [G]" FontSize="17"/> | 296 | <Label Grid.Row="4" Grid.Column="1" Content="DEK 50403 [G]" FontSize="17"/> |
297 | <Label Grid.Row="5" Grid.Column="1" Content="SKG 2739 [kg]" FontSize="17"/> | 297 | <Label Grid.Row="5" Grid.Column="1" Content="SKG 2739 [kg]" FontSize="17"/> |
298 | <Label Grid.Row="6" Grid.Column="1" Content="SOC 86 [%]" FontSize="17"/> | 298 | <Label Grid.Row="6" Grid.Column="1" Content="SOC 86 [%]" FontSize="17"/> |
299 | <Label Grid.Row="7" Grid.Column="1" Content=" :" FontSize="17"/> | 299 | <Label Grid.Row="7" Grid.Column="1" Content=" :" FontSize="17"/> |
300 | <Label Grid.Row="8" Grid.Column="1" Content=" :" FontSize="17"/> | 300 | <Label Grid.Row="8" Grid.Column="1" Content=" :" FontSize="17"/> |
301 | <Label Grid.Row="9" Grid.Column="1" Content=" :" FontSize="17"/> | 301 | <Label Grid.Row="9" Grid.Column="1" Content=" :" FontSize="17"/> |
302 | <Label Grid.Row="10" Grid.Column="1" Content=" :" FontSize="17"/> | 302 | <Label Grid.Row="10" Grid.Column="1" Content=" :" FontSize="17"/> |
303 | <Label Grid.Row="11" Grid.Column="1" Content=" :" FontSize="17"/> | 303 | <Label Grid.Row="11" Grid.Column="1" Content=" :" FontSize="17"/> |
304 | </Grid> | 304 | </Grid> |
305 | <!--</ScrollViewer>--> | 305 | <!--</ScrollViewer>--> |
306 | </DockPanel > | 306 | </DockPanel > |
307 | </Border> | 307 | </Border> |
308 | </Grid> | 308 | </Grid> |
309 | 309 | ||
310 | </Grid> | 310 | </Grid> |
311 | <Border Grid.Row="1" BorderThickness="1" BorderBrush="Gray" Margin="5,5,5,5"> | 311 | <Border Grid.Row="1" BorderThickness="1" BorderBrush="Gray" Margin="5,5,5,5"> |
312 | <Grid ShowGridLines="False"> | 312 | <Grid ShowGridLines="False"> |
313 | <Grid.ColumnDefinitions> | 313 | <Grid.ColumnDefinitions> |
314 | <ColumnDefinition Width="1*"/> | 314 | <ColumnDefinition Width="1*"/> |
315 | <ColumnDefinition Width="8*"/> | 315 | <ColumnDefinition Width="8*"/> |
316 | </Grid.ColumnDefinitions> | 316 | </Grid.ColumnDefinitions> |
317 | <Grid ShowGridLines="False" Grid.Column="0"> | 317 | <Grid ShowGridLines="False" Grid.Column="0"> |
318 | <Grid.RowDefinitions> | 318 | <Grid.RowDefinitions> |
319 | <RowDefinition Height="1*"/> | 319 | <RowDefinition Height="1*"/> |
320 | <RowDefinition Height="1*"/> | 320 | <RowDefinition Height="1*"/> |
321 | <RowDefinition Height="1*"/> | 321 | <RowDefinition Height="1*"/> |
322 | </Grid.RowDefinitions> | 322 | </Grid.RowDefinitions> |
323 | <Label Grid.Row="0" Content="Schedule" Margin="10,0,0,0" FontSize="17"/> | 323 | <Label Grid.Row="0" Content="Schedule" Margin="10,0,0,0" FontSize="17"/> |
324 | <Label Grid.Row="1" Content="FK15_#1" Margin="10,0,0,0" FontSize="17"/> | 324 | <Label Grid.Row="1" Content="FK15_#1" Margin="10,0,0,0" FontSize="17"/> |
325 | </Grid> | 325 | </Grid> |
326 | <Border Grid.Column="1" BorderThickness="1" BorderBrush="Red" Margin="5,5,5,5"> | 326 | <Border Grid.Column="1" BorderThickness="1" BorderBrush="Red" Margin="5,5,5,5"> |
327 | 327 | ||
328 | <s:DesignerCanvas x:Name="MyDesignerCanvasSchedule" | 328 | <s:DesignerCanvas x:Name="MyDesignerCanvasSchedule" |
329 | AllowDrop="True" | 329 | AllowDrop="True" |
330 | Background="White" HorizontalAlignment="Stretch"> | 330 | Background="White" HorizontalAlignment="Stretch"> |
331 | <Grid Name="MCGridShedule" Background="White" ShowGridLines="True" | 331 | <Grid Name="MCGridShedule" Background="White" ShowGridLines="True" |
332 | Width="{Binding ActualWidth, ElementName=MyDesignerCanvasSchedule}" | 332 | Width="{Binding ActualWidth, ElementName=MyDesignerCanvasSchedule}" |
333 | Height="{Binding ActualHeight, ElementName=MyDesignerCanvasSchedule}"> | 333 | Height="{Binding ActualHeight, ElementName=MyDesignerCanvasSchedule}"> |
334 | 334 | ||
335 | <Grid.RowDefinitions> | 335 | <Grid.RowDefinitions> |
336 | <RowDefinition Height="1*"/> | 336 | <RowDefinition Height="1*"/> |
337 | <RowDefinition Height="1*"/> | 337 | <RowDefinition Height="1*"/> |
338 | </Grid.RowDefinitions> | 338 | </Grid.RowDefinitions> |
339 | <Grid.ColumnDefinitions> | 339 | <Grid.ColumnDefinitions> |
340 | <ColumnDefinition Width="*"/> | 340 | <ColumnDefinition Width="*"/> |
341 | <ColumnDefinition Width="*"/> | 341 | <ColumnDefinition Width="*"/> |
342 | <ColumnDefinition Width="*"/> | 342 | <ColumnDefinition Width="*"/> |
343 | <ColumnDefinition Width="*"/> | 343 | <ColumnDefinition Width="*"/> |
344 | <ColumnDefinition Width="*"/> | 344 | <ColumnDefinition Width="*"/> |
345 | <ColumnDefinition Width="*"/> | 345 | <ColumnDefinition Width="*"/> |
346 | <ColumnDefinition Width="*"/> | 346 | <ColumnDefinition Width="*"/> |
347 | <ColumnDefinition Width="*"/> | 347 | <ColumnDefinition Width="*"/> |
348 | <ColumnDefinition Width="*"/> | 348 | <ColumnDefinition Width="*"/> |
349 | <ColumnDefinition Width="*"/> | 349 | <ColumnDefinition Width="*"/> |
350 | </Grid.ColumnDefinitions> | 350 | </Grid.ColumnDefinitions> |
351 | <TextBlock Grid.Row="0" Grid.Column="1" Foreground="SkyBlue">100</TextBlock> | 351 | <TextBlock Grid.Row="0" Grid.Column="1" Foreground="SkyBlue">100</TextBlock> |
352 | <TextBlock Grid.Row="0" Grid.Column="2" Foreground="SkyBlue">200</TextBlock> | 352 | <TextBlock Grid.Row="0" Grid.Column="2" Foreground="SkyBlue">200</TextBlock> |
353 | <TextBlock Grid.Row="0" Grid.Column="3" Foreground="SkyBlue">300</TextBlock> | 353 | <TextBlock Grid.Row="0" Grid.Column="3" Foreground="SkyBlue">300</TextBlock> |
354 | <TextBlock Grid.Row="0" Grid.Column="4" Foreground="SkyBlue">400</TextBlock> | 354 | <TextBlock Grid.Row="0" Grid.Column="4" Foreground="SkyBlue">400</TextBlock> |
355 | <TextBlock Grid.Row="0" Grid.Column="5" Foreground="SkyBlue">500</TextBlock> | 355 | <TextBlock Grid.Row="0" Grid.Column="5" Foreground="SkyBlue">500</TextBlock> |
356 | <TextBlock Grid.Row="0" Grid.Column="6" Foreground="SkyBlue">600</TextBlock> | 356 | <TextBlock Grid.Row="0" Grid.Column="6" Foreground="SkyBlue">600</TextBlock> |
357 | <TextBlock Grid.Row="0" Grid.Column="7" Foreground="SkyBlue">700</TextBlock> | 357 | <TextBlock Grid.Row="0" Grid.Column="7" Foreground="SkyBlue">700</TextBlock> |
358 | <TextBlock Grid.Row="0" Grid.Column="8" Foreground="SkyBlue">800</TextBlock> | 358 | <TextBlock Grid.Row="0" Grid.Column="8" Foreground="SkyBlue">800</TextBlock> |
359 | <TextBlock Grid.Row="0" Grid.Column="9" Foreground="SkyBlue">900</TextBlock> | 359 | <TextBlock Grid.Row="0" Grid.Column="9" Foreground="SkyBlue">900</TextBlock> |
360 | 360 | ||
361 | <TextBlock Grid.Row="1" Grid.Column="0" Foreground="SkyBlue">100</TextBlock> | 361 | <TextBlock Grid.Row="1" Grid.Column="0" Foreground="SkyBlue">100</TextBlock> |
362 | <TextBlock Grid.Row="2" Grid.Column="0" Foreground="SkyBlue">200</TextBlock> | 362 | <TextBlock Grid.Row="2" Grid.Column="0" Foreground="SkyBlue">200</TextBlock> |
363 | </Grid> | 363 | </Grid> |
364 | </s:DesignerCanvas> | 364 | </s:DesignerCanvas> |
365 | 365 | ||
366 | </Border> | 366 | </Border> |
367 | </Grid> | 367 | </Grid> |
368 | </Border> | 368 | </Border> |
369 | <Border Grid.Row="2" BorderThickness="1" BorderBrush="Gray" Margin="5,5,5,5"> | 369 | <Border Grid.Row="2" BorderThickness="1" BorderBrush="Gray" Margin="5,5,5,5"> |
370 | <Grid ShowGridLines="False"> | 370 | <Grid ShowGridLines="False"> |
371 | <Grid.RowDefinitions> | 371 | <Grid.RowDefinitions> |
372 | <RowDefinition Height="1*"/> | 372 | <RowDefinition Height="1*"/> |
373 | <RowDefinition Height="2*"/> | 373 | <RowDefinition Height="2*"/> |
374 | </Grid.RowDefinitions> | 374 | </Grid.RowDefinitions> |
375 | <Label Grid.Row="0" Content="Work [FK15_#1]" Margin="10,0,0,0" FontSize="17"/> | 375 | <Label Grid.Row="0" Content="Work [FK15_#1]" Margin="10,0,0,0" FontSize="17"/> |
376 | </Grid> | 376 | </Grid> |
377 | </Border> | 377 | </Border> |
378 | </Grid> | 378 | </Grid> |
379 | </TabItem> | 379 | </TabItem> |
380 | <TabItem x:Name="TabWork" > | 380 | <TabItem x:Name="TabWork" > |
381 | <TabItem.Header> | 381 | <TabItem.Header> |
382 | <StackPanel Orientation="Horizontal"> | 382 | <StackPanel Orientation="Horizontal"> |
383 | <TextBlock Text=" Work " VerticalAlignment="Center" FontSize="17"></TextBlock> | 383 | <TextBlock Text=" Work " VerticalAlignment="Center" FontSize="17"></TextBlock> |
384 | </StackPanel> | 384 | </StackPanel> |
385 | </TabItem.Header> | 385 | </TabItem.Header> |
386 | </TabItem> | 386 | </TabItem> |
387 | <TabItem x:Name="TabSchedule" > | 387 | <TabItem x:Name="TabSchedule" > |
388 | <TabItem.Header> | 388 | <TabItem.Header> |
389 | <StackPanel Orientation="Horizontal"> | 389 | <StackPanel Orientation="Horizontal"> |
390 | <TextBlock Text=" Schedule " VerticalAlignment="Center" FontSize="17"></TextBlock> | 390 | <TextBlock Text=" Schedule " VerticalAlignment="Center" FontSize="17"></TextBlock> |
391 | </StackPanel> | 391 | </StackPanel> |
392 | </TabItem.Header> | 392 | </TabItem.Header> |
393 | </TabItem> | 393 | </TabItem> |
394 | </TabControl> | 394 | </TabControl> |
395 | </Grid> | 395 | </Grid> |
396 | </Grid> | 396 | </Grid> |
397 | </Window> | 397 | </Window> |
398 | 398 |
sources/RoboforkApp/RoboforkMenu.xaml.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.Text; | 4 | using System.Text; |
5 | using System.Threading.Tasks; | 5 | using System.Threading.Tasks; |
6 | using System.Windows; | 6 | using System.Windows; |
7 | using System.Windows.Controls; | 7 | using System.Windows.Controls; |
8 | using System.Windows.Data; | 8 | using System.Windows.Data; |
9 | using System.Windows.Documents; | 9 | using System.Windows.Documents; |
10 | using System.Windows.Input; | 10 | using System.Windows.Input; |
11 | using System.Windows.Media; | 11 | using System.Windows.Media; |
12 | using System.Windows.Media.Imaging; | 12 | using System.Windows.Media.Imaging; |
13 | using System.Windows.Shapes; | 13 | using System.Windows.Shapes; |
14 | 14 | ||
15 | namespace RoboforkApp | 15 | namespace RoboforkApp |
16 | { | 16 | { |
17 | /// <summary> | 17 | /// <summary> |
18 | /// Interaction logic for RoboforkMenu.xaml | 18 | /// Interaction logic for RoboforkMenu.xaml |
19 | /// </summary> | 19 | /// </summary> |
20 | public partial class RoboforkMenu : Window | 20 | public partial class RoboforkMenu : Window |
21 | { | 21 | { |
22 | public RoboforkMenu() | 22 | public RoboforkMenu() |
23 | { | 23 | { |
24 | InitializeComponent(); | 24 | InitializeComponent(); |
25 | Load_Form(); | 25 | Load_Form(); |
26 | } | 26 | } |
27 | 27 | ||
28 | private void Load_Form() | 28 | private void Load_Form() |
29 | { | 29 | { |
30 | //PassplanTree.IsEnabled = false; | 30 | //PassplanTree.IsEnabled = false; |
31 | //NodeTree.IsEnabled = false; | 31 | //NodeTree.IsEnabled = false; |
32 | 32 | ||
33 | } | 33 | } |
34 | 34 | ||
35 | private void btnMenu_Selected(object sender, RoutedEventArgs e) | ||
36 | { | ||
37 | if (((TreeViewItem)sender) == null) | ||
38 | { | ||
39 | return; | ||
40 | } | ||
41 | |||
42 | string tag = ((TreeViewItem)sender).Tag.ToString(); | ||
43 | switch (tag) | ||
44 | { | ||
45 | case "SetStart": | ||
46 | DoBeginSetStart(); | ||
47 | break; | ||
48 | |||
49 | case "SetGoal": | ||
50 | DoBeginSetGoal(); | ||
51 | break; | ||
52 | |||
53 | case "SetupRoute": | ||
54 | DoBeginSetupRoute(); | ||
55 | break; | ||
56 | |||
57 | case "MakeRoot": | ||
58 | DoBeginMakeRoot(); | ||
59 | break; | ||
60 | |||
61 | case "DeleteRoute": | ||
62 | DoBeginDeleteRoute(); | ||
63 | break; | ||
64 | default: | ||
65 | break; | ||
66 | } | ||
67 | } | ||
68 | |||
69 | private void btnMenu_UnselectedSet(object sender, RoutedEventArgs e) | ||
70 | { | ||
71 | if (((TreeViewItem)sender) == null) | ||
72 | { | ||
73 | return; | ||
74 | } | ||
75 | |||
76 | string tag = ((TreeViewItem)sender).Tag.ToString(); | ||
77 | switch (tag) | ||
78 | { | ||
79 | case "SetStart": | ||
80 | //DoBeginSetStart(); | ||
81 | break; | ||
82 | |||
83 | case "SetGoal": | ||
84 | //DoBeginSetGoal(); | ||
85 | break; | ||
86 | |||
87 | case "DeleteRoute": | ||
88 | //DoBeginDeleteRoute(); | ||
89 | break; | ||
90 | |||
91 | case "SetupRoute": | ||
92 | //DoBeginSetupRoute(); | ||
93 | break; | ||
94 | |||
95 | case "MakeRoot": | ||
96 | //DoBeginMakeRoot(); | ||
97 | break; | ||
98 | |||
99 | default: | ||
100 | break; | ||
101 | } | ||
102 | } | ||
103 | |||
104 | private void DoBeginSetStart() | ||
105 | { | ||
106 | MyDesignerCanvas.CreateStartPoint(); | ||
107 | } | ||
108 | |||
109 | private void DoBeginSetGoal() | ||
110 | { | ||
111 | MyDesignerCanvas.CreateGoalPoint(); | ||
112 | } | ||
113 | |||
114 | private void DoBeginSetupRoute() | ||
115 | { | ||
116 | MyDesignerCanvas.Operation = DesignerCanvas.OperationState.DrawRoute; | ||
117 | } | ||
118 | |||
119 | private void DoBeginMakeRoot() | ||
120 | { | ||
121 | MyDesignerCanvas.Children.Remove(MyDesignerCanvas.pRootLine); | ||
122 | MyDesignerCanvas.MakeRoot(); | ||
123 | } | ||
124 | |||
125 | private void DoBeginDeleteRoute() | ||
126 | { | ||
127 | MessageBoxResult result = MessageBox.Show("Do you want delete route?", "Delete route", MessageBoxButton.OKCancel); | ||
128 | if (result == MessageBoxResult.OK) | ||
129 | { | ||
130 | MyDesignerCanvas.ClearRoute(); | ||
131 | } | ||
132 | } | ||
133 | |||
35 | private void GetPassplanTree(object sender, RoutedEventArgs e) | 134 | private void GetPassplanTree(object sender, RoutedEventArgs e) |
36 | { | 135 | { |
37 | MessageBoxResult result = MessageBox.Show("Selected PassplanTree", "", MessageBoxButton.OKCancel); | 136 | MessageBoxResult result = MessageBox.Show("Selected PassplanTree", "", MessageBoxButton.OKCancel); |
38 | } | 137 | } |
39 | 138 | ||
40 | private void SetPassplanTree(object sender, RoutedEventArgs e) | 139 | private void SetPassplanTree(object sender, RoutedEventArgs e) |
41 | { | 140 | { |
42 | 141 | ||
43 | } | 142 | } |
44 | 143 | ||
45 | private void GetNodeTree(object sender, RoutedEventArgs e) | 144 | private void GetNodeTree(object sender, RoutedEventArgs e) |
46 | { | 145 | { |
47 | MessageBoxResult result = MessageBox.Show("Selected NodeTree", "", MessageBoxButton.OKCancel); | 146 | MessageBoxResult result = MessageBox.Show("Selected NodeTree", "", MessageBoxButton.OKCancel); |
48 | } | 147 | } |
49 | 148 | ||
50 | private void SetNodeTree(object sender, RoutedEventArgs e) | 149 | private void SetNodeTree(object sender, RoutedEventArgs e) |
51 | { | 150 | { |
52 | 151 | ||
53 | } | 152 | } |
54 | 153 | ||
55 | private void GetFK15Tree(object sender, RoutedEventArgs e) | 154 | private void GetFK15Tree(object sender, RoutedEventArgs e) |
56 | { | 155 | { |
57 | MessageBoxResult result = MessageBox.Show("Selected FK15Tree", "", MessageBoxButton.OKCancel); | 156 | MessageBoxResult result = MessageBox.Show("Selected FK15Tree", "", MessageBoxButton.OKCancel); |
58 | } | 157 | } |
59 | 158 | ||
60 | private void SetFK15Tree(object sender, RoutedEventArgs e) | 159 | private void SetFK15Tree(object sender, RoutedEventArgs e) |
61 | { | 160 | { |
62 | 161 | ||
63 | } | 162 | } |
64 | 163 | ||
65 | private void GetVehicleAddTree(object sender, RoutedEventArgs e) | 164 | private void GetVehicleAddTree(object sender, RoutedEventArgs e) |
66 | { | 165 | { |
67 | MessageBoxResult result = MessageBox.Show("Selected VehicleAddTree", "", MessageBoxButton.OKCancel); | 166 | MessageBoxResult result = MessageBox.Show("Selected VehicleAddTree", "", MessageBoxButton.OKCancel); |
68 | } | 167 | } |
69 | 168 | ||
70 | private void SetVehicleAddTree(object sender, RoutedEventArgs e) | 169 | private void SetVehicleAddTree(object sender, RoutedEventArgs e) |
71 | { | 170 | { |
72 | 171 | ||
73 | } | 172 | } |
74 | 173 | ||
75 | private void GetTaskpattermTree(object sender, RoutedEventArgs e) | 174 | private void GetTaskpattermTree(object sender, RoutedEventArgs e) |
76 | { | 175 | { |
77 | 176 | ||
78 | } | 177 | } |
79 | 178 | ||
80 | private void SetTaskpattermTree(object sender, RoutedEventArgs e) | 179 | private void SetTaskpattermTree(object sender, RoutedEventArgs e) |
81 | { | 180 | { |
82 | 181 | ||
83 | } | 182 | } |
84 | 183 | ||
85 | private void GetWorkAddTree(object sender, RoutedEventArgs e) | 184 | private void GetWorkAddTree(object sender, RoutedEventArgs e) |
86 | { | 185 | { |
87 | 186 | ||
88 | } | 187 | } |
89 | 188 | ||
90 | private void SetWorkAddTree(object sender, RoutedEventArgs e) | 189 | private void SetWorkAddTree(object sender, RoutedEventArgs e) |
91 | { | 190 | { |
92 | 191 | ||
93 | } | 192 | } |
94 | 193 | ||
95 | private void GetConnectTree(object sender, RoutedEventArgs e) | 194 | private void GetConnectTree(object sender, RoutedEventArgs e) |
96 | { | 195 | { |
97 | 196 | ||
98 | } | 197 | } |
99 | 198 | ||
100 | private void SetConnectTree(object sender, RoutedEventArgs e) | 199 | private void SetConnectTree(object sender, RoutedEventArgs e) |
101 | { | 200 | { |
102 | 201 | ||
103 | } | 202 | } |
104 | 203 | ||
105 | private void GetParameterTree(object sender, RoutedEventArgs e) | 204 | private void GetParameterTree(object sender, RoutedEventArgs e) |
106 | { | 205 | { |
107 | 206 | ||
108 | } | 207 | } |
109 | 208 | ||
110 | private void SetParameterTree(object sender, RoutedEventArgs e) | 209 | private void SetParameterTree(object sender, RoutedEventArgs e) |
111 | { | 210 | { |
112 | 211 | ||
113 | } | 212 | } |
114 | 213 | ||
115 | private void GetScheduleTree(object sender, RoutedEventArgs e) | 214 | private void GetScheduleTree(object sender, RoutedEventArgs e) |
116 | { | 215 | { |
117 | 216 | ||
118 | } | 217 | } |
119 | 218 | ||
120 | private void SetScheduleTree(object sender, RoutedEventArgs e) | 219 | private void SetScheduleTree(object sender, RoutedEventArgs e) |
121 | { | 220 | { |
122 | 221 | ||
123 | } | 222 | } |
124 | 223 | ||
125 | private void GetLoggingTree(object sender, RoutedEventArgs e) | 224 | private void GetLoggingTree(object sender, RoutedEventArgs e) |
126 | { | 225 | { |
127 | 226 | ||
128 | } | 227 | } |
129 | 228 | ||
130 | private void SetLoggingTree(object sender, RoutedEventArgs e) | 229 | private void SetLoggingTree(object sender, RoutedEventArgs e) |
131 | { | 230 | { |
132 | 231 | ||
133 | } | 232 | } |
134 | 233 | ||
135 | private void GetAlertTree(object sender, RoutedEventArgs e) | 234 | private void GetAlertTree(object sender, RoutedEventArgs e) |
136 | { | 235 | { |
137 | 236 | ||
138 | } | 237 | } |
139 | 238 | ||
140 | private void SetAlertTree(object sender, RoutedEventArgs e) | 239 | private void SetAlertTree(object sender, RoutedEventArgs e) |
141 | { | 240 | { |
142 | 241 | ||
143 | } | 242 | } |
144 | 243 | ||
145 | private void GetHelpTree(object sender, RoutedEventArgs e) | 244 | private void GetHelpTree(object sender, RoutedEventArgs e) |
146 | { | 245 | { |
147 | 246 | ||
148 | } | 247 | } |
149 | 248 | ||
150 | private void SetHelpTree(object sender, RoutedEventArgs e) | 249 | private void SetHelpTree(object sender, RoutedEventArgs e) |
151 | { | 250 | { |
152 | 251 | ||
153 | } | 252 | } |
154 | 253 | ||
155 | private void GetNewProjectTree(object sender, RoutedEventArgs e) | 254 | private void GetNewProjectTree(object sender, RoutedEventArgs e) |
156 | { | 255 | { |
157 | 256 | ||
158 | } | 257 | } |
159 | 258 | ||
160 | private void SetNewProjectTree(object sender, RoutedEventArgs e) | 259 | private void SetNewProjectTree(object sender, RoutedEventArgs e) |
161 | { | 260 | { |
162 | 261 | ||
163 | } | 262 | } |
164 | 263 | ||
165 | 264 | ||
166 | } | 265 | } |
167 | } | 266 | } |
168 | 267 |