Changeset 13426
- Timestamp:
- 12/01/15 21:00:52 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs
r13399 r13426 32 32 public partial class GenealogyGraphChart : ChartControl { 33 33 private IGenealogyGraph genealogyGraph; 34 35 34 private const double XIncrement = 30; 36 35 private const double YIncrement = 30; 37 36 private const double Diameter = 20; 38 39 37 private readonly Brush defaultBrush; 40 38 private readonly Pen defaultPen; … … 47 45 public bool LockGenealogy { get; set; } 48 46 public bool TraceFragments { get; set; } 49 #endregion50 51 #region chart modes52 public Dictionary<string, ChartMode> ChartMode { get; private set; }53 47 #endregion 54 48 … … 105 99 } 106 100 107 public GenealogyGraphChart() {101 public GenealogyGraphChart() : base(new Chart(0, 0, 800, 600)) { 108 102 InitializeComponent(); 109 110 ChartMode = new Dictionary<string, ChartMode> { 111 { "Select", new SelectChartMode(this) }, 112 { "ZoomIn", new ZoomInChartMode(this) }, 113 { "ZoomOut", new ZoomOutChartMode(this) }, 114 { "Pan", new PanChartMode(this) } 115 }; 116 103 AddChartModes(new PanChartMode(this), new ZoomInChartMode(this), new ZoomOutChartMode(this), new SelectChartMode(this)); 117 104 defaultBrush = new SolidBrush(Color.Transparent); 118 105 defaultPen = new Pen(Color.DarkGray); … … 137 124 Data = node, 138 125 ToolTipText = "Rank: " + node.Rank + nl + 139 "Quality: " + String.Format("{0:0.0000}", node.Quality) + nl +126 "Quality: " + string.Format("{0:N4}", node.Quality) + nl + 140 127 "IsElite: " + node.IsElite + nl + 141 128 "In/Out Degree: " + node.InDegree + " " + node.OutDegree … … 187 174 #region event handlers 188 175 189 protected override void PictureBoxOnMouseMove(object sender, MouseEventArgs e) {190 if (!DrawInProgress) {191 switch (e.Button) {192 case MouseButtons.Left:193 Mode = ChartMode["Select"];194 Cursor = Cursors.Default;195 break;196 case MouseButtons.Middle:197 Mode = ChartMode["Pan"];198 Cursor = Cursors.Hand;199 break;200 }201 }202 base.PictureBoxOnMouseMove(sender, e);203 }204 205 176 protected override void PictureBoxOnMouseUp(object sender, MouseEventArgs e) { 206 Cursor = Cursors.Default; 207 208 var primitive = Chart.GetAllPrimitives(e.Location).FirstOrDefault(p => p is VisualGenealogyGraphNode); 209 if (primitive == null) { 210 SelectedVisualNode = null; 211 return; 212 } 213 if (SelectedVisualNode == primitive) return; 214 SelectedVisualNode = primitive as VisualGenealogyGraphNode; 215 if (SelectedVisualNode == null) return; 216 217 UpdateSelectedVisualNode(); // redraw ancestries, mark node etc. 218 177 if (Mode is SelectChartMode) { 178 var primitive = Chart.GetAllPrimitives(e.Location).FirstOrDefault(p => p is VisualGenealogyGraphNode); 179 if (primitive != null && primitive != SelectedVisualNode) { 180 SelectedVisualNode = (VisualGenealogyGraphNode)primitive; 181 UpdateSelectedVisualNode(); // redraw ancestries, mark node etc. 182 } 183 } 219 184 base.PictureBoxOnMouseUp(sender, e); 220 185 }
Note: See TracChangeset
for help on using the changeset viewer.