aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/SideChains/RealTimeGraphX/IGraphPainter.cs
blob: 7a9ae04eac3795a72255b3b91b8c658a0551bc56 (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
using RealTimeGraphX.EventArguments;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace RealTimeGraphX
{
    /// <summary>
    /// Represents a graph painter that can be connected as an <see cref="IGraphRenderer"/> output.
    /// The graph painter will receive data points from the graph renderer and paint the graph.
    /// The final result will be passed to the output <see cref="IGraphSurface"/>.
    /// </summary>
    /// <seealso cref="RealTimeGraphX.IGraphComponent" />
    /// <seealso cref="RealTimeGraphX.IGraphOutputComponent{RealTimeGraphX.IGraphSurface}" />
    public interface IGraphPainter : IGraphComponent, IGraphOutputComponent<IGraphSurface>
    {
        #region Events

        /// <summary>
        /// Occurs when the current painter transformation (Scale/Translate) has changed.
        /// </summary>
        event EventHandler<TransformChangedEventArgs> TransformChanged;

        /// <summary>
        /// Occurs when the current virtual (effective minimum/maximum after transformation) x-axis minimum/maximum has changed.
        /// </summary>
        event EventHandler<RangeChangedEventArgs> VirtualRangeXChanged;

        /// <summary>
        /// Occurs when the current virtual (effective minimum/maximum after transformation) y-axis minimum/maximum has changed.
        /// </summary>
        event EventHandler<RangeChangedEventArgs> VirtualRangeYChanged;

        #endregion

        #region Properties

        /// <summary>
        /// Gets the current virtual (effective minimum/maximum after transformation) x-axis minimum.
        /// </summary>
        GraphDataPointBase VirtualMinimumX { get; }

        /// <summary>
        /// Gets the current virtual (effective minimum/maximum after transformation) x-axis maximum.
        /// </summary>
        GraphDataPointBase VirtualMaximumX { get; }

        /// <summary>
        /// Gets the current virtual (effective minimum/maximum after transformation) y-axis minimum.
        /// </summary>
        GraphDataPointBase VirtualMinimumY { get; }

        /// <summary>
        /// Gets the current virtual (effective minimum/maximum after transformation) y-axis maximum.
        /// </summary>
        GraphDataPointBase VirtualMaximumY { get; }

        /// <summary>
        /// Gets the last zooming rectangle that was passed on <see cref="SetZoomRect(GraphRect)"/>.
        /// </summary>
        GraphRect ZoomRect { get; }

        /// <summary>
        /// Gets the current painter transform object.
        /// The transform object is constructed based on the current <see cref="ZoomRect"/>.
        /// </summary>
        GraphTransform Transform { get; }

        /// <summary>
        /// Gets the width of the connected output surface.
        /// </summary>
        double SurfaceWidth { get; }

        /// <summary>
        /// Gets the height of the connected output surface.
        /// </summary>
        double SurfaceHeight { get; }

        #endregion

        #region Methods

        /// <summary>
        /// Sets the painter zooming rectangle.
        /// The zoom rectangle must be smaller than the size of the connected <see cref="IGraphSurface"/> size.
        /// </summary>
        /// <param name="rect">The rectangle.</param>
        void SetZoomRect(GraphRect rect);

        /// <summary>
        /// Resets the painter zooming rectangle.
        /// </summary>
        void ResetZoomRect();

        #endregion
    }

    /// <summary>
    /// Represents a graph painter that can be connected as an <see cref="IGraphRenderer"/> output.
    /// The graph painter will receive data points from the graph renderer and paint the graph.
    /// The final result will be passed to the output <see cref="IGraphSurface"/>.
    /// </summary>
    /// <typeparam name="TDataSeries">The type of the graph data series.</typeparam>
    /// <seealso cref="RealTimeGraphX.IGraphComponent" />
    /// <seealso cref="RealTimeGraphX.IGraphInputComponent{RealTimeGraphX.IGraphRenderer}" />
    /// <seealso cref="RealTimeGraphX.IGraphOutputComponent{RealTimeGraphX.IGraphSurface}" />
    public interface IGraphPainter<TDataSeries> : IGraphPainter, IGraphInputComponent<IGraphRenderer<TDataSeries>> where TDataSeries : IGraphDataSeries
    {
        #region Methods

        /// <summary>
        /// Draws the specified data point collection.
        /// </summary>
        /// <param name="seriesCollection">The entire series collection.</param>
        /// <param name="series">The data series.</param>
        /// <param name="points">The points.</param>
        void Draw(IEnumerable<TDataSeries> seriesCollection, TDataSeries series, IEnumerable<GraphPoint> points);

        #endregion
    }

    /// <summary>
    /// Represents a graph painter that can be connected as an <see cref="IGraphRenderer"/> output.
    /// The graph painter will receive data points from the graph renderer and paint the graph.
    /// The final result will be passed to the output <see cref="IGraphSurface"/> via the <see cref="IGraphPainter{TImage}.PaintingCompleted"/> event.
    /// </summary>
    /// <typeparam name="TImage">The type of the image.</typeparam>
    /// <typeparam name="TDataSeries">The type of the graph data series.</typeparam>
    /// <seealso cref="RealTimeGraphX.IGraphComponent" />
    /// <seealso cref="RealTimeGraphX.IGraphInputComponent{RealTimeGraphX.IGraphRenderer}" />
    /// <seealso cref="RealTimeGraphX.IGraphOutputComponent{RealTimeGraphX.IGraphSurface}" />
    public interface IGraphPainter<TDataSeries, TImage> : IGraphPainter, IGraphPainter<TDataSeries> where TDataSeries : IGraphDataSeries
    {
        #region Events

        /// <summary>
        /// Occurs when the painter has a new graph image available.
        /// </summary>
        event EventHandler<PaintingCompletedEventArgs<TImage>> PaintingCompleted;

        #endregion

        #region Properties

        /// <summary>
        /// Gets the current graph image.
        /// </summary>
        TImage Image { get; }

        #endregion
    }
}