예제 #1
0
        /// <summary>
        /// Handles output generated by GDAL utilities. The location of output
        /// is specified by OutputLayerInfo.Filename;
        /// </summary>
        public bool HandleGdalOutput(OutputLayerInfo outputInfo)
        {
            if (File.Exists(outputInfo.Filename))
            {
                outputInfo.DatasourcePointer = new DatasourcePointer(outputInfo.Filename);

                if (outputInfo.AddToMap)
                {
                    // don't report error if layer isn't added to the map
                    // user might cancel it because of projection mismatch
                    _layerService.AddLayersFromFilename(outputInfo.Filename);
                }

                return(true);
            }

            return(false);
        }
예제 #2
0
        private static bool AddTempDataSource(
            IAppContext context,
            ILayerService layerService,
            string filename,
            OutputLayerInfo outputInfo)
        {
            var fs = FeatureSet.OpenAsInMemoryDatasource(filename);

            if (fs != null)
            {
                // output info name
                if (layerService.AddDatasource(fs))
                {
                    var layer = context.Layers.ItemByHandle(layerService.LastLayerHandle);
                    layer.Name = outputInfo.Name;

                    GeoSource.Remove(filename);
                    return(true);
                }
            }

            return(false);
        }