Commit 1fe3e8a8735803bb16d3e5dbe54368785e8ff305

Authored by toan
1 parent 6312cbd862
Exists in master

RM2063 : Update source

Showing 9 changed files with 29 additions and 17 deletions Side-by-side Diff

sources/RoboforkApp/Controls/DesignerCanvas.cs
... ... @@ -76,7 +76,7 @@
76 76  
77 77 //Add variable for Vehicle Item click
78 78 public string VehicleItem = "FK_15";
79   - VehicleModel VehicleModel = new VehicleModel();
  79 + public VehicleModel VehicleModel = new VehicleModel();
80 80 public int VehicleIndex = 0;
81 81 public string ColorNode_Add = "Blue";
82 82 public string ColorNode_Insert = "Brown";
... ... @@ -2785,6 +2785,12 @@
2785 2785  
2786 2786 gGrpScheduleNode.Children.Clear();
2787 2787 gGrpScheduleLine.Children.Clear();
  2788 +
  2789 + //Remove existed simulation
  2790 + if(scheduleCanvas.simulation !=null)
  2791 + {
  2792 + scheduleCanvas.Children.Remove(scheduleCanvas.simulation);
  2793 + }
2788 2794  
2789 2795  
2790 2796 List<double> distance = new List<double>();
... ... @@ -3044,7 +3050,7 @@
3044 3050 node = ellipseGeometry.Center;
3045 3051 pMap.pointSchedule_X = node.X;
3046 3052 pMap.pointSchedule_Y = node.Y;
3047   - pMap.speed_Schedule = 0;
  3053 + pMap.speed_Schedule = 0.2; //Hard code
3048 3054  
3049 3055 //Node info
3050 3056 foreach (ListNodeInfo temp in Lst_Node_tmp[i].NodeInfo_tmp)
... ... @@ -3102,7 +3108,7 @@
3102 3108 node = ellipseGeometry.Center;
3103 3109 pMap.pointSchedule_X = node.X;
3104 3110 pMap.pointSchedule_Y = node.Y;
3105   - pMap.speed_Schedule = 0;
  3111 + pMap.speed_Schedule = 0.2; //Hard code
3106 3112  
3107 3113 VehicleModelList.pointMapList.Add(pMap);
3108 3114 }
sources/RoboforkApp/Controls/ScheduleCanvas.cs
1   -using System;
  1 +using RoboforkApp.DataModel;
  2 +using System;
