Exemple #1
0
        public override Collection <FeatureSourceColumn> GetColumnToAdd(string filePath, string customParameter)
        {
            Collection <FeatureSourceColumn> result = new Collection <FeatureSourceColumn>();
            CsvFeatureSource csvFeatureSource       = new CsvFeatureSource();

            csvFeatureSource.DelimitedPathFilename = filePath;
            csvFeatureSource.Delimiter             = customParameter;
            csvFeatureSource.RequireIndex          = false;
            csvFeatureSource.Open();
            foreach (var column in csvFeatureSource.GetColumns())
            {
                DataJoinFeatureSourceColumn csvColumn = new DataJoinFeatureSourceColumn(column.ColumnName, column.TypeName, column.MaxLength);
                result.Add(csvColumn);
            }
            csvFeatureSource.Close();

            return(result);
        }
        protected override void BuildIndexCore(FeatureLayer featureLayer)
        {
            CsvFeatureLayer  csvFeatureLayer  = (CsvFeatureLayer)featureLayer;
            CsvFeatureSource csvFeatureSource = csvFeatureLayer.FeatureSource as CsvFeatureSource;

            try
            {
                csvFeatureSource.BuildingIndex -= DelimitedFeatureSource_BuildingIndex;
                csvFeatureSource.BuildingIndex += DelimitedFeatureSource_BuildingIndex;
                csvFeatureSource.BuildIndexFile(csvFeatureSource.DelimitedPathFilename, csvFeatureSource.WellKnownTextColumnName, csvFeatureSource.Delimiter, BuildIndexMode.DoNotRebuild);
            }
            catch (Exception ex)
            {
                GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex));
            }
            finally
            {
                csvFeatureSource.BuildingIndex -= DelimitedFeatureSource_BuildingIndex;
            }
        }