Exemple #1
0
        /// <summary>
        ///     Exports the source table using the query filter to the table in the output workspace.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="tableName">Name of the output table.</param>
        /// <param name="workspace">The workspace.</param>
        /// <param name="handle">The handle.</param>
        /// <param name="surrogate">The surrogate for the event handler.</param>
        /// <param name="errors">The errors that occured during the export.</param>
        /// <returns>
        ///     Returns a <see cref="ITable" /> representing the feature class that was exported.
        /// </returns>
        public static ITable Export(this ITable source, IQueryFilter filter, string tableName, IWorkspace workspace, int handle, FeatureProgress surrogate, out IEnumInvalidObject errors)
        {
            IEnumFieldError fieldError;

            return(source.Export(filter, tableName, workspace, source.Fields, handle, surrogate, out errors, out fieldError));
        }
Exemple #2
0
        /// <summary>
        ///     Exports the source table using the query filter to the table in the output workspace.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="tableName">Name of the output table.</param>
        /// <param name="workspace">The output workspace.</param>
        /// <param name="requiredFields">The required fields.</param>
        /// <param name="handle">The handle.</param>
        /// <param name="surrogate">The surrogate for the event handler.</param>
        /// <param name="invalid">The errors that occured during the export.</param>
        /// <param name="errors">The field errors.</param>
        /// <returns>
        ///     Returns a <see cref="IFeatureClass" /> representing the feature class that was exported.
        /// </returns>
        public static ITable Export(this ITable source, IQueryFilter filter, string tableName, IWorkspace workspace, IFields requiredFields, int handle, FeatureProgress surrogate, out IEnumInvalidObject invalid, out IEnumFieldError errors)
        {
            var ds    = (IDataset)source;
            var input = ds.Workspace.Define(ds.Name, new TableNameClass());

            var output = workspace.Define(tableName, new TableNameClass());

            workspace.Delete(output);

            IFieldChecker fieldChecker = new FieldCheckerClass();

            fieldChecker.InputWorkspace    = ds.Workspace;
            fieldChecker.ValidateWorkspace = workspace;

            IFields targetFields;

            fieldChecker.Validate(requiredFields, out errors, out targetFields);

            var featureDataConverter = new FeatureDataConverterClass();

            if (surrogate != null)
            {
                surrogate.Advise(featureDataConverter);
            }

            invalid = featureDataConverter.ConvertTable(input, filter, null, output, targetFields, "", 1000, handle);

            return(((IName)output).Open() as ITable);
        }
Exemple #3
0
        /// <summary>
        /// Exports the source table using the query filter to the table in the output workspace.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="tableName">Name of the output table.</param>
        /// <param name="workspace">The output workspace.</param>
        /// <param name="requiredFields">The required fields.</param>
        /// <param name="handle">The handle.</param>
        /// <param name="keepFeatureDatset">if set to <c>true</c> when the feature class should be created within feature datset.</param>
        /// <param name="surrogate">The surrogate for the event handler.</param>
        /// <param name="invalid">The errors that occured during the export.</param>
        /// <param name="errors">The field errors.</param>
        /// <returns>
        /// Returns a <see cref="IFeatureClass" /> representing the feature class that was exported.
        /// </returns>
        public static IFeatureClass Export(this IFeatureClass source, IQueryFilter filter, string tableName, IWorkspace workspace, IFields requiredFields, int handle, bool keepFeatureDatset, FeatureProgress surrogate, out IEnumInvalidObject invalid, out IEnumFieldError errors)
        {
            var ds = (IDataset)source;

            var input  = ds.Workspace.Define(ds.Name, new FeatureClassNameClass());
            var output = workspace.Define(tableName, new FeatureClassNameClass());

            if (source.FeatureDataset != null && keepFeatureDatset)
            {
                output.FeatureDatasetName = source.FeatureDataset.FullName as IDatasetName;
            }

            var i           = source.Fields.FindField(source.ShapeFieldName);
            var field       = source.Fields.Field[i];
            var clone       = (IClone)field.GeometryDef;
            var geometryDef = (IGeometryDef)clone.Clone();

            workspace.Delete(output);

            IFieldChecker fieldChecker = new FieldCheckerClass();

            fieldChecker.InputWorkspace    = ds.Workspace;
            fieldChecker.ValidateWorkspace = workspace;

            IFields targetFields;

            fieldChecker.Validate(requiredFields, out errors, out targetFields);

            var featureDataConverter = new FeatureDataConverterClass();

            if (surrogate != null)
            {
                surrogate.Advise(featureDataConverter);
            }

            invalid = featureDataConverter.ConvertFeatureClass(input, filter, null, output, geometryDef, targetFields, "", 1000, handle);

            return(((IName)output).Open() as IFeatureClass);
        }