示例#1
0
        async static public Task <IFeatureClass> Create(GeometryDataset dataset, string name, string idFieldName, string shapeFieldName, bool isView)
        {
            var featureClass = new Featureclass(dataset, name, idFieldName, shapeFieldName, isView);

            featureClass._name = await dataset.TableNamePlusSchema(name, isView);

            featureClass._idfield    = idFieldName;
            featureClass._shapefield = shapeFieldName;
            featureClass._geomType   = geometryType.Unknown;

            featureClass._dataset = dataset;
            if (featureClass._dataset is GeographyDataset)
            {
                featureClass._sRef = gView.Framework.Geometry.SpatialReference.FromID("epsg:4326");
            }

            await featureClass.ReadSchema();

            if (String.IsNullOrEmpty(featureClass._idfield) && featureClass._fields.Count > 0 && featureClass._dataset != null)
            {
                Field field = featureClass._fields[0] as Field;
                if (field != null)
                {
                    if ((field.type == FieldType.integer || field.type == FieldType.biginteger || field.type == FieldType.ID) &&
                        field.name.ToLower() == featureClass._dataset.OgcDictionary("gview_id").ToLower())
                    {
                        featureClass._idfield = field.name;
                    }
                    ((Field)field).type = FieldType.ID;
                }
            }

            //base._geomType = geometryType.Polygon;

            if (featureClass._sRef == null)
            {
                featureClass._sRef = await gView.Framework.OGC.DB.OgcSpatialFeatureclass.TrySelectSpatialReference(dataset, featureClass);
            }

            return(featureClass);
        }
示例#2
0
        public Featureclass(GeometryDataset dataset, string name, string idFieldName, string shapeFieldName, bool isView)
        {
            _name       = dataset.TableNamePlusSchema(name, isView);
            _idfield    = idFieldName;
            _shapefield = shapeFieldName;
            _geomType   = geometryType.Unknown;

            _dataset = dataset;
            if (_dataset is GeographyDataset)
            {
                _sRef = gView.Framework.Geometry.SpatialReference.FromID("epsg:4326");
            }

            ReadSchema();

            if (String.IsNullOrEmpty(_idfield) && _fields.Count > 0 && _dataset != null)
            {
                Field field = _fields[0] as Field;
                if (field != null)
                {
                    if ((field.type == FieldType.integer || field.type == FieldType.biginteger || field.type == FieldType.ID) &&
                        field.name.ToLower() == _dataset.OgcDictionary("gview_id").ToLower())
                    {
                        _idfield = field.name;
                    }
                    ((Field)field).type = FieldType.ID;
                }
            }

            //base._geomType = geometryType.Polygon;

            if (_sRef == null)
            {
                _sRef = gView.Framework.OGC.DB.OgcSpatialFeatureclass.TrySelectSpatialReference(dataset, this);
            }
        }
示例#3
0
 private Featureclass(GeometryDataset dataset, string name, string idFieldName, string shapeFieldName, bool isView)
 {
 }