Ejemplo n.º 1
0
        protected override void RunCore(Dictionary <string, string> parameters)
        {
            bool parametersValid = TryParseParameters(parameters);

            try
            {
                if (parametersValid)
                {
                    var sourceFeatures = GetSourceFeatures();
                    var resultFeatures = MergeFeatures(sourceFeatures, columns);

                    ShpFileExporter shpFileExporter = new ShpFileExporter();
                    FileExportInfo  fileInfor       = new FileExportInfo(resultFeatures, columns, outputPath, Wkt);
                    shpFileExporter.ExportToFile(fileInfor);
                }
            }
            catch (Exception ex)
            {
                var args = new UpdatingProgressLongRunningTaskPluginEventArgs(LongRunningTaskState.Error);
                args.ExceptionInfo = new LongRunningTaskExceptionInfo(ex.Source, ex.StackTrace);
                OnUpdatingProgress(args);
            }
            finally
            {
                var args = new UpdatingProgressLongRunningTaskPluginEventArgs(LongRunningTaskState.Updating);
                args.Message = "Finished";
                OnUpdatingProgress(args);
            }
        }
        private void Output(IEnumerable <Feature> bufferedFeatures, string path, string projection)
        {
            ShpFileExporter exporter        = new ShpFileExporter();
            string          projectionInWKT = GdalHelper.Proj4ToWkt(projection);
            FileExportInfo  info            = new FileExportInfo(bufferedFeatures, columns, path, projectionInWKT);

            exporter.ExportToFile(info);
        }
Ejemplo n.º 3
0
        private void Output(IEnumerable <Feature> bufferedFeatures)
        {
            string         projectionInWKT = GdalHelper.Proj4ToWkt(displayProjectionParameters);
            FileExportInfo info            = new FileExportInfo(bufferedFeatures, GetColumns(), outputPath, projectionInWKT);

            ShpFileExporter exporter = new ShpFileExporter();

            exporter.ExportToFile(info);
        }
        private void OutPutResults(IEnumerable <Feature> resultFeatures)
        {
            string exportPath = string.Empty;

            //if (outputToMap)
            //{
            //    string dir = Path.GetDirectoryName(tempShapeFilePath);
            //    string fileName = Path.GetFileNameWithoutExtension(tempShapeFilePath);
            //    string outputToMapTempFilePath = Path.Combine(dir, fileName + "OutPutToMapResult.shp");

            //    exportPath = outputToMapTempFilePath;

            //    var args = new UpdatingProgressLongRunningTaskPluginEventArgs(LongRunningTaskState.Updating);
            //    args.Parameters.Add("OutputToMapTempFilePath", exportPath);
            //    OnUpdatingProgress(args);
            //}
            //else
            if (outputToFile && !string.IsNullOrEmpty(outputFilePath))
            {
                exportPath = outputFilePath;

                var args = new UpdatingProgressLongRunningTaskPluginEventArgs(LongRunningTaskState.Updating);
                args.Message = "Creating File";
                OnUpdatingProgress(args);
            }

            FileExportInfo  info     = new FileExportInfo(resultFeatures, columnsToInclude, exportPath, displayProjectionParameters);
            ShpFileExporter exporter = new ShpFileExporter();

            exporter.ExportToFile(info);

            OnUpdatingProgress(new UpdatingProgressLongRunningTaskPluginEventArgs(LongRunningTaskState.Updating)
            {
                Message = "Finished"
            });
        }