Changeset 11240
- Timestamp:
- 07/30/14 14:59:20 (10 years ago)
- Location:
- branches/HeuristicLab.Problems.Orienteering
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringSolutionView.Designer.cs
r11235 r11240 59 59 this.valueTabPage.SuspendLayout(); 60 60 this.tourGroupBox.SuspendLayout(); 61 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); 61 62 this.splitContainer.Panel1.SuspendLayout(); 62 63 this.splitContainer.Panel2.SuspendLayout(); … … 67 68 // pictureBox 68 69 // 69 this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 70 | System.Windows.Forms.AnchorStyles.Left)71 70 this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 71 | System.Windows.Forms.AnchorStyles.Left) 72 | System.Windows.Forms.AnchorStyles.Right))); 72 73 this.pictureBox.BackColor = System.Drawing.Color.White; 73 74 this.pictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 74 75 this.pictureBox.Location = new System.Drawing.Point(6, 6); 75 76 this.pictureBox.Name = "pictureBox"; 76 this.pictureBox.Size = new System.Drawing.Size(403, 288);77 this.pictureBox.Size = new System.Drawing.Size(403, 322); 77 78 this.pictureBox.TabIndex = 0; 78 79 this.pictureBox.TabStop = false; … … 81 82 // tabControl 82 83 // 83 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 84 | System.Windows.Forms.AnchorStyles.Left) 85 | System.Windows.Forms.AnchorStyles.Right))); 84 this.tabControl.AllowDrop = true; 85 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 86 | System.Windows.Forms.AnchorStyles.Left) 87 | System.Windows.Forms.AnchorStyles.Right))); 86 88 this.tabControl.Controls.Add(this.visualizationTabPage); 87 89 this.tabControl.Controls.Add(this.valueTabPage); … … 89 91 this.tabControl.Name = "tabControl"; 90 92 this.tabControl.SelectedIndex = 0; 91 this.tabControl.Size = new System.Drawing.Size(423, 3 26);93 this.tabControl.Size = new System.Drawing.Size(423, 360); 92 94 this.tabControl.TabIndex = 0; 93 95 // … … 98 100 this.visualizationTabPage.Name = "visualizationTabPage"; 99 101 this.visualizationTabPage.Padding = new System.Windows.Forms.Padding(3); 100 this.visualizationTabPage.Size = new System.Drawing.Size(415, 3 00);102 this.visualizationTabPage.Size = new System.Drawing.Size(415, 334); 101 103 this.visualizationTabPage.TabIndex = 0; 102 104 this.visualizationTabPage.Text = "Visualization"; … … 116 118 // tourGroupBox 117 119 // 118 this.tourGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 119 | System.Windows.Forms.AnchorStyles.Left)120 120 this.tourGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 121 | System.Windows.Forms.AnchorStyles.Left) 122 | System.Windows.Forms.AnchorStyles.Right))); 121 123 this.tourGroupBox.Controls.Add(this.tourViewHost); 122 124 this.tourGroupBox.Location = new System.Drawing.Point(6, 6); … … 129 131 // tourViewHost 130 132 // 131 this.tourViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 132 | System.Windows.Forms.AnchorStyles.Left) 133 | System.Windows.Forms.AnchorStyles.Right))); 133 this.tourViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 134 | System.Windows.Forms.AnchorStyles.Left) 135 | System.Windows.Forms.AnchorStyles.Right))); 136 this.tourViewHost.Caption = "View"; 134 137 this.tourViewHost.Content = null; 138 this.tourViewHost.Enabled = false; 135 139 this.tourViewHost.Location = new System.Drawing.Point(6, 19); 136 140 this.tourViewHost.Name = "tourViewHost"; … … 138 142 this.tourViewHost.Size = new System.Drawing.Size(391, 263); 139 143 this.tourViewHost.TabIndex = 0; 144 this.tourViewHost.ViewsLabelVisible = true; 140 145 this.tourViewHost.ViewType = null; 141 146 // … … 155 160 this.splitContainer.Panel2.Controls.Add(this.tabControl); 156 161 this.splitContainer.Size = new System.Drawing.Size(423, 402); 157 this.splitContainer.SplitterDistance = 69;162 this.splitContainer.SplitterDistance = 35; 158 163 this.splitContainer.TabIndex = 0; 159 164 // 160 165 // qualityGroupBox 161 166 // 162 this.qualityGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 163 | System.Windows.Forms.AnchorStyles.Left)164 167 this.qualityGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 168 | System.Windows.Forms.AnchorStyles.Left) 169 | System.Windows.Forms.AnchorStyles.Right))); 165 170 this.qualityGroupBox.Controls.Add(this.qualityViewHost); 166 171 this.qualityGroupBox.Location = new System.Drawing.Point(0, 0); 167 172 this.qualityGroupBox.Name = "qualityGroupBox"; 168 this.qualityGroupBox.Size = new System.Drawing.Size(423, 66);173 this.qualityGroupBox.Size = new System.Drawing.Size(423, 32); 169 174 this.qualityGroupBox.TabIndex = 0; 170 175 this.qualityGroupBox.TabStop = false; … … 173 178 // qualityViewHost 174 179 // 175 this.qualityViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 176 | System.Windows.Forms.AnchorStyles.Left) 177 | System.Windows.Forms.AnchorStyles.Right))); 180 this.qualityViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 181 | System.Windows.Forms.AnchorStyles.Left) 182 | System.Windows.Forms.AnchorStyles.Right))); 183 this.qualityViewHost.Caption = "View"; 178 184 this.qualityViewHost.Content = null; 185 this.qualityViewHost.Enabled = false; 179 186 this.qualityViewHost.Location = new System.Drawing.Point(6, 19); 180 187 this.qualityViewHost.Name = "qualityViewHost"; 181 188 this.qualityViewHost.ReadOnly = false; 182 this.qualityViewHost.Size = new System.Drawing.Size(411, 41);189 this.qualityViewHost.Size = new System.Drawing.Size(411, 7); 183 190 this.qualityViewHost.TabIndex = 0; 191 this.qualityViewHost.ViewsLabelVisible = true; 184 192 this.qualityViewHost.ViewType = null; 185 193 // 186 194 // OrienteeringSolutionView 187 195 // 188 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);189 196 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 190 197 this.Controls.Add(this.splitContainer); … … 198 205 this.splitContainer.Panel1.ResumeLayout(false); 199 206 this.splitContainer.Panel2.ResumeLayout(false); 207 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); 200 208 this.splitContainer.ResumeLayout(false); 201 209 this.qualityGroupBox.ResumeLayout(false); 202 210 this.ResumeLayout(false); 211 203 212 } 204 213 -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringSolutionView.cs
r11235 r11240 22 22 using System; 23 23 using System.Drawing; 24 using System.Linq; 24 25 using HeuristicLab.Core.Views; 25 26 using HeuristicLab.MainForm; … … 41 42 Content.QualityChanged -= new EventHandler(Content_QualityChanged); 42 43 Content.CoordinatesChanged -= new EventHandler(Content_CoordinatesChanged); 44 Content.ScoresChanged -= new EventHandler(Content_ScoresChanged); 43 45 Content.IntegerVectorChanged -= new EventHandler(Content_IntegerVectorChanged); 44 46 base.DeregisterContentEvents(); … … 48 50 Content.QualityChanged += new EventHandler(Content_QualityChanged); 49 51 Content.CoordinatesChanged += new EventHandler(Content_CoordinatesChanged); 52 Content.ScoresChanged += new EventHandler(Content_ScoresChanged); 50 53 Content.IntegerVectorChanged += new EventHandler(Content_IntegerVectorChanged); 51 54 } … … 77 80 } else { 78 81 var coordinates = Content.Coordinates; 82 var scores = Content.Scores; 79 83 var integerVector = Content.IntegerVector; 80 84 var bitmap = new Bitmap(pictureBox.Width, pictureBox.Height); … … 106 110 graphics.DrawPolygon(Pens.Black, tour); 107 111 } 108 for (int i = 0; i < points.Length; i++) 109 graphics.FillRectangle(Brushes.Red, points[i].X - 2, points[i].Y - 2, 6, 6); 112 113 double scoreMin = scores.Min(); 114 double scoreMax = scores.Max(); 115 double scoreRange = scoreMax - scoreMin; 116 for (int i = 0; i < points.Length; i++) { 117 double score = scores[i]; 118 int size = (int)Math.Round(((score - scoreMin) / scoreRange) * 9 + 1); 119 graphics.FillRectangle(Brushes.Red, points[i].X - size / 2, points[i].Y - size / 2, size, size); 120 } 110 121 } 111 122 } else { … … 135 146 GenerateImage(); 136 147 } 148 private void Content_ScoresChanged(object sender, EventArgs e) { 149 if (InvokeRequired) 150 Invoke(new EventHandler(Content_ScoresChanged), sender, e); 151 else 152 GenerateImage(); 153 } 137 154 private void Content_IntegerVectorChanged(object sender, EventArgs e) { 138 155 if (InvokeRequired) -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Analyzers/BestOrienteeringSolutionAnalyser.cs
r11190 r11240 95 95 var solution = BestSolutionParameter.ActualValue; 96 96 var coordinates = CoordinatesParameter.ActualValue; 97 var scores = ScoresParameter.ActualValue; 97 98 if (solution == null) { 98 99 solution = new OrienteeringSolution( 99 100 (IntegerVector)solutions[bestIndex].Clone(), 100 101 coordinates, 102 scores, 101 103 new DoubleValue(qualities[bestIndex].Value)); 102 104 BestSolutionParameter.ActualValue = solution; … … 105 107 if (solution.Quality.Value < qualities[bestIndex].Value) { 106 108 solution.Coordinates = coordinates; 109 solution.Scores = scores; 107 110 solution.IntegerVector = (IntegerVector)solutions[bestIndex].Clone(); 108 111 solution.Quality.Value = qualities[bestIndex].Value; -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringSolution.cs
r11190 r11240 42 42 } 43 43 [Storable] 44 private DoubleArray scores; 45 public DoubleArray Scores { 46 get { return scores; } 47 set { 48 if (scores != value) { 49 if (scores != null) DeregisterScoresEvents(); 50 scores = value; 51 if (scores != null) RegisterScoresEvents(); 52 OnScoresChanged(); 53 } 54 } 55 } 56 [Storable] 44 57 private DoubleValue quality; 45 58 public DoubleValue Quality { … … 64 77 Initialize(); 65 78 } 66 public OrienteeringSolution(IntegerVector integerVector, DoubleMatrix coordinates, Double Value quality)79 public OrienteeringSolution(IntegerVector integerVector, DoubleMatrix coordinates, DoubleArray scores, DoubleValue quality) 67 80 : base() { 68 81 this.integerVector = integerVector; 69 82 this.coordinates = coordinates; 83 this.scores = scores; 70 84 this.quality = quality; 71 85 Initialize(); … … 84 98 if (integerVector != null) RegisterIntegerVectorEvents(); 85 99 if (coordinates != null) RegisterCoordinatesEvents(); 100 if (scores != null) RegisterScoresEvents(); 86 101 if (quality != null) RegisterQualityEvents(); 87 102 } … … 102 117 } 103 118 119 public event EventHandler ScoresChanged; 120 private void OnScoresChanged() { 121 var changed = ScoresChanged; 122 if (changed != null) 123 changed(this, EventArgs.Empty); 124 } 104 125 105 126 public event EventHandler QualityChanged; … … 126 147 Coordinates.Reset -= new EventHandler(Coordinates_Reset); 127 148 } 149 private void RegisterScoresEvents() { 150 Scores.ItemChanged += new EventHandler<EventArgs<int>>(Scores_ItemChanged); 151 Scores.Reset += new EventHandler(Scores_Reset); 152 } 153 private void DeregisterScoresEvents() { 154 Scores.ItemChanged -= new EventHandler<EventArgs<int>>(Scores_ItemChanged); 155 Scores.Reset -= new EventHandler(Scores_Reset); 156 } 128 157 private void RegisterQualityEvents() { 129 158 Quality.ValueChanged += new EventHandler(Quality_ValueChanged); … … 145 174 OnCoordinatesChanged(); 146 175 } 176 private void Scores_ItemChanged(object sender, EventArgs<int> e) { 177 OnCoordinatesChanged(); 178 } 179 private void Scores_Reset(object sender, EventArgs e) { 180 OnCoordinatesChanged(); 181 } 147 182 private void Quality_ValueChanged(object sender, EventArgs e) { 148 183 OnQualityChanged();
Note: See TracChangeset
for help on using the changeset viewer.