コード例 #1
0
        /// <summary>
        /// A method called after the main IGisTool.Run method is successfully finished.
        /// Is executed on the UI thread. Typically used to save output datasources.
        /// Default implementation automatically handles values assigned to OutputLayerInfo.Result.
        /// </summary>
        public override bool AfterRun()
        {
            var output = this.GetOutputs().FirstOrDefault();

            if (output == null || output.MemoryLayer)
            {
                return(base.AfterRun());
            }

            if (output.Result != null)
            {
                if (output.Result is IFeatureSet fs)
                {
                    fs.StopAppendMode();
                    fs.Dispose();
                }

                output.Result = null;
            }

            // the append mode will close the append mode and datasource,
            // so we only need to add it to the map if it's requested by user
            if (!output.AddToMap)
            {
                return(true);
            }

            var fsNew = new FeatureSet(output.Filename);

            OutputManager.AddToMap(fsNew);
            return(true);
        }
コード例 #2
0
        /// <summary>
        /// A method called after the main IGisTool.Run method is successfully finished.
        /// Is executed on the UI thread. Typically used to save output datasources.
        /// Default implementation automatically handles values assigned to OutputLayerInfo.Result.
        /// </summary>
        public override bool AfterRun()
        {
            if (Output.AddToMap && File.Exists(Output.Filename))
            {
                Log.Info("Adding the resulting datasource to the map");

                var fs = new FeatureSet(Output.Filename);

                OutputManager.AddToMap(fs);
            }

            return(true);
        }
コード例 #3
0
        /// <summary>
        /// A method called after the main IGisTool.Run method is successfully finished.
        /// Is executed on the UI thread. Typically used to save output datasources.
        /// Default implementation automatically handles values assigned to OutputLayerInfo.Result.
        /// </summary>
        public override bool AfterRun()
        {
            if (Output.AddToMap && File.Exists(Output.Filename))
            {
                Log.Info("Adding the resulting datasource to the map");

                var raster = BitmapSource.Open(Output.Filename, true);

                OutputManager.AddToMap(raster);
            }

            return(true);
        }
コード例 #4
0
        /// <summary>
        /// Can be used to save results of the processing or display messages.
        /// Default implementation automatically handles values assigned to OutputLayerInfo.Result.
        /// </summary>
        public override bool AfterRun()
        {
            if (AddToMap)
            {
                var img = Output.Result as IImageSource;
                if (OutputManager.AddToMap(img))
                {
                    Output.Filename          = img.Filename;
                    Output.DatasourcePointer = new DatasourcePointer(img.Filename);
                    return(true);
                }
            }

            Output.Result.Dispose();

            return(true);
        }