- Timestamp:
- 05/24/11 09:47:24 (13 years ago)
- Location:
- branches/Scheduling/HeuristicLab.Problems.Scheduling.Views/3.3
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Scheduling/HeuristicLab.Problems.Scheduling.Views/3.3/GanttChart.Designer.cs
r6177 r6260 54 54 this.chart.TabIndex = 0; 55 55 this.chart.Text = "chart"; 56 this.chart.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart_MouseClick); 56 57 // 57 58 // GanttChart -
branches/Scheduling/HeuristicLab.Problems.Scheduling.Views/3.3/GanttChart.cs
r6177 r6260 9 9 public partial class GanttChart : UserControl { 10 10 11 private IDictionary< string, Color> categories = new Dictionary<string, Color>();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 public GanttChart() { 15 16 InitializeComponent(); 17 chart.Series[0].YValueType = ChartValueType.Double; 16 18 } 17 19 18 public void AddCategory(string name, Color color) { 19 if (!categories.ContainsKey(name)) { 20 categories[name] = color; 21 chart.Legends[0].CustomItems.Add(color, name); 20 public void AddJobColor(int jobNr) { 21 if (!jobColors.ContainsKey(jobNr)) { 22 Random r = new Random(jobNr + 1); 23 jobColors[jobNr] = Color.FromArgb (r.Next(256),r.Next(256),r.Next(256)); 24 chart.Legends[0].CustomItems.Clear(); 25 if (jobColors.Count > 1) { 26 int i = 0; 27 foreach (Color c in jobColors.Values) { 28 chart.Legends[0].CustomItems.Add(c, "Job#" + (i++)); 29 } 30 } 22 31 } 23 }24 25 public void AddData(string rowName, string category, double start, double end, string tooltip, bool showLabel = true) {26 AddRowName(rowName);27 var point = CreateDataPoint(rowNames[rowName], rowName, start, end, showLabel ? category : string.Empty, categories[category]);28 point.ToolTip = tooltip;29 chart.Series[0].Points.Add(point);30 32 } 31 33 … … 37 39 } 38 40 39 private static DataPoint CreateDataPoint(double x, string axisLabel, double start, double end, string text, Color color) { 40 var point = new DataPoint(x, new double[] { start, end }); 41 point.Color = color; 42 point.Label = text; 43 point.AxisLabel = axisLabel; 44 return point; 41 public void AddData(string rowName, int jobNr, double start, double end, string tooltip, bool showLabel = true) { 42 AddRowName(rowName); 43 var point = new DataPoint(rowNames[rowName], new double[] { start, end }); 44 point.Color = jobColors[jobNr]; 45 point.AxisLabel = rowName; 46 point.ToolTip = tooltip; 47 chart.Series[0].Points.Add(point); 45 48 } 46 49 47 50 public void Reset() { 48 51 chart.Series[0].Points.Clear(); 49 categories.Clear();52 jobColors.Clear(); 50 53 chart.Legends[0].CustomItems.Clear(); 51 54 rowNames.Clear(); 52 55 } 56 57 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 } 73 } 74 } 75 } 53 76 } 54 77 } -
branches/Scheduling/HeuristicLab.Problems.Scheduling.Views/3.3/HeuristicLab.Problems.Scheduling.Views-3.3.csproj
r6177 r6260 32 32 </PropertyGroup> 33 33 <ItemGroup> 34 <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4"> 35 <HintPath>..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\bin\Debug\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath> 36 </Reference> 37 <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4"> 38 <HintPath>..\..\HeuristicLab.Problems.DataAnalysis\3.4\bin\Debug\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath> 39 </Reference> 40 <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4"> 41 <HintPath>..\..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\bin\Debug\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.dll</HintPath> 42 </Reference> 43 <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4"> 44 <HintPath>..\..\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression\3.4\bin\Debug\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.dll</HintPath> 45 </Reference> 46 <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4"> 47 <HintPath>..\..\HeuristicLab.Problems.DataAnalysis.Symbolic.Views\3.4\bin\Debug\HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.dll</HintPath> 48 </Reference> 49 <Reference Include="HeuristicLab.Problems.DataAnalysis.Views-3.4"> 50 <HintPath>..\..\HeuristicLab.Problems.DataAnalysis.Views\3.4\bin\Debug\HeuristicLab.Problems.DataAnalysis.Views-3.4.dll</HintPath> 51 </Reference> 34 52 <Reference Include="System" /> 35 53 <Reference Include="System.Core" /> … … 153 171 <Name>HeuristicLab.PluginInfrastructure-3.3</Name> 154 172 </ProjectReference> 173 <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views-3.4.csproj"> 174 <Project>{20831A74-D18F-42D9-A667-1CE3AF53DF93}</Project> 175 <Name>HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views-3.4</Name> 176 </ProjectReference> 155 177 <ProjectReference Include="..\..\HeuristicLab.Problems.Scheduling\3.3\HeuristicLab.Problems.Scheduling-3.3.csproj"> 156 178 <Project>{2BF1D639-1A74-44ED-AAAD-41ECD395AD93}</Project> -
branches/Scheduling/HeuristicLab.Problems.Scheduling.Views/3.3/JobShopSchedulingProblemView.Designer.cs
r6177 r6260 109 109 // ganttChart 110 110 // 111 this.ganttChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 112 | System.Windows.Forms.AnchorStyles.Left) 113 | System.Windows.Forms.AnchorStyles.Right))); 111 114 this.ganttChart.Location = new System.Drawing.Point(0, 3); 112 115 this.ganttChart.Name = "ganttChart"; -
branches/Scheduling/HeuristicLab.Problems.Scheduling.Views/3.3/JobShopSchedulingProblemView.cs
r6177 r6260 57 57 private void FillGanttChart(JobShopSchedulingProblem content) { 58 58 //Add Jobs as Categories 59 ganttChart.Reset(); 59 60 int jobCount = 0; 60 Random random = new Random( );61 Random random = new Random(1); 61 62 foreach (JSSPJob j in content.Jobs) { 62 63 foreach (JSSPTask t in content.Jobs[jobCount].Tasks) { 63 string categoryName = "ScheduleTasks";64 categoryName = "Job" + t.Job.Index;65 ganttChart.Add Category(categoryName, Color.FromArgb(random.Next(255), random.Next(255), random.Next(255)));64 int categoryNr = t.JobNr.Value; 65 string categoryName = "Job" + categoryNr; 66 ganttChart.AddJobColor(categoryNr); 66 67 ganttChart.AddData(categoryName, 67 categoryN ame,68 categoryNr, 68 69 t.StartTime.Value, 69 70 t.EndTime.Value, 70 "Job" + t.Job.Index + " - " + "Task#" + t.TaskNr.Value.ToString(), 71 false); 71 "Job" + t.JobNr + " - " + "Task#" + t.TaskNr.Value.ToString()); 72 72 } 73 73 jobCount++; … … 92 92 } 93 93 94 /* TODO: Implement solution-import in problem-class 94 95 95 if (!string.IsNullOrEmpty(spImportDialog.OptimalScheduleFileName)) 96 Content.ImportSolution(spImportDialog.OptimalScheduleFileName); 97 * */ 96 Content.ImportJSMSolution(spImportDialog.OptimalScheduleFileName); 98 97 OnContentChanged(); 99 98 } -
branches/Scheduling/HeuristicLab.Problems.Scheduling.Views/3.3/Plugin.cs
r6177 r6260 23 23 24 24 namespace HeuristicLab.Problems.Scheduling.Views { 25 [Plugin("HeuristicLab.Problems.Scheduling.Views", "3.3.3.61 21")]25 [Plugin("HeuristicLab.Problems.Scheduling.Views", "3.3.3.6177")] 26 26 [PluginFile("HeuristicLab.Problems.Scheduling.Views-3.3.dll", PluginFileType.Assembly)] 27 27 public class HeuristicLabProblemsSchedulingViewsPlugin : PluginBase { -
branches/Scheduling/HeuristicLab.Problems.Scheduling.Views/3.3/Properties/AssemblyInfo.cs
r6177 r6260 53 53 // by using the '*' as shown below: 54 54 [assembly: AssemblyVersion("3.3.0.0")] 55 [assembly: AssemblyFileVersion("3.3.0.61 21")]55 [assembly: AssemblyFileVersion("3.3.0.6177")] -
branches/Scheduling/HeuristicLab.Problems.Scheduling.Views/3.3/ScheduleView.cs
r6177 r6260 40 40 } 41 41 42 43 protected override void DeregisterContentEvents() { 44 Content.QualityChanged -= new EventHandler(Content_QualityChanged); 45 Content.ResourcesChanged -= new EventHandler(Content_ResourcesChanged); 46 47 base.DeregisterContentEvents(); 48 } 49 protected override void RegisterContentEvents() { 50 base.RegisterContentEvents(); 51 Content.QualityChanged += new EventHandler(Content_QualityChanged); 52 Content.ResourcesChanged += new EventHandler(Content_ResourcesChanged); 53 } 54 55 42 56 public new Schedule Content { 43 57 get { return (Schedule)base.Content; } … … 59 73 60 74 private void FillGanttChart(Schedule content) { 61 //Add Resources as Categories75 ResetGanttChart(); 62 76 int resCount = 0; 63 Random random = new Random ( );77 Random random = new Random (1); 64 78 foreach (Resource r in content.Resources) { 65 79 foreach (JSSPTask t in content.Resources[resCount].Tasks) { 80 int categoryNr = 0; 81 string toolTip = "Task#" + t.TaskNr; 66 82 string categoryName = "ScheduleTasks"; 67 string toolTip = "Task#" + t.TaskNr.Value.ToString();68 83 if (t is JSSPTask) { 69 categoryName = "Job" + ((JSSPTask)t).Job.Index; 84 categoryNr = ((JSSPTask)t).JobNr.Value; 85 categoryName = "Job" + categoryNr; 70 86 toolTip = categoryName + " - " + toolTip; 71 } 72 ganttChart.Add Category(categoryName, Color.FromArgb(random.Next(255), random.Next(255), random.Next(255)));87 } 88 ganttChart.AddJobColor(categoryNr); 73 89 ganttChart.AddData("Resource" + r.Index, 74 categoryN ame,90 categoryNr, 75 91 t.StartTime.Value, 76 92 t.EndTime.Value, 77 toolTip, 78 false); 93 toolTip); 79 94 } 80 95 resCount++; … … 86 101 ganttChart.Enabled = Content != null; 87 102 } 103 104 105 private void Content_QualityChanged(object sender, EventArgs e) { 106 if (InvokeRequired) 107 Invoke(new EventHandler(Content_QualityChanged), sender, e); 108 else { 109 if (Content == null) { 110 ResetGanttChart(); 111 } else { 112 FillGanttChart(Content); 113 } 114 } 115 } 116 117 private void Content_ResourcesChanged(object sender, EventArgs e) { 118 if (InvokeRequired) 119 Invoke(new EventHandler(Content_ResourcesChanged), sender, e); 120 else { 121 if (Content == null) { 122 ResetGanttChart(); 123 } else { 124 FillGanttChart(Content); 125 } 126 } 127 } 88 128 } 89 129 }
Note: See TracChangeset
for help on using the changeset viewer.