/// <inheritdoc /> public IDataTable GetAttributes(int startIndex, int numRows, IEnumerable <string> fieldNames) { var c = new AttributeCache(_layer.DataSet, numRows); var fn = new HashSet <string>(fieldNames); var result = new DS_DataTable(); foreach (DataColumn col in _layer.DataSet.GetColumns()) { if (fn.Contains(col.ColumnName)) { result.Columns.Add(col); } } int i = 0; FastDrawnState[] drawnStates = _layer.DrawnStates; for (int fid = 0; fid < drawnStates.Length; fid++) { if (drawnStates[fid].Selected) { i++; if (i < startIndex) { continue; } IDataRow dr = result.NewRow(); Dictionary <string, object> vals = c.RetrieveElement(fid); foreach (KeyValuePair <string, object> pair in vals) { if (fn.Contains(pair.Key)) { dr[pair.Key] = pair.Value; } } result.Rows.Add(dr); if (i > startIndex + numRows) { break; } } } return(result); }
/// <inheritdoc/> public IDataTable GetAttributes(int startIndex, int numRows, IEnumerable <string> fieldNames) { int count = 0; IDataTable dt = new DS_DataTable(); List <DataColumn> dc = new List <DataColumn>(); DataColumn[] original = _featureSet.GetColumns(); var names = fieldNames as IList <string> ?? fieldNames.ToList(); foreach (DataColumn c in original) { if (names.Contains(c.ColumnName)) { dc.Add(c); } } dt.Columns.AddRange(dc.ToArray()); foreach (IFeature feature in Filter) { if (count >= startIndex && count < startIndex + numRows) { foreach (string name in names) { IDataRow dr = dt.NewRow(); dr[name] = feature.DataRow[name]; dt.Rows.Add(dr); } } if (count > numRows + startIndex) { break; } count++; } return(dt); }
/// <inheritdoc /> public IDataTable GetAttributes(int startIndex, int numRows) { int count = 0; IDataTable dt = new DS_DataTable(); dt.Columns.AddRange(_featureSet.GetColumns()); foreach (IFeature feature in Filter) { if (count >= startIndex && count < startIndex + numRows) { dt.Rows.Add(feature.DataRow.ItemArray); } if (count > numRows + startIndex) { break; } count++; } return(dt); }