/// <summary> /// Return gridcells group with id matched around gCell /// </summary> /// <param name="gCell"></param> /// <returns></returns> public MatchGroup GetMatchIdArea(GridCell gCell) { MatchGroup res = new MatchGroup(); if (!gCell.Match || !gCell.IsMatchable) { return(res); } MatchGroup equalNeigh = new MatchGroup(); MatchGroup neighTemp; int id = gCell.Match.GetID(); res.Add(gCell); equalNeigh.AddRange(gCell.Neighbors.GetMatchIdCells(id, true)); //equalNeigh.AddRange(gCell.EqualNeighBornCells()); while (equalNeigh.Length > 0) { res.AddRange(equalNeigh.Cells); neighTemp = new MatchGroup(); foreach (var item in equalNeigh.Cells) { neighTemp.AddRange(item.Neighbors.GetMatchIdCells(id, true)); // neighTemp.AddRange(item.EqualNeighBornCells()); } equalNeigh = neighTemp; equalNeigh.Remove(res.Cells); } return(res); }
/// <summary> /// Return not empty gridcells from column /// </summary> /// <param name="gridCell"></param> /// <returns></returns> public MatchGroup GetColumnArea(GridCell gridCell) { MatchGroup res = new MatchGroup(); int row = gridCell.Row; int column = gridCell.Column; for (int i = row; i >= 0; i -= 2) { GridCell gCell = this[i, column]; if (!gCell.IsEmpty) { res.Add(gCell); } } return(res); }