コード例 #1
0
        /// <summary>
        /// Gets the columns to remove.
        /// </summary>
        /// <param name="shapeModel">The shape model.</param>
        /// <returns>A list of column indexes</returns>
        private static List <int> GetColumnsToRemove(this ShapeModel shapeModel)
        {
            var columnsToRemove = new List <int>();

            for (int col = shapeModel.LastColumn(); col >= 1; col--)
            {
                if (shapeModel.GetColumn(col).All(b => b.Color == CGA16Colors.Black.GetColor()))
                {
                    columnsToRemove.Add(col);
                }
                else
                {
                    break;
                }
            }

            for (int col = 1; col <= shapeModel.LastColumn(); col++)
            {
                if (shapeModel.GetColumn(col).All(b => b.Color == CGA16Colors.Black.GetColor()))
                {
                    columnsToRemove.Add(col);
                }
                else
                {
                    break;
                }
            }

            columnsToRemove.Sort();
            columnsToRemove.Reverse();

            return(columnsToRemove);
        }