示例#1
0
        /// <summary>
        /// Sets the data columns from an enumeration of data column proxies.
        /// </summary>
        /// <param name="dataRows">The enumeration of data rows.</param>
        public void SetDataRows(IAscendingIntegerCollection dataRows)
        {
            _participatingDataRows.Clear();

            foreach (var range in dataRows.RangesAscending)
            {
                _participatingDataRows.AddRange(range.Start, range.Count);
            }

            _isDirty = true;
        }
        /// <summary>
        /// Gets the data rows that participate in a matrix area by providing a table, the collection of selected data rows, and the collection of selected data columns.
        /// </summary>
        /// <param name="table">The table.</param>
        /// <param name="selectedRows">The selected data rows.</param>
        /// <param name="participatingColumns">The data columns that participate in the matrix area.</param>
        /// <returns>The collection of indices of data rows that participate in the matrix area.</returns>
        public static Altaxo.Collections.AscendingIntegerCollection GetParticipatingDataRows(DataTable table, IAscendingIntegerCollection selectedRows, IAscendingIntegerCollection participatingColumns)
        {
            var result = new AscendingIntegerCollection();

            if (null != selectedRows && selectedRows.Count > 0)
            {
                result.Add(selectedRows);
            }
            else
            {
                var dc   = table.DataColumns;
                int rows = participatingColumns.Select(i => dc[i].Count).MaxOrDefault(0);

                result.AddRange(0, rows);
            }

            return(result);
        }