- Timestamp:
- 08/31/11 11:52:11 (13 years ago)
- Location:
- branches/GeneralizedQAP
- Files:
-
- 13 edited
- 8 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP
- Property svn:mergeinfo changed
/trunk/sources (added) merged: 6648-6649,6652-6656,6661-6674,6676-6681,6684
- Property svn:mergeinfo changed
-
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionModelView.cs
r6642 r6685 19 19 */ 20 20 #endregion 21 22 using System.Linq; 21 23 using System.Windows.Forms; 24 using HeuristicLab.Common; 22 25 using HeuristicLab.Core.Views; 23 26 using HeuristicLab.MainForm; … … 44 47 protected override void OnContentChanged() { 45 48 base.OnContentChanged(); 46 if (Content != null) 49 if (Content != null) { 50 view.Locked = Content.ProblemData == ClassificationEnsembleProblemData.EmptyProblemData; 47 51 view.Content = Content.ClassificationSolutions; 48 else52 } else 49 53 view.Content = null; 50 54 } … … 62 66 detailsGroupBox.Enabled = Content != null && itemsListView.SelectedItems.Count == 1; 63 67 } 68 69 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 70 validDragOperation = false; 71 if (ReadOnly || Locked) return; 72 if (Content.IsReadOnly) return; 73 74 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 75 validDragOperation = dropData.GetObjectGraphObjects().OfType<IClassificationSolution>().Any(); 76 } 77 protected override void itemsListView_DragDrop(object sender, DragEventArgs e) { 78 if (e.Effect != DragDropEffects.None) { 79 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 80 var solutions = dropData.GetObjectGraphObjects().OfType<IClassificationSolution>(); 81 if (e.Effect.HasFlag(DragDropEffects.Copy)) { 82 Cloner cloner = new Cloner(); 83 solutions = solutions.Select(s => cloner.Clone(s)); 84 } 85 foreach (var solution in solutions) 86 Content.Add(solution); 87 } 88 } 64 89 } 65 90 } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj
r6642 r6685 110 110 </ItemGroup> 111 111 <ItemGroup> 112 <Compile Include="Classification\ClassificationEnsembleSolutionEstimatedClassValuesView.cs"> 113 <SubType>UserControl</SubType> 114 </Compile> 115 <Compile Include="Classification\ClassificationEnsembleSolutionEstimatedClassValuesView.Designer.cs"> 116 <DependentUpon>ClassificationEnsembleSolutionEstimatedClassValuesView.cs</DependentUpon> 117 </Compile> 112 118 <Compile Include="Classification\ClassificationEnsembleSolutionModelView.cs"> 113 119 <SubType>UserControl</SubType> … … 182 188 <DependentUpon>ClusteringSolutionView.cs</DependentUpon> 183 189 </Compile> 190 <Compile Include="Solution Views\ClassificationEnsembleSolutionView.cs"> 191 <SubType>UserControl</SubType> 192 </Compile> 193 <Compile Include="Solution Views\ClassificationEnsembleSolutionView.Designer.cs"> 194 <DependentUpon>ClassificationEnsembleSolutionView.cs</DependentUpon> 195 </Compile> 184 196 <Compile Include="Solution Views\DiscriminantFunctionClassificationSolutionView.cs"> 185 197 <SubType>UserControl</SubType> … … 202 214 <Compile Include="Interfaces\IDataAnalysisSolutionEvaluationView.cs" /> 203 215 <Compile Include="MenuItems\CreateEnsembleMenuItem.cs" /> 216 <Compile Include="Solution Views\NamedDataAnalysisSolutionView.cs"> 217 <SubType>UserControl</SubType> 218 </Compile> 219 <Compile Include="Solution Views\NamedDataAnalysisSolutionView.Designer.cs"> 220 <DependentUpon>NamedDataAnalysisSolutionView.cs</DependentUpon> 221 </Compile> 222 <Compile Include="Solution Views\RegressionEnsembleSolutionView.cs"> 223 <SubType>UserControl</SubType> 224 </Compile> 225 <Compile Include="Solution Views\RegressionEnsembleSolutionView.Designer.cs"> 226 <DependentUpon>RegressionEnsembleSolutionView.cs</DependentUpon> 227 </Compile> 204 228 <Compile Include="Solution Views\RegressionSolutionView.cs"> 205 229 <SubType>UserControl</SubType> -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionEnsembleSolutionModelView.cs
r6642 r6685 19 19 */ 20 20 #endregion 21 22 using System.Linq; 21 23 using System.Windows.Forms; 24 using HeuristicLab.Common; 22 25 using HeuristicLab.Core.Views; 23 26 using HeuristicLab.MainForm; … … 44 47 protected override void OnContentChanged() { 45 48 base.OnContentChanged(); 46 if (Content != null) 49 if (Content != null) { 50 view.Locked = Content.ProblemData == RegressionEnsembleProblemData.EmptyProblemData; 47 51 view.Content = Content.RegressionSolutions; 48 else52 } else 49 53 view.Content = null; 50 54 } … … 59 63 addButton.Enabled = Content != null && !Content.IsReadOnly && !Locked; 60 64 removeButton.Enabled = Content != null && !Content.IsReadOnly && !Locked && itemsListView.SelectedItems.Count > 0; 61 itemsListView.Enabled = Content != null ;65 itemsListView.Enabled = Content != null && !Locked; 62 66 detailsGroupBox.Enabled = Content != null && itemsListView.SelectedItems.Count == 1; 67 } 68 69 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 70 validDragOperation = false; 71 if (ReadOnly || Locked) return; 72 if (Content.IsReadOnly) return; 73 74 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 75 validDragOperation = dropData.GetObjectGraphObjects().OfType<IRegressionSolution>().Any(); 76 } 77 protected override void itemsListView_DragDrop(object sender, DragEventArgs e) { 78 if (e.Effect != DragDropEffects.None) { 79 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 80 var solutions = dropData.GetObjectGraphObjects().OfType<IRegressionSolution>(); 81 if (e.Effect.HasFlag(DragDropEffects.Copy)) { 82 Cloner cloner = new Cloner(); 83 solutions = solutions.Select(s => cloner.Clone(s)); 84 } 85 foreach (var solution in solutions) 86 Content.Add(solution); 87 } 63 88 } 64 89 } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.Designer.cs
r5809 r6685 63 63 this.chart.Size = new System.Drawing.Size(358, 225); 64 64 this.chart.TabIndex = 0; 65 this.chart.CustomizeLegend += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CustomizeLegendEventArgs>(this.chart_CustomizeLegend); 65 66 this.chart.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.Chart_MouseDoubleClick); 67 this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown); 68 this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove); 66 69 // 67 // LineChartView70 // RegressionSolutionLineChartView 68 71 // 69 72 this.AllowDrop = true; … … 71 74 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 72 75 this.Controls.Add(this.chart); 73 this.Name = " LineChartView";76 this.Name = "RegressionSolutionLineChartView"; 74 77 this.Size = new System.Drawing.Size(358, 225); 75 78 ((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit(); -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.cs
r6642 r6685 20 20 #endregion 21 21 using System; 22 using System.Collections.Generic; 22 23 using System.Drawing; 23 24 using System.Linq; … … 34 35 private const string ESTIMATEDVALUES_TRAINING_SERIES_NAME = "Estimated Values (training)"; 35 36 private const string ESTIMATEDVALUES_TEST_SERIES_NAME = "Estimated Values (test)"; 37 private const string ESTIMATEDVALUES_ALL_SERIES_NAME = "Estimated Values (all samples)"; 36 38 37 39 public new IRegressionSolution Content { … … 70 72 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].LegendText = ESTIMATEDVALUES_TRAINING_SERIES_NAME; 71 73 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].ChartType = SeriesChartType.FastLine; 72 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TrainingIndizes.ToArray(), 73 Content.EstimatedTrainingValues.ToArray()); 74 this.chart.DataManipulator.InsertEmptyPoints(Content.ProblemData.Dataset.Rows, IntervalType.Number, ESTIMATEDVALUES_TRAINING_SERIES_NAME); 74 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TrainingIndizes.ToArray(), Content.EstimatedTrainingValues.ToArray()); 75 75 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Tag = Content; 76 this.chart.DataManipulator.InsertEmptyPoints(1, IntervalType.Number, ESTIMATEDVALUES_TRAINING_SERIES_NAME); 77 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.BorderWidth = 0; 78 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.MarkerStyle = MarkerStyle.None; 79 76 80 77 81 this.chart.Series.Add(ESTIMATEDVALUES_TEST_SERIES_NAME); 78 82 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].LegendText = ESTIMATEDVALUES_TEST_SERIES_NAME; 79 83 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].ChartType = SeriesChartType.FastLine; 80 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TestIndizes.ToArray(), 81 Content.EstimatedTestValues.ToArray()); 84 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TestIndizes.ToArray(), Content.EstimatedTestValues.ToArray()); 82 85 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Tag = Content; 86 87 88 int[] allIndizes = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndizes).Except(Content.ProblemData.TestIndizes).ToArray(); 89 var estimatedValues = Content.EstimatedValues.ToArray(); 90 List<double> allEstimatedValues = allIndizes.Select(index => estimatedValues[index]).ToList(); 91 92 this.chart.Series.Add(ESTIMATEDVALUES_ALL_SERIES_NAME); 93 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].LegendText = ESTIMATEDVALUES_ALL_SERIES_NAME; 94 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].ChartType = SeriesChartType.FastLine; 95 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIndizes, allEstimatedValues); 96 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Tag = Content; 97 this.chart.DataManipulator.InsertEmptyPoints(1, IntervalType.Number, ESTIMATEDVALUES_ALL_SERIES_NAME); 98 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.BorderWidth = 0; 99 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.MarkerStyle = MarkerStyle.None; 100 this.ToggleSeriesData(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]); 101 83 102 UpdateCursorInterval(); 84 103 this.UpdateStripLines(); … … 109 128 } 110 129 111 private void Content_ProblemDataChanged(object sender, EventArgs e) {112 RedrawChart();113 }114 115 private void Content_ModelChanged(object sender, EventArgs e) {116 UpdateEstimatedValuesLineChart();117 }118 119 130 protected override void OnContentChanged() { 120 131 base.OnContentChanged(); 121 132 RedrawChart(); 122 133 } 123 124 private void UpdateEstimatedValuesLineChart() { 125 if (InvokeRequired) Invoke((Action)UpdateEstimatedValuesLineChart); 126 else { 127 if (this.chart.Series.Count > 0) { 128 Series s = this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME]; 129 if (s != null) { 130 s.Points.DataBindXY(Content.ProblemData.TrainingIndizes.ToArray(), Content.EstimatedTrainingValues.ToArray()); 131 s.LegendText = ESTIMATEDVALUES_TRAINING_SERIES_NAME; 132 } 133 s = this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME]; 134 if (s != null) { 135 s.Points.DataBindXY(Content.ProblemData.TestIndizes.ToArray(), Content.EstimatedTestValues.ToArray()); 136 s.LegendText = ESTIMATEDVALUES_TEST_SERIES_NAME; 137 } 138 this.UpdateStripLines(); 139 UpdateCursorInterval(); 140 } 141 } 142 } 134 private void Content_ProblemDataChanged(object sender, EventArgs e) { 135 RedrawChart(); 136 } 137 private void Content_ModelChanged(object sender, EventArgs e) { 138 RedrawChart(); 139 } 140 141 143 142 144 143 private void Chart_MouseDoubleClick(object sender, MouseEventArgs e) { … … 201 200 this.chart.ChartAreas[0].AxisX.StripLines.Add(stripLine); 202 201 } 202 203 private void ToggleSeriesData(Series series) { 204 if (series.Points.Count > 0) { //checks if series is shown 205 if (this.chart.Series.Any(s => s != series && s.Points.Count > 0)) { 206 series.Points.Clear(); 207 } 208 } else if (Content != null) { 209 string targetVariableName = Content.ProblemData.TargetVariable; 210 211 IEnumerable<int> indizes = null; 212 IEnumerable<double> predictedValues = null; 213 switch (series.Name) { 214 case ESTIMATEDVALUES_ALL_SERIES_NAME: 215 indizes = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndizes).Except(Content.ProblemData.TestIndizes).ToArray(); 216 var estimatedValues = Content.EstimatedValues.ToArray(); 217 predictedValues = indizes.Select(index => estimatedValues[index]).ToList(); 218 break; 219 case ESTIMATEDVALUES_TRAINING_SERIES_NAME: 220 indizes = Content.ProblemData.TrainingIndizes.ToArray(); 221 predictedValues = Content.EstimatedTrainingValues.ToArray(); 222 break; 223 case ESTIMATEDVALUES_TEST_SERIES_NAME: 224 indizes = Content.ProblemData.TestIndizes.ToArray(); 225 predictedValues = Content.EstimatedTestValues.ToArray(); 226 break; 227 } 228 series.Points.DataBindXY(indizes, predictedValues); 229 chart.DataManipulator.InsertEmptyPoints(1, IntervalType.Number, series.Name); 230 chart.Legends[series.Legend].ForeColor = Color.Black; 231 UpdateCursorInterval(); 232 } 233 } 234 235 private void chart_MouseMove(object sender, MouseEventArgs e) { 236 HitTestResult result = chart.HitTest(e.X, e.Y); 237 if (result.ChartElementType == ChartElementType.LegendItem && result.Series.Name != TARGETVARIABLE_SERIES_NAME) 238 Cursor = Cursors.Hand; 239 else 240 Cursor = Cursors.Default; 241 } 242 private void chart_MouseDown(object sender, MouseEventArgs e) { 243 HitTestResult result = chart.HitTest(e.X, e.Y); 244 if (result.ChartElementType == ChartElementType.LegendItem && result.Series.Name != TARGETVARIABLE_SERIES_NAME) { 245 ToggleSeriesData(result.Series); 246 } 247 } 248 249 private void chart_CustomizeLegend(object sender, CustomizeLegendEventArgs e) { 250 if (chart.Series.Count != 4) return; 251 e.LegendItems[0].Cells[1].ForeColor = this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black; 252 e.LegendItems[1].Cells[1].ForeColor = this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black; 253 e.LegendItems[2].Cells[1].ForeColor = this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black; 254 e.LegendItems[3].Cells[1].ForeColor = this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black; 255 } 203 256 } 204 257 } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionScatterPlotView.Designer.cs
r5809 r6685 64 64 this.chart.Size = new System.Drawing.Size(527, 392); 65 65 this.chart.TabIndex = 1; 66 this.chart.PostPaint += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.ChartPaintEventArgs>(this.chart_PostPaint); 67 this.chart.CustomizeLegend += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CustomizeLegendEventArgs>(this.chart_CustomizeLegend); 68 this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown); 66 69 this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove); 67 this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown);68 this.chart.CustomizeLegend += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CustomizeLegendEventArgs>(chart_CustomizeLegend);69 70 // 70 // ScatterPlotView71 // RegressionSolutionScatterPlotView 71 72 // 73 this.AllowDrop = true; 72 74 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 73 75 this.Controls.Add(this.chart); 74 this.Name = "ScatterPlotView"; 75 this.AllowDrop = true; 76 this.Name = "RegressionSolutionScatterPlotView"; 76 77 this.Size = new System.Drawing.Size(527, 392); 77 78 ((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit(); -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionScatterPlotView.cs
r6642 r6685 219 219 e.LegendItems[2].Cells[1].ForeColor = this.chart.Series[TEST_SERIES].Points.Count == 0 ? Color.Gray : Color.Black; 220 220 } 221 222 private void chart_PostPaint(object sender, ChartPaintEventArgs e) { 223 var chartArea = e.ChartElement as ChartArea; 224 if (chartArea != null) { 225 ChartGraphics chartGraphics = e.ChartGraphics; 226 using (Pen p = new Pen(Color.DarkGray)) { 227 double xmin = chartArea.AxisX.ScaleView.ViewMinimum; 228 double xmax = chartArea.AxisX.ScaleView.ViewMaximum; 229 double ymin = chartArea.AxisY.ScaleView.ViewMinimum; 230 double ymax = chartArea.AxisY.ScaleView.ViewMaximum; 231 232 if (xmin > ymax || ymin > xmax) return; 233 234 PointF start = PointF.Empty; 235 start.X = (float)chartGraphics.GetPositionFromAxis(chartArea.Name, chartArea.AxisX.AxisName, Math.Max(xmin, ymin)); 236 start.Y = (float)chartGraphics.GetPositionFromAxis(chartArea.Name, chartArea.AxisY.AxisName, Math.Max(xmin, ymin)); 237 PointF end = PointF.Empty; 238 end.X = (float)chartGraphics.GetPositionFromAxis(chartArea.Name, chartArea.AxisX.AxisName, Math.Min(xmax, ymax)); 239 end.Y = (float)chartGraphics.GetPositionFromAxis(chartArea.Name, chartArea.AxisY.AxisName, Math.Min(xmax, ymax)); 240 241 chartGraphics.Graphics.DrawLine(p, chartGraphics.GetAbsolutePoint(start), chartGraphics.GetAbsolutePoint(end)); 242 } 243 } 244 } 221 245 } 222 246 } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/ClassificationSolutionView.cs
r6642 r6685 21 21 22 22 using System.Windows.Forms; 23 using HeuristicLab.Core; 23 24 using HeuristicLab.MainForm; 24 25 25 26 namespace HeuristicLab.Problems.DataAnalysis.Views { 26 27 [View("ClassificationSolution View")] 27 [Content(typeof(ClassificationSolutionBase), true)]28 [Content(typeof(ClassificationSolutionBase), false)] 28 29 public partial class ClassificationSolutionView : DataAnalysisSolutionView { 29 30 public ClassificationSolutionView() { … … 35 36 set { base.Content = value; } 36 37 } 38 39 #region drag and drop 40 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 41 validDragOperation = false; 42 if (ReadOnly) return; 43 44 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 45 if (dropData is ClassificationProblemData) validDragOperation = true; 46 else if (dropData is IValueParameter) { 47 var param = (IValueParameter)dropData; 48 if (param.Value is ClassificationProblemData) validDragOperation = true; 49 } 50 } 51 #endregion 37 52 } 38 53 } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/ClusteringSolutionView.cs
r6642 r6685 25 25 namespace HeuristicLab.Problems.DataAnalysis.Views { 26 26 [View("ClusteringSolution View")] 27 [Content(typeof(ClusteringSolution), true)]27 [Content(typeof(ClusteringSolution), false)] 28 28 public partial class ClusteringSolutionView : DataAnalysisSolutionView { 29 29 public ClusteringSolutionView() { … … 35 35 set { base.Content = value; } 36 36 } 37 38 #region drag and drop 39 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 40 validDragOperation = false; 41 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is ClusteringProblemData)) { 42 validDragOperation = true; 43 } 44 } 45 #endregion 37 46 } 38 47 } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.cs
r6642 r6685 25 25 using System.Linq; 26 26 using System.Windows.Forms; 27 using HeuristicLab.Core.Views; 27 28 using HeuristicLab.MainForm; 29 using HeuristicLab.Optimization; 28 30 using HeuristicLab.Optimization.Views; 29 31 30 32 namespace HeuristicLab.Problems.DataAnalysis.Views { 31 33 [View("DataAnalysisSolution View")] 32 [Content(typeof(DataAnalysisSolution), true)]33 public partial class DataAnalysisSolutionView : ResultCollectionView{34 [Content(typeof(DataAnalysisSolution), false)] 35 public partial class DataAnalysisSolutionView : NamedItemCollectionView<IResult> { 34 36 public DataAnalysisSolutionView() { 35 37 InitializeComponent(); 38 viewHost.ViewsLabelVisible = false; 36 39 } 37 40 … … 39 42 get { return (DataAnalysisSolution)base.Content; } 40 43 set { base.Content = value; } 44 } 45 46 protected override void SetEnabledStateOfControls() { 47 base.SetEnabledStateOfControls(); 48 addButton.Enabled = false; 49 removeButton.Enabled = false; 50 } 51 52 protected override void RegisterContentEvents() { 53 base.RegisterContentEvents(); 54 Content.ProblemDataChanged += new EventHandler(Content_ProblemDataChanged); 55 } 56 protected override void DeregisterContentEvents() { 57 base.DeregisterContentEvents(); 58 Content.ProblemDataChanged -= new EventHandler(Content_ProblemDataChanged); 59 } 60 private void Content_ProblemDataChanged(object sender, EventArgs e) { 61 OnContentChanged(); 41 62 } 42 63 … … 58 79 } 59 80 81 protected override IResult CreateItem() { 82 return null; 83 } 84 60 85 protected virtual void AddEvaluationViewTypes() { 61 if (Content != null ) {86 if (Content != null && !Content.ProblemData.IsEmpty) { 62 87 var viewTypes = MainFormManager.GetViewTypes(Content.GetType(), true) 63 88 .Where(t => typeof(IDataAnalysisSolutionEvaluationView).IsAssignableFrom(t)); … … 68 93 69 94 protected override void itemsListView_DoubleClick(object sender, EventArgs e) { 70 if (itemsListView.SelectedItems.Count == 1 && itemsListView.SelectedItems[0].Tag is Type) { 71 Type viewType = (Type)itemsListView.SelectedItems[0].Tag; 95 if (itemsListView.SelectedItems.Count != 1) return; 96 97 IResult result = itemsListView.SelectedItems[0].Tag as IResult; 98 Type viewType = itemsListView.SelectedItems[0].Tag as Type; 99 if (result != null) { 100 IContentView view = MainFormManager.MainForm.ShowContent(result, typeof(ResultView)); 101 if (view != null) { 102 view.ReadOnly = ReadOnly; 103 view.Locked = Locked; 104 } 105 } else if (viewType != null) { 72 106 MainFormManager.MainForm.ShowContent(Content, viewType); 73 } else 74 base.itemsListView_DoubleClick(sender, e); 107 } 75 108 } 76 109 … … 102 135 itemsListView.Items.Remove(item); 103 136 } 137 138 #region drag and drop 139 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 140 validDragOperation = false; 141 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is DataAnalysisProblemData)) { 142 validDragOperation = true; 143 } 144 } 145 146 protected override void itemsListView_DragDrop(object sender, DragEventArgs e) { 147 if (e.Effect != DragDropEffects.None) { 148 if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is DataAnalysisProblemData) { 149 DataAnalysisProblemData problemData = (DataAnalysisProblemData)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 150 Content.ProblemData = (DataAnalysisProblemData)problemData.Clone(); 151 } 152 } 153 } 154 #endregion 104 155 } 105 156 } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DiscriminantFunctionClassificationSolutionView.cs
r6642 r6685 20 20 #endregion 21 21 22 using System.Windows.Forms; 22 23 23 using HeuristicLab.MainForm; 24 25 24 namespace HeuristicLab.Problems.DataAnalysis.Views { 26 [View(" DiscriminantFunctionClassificationSolution View")]27 [Content(typeof(DiscriminantFunctionClassificationSolutionBase), true)]28 public partial class DiscriminantFunctionClassificationSolutionView : DataAnalysisSolutionView {25 [View("ClassificationSolution View")] 26 [Content(typeof(DiscriminantFunctionClassificationSolutionBase), false)] 27 public partial class DiscriminantFunctionClassificationSolutionView : ClassificationSolutionView { 29 28 public DiscriminantFunctionClassificationSolutionView() { 30 29 InitializeComponent(); -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.cs
r6642 r6685 21 21 22 22 using System.Windows.Forms; 23 using HeuristicLab.Core; 23 24 using HeuristicLab.MainForm; 24 25 25 26 namespace HeuristicLab.Problems.DataAnalysis.Views { 26 27 [View("RegressionSolution View")] 27 [Content(typeof(RegressionSolutionBase), true)]28 [Content(typeof(RegressionSolutionBase), false)] 28 29 public partial class RegressionSolutionView : DataAnalysisSolutionView { 29 30 public RegressionSolutionView() { … … 35 36 set { base.Content = value; } 36 37 } 38 39 #region drag and drop 40 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 41 validDragOperation = false; 42 if (ReadOnly) return; 43 44 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 45 if (dropData is RegressionProblemData) validDragOperation = true; 46 else if (dropData is IValueParameter) { 47 var param = (IValueParameter)dropData; 48 if (param.Value is RegressionProblemData) validDragOperation = true; 49 } 50 } 51 #endregion 37 52 } 38 53 }
Note: See TracChangeset
for help on using the changeset viewer.