2 3 using System.Collections.Generic;
3 4 using System.Linq;
4 5 using System.Text;
5 6  
... ... @@ -15,11 +16,12 @@
15 16 {
16 17 const double COOR_Y = 65;
17 18 const double RADIUS_NODE = 25;
18   - private simulationRobo simulation;
  19 + public simulationRobo simulation;
  20 + private VehicleModelList vehicleModelList;
19 21 private Point startPoint;
20 22 private Point endPoint;
21 23 private bool _isGoal = false;
22   - private double _speed = 0.2; //Now _speed is fixed, but when update node
  24 + private double _speed;
23 25 private int index;
24 26  
25 27 private List<ucNode> _lstNode;
... ... @@ -27,8 +29,10 @@
27 29 /// <summary>
28 30 /// Create simulation
29 31 /// </summary>
30   - /// <param name="lstNode"></param>
31   - public void CreateSimulation(List<ucNode> lstNode)
  32 + /// <param name="lstNode">List node on schedule</param>
  33 + /// <param name="vehicleModel">Vehicle model on map</param>
  34 + /// <param name="vehicleIndex">Current index of vehicle</param>
  35 + public void CreateSimulation(List<ucNode> lstNode, VehicleModel vehicleModel, int vehicleIndex)
32 36 {
33 37 //If node is less than 2 so return
34 38 if (this.Children.Count < 2)
35 39  
... ... @@ -40,8 +44,10 @@
40 44  
41 45 //Init data
42 46 this._lstNode = lstNode;
  47 + this.vehicleModelList = vehicleModel.VehicleModelList[vehicleIndex];
43 48 this.startPoint = new Point(Canvas.GetLeft(_lstNode[index]) + RADIUS_NODE, COOR_Y);
44 49 this.endPoint = new Point(Canvas.GetLeft(_lstNode[index + 1]) + RADIUS_NODE, COOR_Y);
  50 + this._speed = vehicleModelList.pointMapList[index].speed_Schedule;
45 51 this.index += 1;
46 52 if (index == _lstNode.Count - 1)
47 53 {
... ... @@ -113,6 +119,7 @@
113 119 // If not end node
114 120 if (!isGoal)
115 121 {
  122 + this._speed = vehicleModelList.pointMapList[index].speed_Schedule;
116 123 this.index += 1;
117 124 this.Children.Remove(simulation);
118 125 this.startPoint = endPoint;
119 126  
... ... @@ -122,14 +129,13 @@
122 129 {
123 130 this._isGoal = true;
124 131 }
125   - this._speed += 0.2;
126 132 RoboSimulation();
127 133 return;
128 134 }
129 135  
130 136 // Reset data when finish
131 137 this.index = 0;
132   - this._speed = 0.2;
  138 + this._speed = 0;
133 139 this._isGoal = false;
134 140 }
135 141 }
sources/RoboforkApp/DataModel/ListNodeInfo.cs
... ... @@ -6,7 +6,7 @@
6 6  
7 7 namespace RoboforkApp.DataModel
8 8 {
9   - class ListNodeInfo
  9 + public class ListNodeInfo
10 10 {
11 11 public string Mode { get; set; }
12 12 public double Speed { get; set; }
sources/RoboforkApp/DataModel/NodeInfo_tmp.cs
... ... @@ -6,7 +6,7 @@
6 6  
7 7 namespace RoboforkApp.DataModel
8 8 {
9   - class NodeInfo_tmp
  9 + public class NodeInfo_tmp
10 10 {
11 11 public string Mode { get; set; }
12 12 public double Speed { get; set; }
sources/RoboforkApp/DataModel/Node_tmp.cs
... ... @@ -6,7 +6,7 @@
6 6  
7 7 namespace RoboforkApp.DataModel
8 8 {
9   - class Node_tmp
  9 + public class Node_tmp
10 10 {
11 11 public double pointMap_X { get; set; }
12 12 public double pointMap_Y { get; set; }
sources/RoboforkApp/DataModel/PointMap.cs
... ... @@ -6,7 +6,7 @@
6 6  
7 7 namespace RoboforkApp.DataModel
8 8 {
9   - class PointMap : ListNodeInfo
  9 + public class PointMap : ListNodeInfo
10 10 {
11 11 public double pointMap_X { get; set; }
12 12 public double pointMap_Y { get; set; }
sources/RoboforkApp/DataModel/VehicleModel.cs
... ... @@ -7,7 +7,7 @@
7 7 namespace RoboforkApp.DataModel
8 8 {
9 9  
10   - class VehicleModel : VehicleModelList
  10 + public class VehicleModel : VehicleModelList
11 11 {
12 12 public List<VehicleModelList> VehicleModelList = new List<VehicleModelList>();
13 13 }
sources/RoboforkApp/DataModel/VehicleModelList.cs
... ... @@ -6,7 +6,7 @@
6 6  
7 7 namespace RoboforkApp.DataModel
8 8 {
9   - class VehicleModelList : PointMap
  9 + public class VehicleModelList : PointMap
10 10 {
11 11 public string VehicleName { get; set; }
12 12 public List<PointMap> pointMapList = new List<PointMap>();
sources/RoboforkApp/RoboforkMenuView.xaml.cs
... ... @@ -148,7 +148,7 @@
148 148  
149 149 private void DoBeginTask()
150 150 {
151   - MyScheduleCanvas.CreateSimulation(MyDesignerCanvas.ucScheduleNode_Lst);
  151 + MyScheduleCanvas.CreateSimulation(MyDesignerCanvas.ucScheduleNode_Lst, MyDesignerCanvas.VehicleModel, MyDesignerCanvas.VehicleIndex);
152 152 }
153 153  
154 154 private void DoBeginSetAutoNotes()