Exemplo n.º 1
0
 public Matrix(bool visualize)
 {
     if (visualize)
     {
         matrixid = Visualize.CreateMatrix();
     }
 }
Exemplo n.º 2
0
 public void SetRange(int minx, int maxx, int miny, int maxy)
 {
     this.minx = minx;
     this.maxx = maxx;
     this.miny = miny;
     this.maxy = maxy;
     if (matrixid >= 0)
     {
         Visualize.SetMatrixRange(matrixid, minx, maxx, miny, maxy);
     }
 }
Exemplo n.º 3
0
 public T this[int x, int y]
 {
     get
     {
         T value;
         if (!data.TryGetValue(MakeKey(x, y), out value))
         {
             if (!allowuninitread)
             {
                 throw new IndexOutOfRangeException(String.Format("Trying to read uninitialized value ({0}, {1}) [{2}-{3}], [{4}-{5}]", x, y, minx, maxx, miny, maxy));
             }
         }
         return(value);
     }
     set
     {
         if (x < minx || x > maxx || y < miny || y > maxy)
         {
             if (!autosize)
             {
                 throw new IndexOutOfRangeException(String.Format("Trying to write out of range ({0}, {1}) [{2}-{3}], [{4}-{5}]", x, y, minx, maxx, miny, maxy));
             }
             if (x < minx)
             {
                 minx = x;
             }
             if (x > maxx)
             {
                 maxx = x;
             }
             if (y < miny)
             {
                 miny = y;
             }
             if (y > maxy)
             {
                 maxy = y;
             }
             //if (matrixid >= 0)
             //    Visualize.SetMatrixRange(matrixid, minx, maxx, miny, maxy);
         }
         if (keys != null && !data.ContainsKey(MakeKey(x, y)))
         {
             keys = null;
         }
         data[MakeKey(x, y)] = value;
         if (matrixid >= 0)
         {
             Visualize.SetMatrixData(matrixid, x, y, value.ToString());
         }
     }
 }
Exemplo n.º 4
0
 public T this[int index]
 {
     get
     {
         if (keys == null)
         {
             keys = data.Keys.ToList();
         }
         return(data[keys[index]]);
     }
     set
     {
         if (keys == null)
         {
             keys = data.Keys.ToList();
         }
         if (matrixid >= 0)
         {
             var xy = FromKey(keys[index]);
             Visualize.SetMatrixData(matrixid, xy.Item1, xy.Item2, value.ToString());
         }
         data[keys[index]] = value;
     }
 }