protected override TaskPlugin GetTaskPluginCore()
        {
            BufferTaskPlugin result = GisEditor.TaskManager.GetActiveTaskPlugins <BufferTaskPlugin>().FirstOrDefault();

            if (result != null)
            {
                PrepareTaskParameters(result);
            }
            return(result);
        }
        private void PrepareTaskParameters(BufferTaskPlugin plugin)
        {
            FeatureSource featureSource = null;

            if (CurrentLayerHasSelectedFeatures && OnlyBufferSelectedFeatures)
            {
                ShapeFileExporter shpExporter     = new ShapeFileExporter();
                string            projectionInWKT = Proj4Projection.ConvertProj4ToPrj(GisEditor.ActiveMap.DisplayProjectionParameters);

                if (GisEditor.SelectionManager.GetSelectionOverlay() != null)
                {
                    var features = GisEditor.SelectionManager.GetSelectionOverlay().HighlightFeatureLayer
                                   .InternalFeatures.Where(f => f.Tag == SelectedFeatureLayer);
                    FileExportInfo info = new FileExportInfo(features, GetColumns(), tempShpFilePath, projectionInWKT);
                    shpExporter.ExportToFile(info);
                }
                featureSource = new ShapeFileFeatureSource(tempShpFilePath);
            }
            else
            {
                featureSource = SelectedFeatureLayer.FeatureSource;
            }

            if (featureSource.IsOpen)
            {
                featureSource.Close();
            }

            if (OutputMode == OutputMode.ToFile)
            {
                plugin.OutputPathFileName = OutputPathFileName;
            }
            else
            {
                string tempPathFileName = Path.Combine(FolderHelper.GetCurrentProjectTaskResultFolder(), TempFileName) + ".shp";
                plugin.OutputPathFileName = tempPathFileName;
                OutputPathFileName        = tempPathFileName;
            }
            plugin.FeatureSource = featureSource;
            plugin.Distance      = Distance;
            plugin.Smoothness    = Smoothness;
            plugin.Capstyle      = CapStyle;
            plugin.MapUnit       = GisEditor.ActiveMap.MapUnit;
            plugin.DistanceUnit  = SelectedDistanceUnit;
            plugin.DisplayProjectionParameters = GisEditor.ActiveMap.DisplayProjectionParameters;
            plugin.Dissolve = NeedDissolve;
        }