Changeset 10285 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4
- Timestamp:
- 01/05/14 20:47:50 (11 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.Designer.cs
r10271 r10285 1 namespace HeuristicLab.EvolutionTracking.Views { 2 partial class GenealogyGraphChart { 1 using HeuristicLab.Core; 2 3 namespace HeuristicLab.EvolutionTracking.Views { 4 partial class GenealogyGraphChart<TGraph, TVertex, TContent> 5 where TGraph : class, IGenealogyGraph<TVertex, TContent> 6 where TVertex : class, IGenealogyGraphNode<TContent>, new() 7 where TContent : class, IItem { 3 8 /// <summary> 4 9 /// Required designer variable. -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs
r10271 r10285 6 6 using System.Windows.Forms; 7 7 using HeuristicLab.Common; 8 using HeuristicLab.Core; 8 9 using HeuristicLab.Visualization; 9 10 10 11 namespace HeuristicLab.EvolutionTracking.Views { 11 public partial class GenealogyGraphChart : ChartControl { 12 private GenealogyGraph genealogyGraph; 12 public partial class GenealogyGraphChart<TGraph, TVertex, TContent> : ChartControl 13 where TGraph : class, IGenealogyGraph<TVertex, TContent> 14 where TVertex : class, IGenealogyGraphNode<TContent>, new() 15 where TContent : class,IItem { 16 private TGraph genealogyGraph; 13 17 14 18 private const double XIncrement = 30; … … 16 20 private const double Diameter = 20; 17 21 18 public GenealogyGraph GenealogyGraph {22 public TGraph GenealogyGraph { 19 23 get { return genealogyGraph; } 20 24 set { … … 62 66 return arc; 63 67 } 64 65 68 private bool DrawInProgress { get; set; } // do not try to update the chart while the drawing is not finished 66 69 private VisualGenealogyGraphNode SelectedVisualNode { get; set; } … … 71 74 if (clicked != null) clicked(sender, e); 72 75 } 73 74 76 public GenealogyGraphChart() { 75 77 InitializeComponent(); 76 78 } 77 78 79 protected virtual void DrawGraph(double xIncrement, double yIncrement, double diameter) { 79 80 Chart.UpdateEnabled = false; … … 104 105 } 105 106 y -= yIncrement; 106 } 107 x = 0; 108 } 109 107 110 // add arcs 108 111 foreach (var node in GenealogyGraph.Nodes) { … … 116 119 var pen = new Pen(Color.Transparent); 117 120 var visualArc = AddArc(Chart, visualParent, visualNode, pen); 118 arcMap.Add(Tuple.Create(visualParent, visualNode), visualArc); 121 if (!arcMap.ContainsKey(Tuple.Create(visualParent, visualNode))) 122 arcMap.Add(Tuple.Create(visualParent, visualNode), visualArc); 119 123 } 120 124 } … … 126 130 DrawInProgress = false; 127 131 } 128 129 protected override void pictureBox_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { 132 protected override void pictureBox_MouseMove(object sender, MouseEventArgs e) { 130 133 if (!DrawInProgress) { 131 134 switch (e.Button) { … … 142 145 base.pictureBox_MouseMove(sender, e); 143 146 } 144 145 147 protected override void pictureBox_MouseUp(object sender, MouseEventArgs e) { 146 148 Cursor = Cursors.Default; … … 189 191 base.pictureBox_MouseUp(sender, e); 190 192 } 191 192 193 private void DrawLineage(VisualGenealogyGraphNode node, Func<VisualGenealogyGraphNode, IEnumerable<VisualGenealogyGraphArc>> arcSelector, Func<VisualGenealogyGraphArc, VisualGenealogyGraphNode> nodeSelector) { 193 194 if (node.Brush != null) return; … … 207 208 } 208 209 } 209 210 210 void MarkSelectedNode() { 211 211 var center = SelectedVisualNode.Center; … … 222 222 } 223 223 } 224 225 226 224 private static VisualGenealogyGraphArc AddArc(IChart chart, VisualGenealogyGraphNode source, VisualGenealogyGraphNode target, Pen pen, Brush brush = null) { 227 225 var arc = new VisualGenealogyGraphArc(chart, source, target, pen) { Brush = brush }; … … 232 230 return arc; 233 231 } 234 235 232 public virtual void ClearPrimitives() { 236 233 foreach (var primitive in Chart.Group.Primitives) { … … 267 264 } 268 265 } 269 270 266 internal static class Util { 271 267 public static Color GetColor(this IGenealogyGraphNode node) { -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphView.cs
r10271 r10285 60 60 protected override void OnContentChanged() { 61 61 base.OnContentChanged(); 62 genealogyGraphChart.GenealogyGraph = Content ?? null;62 // genealogyGraphChart.GenealogyGraph = Content ?? null; 63 63 } 64 64 private void Content_GraphChanged(object sender, EventArgs e) { -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/HeuristicLab.EvolutionTracking.Views-3.4.csproj
r10269 r10285 122 122 <DependentUpon>GenealogyGraphChart.cs</DependentUpon> 123 123 </Compile> 124 <Compile Include="GenealogyGraphView.cs">125 <SubType>UserControl</SubType>126 </Compile>127 <Compile Include="GenealogyGraphView.Designer.cs">128 <DependentUpon>GenealogyGraphView.cs</DependentUpon>129 </Compile>130 124 <Compile Include="Plugin.cs" /> 131 125 <Compile Include="Primitives\LabeledEllipse.cs" />
Note: See TracChangeset
for help on using the changeset viewer.