private FeatureData GetFeatureData(GetFeatures getFeatures, FieldSelection fieldSelection) { CheckIsFeatureLayer(); Features features = (Features)_service.Send(getFeatures); FeatureData featureData = fieldSelection.CreateFeatureData(); featureData.LayerName = Name; LoadFeatureData(features, featureData, fieldSelection); if (features.FeatureCount.HasMore) { getFeatures.BeginRecord = 1; do { getFeatures.BeginRecord += features.FeatureCount.Count; features = (Features)_service.Send(getFeatures); LoadFeatureData(features, featureData, fieldSelection); }while (features.FeatureCount.HasMore); } return(featureData); }
private FeatureData RecordSetToFeatureData(RecordSet recordSet, FieldSelection fieldSelection) { int fieldCount = fieldSelection.Fields.Count; int[] fieldIndex = new int[fieldCount]; var select = recordSet.Fields.FieldArray.Select((field, index) => new { field, index }); for (int i = 0; i < fieldCount; ++i) { var result = select.Where(x => String.Compare(x.field.Name, fieldSelection.Fields[i].Name, true) == 0).FirstOrDefault(); fieldIndex[i] = result == null ? -1 : result.index; } FeatureData featureData = fieldSelection.CreateFeatureData(); featureData.LayerName = Name; featureData.Rows = new FeatureRow[recordSet.Records.Length]; for (int r = 0; r < recordSet.Records.Length; ++r) { FeatureRow featureRow = new FeatureRow(); featureRow.Values = new object[fieldCount]; for (int c = 0; c < fieldSelection.Fields.Count; ++c) { if (fieldIndex[c] >= 0) { object value = recordSet.Records[r].Values[fieldIndex[c]]; if (value != null) { if (fieldSelection.Fields[c].Type == CommonFieldType.Geometry) { featureRow.Values[c] = ((AppGeo.Clients.Ags.Proxy.Geometry)value).ToCommon(); } else { featureRow.Values[c] = value; } } } } featureData.Rows[r] = featureRow; } return(featureData); }