Changeset 13874
- Timestamp:
- 06/06/16 14:48:09 (8 years ago)
- Location:
- branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/DirectedGraphChart.Designer.cs
r13789 r13874 32 32 // pictureBox 33 33 // 34 //this.pictureBox.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox.Image")));34 this.pictureBox.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox.Image"))); 35 35 // 36 36 // toolTip -
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/DirectedGraphChart.cs
r13821 r13874 26 26 using System.Linq; 27 27 using System.Windows.Forms; 28 using HeuristicLab.Common; 28 29 using HeuristicLab.Core; 29 30 using HeuristicLab.Random; … … 36 37 namespace HeuristicLab.VariableInteractionNetworks.Views { 37 38 public partial class DirectedGraphChart : ChartControl { 39 public new Bitmap Picture { get { return base.Picture; } } 40 38 41 private ConstrainedForceDirectedLayout layout; 39 42 // provide direct and reverse mapping between graph objects and layout shapes … … 147 150 shape.Move(new Offset(pos.X, pos.Y)); 148 151 } 149 152 var colors = ColorGradient.GrayscaledColors; 150 153 foreach (var pair in arcRoutes) { 151 154 var arc = pair.Key; … … 155 158 var len = points.Length; // len = 2 when no edge routingMode is performed 156 159 Pen pen; 157 var penWidth = weight / max * 2; 160 var penWidth = weight / max * 3; 161 //var penColor = colors[(int)Math.Min(255, weight / max * 255)]; 162 var penColor = Color.Black; 158 163 if (len == 2) { 159 164 if (double.IsInfinity(penWidth) || double.IsNaN(penWidth)) penWidth = 1; 160 pen = new Pen( Color.Black, (float)penWidth) { CustomEndCap = new AdjustableArrowCap(5, 3) };165 pen = new Pen(penColor, (float)penWidth) { CustomEndCap = new AdjustableArrowCap(5, 3) }; 161 166 var start = points[0]; 162 167 var end = points[1]; … … 198 203 if (intersectionPoints.Any()) { 199 204 endPoint = intersectionPoints.First(); 200 pen = new Pen( Color.Black, (float)penWidth) { CustomEndCap = new AdjustableArrowCap(5, 3) };205 pen = new Pen(penColor, (float)penWidth) { CustomEndCap = new AdjustableArrowCap(5, 3) }; 201 206 } else { 202 207 endPoint = end; 203 pen = new Pen( Color.Black, (float)penWidth);208 pen = new Pen(penColor, (float)penWidth); 204 209 } 205 210 line = new Line(Chart, new PointD(start.X, start.Y), endPoint, pen) { ToolTipText = arc.Label }; … … 226 231 } 227 232 228 private Dictionary<Type, LabeledPrimitive> shapes;233 private readonly Dictionary<Type, LabeledPrimitive> shapes; 229 234 public void AddShape(Type t, LabeledPrimitive shape) { 230 235 shapes[t] = shape; -
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/RunCollectionVariableInteractionNetworkView.Designer.cs
r13821 r13874 1 using System.Globalization; 2 3 namespace HeuristicLab.VariableInteractionNetworks.Views { 1 namespace HeuristicLab.VariableInteractionNetworks.Views { 4 2 partial class RunCollectionVariableInteractionNetworkView { 5 3 /// <summary> … … 52 50 // settingsGroupBox 53 51 // 54 this.settingsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 52 this.settingsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 55 53 | System.Windows.Forms.AnchorStyles.Left))); 56 54 this.settingsGroupBox.Controls.Add(this.onlineImpactCalculationButton); … … 116 114 this.impactThresholdTextBox.Size = new System.Drawing.Size(201, 20); 117 115 this.impactThresholdTextBox.TabIndex = 2; 118 this.impactThresholdTextBox.Text = 0.2.ToString(CultureInfo.CurrentCulture);116 this.impactThresholdTextBox.Text = "0.2"; 119 117 this.impactThresholdTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.TextBoxValidating); 120 118 this.impactThresholdTextBox.Validated += new System.EventHandler(this.ImpactThresholdTextBoxValidated); … … 171 169 // layoutOptionsGroupBox 172 170 // 173 this.layoutOptionsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 171 this.layoutOptionsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 174 172 | System.Windows.Forms.AnchorStyles.Left))); 175 173 this.layoutOptionsGroupBox.Controls.Add(this.idealEdgeLengthTextBox); … … 232 230 // graphChart 233 231 // 234 this.graphChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 235 | System.Windows.Forms.AnchorStyles.Left) 232 this.graphChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 233 | System.Windows.Forms.AnchorStyles.Left) 236 234 | System.Windows.Forms.AnchorStyles.Right))); 237 235 this.graphChart.BackColor = System.Drawing.SystemColors.Control; -
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/RunCollectionVariableInteractionNetworkView.cs
r13821 r13874 233 233 var junctionLabel = Concatenate(variableList); 234 234 IVertex junctionNode; 235 var sb = new StringBuilder(); 235 236 if (!nodes.TryGetValue(junctionLabel, out junctionNode)) { 236 237 var solutionsEnsemble = CreateEnsembleSolution(targetRuns); 237 junctionNode = new JunctionNetworkNode { Label = s tring.Empty, Data = solutionsEnsemble };238 junctionNode = new JunctionNetworkNode { Label = solutionsEnsemble.TrainingRSquared.ToString("N3", CultureInfo.CurrentCulture), Data = solutionsEnsemble }; 238 239 vn.AddVertex(junctionNode); 239 240 nodes[junctionLabel] = junctionNode; 240 junctionNode.Label = solutionsEnsemble.TrainingRSquared.ToString("N3", CultureInfo.CurrentCulture);241 sb.AppendLine(junctionNode.Label); 241 242 } 242 243 IArc arc; … … 249 250 } 250 251 arc = new Arc(variableNode, junctionNode) { Weight = impact, Label = impact.ToString("N3", CultureInfo.CurrentCulture) }; 252 sb.AppendLine(v + ": " + arc.Label); 251 253 vn.AddArc(arc); 252 254 } 253 var trainingR2 = ((IRegressionSolution)((JunctionNetworkNode)junctionNode).Data).TrainingRSquared; 255 var jcnNode = (JunctionNetworkNode)junctionNode; 256 var trainingR2 = ((IRegressionSolution)jcnNode.Data).TrainingRSquared; 254 257 arc = new Arc(junctionNode, targetNode) { Weight = junctionNode.InArcs.Sum(x => x.Weight), Label = trainingR2.ToString("N3", CultureInfo.CurrentCulture) }; 255 258 vn.AddArc(arc); … … 394 397 errorProvider.SetError(tb, string.Empty); 395 398 double impact; 396 if (!double.TryParse(tb.Text, out impact)) 399 if (!double.TryParse(tb.Text, out impact)) { 397 400 impact = 0.2; 401 } 398 402 var network = ApplyThreshold(variableInteractionNetwork, impact); 399 403 graphChart.Graph = network; … … 443 447 } 444 448 449 private void ControlsEnable(bool enabled) { 450 qualityResultNameComboBox.Enabled 451 = impactResultNameComboBox.Enabled 452 = impactAggregationComboBox.Enabled 453 = impactThresholdTextBox.Enabled 454 = onlineImpactCalculationButton.Enabled 455 = edgeRoutingComboBox.Enabled 456 = idealEdgeLengthTextBox.Enabled = enabled; 457 } 458 445 459 private void onlineImpactCalculationButton_Click(object sender, EventArgs args) { 446 var button = (Button)sender;447 460 var worker = new BackgroundWorker(); 448 461 worker.DoWork += (o, e) => { 449 button.Enabled = false;462 ControlsEnable(false); 450 463 var impacts = CalculateVariableImpactsOnline(Content, false); 451 464 variableInteractionNetwork = CreateNetwork(impacts); … … 453 466 graphChart.Graph = ApplyThreshold(variableInteractionNetwork, threshold); 454 467 }; 455 worker.RunWorkerCompleted += (o, e) => button.Enabled = true;468 worker.RunWorkerCompleted += (o, e) => ControlsEnable(true); 456 469 worker.RunWorkerAsync(); 457 470 }
Note: See TracChangeset
for help on using the changeset viewer.