Changeset 7470 for branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/GQAPAssignmentView.cs
- Timestamp:
- 02/15/12 17:28:37 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/GQAPAssignmentView.cs
r7448 r7470 49 49 protected override void DeregisterContentEvents() { 50 50 Content.PropertyChanged -= new PropertyChangedEventHandler(Content_PropertyChanged); 51 Content.Solution.PropertyChanged -= new PropertyChangedEventHandler(ContentSolution_PropertyChanged);52 51 base.DeregisterContentEvents(); 53 52 } … … 55 54 base.RegisterContentEvents(); 56 55 Content.PropertyChanged += new PropertyChangedEventHandler(Content_PropertyChanged); 57 Content.Solution.PropertyChanged += new PropertyChangedEventHandler(ContentSolution_PropertyChanged);58 56 } 59 57 #endregion … … 75 73 private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e) { 76 74 switch (e.PropertyName) { 77 case "EquipmentNames": UpdateAssignment(); break;78 case "LocationNames": UpdateAssignment(); break;79 default: break;80 }81 }82 private void ContentSolution_PropertyChanged(object sender, PropertyChangedEventArgs e) {83 switch (e.PropertyName) {84 75 case "Quality": UpdateQuality(); break; 85 76 case "FlowDistanceQuality": UpdateFlowDistanceQuality(); break; … … 87 78 case "OverbookedCapacity": UpdateOverbookedCapacity(); break; 88 79 case "Assignment": UpdateAssignment(); break; 80 case "EquipmentNames": UpdateAssignment(); break; 81 case "LocationNames": UpdateAssignment(); break; 89 82 default: break; 90 83 } 84 } 85 86 private void Content_Assignment_ToStringChanged(object sender, EventArgs e) { 87 UpdateAssignment(); 91 88 } 92 89 #endregion … … 129 126 qualityLabel.Text = "-"; 130 127 } else { 131 qualityLabel.Text = Content. Solution.Quality.ToString();128 qualityLabel.Text = Content.Quality.ToString(); 132 129 } 133 130 } … … 137 134 if (InvokeRequired) Invoke((Action)UpdateFlowDistanceQuality); 138 135 else { 139 if (Content == null || Content. Solution.FlowDistanceQuality == null) {136 if (Content == null || Content.FlowDistanceQuality == null) { 140 137 flowDistanceQualityLabel.Text = "-"; 141 138 } else { 142 flowDistanceQualityLabel.Text = Content. Solution.FlowDistanceQuality.ToString();139 flowDistanceQualityLabel.Text = Content.FlowDistanceQuality.ToString(); 143 140 } 144 141 } … … 148 145 if (InvokeRequired) Invoke((Action)UpdateInstallationQuality); 149 146 else { 150 if (Content == null || Content. Solution.InstallationQuality == null) {147 if (Content == null || Content.InstallationQuality == null) { 151 148 installationQualityLabel.Text = "-"; 152 149 } else { 153 installationQualityLabel.Text = Content. Solution.InstallationQuality.ToString();150 installationQualityLabel.Text = Content.InstallationQuality.ToString(); 154 151 } 155 152 } … … 159 156 if (InvokeRequired) Invoke((Action)UpdateOverbookedCapacity); 160 157 else { 161 if (Content == null || Content. Solution.OverbookedCapacity == null) {158 if (Content == null || Content.OverbookedCapacity == null) { 162 159 overbookedCapacityLabel.Text = "-"; 163 160 } else { 164 overbookedCapacityLabel.Text = Content. Solution.OverbookedCapacity.ToString();161 overbookedCapacityLabel.Text = Content.OverbookedCapacity.ToString(); 165 162 } 166 163 } … … 172 169 assignmentTreeView.Nodes.Clear(); 173 170 if (Content != null) { 174 IntegerVector assignment = Content. Solution.Assignment;171 IntegerVector assignment = Content.Assignment; 175 172 Dictionary<int, TreeNode> locationNodes = new Dictionary<int, TreeNode>(); 176 173 for (int i = 0; i < assignment.Length; i++) { … … 202 199 var installationCosts = new Dictionary<EquipmentNode, double>(); 203 200 foreach (var node in GetAllSubNodes(assignmentTreeView.Nodes).OfType<EquipmentNode>()) { 204 int location = Content. Solution.Assignment[node.Equipment];201 int location = Content.Assignment[node.Equipment]; 205 202 installationCosts[node] = Content.InstallationCosts[node.Equipment, location]; 206 203 } … … 249 246 250 247 private void ColorByWeight(LocationNode selectedNode) { 251 var equipments = new HashSet<int>(Content. Solution.Assignment.Select((v, i) => new { Index = i, Value = v })248 var equipments = new HashSet<int>(Content.Assignment.Select((v, i) => new { Index = i, Value = v }) 252 249 .Where(x => x.Value == selectedNode.Location).Select(x => x.Index)); 253 250 var rowSums = new Dictionary<int, double>(equipments.Count);
Note: See TracChangeset
for help on using the changeset viewer.