Changeset 13893 for branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/DirectedGraphChart.cs
- Timestamp:
- 06/14/16 17:12:51 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/DirectedGraphChart.cs
r13874 r13893 159 159 Pen pen; 160 160 var penWidth = weight / max * 3; 161 //var penColor = colors[(int)Math.Min(255, weight / max * 255)]; 162 var penColor = Color.Black; 161 var colorIndex = (int)Math.Min(255, weight / max * 255); 162 if (colorIndex < 0) colorIndex = 0; 163 if (colorIndex > 255) colorIndex = 255; 164 var penColor = colors[colorIndex]; 163 165 if (len == 2) { 164 if (double.IsInfinity(penWidth) || double.IsNaN(penWidth)) penWidth = 1; 166 if (double.IsInfinity(penWidth) || double.IsNaN(penWidth)) 167 penWidth = 1; 168 165 169 pen = new Pen(penColor, (float)penWidth) { CustomEndCap = new AdjustableArrowCap(5, 3) }; 166 170 var start = points[0]; … … 169 173 var rect = target.Primitive as Rectangle; 170 174 var ell = target.Primitive as Ellipse; 175 176 // calculate intersection point 171 177 PointD intersectionPoint; 172 178 if (rect != null) … … 176 182 else 177 183 throw new InvalidOperationException("Unknown vertex shape."); 184 178 185 if (intersectionPoint == default(PointD)) 179 186 intersectionPoint = end; 187 180 188 line = new Line(Chart, new PointD(start.X, start.Y), intersectionPoint, pen) { ToolTipText = arc.Label }; 181 189 Chart.Group.Add(line); … … 184 192 } else { 185 193 for (int i = 0; i < points.Length - 1; ++i) { 186 Line line;187 194 var start = points[i]; 188 195 var end = points[i + 1]; … … 208 215 pen = new Pen(penColor, (float)penWidth); 209 216 } 210 line = new Line(Chart, new PointD(start.X, start.Y), endPoint, pen) { ToolTipText = arc.Label }; 217 var startPoint = new PointD(start.X, start.Y); 218 var line = new Line(Chart, startPoint, endPoint, pen) { ToolTipText = arc.Label }; 211 219 Chart.Group.Add(line); 212 220 if (intersectionPoints.Any()) { … … 248 256 var rectangle = p as Rectangle; 249 257 var ellipse = p as Ellipse; 250 var brush = (SolidBrush)shape.Brush; 258 var pen = new Pen(shape.Pen.Color); 259 var brush = new SolidBrush(((SolidBrush)shape.Brush).Color); 251 260 252 261 if (rectangle != null) { 253 var r = new Rectangle(this.Chart, shape.LowerLeft, shape.UpperRight, new Pen(shape.Pen.Color), new SolidBrush(brush.Color));262 var r = new Rectangle(this.Chart, shape.LowerLeft, shape.UpperRight, pen, brush); 254 263 return new LabeledPrimitive(r, v.Label, shape.Font); 255 264 } 256 265 if (ellipse != null) { 257 var e = new Ellipse(this.Chart, shape.LowerLeft, shape.UpperRight, new Pen(shape.Pen.Color), new SolidBrush(brush.Color));266 var e = new Ellipse(this.Chart, shape.LowerLeft, shape.UpperRight, pen, brush); 258 267 return new LabeledPrimitive(e, v.Label, shape.Font); 259 268 }
Note: See TracChangeset
for help on using the changeset viewer.