aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/SideChains/RealTimeGraphX/IGraphRenderer.cs
blob: bdfae58f9d3bc97983b55ffd8a148fc6fdb3b444 (plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
using RealTimeGraphX.EventArguments;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace RealTimeGraphX
{
    /// <summary>
    /// Represents a graph renderer that can be connected as an output of an <see cref="IGraphController"/>.
    /// The graph renderer receives data points from the graph controller and prepares them for drawing.
    /// The output of a graph renderer should be of type <see cref="IGraphPainter"/>.
    /// </summary>
    /// <typeparam name="TDataSeries">The type of the graph data series.</typeparam>
    /// <seealso cref="RealTimeGraphX.IGraphInputComponent{RealTimeGraphX.IGraphController}" />
    /// <seealso cref="RealTimeGraphX.IGraphOutputComponent{RealTimeGraphX.IGraphPainter}" />
    public interface IGraphRenderer<TDataSeries> : IGraphInputComponent<IGraphController<TDataSeries>>, IGraphOutputComponent<IGraphPainter<TDataSeries>> where TDataSeries : IGraphDataSeries
    {
        #region Events

        /// <summary>
        /// Occurs when the current effective x-axis minimum/maximum has changed.
        /// </summary>
        event EventHandler<RangeChangedEventArgs> EffectiveRangeXChanged;

        /// <summary>
        /// Occurs when the current effective y-axis minimum/maximum has changed.
        /// </summary>        
        event EventHandler<RangeChangedEventArgs> EffectiveRangeYChanged;

        #endregion

        #region Properties

        /// <summary>
        /// Gets the current effective x-axis minimum.
        /// </summary>
        GraphDataPointBase EffectiveMinimumX { get; }

        /// <summary>
        /// Gets the current effective x-axis maximum.
        /// </summary>
        GraphDataPointBase EffectiveMaximumX { get; }

        /// <summary>
        /// Gets the current effective y-axis minimum.
        /// </summary>
        GraphDataPointBase EffectiveMinimumY { get; }

        /// <summary>
        /// Gets the current effective y-axis maximum.
        /// </summary>
        GraphDataPointBase EffectiveMaximumY { get; }

        /// <summary>
        /// Gets or sets the renderer refresh rate.
        /// Higher rate requires more CPU time.
        /// </summary>
        TimeSpan RefreshRate { get; set; }

        /// <summary>
        /// Gets the current data point x position.
        /// </summary>
        double CurrentXPosition { get; }

        /// <summary>
        /// Gets or sets a value indicating whether to pause the rendering.
        /// </summary>
        bool IsPaused { get; set; }

        #endregion

        #region Methods

        /// <summary>
        /// Invalidates the graph.
        /// </summary>
        void Invalidate();

        /// <summary>
        /// Clears the graph data.
        /// </summary>
        void Clear();

        #endregion
    }

    /// <summary>
    /// Represents a graph renderer that can be connected as an output of an <see cref="IGraphController"/>.
    /// The graph renderer receives data points from the graph controller and prepares them for drawing.
    /// The output of a graph renderer should be of type <see cref="IGraphPainter"/>.
    /// </summary>
    /// <typeparam name="TDataSeries">The type of the graph data series.</typeparam>
    /// <typeparam name="XDataPoint">The type of the x-axis data point.</typeparam>
    /// <typeparam name="YDataPoint">The type of the y-axis data point.</typeparam>
    /// <seealso cref="RealTimeGraphX.IGraphInputComponent{RealTimeGraphX.IGraphController}" />
    /// <seealso cref="RealTimeGraphX.IGraphOutputComponent{RealTimeGraphX.IGraphPainter}" />
    public interface IGraphRenderer<TDataSeries, XDataPoint, YDataPoint> : IGraphRenderer<TDataSeries>, IGraphInputComponent<IGraphController<TDataSeries, XDataPoint, YDataPoint>> where XDataPoint : GraphDataPointBase where YDataPoint : GraphDataPointBase where TDataSeries : IGraphDataSeries
    {
        #region Methods

        /// <summary>
        /// Renders the specified data points collection.
        /// • The number of data series of x and y must match.
        /// • The number of x and y collections must match.
        /// • The number of x and y data points must match.
        /// </summary>
        /// <param name="seriesCollection">The series collection.</param>
        /// <param name="xxxx">The x-axis series collection.</param>
        /// <param name="yyyy">The y-axis series collection.</param>
        void Render(IEnumerable<TDataSeries> seriesCollection, IEnumerable<IEnumerable<XDataPoint>> xxxx, IEnumerable<IEnumerable<YDataPoint>> yyyy);

        /// <summary>
        /// Gets the connected input controller.
        /// </summary>
        new IGraphController<TDataSeries, XDataPoint, YDataPoint> Input { get; }

        /// <summary>
        /// Occurs when the connected input controller has changed.
        /// </summary>
        new event EventHandler<InputChangedEventArgs<IGraphController<TDataSeries, XDataPoint, YDataPoint>>> InputChanged;

        #endregion
    }
}