1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Windows;
|
---|
6 | using Microsoft.Research.DynamicDataDisplay.Common.Auxiliary;
|
---|
7 | using Microsoft.Research.DynamicDataDisplay.Charts;
|
---|
8 |
|
---|
9 | namespace Microsoft.Research.DynamicDataDisplay.DataSources.MultiDimensional
|
---|
10 | {
|
---|
11 | /// <summary>
|
---|
12 | /// Defines warped two-dimensional data source.
|
---|
13 | /// </summary>
|
---|
14 | /// <typeparam name="T">Data piece type</typeparam>
|
---|
15 | public sealed class WarpedDataSource2D<T> : IDataSource2D<T> where T : struct
|
---|
16 | {
|
---|
17 | /// <summary>
|
---|
18 | /// Initializes a new instance of the <see cref="WarpedDataSource2D<T>"/> class.
|
---|
19 | /// </summary>
|
---|
20 | /// <param name="data">Data.</param>
|
---|
21 | /// <param name="grid">Grid.</param>
|
---|
22 | public WarpedDataSource2D(T[,] data, Point[,] grid)
|
---|
23 | {
|
---|
24 | if (data == null)
|
---|
25 | throw new ArgumentNullException("data");
|
---|
26 | if (grid == null)
|
---|
27 | throw new ArgumentNullException("grid");
|
---|
28 |
|
---|
29 | Verify.IsTrue(data.GetLength(0) == grid.GetLength(0));
|
---|
30 | Verify.IsTrue(data.GetLength(1) == grid.GetLength(1));
|
---|
31 |
|
---|
32 | this.data = data;
|
---|
33 | this.grid = grid;
|
---|
34 | width = data.GetLength(0);
|
---|
35 | height = data.GetLength(1);
|
---|
36 | }
|
---|
37 |
|
---|
38 | #region DataSource<T> Members
|
---|
39 |
|
---|
40 | private readonly T[,] data;
|
---|
41 | /// <summary>
|
---|
42 | /// Gets two-dimensional data array.
|
---|
43 | /// </summary>
|
---|
44 | /// <value>The data.</value>
|
---|
45 | public T[,] Data
|
---|
46 | {
|
---|
47 | get { return data; }
|
---|
48 | }
|
---|
49 |
|
---|
50 | private readonly Point[,] grid;
|
---|
51 | /// <summary>
|
---|
52 | /// Gets the grid of data source.
|
---|
53 | /// </summary>
|
---|
54 | /// <value>The grid.</value>
|
---|
55 | public Point[,] Grid
|
---|
56 | {
|
---|
57 | get { return grid; }
|
---|
58 | }
|
---|
59 |
|
---|
60 | private readonly int width;
|
---|
61 | /// <summary>
|
---|
62 | /// Gets data grid width.
|
---|
63 | /// </summary>
|
---|
64 | /// <value>The width.</value>
|
---|
65 | public int Width
|
---|
66 | {
|
---|
67 | get { return width; }
|
---|
68 | }
|
---|
69 |
|
---|
70 | private readonly int height;
|
---|
71 | /// <summary>
|
---|
72 | /// Gets data grid height.
|
---|
73 | /// </summary>
|
---|
74 | /// <value>The height.</value>
|
---|
75 | public int Height
|
---|
76 | {
|
---|
77 | get { return height; }
|
---|
78 | }
|
---|
79 |
|
---|
80 | public IDataSource2D<T> GetSubset(int x0, int y0, int countX, int countY, int stepX, int stepY)
|
---|
81 | {
|
---|
82 | throw new NotImplementedException();
|
---|
83 | }
|
---|
84 |
|
---|
85 | private void RaiseChanged()
|
---|
86 | {
|
---|
87 | if (Changed != null)
|
---|
88 | {
|
---|
89 | Changed(this, EventArgs.Empty);
|
---|
90 | }
|
---|
91 | }
|
---|
92 | /// <summary>
|
---|
93 | /// Occurs when data source changes.
|
---|
94 | /// </summary>
|
---|
95 | public event EventHandler Changed;
|
---|
96 |
|
---|
97 | #endregion
|
---|
98 |
|
---|
99 | #region IDataSource2D<T> Members
|
---|
100 |
|
---|
101 | private Range<T>? range = null;
|
---|
102 | public Range<T>? Range
|
---|
103 | {
|
---|
104 | get { return range; }
|
---|
105 | }
|
---|
106 |
|
---|
107 | private T? missingValue = null;
|
---|
108 | public T? MissingValue
|
---|
109 | {
|
---|
110 | get { return missingValue; }
|
---|
111 | }
|
---|
112 |
|
---|
113 | #endregion
|
---|
114 | }
|
---|
115 | }
|
---|