[12503] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using System.Windows;
|
---|
| 6 |
|
---|
| 7 | namespace Microsoft.Research.DynamicDataDisplay.DataSources.MultiDimensional
|
---|
| 8 | {
|
---|
| 9 | public class NonUniformDataSource2D<T> : INonUniformDataSource2D<T> where T : struct
|
---|
| 10 | {
|
---|
| 11 | public NonUniformDataSource2D(double[] xcoordinates, double[] ycoordinates, T[,] data)
|
---|
| 12 | {
|
---|
| 13 | if (xcoordinates == null)
|
---|
| 14 | throw new ArgumentNullException("xcoordinates");
|
---|
| 15 | if (ycoordinates == null)
|
---|
| 16 | throw new ArgumentNullException("ycoordinates");
|
---|
| 17 | if (data == null)
|
---|
| 18 | throw new ArgumentNullException("data");
|
---|
| 19 |
|
---|
| 20 | this.xCoordinates = xcoordinates;
|
---|
| 21 | this.yCoordinates = ycoordinates;
|
---|
| 22 |
|
---|
| 23 | BuildGrid();
|
---|
| 24 |
|
---|
| 25 | this.data = data;
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | private void BuildGrid()
|
---|
| 29 | {
|
---|
| 30 | grid = new Point[Width, Height];
|
---|
| 31 | for (int iy = 0; iy < Height; iy++)
|
---|
| 32 | {
|
---|
| 33 | for (int ix = 0; ix < Width; ix++)
|
---|
| 34 | {
|
---|
| 35 | grid[ix, iy] = new Point(xCoordinates[ix], yCoordinates[iy]);
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | #region INonUniformDataSource2D<T> Members
|
---|
| 41 |
|
---|
| 42 | private double[] xCoordinates;
|
---|
| 43 | public double[] XCoordinates
|
---|
| 44 | {
|
---|
| 45 | get { return xCoordinates; }
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | private double[] yCoordinates;
|
---|
| 49 | public double[] YCoordinates
|
---|
| 50 | {
|
---|
| 51 | get { return yCoordinates; }
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | #endregion
|
---|
| 55 |
|
---|
| 56 | #region IDataSource2D<T> Members
|
---|
| 57 |
|
---|
| 58 | private T[,] data;
|
---|
| 59 | public T[,] Data
|
---|
| 60 | {
|
---|
| 61 | get { return data; }
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | public IDataSource2D<T> GetSubset(int x0, int y0, int countX, int countY, int stepX, int stepY)
|
---|
| 65 | {
|
---|
| 66 | throw new NotImplementedException();
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | public void ApplyMappings(DependencyObject marker, int x, int y)
|
---|
| 70 | {
|
---|
| 71 | throw new NotImplementedException();
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | #endregion
|
---|
| 75 |
|
---|
| 76 | #region IGridSource2D Members
|
---|
| 77 |
|
---|
| 78 | private Point[,] grid;
|
---|
| 79 | public Point[,] Grid
|
---|
| 80 | {
|
---|
| 81 | get { return grid; }
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | public int Width
|
---|
| 85 | {
|
---|
| 86 | get { return xCoordinates.Length; }
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | public int Height
|
---|
| 90 | {
|
---|
| 91 | get { return yCoordinates.Length; }
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | public event EventHandler Changed;
|
---|
| 95 |
|
---|
| 96 | #endregion
|
---|
| 97 |
|
---|
| 98 | #region IDataSource2D<T> Members
|
---|
| 99 |
|
---|
| 100 |
|
---|
| 101 | public Microsoft.Research.DynamicDataDisplay.Charts.Range<T>? Range
|
---|
| 102 | {
|
---|
| 103 | get { throw new NotImplementedException(); }
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | public T? MissingValue
|
---|
| 107 | {
|
---|
| 108 | get { throw new NotImplementedException(); }
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | #endregion
|
---|
| 112 | }
|
---|
| 113 | }
|
---|