Beispiel #1
0
        private DataTable RecordSetToTable(RecordSet recordSet, FieldSelection fieldSelection)
        {
            int[] fieldIndex = new int[fieldSelection.Fields.Count];
            var   select     = recordSet.Fields.FieldArray.Select((field, index) => new { field, index });

            for (int i = 0; i < fieldSelection.Fields.Count; ++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;
            }

            DataTable table = fieldSelection.CreateTable();

            foreach (Record record in recordSet.Records)
            {
                DataRow row = table.NewRow();

                for (int c = 0; c < fieldSelection.Fields.Count; ++c)
                {
                    if (fieldIndex[c] >= 0)
                    {
                        object value = record.Values[fieldIndex[c]];

                        if (value != null)
                        {
                            if (fieldSelection.Fields[c].Type == CommonFieldType.Geometry)
                            {
                                row[c] = ((AppGeo.Clients.Ags.Proxy.Geometry)value).ToCommon();
                            }
                            else
                            {
                                row[c] = value;
                            }
                        }
                    }
                }

                table.Rows.Add(row);
            }

            return(table);
        }
Beispiel #2
0
        private DataTable GetFeatureTable(GetFeatures getFeatures, FieldSelection fieldSelection)
        {
            CheckIsFeatureLayer();

            Features features = (Features)_service.Send(getFeatures);

            DataTable table = fieldSelection.CreateTable();

            LoadFeatureTable(features, table, fieldSelection);

            if (features.FeatureCount.HasMore)
            {
                getFeatures.BeginRecord = 1;

                do
                {
                    getFeatures.BeginRecord += features.FeatureCount.Count;
                    features = (Features)_service.Send(getFeatures);
                    LoadFeatureTable(features, table, fieldSelection);
                }while (features.FeatureCount.HasMore);
            }

            return(table);
        }