示例#1
0
 public GeoServicesClass(GeoServicesDataset dataset)
 {
     _dataset = dataset;
     if (_dataset != null)
     {
         this.Name = _dataset._name;
     }
 }
 public GeoServicesFeatureCursor(GeoServicesDataset dataset,
                                 GeoServicesFeatureClass featureClass,
                                 string queryUrl,
                                 string postData,
                                 string where)
 {
     _dataset      = dataset;
     _featureClass = featureClass;
     _queryUrl     = queryUrl;
     _postData     = postData;
     _where        = where;
 }
        async static internal Task <GeoServicesFeatureClass> CreateAsync(GeoServicesDataset dataset, JsonLayer jsonLayer)
        {
            var featureClass = new GeoServicesFeatureClass();

            featureClass._dataaset = dataset;

            featureClass.ID   = jsonLayer.Id.ToString();
            featureClass.Name = jsonLayer.Name;

            var fields = featureClass.Fields as Fields;

            if (fields != null && jsonLayer.Fields != null)
            {
                foreach (var jsonField in jsonLayer.Fields)
                {
                    var fieldType = RestHelper.FType(jsonField.Type);

                    if (fieldType == FieldType.String)
                    {
                        fields.Add(new Field(jsonField.Name, fieldType, 1024)
                        {
                            aliasname = jsonField.Alias ?? jsonField.Name
                        });
                    }
                    else
                    {
                        fields.Add(new Field(jsonField.Name, fieldType)
                        {
                            aliasname = jsonField.Alias ?? jsonField.Name
                        });
                    }

                    if (fieldType == FieldType.ID)
                    {
                        featureClass.IDFieldName = jsonField.Name;
                    }
                }
            }

            featureClass.GeometryType = jsonLayer.GetGeometryType();

            if (jsonLayer.Extent != null)
            {
                featureClass.Envelope = new Envelope(jsonLayer.Extent.Xmin,
                                                     jsonLayer.Extent.Ymin,
                                                     jsonLayer.Extent.Xmax,
                                                     jsonLayer.Extent.Ymax);
            }

            featureClass.SpatialReference = await dataset.GetSpatialReference();

            return(featureClass);
        }
示例#4
0
        async public Task <object> GetInstanceAsync()
        {
            if (_class == null)
            {
                GeoServicesDataset dataset = new GeoServicesDataset(
                    _connectionString,
                    (String.IsNullOrWhiteSpace(_folder) ? "" : $"{_folder}/") + _name);

                await dataset.Open();

                var elements = await dataset.Elements();

                if (elements.Count == 0)
                {
                    dataset.Dispose();
                    return(null);
                }

                _class = elements[0].Class as GeoServicesClass;
            }

            return(_class);
        }