Exemple #1
0
        private void t()
        {
            string fname            = "E:\\masData\\Mas二期投影结果展示\\FY3A_VIRRX_GBAL_L1_20110322_0525_1000M_MS.ldf";
            IRasterDataProvider prd = GeoDataDriver.Open(fname) as IRasterDataProvider;

            BlockDef[]          blocks = new BlockDef[] { new BlockDef("DXX", 74.0, 33.0, 10.0) };
            RasterClipProcesser s      = new RasterClipProcesser();

            IRasterDataProvider[] outs = s.Clip(prd, blocks, 50, "LDF", "E:\\masData\\Clip", null);
        }
Exemple #2
0
        public Execute()
        {
            _rasterClipProcess = new RasterClipProcesser();

            string size = System.Configuration.ConfigurationManager.AppSettings["BlockThumbnailSize"];

            if (!string.IsNullOrWhiteSpace(size))
            {
                int.TryParse(size, out _blockPngSize);
            }
        }
Exemple #3
0
        public void ClipDataProvider()
        {
            string fname = "d:\\ce110429n18.ldf";
            //IRasterDataProvider prd = GeoDataDriver.Open(fname) as IRasterDataProvider;
            IRasterDataDriver driver = GeoDataDriver.GetDriverByName("GDAL") as IRasterDataDriver;

            Assert.NotNull(driver);
            IRasterDataProvider prd = driver.Open(fname, enumDataProviderAccess.ReadOnly) as IRasterDataProvider;

            Console.WriteLine(prd.CoordEnvelope.Height);
            Console.WriteLine(prd.CoordEnvelope.Width);
            Console.WriteLine(prd.Height);
            Console.WriteLine(prd.Width);

            RasterClipProcesser cp = new RasterClipProcesser();
            //BlockDef block=new BlockDef("a",
        }
Exemple #4
0
        public string[] RasterClipT(string infName, BlockDef[] blocks, string outDir, IProgressMonitor progress, string type)
        {
            IRasterDataProvider prd = GeoDataDriver.Open(infName) as IRasterDataProvider;

            try
            {
                if (progress != null)
                {
                    progress.Reset("", 100);
                    progress.Start(false);
                }
                if (type.Equals("Clip"))
                {
                    RasterClipProcesser   clip = new RasterClipProcesser();
                    IRasterDataProvider[] outs = null;
                    if (prd is IMemoryRasterDataProvider)
                    {
                        outs = clip.Clip(prd, blocks, 100, "MEM", outDir,
                                         new Action <int, string>((int progerss, string text) =>
                        {
                            if (progress != null)
                            {
                                progress.Boost(progerss, text);
                            }
                        }));
                    }
                    else
                    {
                        outs = clip.Clip(prd, blocks, 100, "LDF", outDir,
                                         new Action <int, string>((int progerss, string text) =>
                        {
                            if (progress != null)
                            {
                                progress.Boost(progerss, text);
                            }
                        }));
                    }
                    List <string> files = new List <string>();
                    for (int i = 0; i < outs.Length; i++)
                    {
                        if (outs[i] != null)
                        {
                            files.Add(outs[i].fileName);
                            outs[i].Dispose();
                        }
                    }
                    return(files.ToArray());
                }
                else if (type.Equals("Cut"))
                {
                    RasterCutProcesser  cut    = new RasterCutProcesser();
                    IRasterDataProvider result = null;
                    if (prd is IMemoryRasterDataProvider)
                    {
                        result = cut.Cut(prd, blocks[0] as BlockDefWithAOI, 100, "MEM", outDir,
                                         new Action <int, string>((int progerss, string text) =>
                        {
                            if (progress != null)
                            {
                                progress.Boost(progerss, text);
                            }
                        }));
                    }
                    else
                    {
                        result = cut.Cut(prd, blocks[0] as BlockDefWithAOI, 100, "LDF", outDir,
                                         new Action <int, string>((int progerss, string text) =>
                        {
                            if (progress != null)
                            {
                                progress.Boost(progerss, text);
                            }
                        }));
                    }
                    List <string> files = new List <string>();
                    if (result != null)
                    {
                        files.Add(result.fileName);
                    }
                    return(files.ToArray());
                }
                else
                {
                    return(null);
                }
            }
            finally
            {
                if (progress != null)
                {
                    progress.Finish();
                }
            }
        }