public void SetCalcMatrix(byte[] grid, byte gridBit)
        {
            if (grid == null)
            {
                throw new Exception("Grid cannot be null");
            }
            if (grid.Length != mGrid.Length) // mGridX != (ushort) (mGrid.GetUpperBound(0) + 1) || mGridY != (ushort) (mGrid.GetUpperBound(1) + 1))
            {
                throw new Exception("SetCalcMatrix called with matrix with different dimensions. Call constructor instead.");
            }
            mGrid    = grid;
            mGridBit = gridBit;

            Array.Clear(mCalcGrid, 0, mCalcGrid.Length);
            ComparePFNodeMatrix comparer = (ComparePFNodeMatrix)mOpen.comparer;

            comparer.SetMatrix(mCalcGrid);
        }
Beispiel #2
0
        public void SetCalcMatrix(Dictionary <int, byte> grid, Cell[] Cells)
        {
            if (grid == null)
            {
                throw new Exception("Grid cannot be null");
            }
            mGrid  = grid;
            mCells = Cells;

            if (mCalcGrid == null || mCalcGrid.Length != mCells.Length)
            {
                mCalcGrid = new PathFinderNodeFast[mCells.Length];
            }
            mOpen.Clear();

            Array.Clear(mCalcGrid, 0, mCalcGrid.Length);
            ComparePFNodeMatrix comparer = (ComparePFNodeMatrix)mOpen.comparer;

            comparer.SetMatrix(mCalcGrid);
        }