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
}
}