Rev | Line | |
---|
[12503] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using System.Windows.Media;
|
---|
| 6 | using System.Windows;
|
---|
| 7 |
|
---|
| 8 | namespace 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.