Exemple #1
0
        public void SetTableSchemaWithDifferentKeyNameAndSchemaMergeAction()
        {
            ShapeFileProvider shapeFile = new ShapeFileProvider(
                BcRoadsShapeFile, _geoFactory, _coordSysFactory);

            shapeFile.Open();
            IGeometry empty = _geoFactory.CreatePoint();
            FeatureDataTable <UInt32> queryTable = shapeFile.CreateNewTable() as FeatureDataTable <UInt32>;
            // expecting a new FeatureDataTable<UInt32>("OID", _geoFactory);

            FeatureDataTable <UInt32> keyedTable = new FeatureDataTable <UInt32>("FID", _geoFactory);

            shapeFile.SetTableSchema(keyedTable, SchemaMergeAction.KeyByType);
            DataTableHelper.AssertTableStructureIdentical(keyedTable, queryTable);
        }
        public void MergeSchemaToSchemalessTargetShouldCreateIdenticalTable()
        {
            FeatureDataTable       table    = new FeatureDataTable(_factories.GeoFactory);
            FeatureProvider        provider = DataSourceHelper.CreateFeatureDatasource(_factories.GeoFactory);
            FeatureQueryExpression query    = FeatureQueryExpression.Intersects(provider.GetExtents());
            IFeatureDataReader     reader   = provider.ExecuteFeatureQuery(query);

            table.Load(reader, LoadOption.OverwriteChanges, null);

            FeatureDataTable target = new FeatureDataTable(_factories.GeoFactory);

            table.MergeSchemaTo(target);

            DataTableHelper.AssertTableStructureIdentical(table, target);
        }
        public void MergeSchemaToKeyedTableWithDifferentKeyNameButSameTypeShouldKeepKeyButAddOtherColumns()
        {
            FeatureDataTable       table    = new FeatureDataTable(_factories.GeoFactory);
            FeatureProvider        provider = DataSourceHelper.CreateFeatureDatasource(_factories.GeoFactory);
            FeatureQueryExpression query    = FeatureQueryExpression.Intersects(provider.GetExtents());
            IFeatureDataReader     reader   = provider.ExecuteFeatureQuery(query);

            table.Load(reader, LoadOption.OverwriteChanges, null);

            FeatureDataTable <Guid> target = new FeatureDataTable <Guid>("GID", _factories.GeoFactory);

            table.MergeSchemaTo(target);

            DataTableHelper.AssertTableStructureIdentical(table, target);
        }
        public void CloneToCopiesTableStructureAndNoData()
        {
            FeatureDataTable       table    = new FeatureDataTable(_factories.GeoFactory);
            FeatureProvider        provider = DataSourceHelper.CreateFeatureDatasource(_factories.GeoFactory);
            FeatureQueryExpression query    = FeatureQueryExpression.Intersects(provider.GetExtents());
            IFeatureDataReader     reader   = provider.ExecuteFeatureQuery(query);

            table.Load(reader, LoadOption.OverwriteChanges, null);

            FeatureDataTable clone = new FeatureDataTable(_factories.GeoFactory);

            table.CloneTo(clone);
            DataTableHelper.AssertTableStructureIdentical(table, clone);

            Assert.Equal(0, clone.Rows.Count);
        }
Exemple #5
0
        public void SetTableSchemaShouldMatchShapeFileSchema()
        {
            ShapeFileProvider shapeFile = new ShapeFileProvider(
                BcRoadsShapeFile, _geoFactory, _coordSysFactory);

            shapeFile.Open();
            IGeometry empty = _geoFactory.CreatePoint();
            FeatureDataTable <UInt32> queryTable = shapeFile.CreateNewTable() as FeatureDataTable <UInt32>;

            FeatureDataTable nonKeyedTable = new FeatureDataTable(_geoFactory);

            shapeFile.SetTableSchema(nonKeyedTable);
            DataTableHelper.AssertTableStructureIdentical(nonKeyedTable, queryTable);

            FeatureDataTable <UInt32> keyedTable = new FeatureDataTable <UInt32>("OID", _geoFactory);

            shapeFile.SetTableSchema(keyedTable);
            DataTableHelper.AssertTableStructureIdentical(keyedTable, queryTable);
        }