-
Notifications
You must be signed in to change notification settings - Fork 976
Expand file tree
/
Copy pathPolyLineAnnotation.cs
More file actions
62 lines (54 loc) · 1.98 KB
/
Copy pathPolyLineAnnotation.cs
File metadata and controls
62 lines (54 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="PolyLineAnnotation.cs" company="OxyPlot">
// Copyright (c) 2014 OxyPlot contributors
// </copyright>
// <summary>
// Represents an annotation that shows a polyline.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
#nullable enable
namespace OxyPlot.Annotations
{
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Represents an annotation that shows a polyline.
/// </summary>
public class PolylineAnnotation : PathAnnotation
{
/// <summary>
/// The points.
/// </summary>
private readonly List<DataPoint> points = new List<DataPoint>();
/// <summary>
/// Gets the points.
/// </summary>
/// <value>The points.</value>
public List<DataPoint> Points
{
get
{
return this.points;
}
}
/// <summary>
/// Gets or sets the interpolation algorithm.
/// </summary>
/// <value>An interpolation algorithm.</value>
public IInterpolationAlgorithm? InterpolationAlgorithm { get; set; }
/// <summary>
/// Gets the screen points.
/// </summary>
/// <returns>The list of points to display on screen for this path.</returns>
protected override IList<ScreenPoint> GetScreenPoints()
{
var screenPoints = this.Points.Select(this.Transform).ToList();
if (this.InterpolationAlgorithm != null)
{
var resampledPoints = ScreenPointHelper.ResamplePoints(screenPoints, this.MinimumSegmentLength);
return this.InterpolationAlgorithm.CreateSpline(resampledPoints, false, 0.25);
}
return this.Points.Select(this.Transform).ToList();
}
}
}