Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Charts/Shapes/ViewportPolyline.cs @ 12503

Last change on this file since 12503 was 12503, checked in by aballeit, 9 years ago

#2283 added GUI and charts; fixed MCTS

File size: 1.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows.Media;
6using System.Windows;
7
8namespace Microsoft.Research.DynamicDataDisplay.Charts.Shapes
9{
10  /// <summary>
11  /// Represents a polyline with points in Viewport coordinates.
12  /// </summary>
13  public sealed class ViewportPolyline : ViewportPolylineBase
14  {
15    /// <summary>
16    /// Initializes a new instance of the <see cref="ViewportPolyline"/> class.
17    /// </summary>
18    public ViewportPolyline() { }
19
20    protected override void UpdateUIRepresentationCore()
21    {
22      var transform = Plotter.Viewport.Transform;
23
24      PathGeometry geometry = PathGeometry;
25
26      PointCollection points = Points;
27      geometry.Clear();
28
29      if (points == null) { }
30      else
31      {
32        PathFigure figure = new PathFigure();
33        if (points.Count > 0)
34        {
35          figure.StartPoint = points[0].DataToScreen(transform);
36          if (points.Count > 1)
37          {
38            Point[] pointArray = new Point[points.Count - 1];
39            for (int i = 1; i < points.Count; i++)
40            {
41              pointArray[i - 1] = points[i].DataToScreen(transform);
42            }
43            figure.Segments.Add(new PolyLineSegment(pointArray, true));
44          }
45        }
46        geometry.Figures.Add(figure);
47        geometry.FillRule = this.FillRule;
48      }
49    }
50  }
51}
Note: See TracBrowser for help on using the repository browser.