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 | public abstract class ViewportPolylineBase : ViewportShape
|
---|
11 | {
|
---|
12 | protected ViewportPolylineBase()
|
---|
13 | {
|
---|
14 | }
|
---|
15 |
|
---|
16 | #region Properties
|
---|
17 |
|
---|
18 | /// <summary>
|
---|
19 | /// Gets or sets the points in Viewport coordinates, that form the line.
|
---|
20 | /// </summary>
|
---|
21 | /// <value>The points.</value>
|
---|
22 | public PointCollection Points
|
---|
23 | {
|
---|
24 | get { return (PointCollection)GetValue(PointsProperty); }
|
---|
25 | set { SetValue(PointsProperty, value); }
|
---|
26 | }
|
---|
27 |
|
---|
28 | /// <summary>
|
---|
29 | /// Identifies the Points dependency property.
|
---|
30 | /// </summary>
|
---|
31 | public static readonly DependencyProperty PointsProperty = DependencyProperty.Register(
|
---|
32 | "Points",
|
---|
33 | typeof(PointCollection),
|
---|
34 | typeof(ViewportPolylineBase),
|
---|
35 | new FrameworkPropertyMetadata(new PointCollection(), OnPropertyChanged));
|
---|
36 |
|
---|
37 | protected static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
---|
38 | {
|
---|
39 | ViewportPolylineBase polyline = (ViewportPolylineBase)d;
|
---|
40 |
|
---|
41 | PointCollection currentPoints = (PointCollection)e.NewValue;
|
---|
42 |
|
---|
43 | polyline.UpdateUIRepresentation();
|
---|
44 | }
|
---|
45 |
|
---|
46 | /// <summary>
|
---|
47 | /// Gets or sets the fill rule of polygon or polyline.
|
---|
48 | /// </summary>
|
---|
49 | /// <value>The fill rule.</value>
|
---|
50 | public FillRule FillRule
|
---|
51 | {
|
---|
52 | get { return (FillRule)GetValue(FillRuleProperty); }
|
---|
53 | set { SetValue(FillRuleProperty, value); }
|
---|
54 | }
|
---|
55 |
|
---|
56 | public static readonly DependencyProperty FillRuleProperty = DependencyProperty.Register(
|
---|
57 | "FillRule",
|
---|
58 | typeof(FillRule),
|
---|
59 | typeof(ViewportPolylineBase),
|
---|
60 | new FrameworkPropertyMetadata(FillRule.EvenOdd, OnPropertyChanged));
|
---|
61 |
|
---|
62 | #endregion
|
---|
63 |
|
---|
64 | private PathGeometry geometry = new PathGeometry();
|
---|
65 | protected PathGeometry PathGeometry
|
---|
66 | {
|
---|
67 | get { return geometry; }
|
---|
68 | }
|
---|
69 |
|
---|
70 | protected sealed override Geometry DefiningGeometry
|
---|
71 | {
|
---|
72 | get { return geometry; }
|
---|
73 | }
|
---|
74 | }
|
---|
75 | }
|
---|