Changeset 6482
- Timestamp:
- 06/27/11 15:51:15 (13 years ago)
- Location:
- branches/Scheduling
- Files:
-
- 1 added
- 8 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding.Tests/Properties
-
Property
svn:ignore
set to
AssemblyInfo.cs
-
Property
svn:ignore
set to
-
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding.Views/3.3
- Property svn:ignore
-
old new 1 1 HeuristicLab.Encodings.ScheduleEncoding.Views-3.3.csproj.user 2 Plugin.cs 2 3 bin 3 4 obj
-
- Property svn:ignore
-
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding.Views/3.3/GanttChart.cs
r6406 r6482 11 11 private IDictionary<int, Color> jobColors = new SortedDictionary<int, Color>(); 12 12 private IDictionary<string, int> rowNames = new Dictionary<string, int>(); 13 13 14 14 15 15 public GanttChart() { … … 21 21 if (!jobColors.ContainsKey(jobNr)) { 22 22 Random r = new Random(jobNr + 1); 23 jobColors[jobNr] = Color.FromArgb (r.Next(256),r.Next(256),r.Next(256));23 jobColors[jobNr] = Color.FromArgb(r.Next(256), r.Next(256), r.Next(256)); 24 24 chart.Legends[0].CustomItems.Clear(); 25 25 if (jobColors.Count > 1) { … … 28 28 chart.Legends[0].CustomItems.Add(c, "Job#" + (i++)); 29 29 } 30 } 30 } 31 31 } 32 32 } … … 39 39 } 40 40 41 public void AddData(string rowName, int jobNr, double start, double end, string tooltip, bool showLabel = true) {41 public void AddData(string rowName, int jobNr, int taskNr, double start, double end, string tooltip, bool showLabel = true) { 42 42 AddRowName(rowName); 43 var point = new DataPoint(rowNames[rowName], new double[] { start, end }); 43 AddJobColor(jobNr); 44 JobDataPoint point = new JobDataPoint(rowNames[rowName], new double[] { start, end }, jobNr, taskNr); 44 45 point.Color = jobColors[jobNr]; 45 46 point.AxisLabel = rowName; … … 56 57 57 58 void chart_MouseClick(object sender, MouseEventArgs e) { 58 var pos = e.Location; 59 var results = chart.HitTest(pos.X, pos.Y, false, ChartElementType.DataPoint); 60 foreach (DataPoint dp in chart.Series[0].Points) { 61 Color newColor = Color.FromArgb(255, dp.Color); 62 dp.Color = newColor; 63 } 64 foreach (var result in results) { 65 if (result.ChartElementType == ChartElementType.DataPoint) { 66 Color currentColor = chart.Series[0].Points[result.PointIndex].Color; 67 foreach (DataPoint dp in result.Series.Points) { 68 if (dp.Color != currentColor) { 69 Color newColor = Color.FromArgb(0, dp.Color); 70 dp.Color = newColor; 71 } 72 } 59 Point pos = e.Location; 60 HitTestResult[] results = chart.HitTest(pos.X, pos.Y, false, ChartElementType.DataPoint); 61 ResetDataColors(); 62 63 foreach (HitTestResult result in results) { 64 if (result.ChartElementType == ChartElementType.DataPoint && result.Object.GetType() == typeof(JobDataPoint)) { 65 int currentJobNr = (result.Object as JobDataPoint).JobNr; 66 int currentTaskNr = (result.Object as JobDataPoint).TaskNr; 67 68 HighlightTaskAndJob(currentJobNr, currentTaskNr); 73 69 } 74 70 } 75 71 } 72 73 public void ResetDataColors() { 74 foreach (DataPoint dp in chart.Series[0].Points) { 75 if (dp.GetType() == typeof(JobDataPoint)) 76 dp.Color = jobColors[(dp as JobDataPoint).JobNr]; 77 } 78 } 79 80 public void HighlightTaskAndJob(int jobNr, int taskNr) { 81 foreach (DataPoint dp in chart.Series[0].Points) { 82 if (dp.GetType() == typeof(JobDataPoint) && ((dp as JobDataPoint).JobNr == jobNr) && ((dp as JobDataPoint).TaskNr == taskNr)) { 83 Color newColor = Color.FromArgb(255, dp.Color); 84 dp.Color = newColor; 85 } else if (dp.GetType() == typeof(JobDataPoint) && ((dp as JobDataPoint).JobNr == jobNr)) { 86 Color newColor = Color.FromArgb(180, dp.Color); 87 dp.Color = newColor; 88 } else if (dp.GetType() == typeof(JobDataPoint) && !((dp as JobDataPoint).JobNr == jobNr)) { 89 Color newColor = Color.FromArgb(0, dp.Color); 90 dp.Color = newColor; 91 } 92 } 93 } 94 76 95 } 77 96 } -
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding.Views/3.3/HeuristicLab.Encodings.ScheduleEncoding.Views-3.3.csproj
r6406 r6482 56 56 <DependentUpon>GanttChart.cs</DependentUpon> 57 57 </Compile> 58 <Compile Include="JobDataPoint.cs" /> 58 59 <Compile Include="Plugin.cs" /> 59 60 <Compile Include="Properties\AssemblyInfo.cs" /> -
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding.Views/3.3/Properties
-
Property
svn:ignore
set to
AssemblyInfo.cs
-
Property
svn:ignore
set to
-
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding.Views/3.3/ScheduleView.Designer.cs
r6406 r6482 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this.ganttChart = new GanttChart();47 this.ganttChart = new HeuristicLab.Encodings.ScheduleEncoding.Views.GanttChart(); 48 48 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 49 49 this.SuspendLayout(); -
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding.Views/3.3/ScheduleView.cs
r6412 r6482 72 72 foreach (ScheduledTask t in content.Resources[resCount].Tasks) { 73 73 int categoryNr = 0; 74 string toolTip = "Task#" ;// +t.TaskNr;74 string toolTip = "Task#" + t.TaskNr; 75 75 string categoryName = "ScheduleTasks"; 76 76 if (t is ScheduledTask) { … … 79 79 toolTip = categoryName + " - " + toolTip; 80 80 } 81 ganttChart.AddJobColor(categoryNr);82 81 ganttChart.AddData("Resource" + r.Index, 83 82 categoryNr, 83 t.TaskNr, 84 84 t.StartTime, 85 85 t.EndTime, … … 88 88 resCount++; 89 89 } 90 } 91 92 private void RefreshChartInformations(Schedule content) { 93 90 94 } 91 95 -
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3
- Property svn:ignore
-
old new 1 1 HeuristicLab.Encodings.ScheduleEncoding-3.3.csproj.user 2 Plugin.cs 2 3 bin 3 4 obj
-
- Property svn:ignore
-
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/Properties
-
Property
svn:ignore
set to
AssemblyInfo.cs
-
Property
svn:ignore
set to
-
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Schedule.cs
r6475 r6482 123 123 i++; 124 124 125 if (!lastScheduledTaskOfJob.ContainsKey(jobNr)) { 126 lastScheduledTaskOfJob.Add(jobNr, task); 127 task.TaskNr = 0; 128 } else { 129 task.TaskNr = lastScheduledTaskOfJob[jobNr].TaskNr + 1; 130 lastScheduledTaskOfJob[jobNr] = task; 131 } 132 125 133 if (i >= affectedResource.Tasks.Count) 126 134 affectedResource.Tasks.Add(task); … … 128 136 affectedResource.Tasks.Insert(i, task); 129 137 130 if (!lastScheduledTaskOfJob.ContainsKey(jobNr))131 lastScheduledTaskOfJob.Add(jobNr, task);132 else133 lastScheduledTaskOfJob[jobNr] = task;134 138 } 135 139 -
branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/ScheduledTask.cs
r6475 r6482 31 31 #region Properties 32 32 [Storable] 33 public int TaskNr { get; set; } 34 [Storable] 33 35 public int ResourceNr { get; set; } 34 36 [Storable] … … 49 51 protected ScheduledTask(ScheduledTask original, Cloner cloner) 50 52 : base(original, cloner) { 53 this.TaskNr = original.TaskNr; 51 54 this.ResourceNr = original.ResourceNr; 52 55 this.Duration = original.Duration; … … 81 84 82 85 public static bool AreEqual(ScheduledTask task1, ScheduledTask task2) { 83 return (task1.Duration == task2.Duration && 86 return ( 87 task1.TaskNr == task2.TaskNr && 88 task1.Duration == task2.Duration && 84 89 task1.JobNr == task2.JobNr && 85 90 task1.ResourceNr == task2.ResourceNr && -
branches/Scheduling/HeuristicLab.Problems.Scheduling.Views/3.3
- Property svn:ignore
-
old new 1 HeuristicLab.Problems.Scheduling.Views-3.3.csproj.user 2 Plugin.cs 1 3 bin 2 4 obj 3 HeuristicLab.Problems.Scheduling.Views-3.3.csproj.user
-
- Property svn:ignore
-
branches/Scheduling/HeuristicLab.Problems.Scheduling.Views/3.3/JobShopSchedulingProblemView.cs
r6475 r6482 63 63 int categoryNr = t.JobNr; 64 64 string categoryName = "Job" + categoryNr; 65 ganttChart.AddJobColor(categoryNr);66 65 ganttChart.AddData(categoryName, 67 66 categoryNr, 67 t.TaskNr, 68 68 lastEndTime + 1, 69 69 lastEndTime + t.Duration, -
branches/Scheduling/HeuristicLab.Problems.Scheduling.Views/3.3/Properties
-
Property
svn:ignore
set to
AssemblyInfo.cs
-
Property
svn:ignore
set to
-
branches/Scheduling/HeuristicLab.Problems.Scheduling/3.3
- Property svn:ignore
-
old new 1 HeuristicLab.Problems.Scheduling-3.3.csproj.user 1 2 Plugin.cs 2 3 bin 3 4 obj 4 HeuristicLab.Problems.Scheduling-3.3.csproj.user
-
- Property svn:ignore
Note: See TracChangeset
for help on using the changeset viewer.