コード例 #1
0
 private void TryHandleCustomArguments(IArgumentProvider argProvider, AlgorithmDef alg)
 {
     foreach (ArgumentDef arg in alg.Arguments.Where((a) => { return(a is ArgumentDef); }))
     {
         string uieditor = arg.EditorUiProvider;
         if (string.IsNullOrEmpty(uieditor))
         {
             continue;
         }
         var xElement = arg.DefaultValueElement;
         if (xElement == null)
         {
             continue;
         }
         if (!xElement.HasElements)
         {
             continue;
         }
         object v = TryGetValueUseUIEditor(uieditor, xElement);
         if (v != null)
         {
             argProvider.SetArg(arg.Name, v);
         }
     }
 }
コード例 #2
0
        void c_OnAlgorithmChanged(object sender, AlgorithmDef algDef)
        {
            IMonitoringSession    msession   = _session.MonitoringSession as IMonitoringSession;
            IMonitoringSubProduct subProduct = msession.ActiveMonitoringSubProduct;

            if (subProduct == null)
            {
                return;
            }
            if (subProduct.Definition.IsNeedCurrentRaster)
            {
                DataIdentify did = GetCurrentRasterIdentify();
                if (did != null)
                {
                    subProduct.ResetArgumentProvider(algDef.Identify, did.Satellite, did.Sensor);
                }
            }
            else
            {
                subProduct.ResetArgumentProvider(algDef.Identify);
            }
            subProduct.ArgumentProvider.SetArg("AlgorithmName", algDef.Identify);
            SetSystemArguments(subProduct);
            SetCurrentRasterArgument(subProduct);
            SetBandArgs(subProduct);
        }
コード例 #3
0
        private void btOPTD_Click(object sender, EventArgs e)
        {
            ProductColorTable[] tables = ProductColorTableFactory.GetAllColorTables();
            ProductColorTable   table  = ProductColorTableFactory.GetColorTable("FOG", "TIMS");


            ExtractProductIdentify exPro = new ExtractProductIdentify();

            exPro.ThemeIdentify      = "CMA";
            exPro.ProductIdentify    = "FOG";
            exPro.SubProductIdentify = "OPTD";


            ThemeDef      theme = MonitoringThemeFactory.GetThemeDefByIdentify("CMA");
            ProductDef    pro   = theme.GetProductDefByIdentify("FOG");
            SubProductDef sub   = pro.GetSubProductDefByIdentify("OPTD");
            AlgorithmDef  alg   = sub.GetAlgorithmDefByIdentify("OPTDAlgorithm");

            IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(exPro, "OPTDAlgorithm", "FY3A", "MERSI");

            arg.SetArg("OPTDAlgorithm", alg);
            IRasterDataProvider prd = GetRasterDataProvider("FOG");

            arg.DataProvider = prd;
            arg.SetArg("CSRFile", @"E:\code\SMARTII\SRC\【控制】监测分析框架\testCN\bin\Release\TEMP\FOG_0CSR_FY3A_MERSI_10M_20120614001422_20120615001422.dat");
            arg.SetArg("DBLVFile", @"E:\code\SMARTII\SRC\【控制】监测分析框架\testCN\bin\Release\TEMP\FOG_DBLV_FY3A_MERSI_1000M_20120614005135_20120615005135.dat");
            IMonitoringSubProduct       bin    = new SubProductOPTDFOG(sub);
            IPixelFeatureMapper <Int16> result = bin.Make(null) as IPixelFeatureMapper <Int16>;

            result.Dispose();
        }
コード例 #4
0
        private void btSeaIceNDSI_Click(object sender, EventArgs e)
        {
            ExtractProductIdentify exPro = new ExtractProductIdentify();

            exPro.ThemeIdentify      = "CMA";
            exPro.ProductIdentify    = "ICE";
            exPro.SubProductIdentify = "DBLV";

            //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory;
            ThemeDef      theme = MonitoringThemeFactory.GetThemeDefByIdentify("CMA");
            ProductDef    pro   = theme.GetProductDefByIdentify("ICE");
            SubProductDef sub   = pro.GetSubProductDefByIdentify("DBLV");
            AlgorithmDef  alg   = sub.GetAlgorithmDefByIdentify("NDSIAlgorithm_NOAA");

            IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(exPro, "NDSIAlgorithm_NOAA", "FY3A", "VIRR");

            arg.SetArg("NDSIAlgorithm_NOAA", alg);
            IRasterDataProvider prd = GetRasterDataProvider("ICE");

            arg.DataProvider = prd;
            IMonitoringSubProduct bin    = new SubProductBinaryICE(sub);
            IPixelIndexMapper     result = bin.Make(null) as IPixelIndexMapper;
            string saveName = "e:\\seaice1.png";

            CreatBitmap(prd, result.Indexes.ToArray(), saveName);
        }
コード例 #5
0
        private IMonitoringSubProduct CreateMonitoringSubProduct(string rstFileName, string productIdentify, string subProductIdentify)
        {
            MonitoringSession        session        = new MonitoringSession(_session);
            IMonitoringProduct       monitorProduct = session.ChangeActiveProduct(productIdentify);
            IMonitoringSubProduct    subprd         = session.ChangeActiveSubProduct(subProductIdentify);
            RasterIdentify           rstIdentify    = new RasterIdentify(rstFileName);
            ExtractAlgorithmIdentify id             = new ExtractAlgorithmIdentify();

            id.Satellite = rstIdentify.Satellite;
            id.Sensor    = rstIdentify.Sensor;
            AlgorithmDef alg = subprd.Definition.GetAlgorithmDefByAlgorithmIdentify(id);

            if (alg == null)
            {
                PrintInfo("没有匹配的算法:" + "卫星" + rstIdentify.Satellite + ",传感器" + rstIdentify.Sensor);
                return(null);
            }
            subprd.ResetArgumentProvider(alg.Identify);
            subprd.ArgumentProvider.SetArg("AlgorithmName", alg.Identify);
            if (alg.Bands != null && alg.Bands.Length > 0)
            {
                MonitoringThemeFactory.SetBandArgs(subprd, rstIdentify.Satellite, rstIdentify.Sensor);
                foreach (BandDef band in alg.Bands)
                {
                    if (subprd.ArgumentProvider.GetArg(band.Identify).ToString() == "-1")
                    {
                        PrintInfo("从波段映射表获取\"" + band.Identify + "\"的波段序号失败,生成过程终止!");
                        return(null);
                    }
                }
            }
            TryHandleCustomArguments(subprd.ArgumentProvider, alg);
            return(subprd);
        }
コード例 #6
0
        private void SetBandArgs(IMonitoringSubProduct subProduct)
        {
            if (!subProduct.Definition.IsNeedCurrentRaster)
            {
                return;
            }
            DataIdentify id = GetCurrentRasterIdentify();

            if (id == null)
            {
                return;
            }
            if (!subProduct.ArgumentProvider.BandArgsIsSetted)
            {
                MonitoringThemeFactory.SetBandArgs(subProduct, id.Satellite, id.Sensor);
            }
            else
            {
                AlgorithmDef alg = subProduct.ArgumentProvider.CurrentAlgorithmDef;
                if (!alg.Satellites.Contains(id.Satellite) || !alg.Sensors.Contains(id.Sensor))
                {
                    MonitoringThemeFactory.SetBandArgs(subProduct, id.Satellite, id.Sensor);
                }
            }
        }
コード例 #7
0
 private string[] GetArgNames(AlgorithmDef algDef)
 {
     string[] argNames = null;
     argNames = new string[algDef.Arguments.Count()];
     for (int i = 0; i < algDef.Arguments.Count(); i++)
     {
         argNames[i] = algDef.Arguments[i].Name;
     }
     return(argNames);
 }
コード例 #8
0
ファイル: Form1.cs プロジェクト: configare/hispeed
        //通过读取历史判识文件获取AOI
        private void 能见度计算file_Click(object sender, EventArgs e)
        {
            InitExIdentify();
            _exPro.SubProductIdentify = "VISY";
            _sub             = _pro.GetSubProductDefByIdentify("VISY");
            _exAlg.Satellite = "FY3A";
            _exAlg.Sensor    = "VIRR";
            AlgorithmDef      visiAlg = _sub.GetAlgorithmDefByIdentify("Visibility");
            IArgumentProvider visiArg = MonitoringThemeFactory.GetArgumentProvider(_exPro, _exAlg);

            IRasterDataProvider          prd    = GetRasterDataProviderBinaryFile();
            Dictionary <string, object>  args   = new Dictionary <string, object>();
            IArgumentProvider            argPrd = new ArgumentProvider(prd, args);
            RasterPixelsVisitor <UInt16> raster = new RasterPixelsVisitor <UInt16>(argPrd);
            List <int> idxs = new List <int>();

            raster.VisitPixel(new int[] { 1 }, (index, value) =>
            {
                if (value[0] != 0)
                {
                    idxs.Add(index);
                }
            });

            visiArg.DataProvider = GetRasterDataProviderVIRR();
            visiArg.AOI          = idxs.ToArray();
            visiArg.SetArg("Visibility", visiAlg);
            SubProductRasterDst          subraster    = new SubProductRasterDst(_sub);
            IPixelFeatureMapper <UInt16> rasterResult = subraster.Make(null) as IPixelFeatureMapper <UInt16>;

            //
            RasterIdentify id = new RasterIdentify();

            id.ThemeIdentify      = "CMA";
            id.ProductIdentify    = "SAND";
            id.SubProductIdentify = "VISIBILITY";
            id.Satellite          = "FY3A";
            id.Sensor             = "VIRRX";
            id.Resolution         = "1000M";
            id.OrbitDateTime      = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0));
            id.GenerateDateTime   = DateTime.Now;
            IInterestedRaster <UInt16> iir = new InterestedRaster <UInt16>(id, new Size(prd.Width, prd.Height), prd.CoordEnvelope.Clone());

            iir.Put(rasterResult);
            iir.Dispose();

            MessageBox.Show("能见度计算完成!");
        }
コード例 #9
0
        private void button2_Click(object sender, EventArgs e)
        {
            ExtractProductIdentify prdIdentify = new ExtractProductIdentify();

            prdIdentify.ThemeIdentify      = "CMA";
            prdIdentify.ProductIdentify    = "BAG";
            prdIdentify.SubProductIdentify = "DBLV";
            ExtractAlgorithmIdentify algIdentify = new ExtractAlgorithmIdentify();

            algIdentify.Satellite  = "EOST";
            algIdentify.Sensor     = "MODIS";
            algIdentify.Resolution = null;//not use

            //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory;
            ThemeDef           themeDef = MonitoringThemeFactory.GetThemeDefByIdentify("CMA");
            IArgumentProvider  prd      = MonitoringThemeFactory.GetArgumentProvider(prdIdentify, algIdentify);
            ProductDef         bag      = themeDef.GetProductDefByIdentify("BAG");
            IMonitoringProduct prbag    = new MonitoringProductBag();

            SubProductDef productDef = bag.GetSubProductDefByIdentify("DBLV");
            AlgorithmDef  alg        = productDef.GetAlgorithmDefByIdentify("BAGExtract");

            IMonitoringSubProduct product = new SubProductBinaryBag(productDef);

            //prd.SetArg("BAGExtract", alg);
            prd.DataProvider = GetRasterDataProvider();
            prd.AOI          = GetAOI(prd.DataProvider);
            //IExtractResult result = (product as SubProductBinaryBag).Make(null,null);
            //结果存为图片
            //idxs = (result as MatrixPixelIndexMapper).Indexes.ToArray();
            //IBinaryBitmapBuilder builder = new BinaryBitmapBuilder();
            //Size bmSize = new Size(prd.DataProvider.Width, prd.DataProvider.Height);
            //Bitmap bitmap = builder.CreateBinaryBitmap(bmSize, Color.Red, Color.Transparent);
            //builder.Fill(idxs, new Size(prd.DataProvider.Width, prd.DataProvider.Height), ref bitmap);
            //bitmap.Save(@"D:\Code\源代码\【控制】监测分析框架\test\bin\Release\TEMP\bag.png", ImageFormat.Png);
            //MessageBox.Show("判识结束.");
            //RasterIdentify id = new RasterIdentify();
            //id.ThemeIdentify = "CMA";
            //id.ProductIdentify = "BAG";
            //id.SubProductIdentify = "DBLV";
            //id.Sensor = "MODIS";
            //id.OrbitDateTime = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0));
            //id.GenerateDateTime = DateTime.Now;
            //IInterestedRaster<UInt16> iir = new InterestedRaster<UInt16>(id, new Size(prd.DataProvider.Width, prd.DataProvider.Height), prd.DataProvider.CoordEnvelope.Clone());
            //iir.Put(idxs, 1);
            //iir.Dispose();
            //MessageBox.Show("判识结果已永久保存.");
        }
コード例 #10
0
ファイル: Form1.cs プロジェクト: configare/hispeed
        //通过实时判识结果获取AOI
        private void 能见度计算_Click(object sender, EventArgs e)
        {
            InitExIdentify();
            _exAlg.CustomIdentify = "陆地";
            _exAlg.Satellite      = "FY3A";
            _exAlg.Sensor         = "VIRR";
            AlgorithmDef        alg = _sub.GetAlgorithmDefByIdentify("FY3Land");
            IArgumentProvider   arg = MonitoringThemeFactory.GetArgumentProvider(_exPro, _exAlg);
            IRasterDataProvider prd = GetRasterDataProviderVIRR();

            arg.DataProvider = prd;
            arg.AOI          = GetAOI(prd, true);
            arg.SetArg("FY3Land", alg);
            SubProductBinaryDst bin    = new SubProductBinaryDst(_sub);
            IPixelIndexMapper   result = bin.Make(null) as IPixelIndexMapper;

            int[] indxs = result.Indexes.ToArray();

            _exPro.SubProductIdentify = "VISY";
            _sub = _pro.GetSubProductDefByIdentify("VISY");
            _exAlg.CustomIdentify = null;
            AlgorithmDef      visiAlg = _sub.GetAlgorithmDefByIdentify("Visibility");
            IArgumentProvider visiArg = MonitoringThemeFactory.GetArgumentProvider(_exPro, _exAlg);

            visiArg.DataProvider = prd;
            visiArg.AOI          = indxs;
            visiArg.SetArg("Visibility", visiAlg);
            SubProductRasterDst          raster       = new SubProductRasterDst(_sub);
            IPixelFeatureMapper <UInt16> rasterResult = raster.Make(null) as IPixelFeatureMapper <UInt16>;

            //
            RasterIdentify id = new RasterIdentify();

            id.ThemeIdentify      = "CMA";
            id.ProductIdentify    = "SAND";
            id.SubProductIdentify = "VISIBILITY";
            id.Satellite          = "FY3A";
            id.Sensor             = "VIRRX";
            id.Resolution         = "1000M";
            id.OrbitDateTime      = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0));
            id.GenerateDateTime   = DateTime.Now;
            IInterestedRaster <UInt16> iir = new InterestedRaster <UInt16>(id, new Size(prd.Width, prd.Height), prd.CoordEnvelope.Clone());

            iir.Put(rasterResult);
            iir.Dispose();

            MessageBox.Show("能见度计算完成!");
        }
コード例 #11
0
        private void btCSR_Click(object sender, EventArgs e)
        {
            //IArgumentProviderFactory fac1 = MifEnvironment.ActiveArgumentProviderFactory;

            ThemeDef   theme1 = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); // fac1.GetThemeDefByIdentify("CMA");
            ProductDef pro1   = theme1.GetProductDefByIdentify("FOG");

            //ProductDef pro1 = theme1.GetProductDefByIdentify("ICE");

            MonitoringProduct mp = new MonitoringProductFOG();

            //MonitoringProduct mp = new MonitoringProductICE(pro1);
            mp = mp;

            ExtractProductIdentify exPro = new ExtractProductIdentify();

            exPro.ThemeIdentify      = "CMA";
            exPro.ProductIdentify    = "FOG";
            exPro.SubProductIdentify = "0CSR";

            ExtractAlgorithmIdentify exAlg = new ExtractAlgorithmIdentify();

            exAlg.CustomIdentify = null;
            exAlg.Satellite      = "FY3A";
            exAlg.Sensor         = "MERSI";
            exAlg.Resolution     = null;

            //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory;
            ThemeDef      theme = MonitoringThemeFactory.GetThemeDefByIdentify("CMA"); //fac.GetThemeDefByIdentify("CMA");
            ProductDef    pro   = theme.GetProductDefByIdentify("FOG");
            SubProductDef sub   = pro.GetSubProductDefByIdentify("0CSR");
            AlgorithmDef  alg   = sub.GetAlgorithmDefByIdentify("BaseOrbitAlgorithm");

            IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(exPro, "BaseOrbitAlgorithm", "FY3A", "MERSI");

            arg.SetArg("BaseOrbitAlgorithm", alg);
            IRasterDataProvider prd = GetRasterDataProvider("FOG");

            arg.DataProvider = prd;
            arg.SetArg("OrbitFile", new string[] { prd.fileName });
            IMonitoringSubProduct        bin    = new SubProductCSRFOG(sub);
            IPixelFeatureMapper <UInt16> result = bin.Make(null) as IPixelFeatureMapper <UInt16>;

            result.Dispose();
        }
コード例 #12
0
        private void btFogBB_Click(object sender, EventArgs e)
        {
            ExtractProductIdentify exPro = new ExtractProductIdentify();

            exPro.ThemeIdentify      = "CMA";
            exPro.ProductIdentify    = "FOG";
            exPro.SubProductIdentify = "DBLV";

            ExtractAlgorithmIdentify exAlg = new ExtractAlgorithmIdentify();

            exAlg.CustomIdentify = null;
            exAlg.Satellite      = "FY3A";
            exAlg.Sensor         = "MERSI";
            exAlg.Resolution     = null;

            //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory;
            ThemeDef      theme = MonitoringThemeFactory.GetThemeDefByIdentify("CMA");
            ProductDef    pro   = theme.GetProductDefByIdentify("FOG");
            SubProductDef sub   = pro.GetSubProductDefByIdentify("DBLV");
            AlgorithmDef  alg   = sub.GetAlgorithmDefByIdentify("EasyAlgorithm");

            IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(exPro, "EasyAlgorithm", "FY3A", "MERSI");

            arg.SetArg("EasyAlgorithm", alg);
            IRasterDataProvider prd = GetRasterDataProvider("FOG");

            arg.DataProvider = prd;
            IMonitoringSubProduct bin    = new SubProductBinaryFOG(sub);
            IPixelIndexMapper     result = bin.Make(null) as IPixelIndexMapper;
            RasterIdentify        id     = new RasterIdentify();

            id.ThemeIdentify      = "CMA";
            id.ProductIdentify    = "FOG";
            id.SubProductIdentify = "DBLV";
            id.Satellite          = "FY3A";
            id.Sensor             = "MERSI";
            id.Resolution         = "1000M";
            id.OrbitDateTime      = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0));
            id.GenerateDateTime   = DateTime.Now;
            IInterestedRaster <Int16> iir = new InterestedRaster <Int16>(id, new Size(prd.Width, prd.Height), prd.CoordEnvelope);

            iir.Put(result.Indexes.ToArray(), 1);
            iir.Dispose();
        }
コード例 #13
0
ファイル: Form1.cs プロジェクト: configare/hispeed
        private void FY3陆地_Click(object sender, EventArgs e)
        {
            InitExIdentify();
            _exAlg.CustomIdentify = "陆地";
            _exAlg.Satellite      = "FY3A";
            _exAlg.Sensor         = "VIRR";

            AlgorithmDef        alg = _sub.GetAlgorithmDefByIdentify("FY3Land");
            IArgumentProvider   arg = MonitoringThemeFactory.GetArgumentProvider(_exPro, _exAlg);
            IRasterDataProvider prd = GetRasterDataProviderVIRR();
            // arg.DataProvider = prd;
            //arg.AOI = ApplyAOI(prd, true);
            // arg.SetArg("AlgorithmName","FY3Land");
            SubProductBinaryDst bin = new SubProductBinaryDst(_sub);

            bin.ResetArgumentProvider("FY3Land", prd.DataIdentify.Satellite, prd.DataIdentify.Sensor, "陆地");
            bin.ArgumentProvider.DataProvider = prd;
            bin.ArgumentProvider.SetArg("AlgorithmName", "FY3Land");
            IPixelIndexMapper result = bin.Make(null) as IPixelIndexMapper;

            string saveName = @"E:\沙尘判识VIRR.png";

            CreatBitmap(prd, result.Indexes.ToArray(), saveName);

            RasterIdentify id = new RasterIdentify();

            id.ThemeIdentify      = "CMA";
            id.ProductIdentify    = "DST";
            id.SubProductIdentify = "2VAL";
            id.Satellite          = "FY3A";
            id.Sensor             = "VIRR";
            id.Resolution         = "1000M";
            id.OrbitDateTime      = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0));
            id.GenerateDateTime   = DateTime.Now;
            IInterestedRaster <UInt16> iir = new InterestedRaster <UInt16>(id, new Size(prd.Width, prd.Height), prd.CoordEnvelope.Clone());

            iir.Put(result.Indexes.ToArray(), 1);
            iir.Dispose();

            MessageBox.Show("判识完成,输出文件:E:\\data\\dst\\output\\沙尘判识VIRR.png");
        }
コード例 #14
0
ファイル: Form1.cs プロジェクト: configare/hispeed
        private void MODIS陆地_Click(object sender, EventArgs e)
        {
            InitExIdentify();
            _exAlg.CustomIdentify = "陆地";
            _exAlg.Satellite      = "EOST";
            _exAlg.Sensor         = "MODIS";

            AlgorithmDef        alg = _sub.GetAlgorithmDefByIdentify("EOSLand");
            IArgumentProvider   arg = MonitoringThemeFactory.GetArgumentProvider(_exPro, _exAlg);
            IRasterDataProvider prd = GetRasterDataProviderMODIS();

            arg.DataProvider = prd;
            arg.AOI          = GetAOI(prd, true);
            arg.SetArg("EOSLand", alg);
            SubProductBinaryDst bin = new SubProductBinaryDst(_sub);

            IPixelIndexMapper result   = bin.Make(null) as IPixelIndexMapper;
            string            saveName = @"E:\data\dst\output\2sandEOSland.png";

            CreatBitmap(prd, result.Indexes.ToArray(), saveName);
        }
コード例 #15
0
ファイル: Form1.cs プロジェクト: configare/hispeed
        private void NOAA18海洋_Click(object sender, EventArgs e)
        {
            InitExIdentify();
            _exAlg.CustomIdentify = "海洋";
            _exAlg.Satellite      = "NOAA18";
            _exAlg.Sensor         = "AVHRR";

            AlgorithmDef        alg = _sub.GetAlgorithmDefByIdentify("NOAA18Sea");
            IArgumentProvider   arg = MonitoringThemeFactory.GetArgumentProvider(_exPro, _exAlg);
            IRasterDataProvider prd = GetRasterDataProviderNOAA18();

            arg.DataProvider = prd;
            arg.AOI          = GetAOI(prd, false);
            arg.SetArg("NOAA18Sea", alg);
            SubProductBinaryDst bin = new SubProductBinaryDst(_sub);

            IPixelIndexMapper result   = bin.Make(null) as IPixelIndexMapper;
            string            saveName = @"E:\data\dst\output\3sandNoaa18Sea.png";

            CreatBitmap(prd, result.Indexes.ToArray(), saveName);
        }
コード例 #16
0
        private void btImage_Click(object sender, EventArgs e)
        {
            //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory;
            ThemeDef      theme = MonitoringThemeFactory.GetThemeDefByIdentify("CMA");
            ProductDef    pro   = theme.GetProductDefByIdentify("FOG");
            SubProductDef sub   = pro.GetSubProductDefByIdentify("0IMG");
            AlgorithmDef  alg   = sub.GetAlgorithmDefByIdentify("0IMGAlgorithm");

            ExtractProductIdentify exPro = new ExtractProductIdentify();

            exPro.ThemeIdentify      = "CMA";
            exPro.ProductIdentify    = "FOG";
            exPro.SubProductIdentify = "0IMG";

            IArgumentProvider     arg    = MonitoringThemeFactory.GetArgumentProvider(exPro, "0IMGAlgorithm", "FY3A", "MERSI");
            IMonitoringSubProduct subPro = new SubProductIMGFOG(sub);

            subPro.ResetArgumentProvider("FY3A", "MERSI");
            arg.SetArg("AOI", "");
            arg.SetArg("OutFileIdentify", "STBI");
            subPro.Make(null);
        }
コード例 #17
0
        private void button1_Click(object sender, EventArgs e)
        {
            ExtractProductIdentify prdIdentify = new ExtractProductIdentify();

            prdIdentify.ThemeIdentify      = "CMA";
            prdIdentify.ProductIdentify    = "BAG";
            prdIdentify.SubProductIdentify = "DBLV";
            ExtractAlgorithmIdentify algIdentify = new ExtractAlgorithmIdentify();

            algIdentify.Satellite  = "EOST";
            algIdentify.Sensor     = "MODIS";
            algIdentify.Resolution = null;//not use

            //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory;
            ThemeDef           themeDef = MonitoringThemeFactory.GetThemeDefByIdentify("CMA");
            IArgumentProvider  prd      = MonitoringThemeFactory.GetArgumentProvider(prdIdentify, algIdentify);
            ProductDef         bag      = themeDef.GetProductDefByIdentify("BAG");
            IMonitoringProduct prbag    = new MonitoringProductBag();

            SubProductDef productDef = bag.GetSubProductDefByIdentify("DBLV");
            AlgorithmDef  alg        = productDef.GetAlgorithmDefByIdentify("BAGExtract");

            IMonitoringSubProduct product = new SubProductBinaryBag(productDef);

            prd.SetArg("BAGExtract", alg);
            prd.DataProvider = GetRasterDataProvider();
            prd.AOI          = GetAOI(prd.DataProvider);
            //IExtractResult result = (product as SubProductBinaryBag).Make(prd,null);
            //结果存为图片
            //int[] idxs = (result as IPixelIndexMapper).Indexes.ToArray();
            //IBinaryBitmapBuilder builder = new BinaryBitmapBuilder();
            //Size bmSize = new Size(prd.DataProvider.Width, prd.DataProvider.Height);
            //Bitmap bitmap = builder.CreateBinaryBitmap(bmSize, Color.Red, Color.Transparent);
            //builder.Fill(idxs, new Size(prd.DataProvider.Width, prd.DataProvider.Height), ref bitmap);
            //bitmap.Save("E:\\bag.png", ImageFormat.Png);
            //MessageBox.Show("判识结束");
        }
コード例 #18
0
        private void button4_Click(object sender, EventArgs e)
        {
            ExtractProductIdentify prdIdentify = new ExtractProductIdentify();

            prdIdentify.ThemeIdentify      = "CMA";
            prdIdentify.ProductIdentify    = "SNW";
            prdIdentify.SubProductIdentify = "0CLM";
            ExtractAlgorithmIdentify algIdentify = new ExtractAlgorithmIdentify();

            algIdentify.Satellite  = "FY3A";
            algIdentify.Sensor     = "VIRR";
            algIdentify.Resolution = null;//not use

            //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory;
            ThemeDef           themeDef = MonitoringThemeFactory.GetThemeDefByIdentify("CMA");
            IArgumentProvider  prd      = MonitoringThemeFactory.GetArgumentProvider(prdIdentify, algIdentify);
            ProductDef         snw      = themeDef.GetProductDefByIdentify("SNW");
            IMonitoringProduct prbag    = new MonitoringProductBag();

            SubProductDef productDef = snw.GetSubProductDefByIdentify("0CLM");
            AlgorithmDef  alg        = productDef.GetAlgorithmDefByIdentify("CloudExtract");

            IMonitoringSubProduct product = new SubProductBinaryClm(productDef);

            prd.SetArg("CloudExtract", alg);
            prd.DataProvider = GetRasterDataProvider1();
            //IExtractResult result = product.Make(null,null);
            //结果存为图片
            //int[] idxs = (result as MemPixelIndexMapper).Indexes.ToArray();
            //IBinaryBitmapBuilder builder = new BinaryBitmapBuilder();
            //Size bmSize = new Size(prd.DataProvider.Width, prd.DataProvider.Height);
            //Bitmap bitmap = builder.CreateBinaryBitmap(bmSize, Color.Red, Color.Transparent);
            //builder.Fill(idxs, new Size(prd.DataProvider.Width, prd.DataProvider.Height), ref bitmap);
            //bitmap.Save("E:\\data\\蓝藻\\snow_clound.png", ImageFormat.Png);
            //MessageBox.Show("判识结束");
        }
コード例 #19
0
        private void button6_Click(object sender, EventArgs e)
        {
            string fname = @"E:\数据文件\BAG_NDVITemp_NUL_NUL_NUL_20120619163044_20120620163044.dat";
            IRasterDataProvider dataProvider = GeoDataDriver.Open(fname) as IRasterDataProvider;
            //非蓝藻区域赋-9999
            NDVISetValue setValue1 = (dataProvider as MemoryRasterDataProvider).GetExtHeader <NDVISetValue>();
            double       min       = setValue1.MinNDVI;
            double       max       = setValue1.MaxNDVI;
            IPixelFeatureMapper <float> ndvifinal = new MemPixelFeatureMapper <float>("NDVI", 1000, new Size(dataProvider.Width, dataProvider.Height), dataProvider.CoordEnvelope, dataProvider.SpatialRef);
            RasterIdentify idNDVI = new RasterIdentify();

            idNDVI.ThemeIdentify      = "CMA";
            idNDVI.ProductIdentify    = "BAG";
            idNDVI.SubProductIdentify = "NDVI";
            idNDVI.OrbitDateTime      = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0));
            idNDVI.GenerateDateTime   = DateTime.Now;
            InterestedRaster <float> iirNDVI = new InterestedRaster <float>(idNDVI, new Size(dataProvider.Width, dataProvider.Height), dataProvider.CoordEnvelope.Clone(), dataProvider.SpatialRef, 8);

            iirNDVI.Put(-9999);
            //IEnumerable<int> ids = (indexProvider as IPixelIndexMapper).Indexes;
            ArgumentProvider            ap      = new ArgumentProvider(dataProvider, null);
            RasterPixelsVisitor <float> visitor = new RasterPixelsVisitor <float>(ap);

            #region
            ExtractProductIdentify prdIdentify = new ExtractProductIdentify();
            prdIdentify.ThemeIdentify      = "CMA";
            prdIdentify.ProductIdentify    = "BAG";
            prdIdentify.SubProductIdentify = "DBLV";
            ExtractAlgorithmIdentify algIdentify = new ExtractAlgorithmIdentify();
            algIdentify.Satellite  = "EOST";
            algIdentify.Sensor     = "MODIS";
            algIdentify.Resolution = null;//not use

            //IArgumentProviderFactory fac = MifEnvironment.ActiveArgumentProviderFactory;
            ThemeDef           themeDef = MonitoringThemeFactory.GetThemeDefByIdentify("CMA");
            IArgumentProvider  prd      = MonitoringThemeFactory.GetArgumentProvider(prdIdentify, algIdentify);
            ProductDef         bag      = themeDef.GetProductDefByIdentify("BAG");
            IMonitoringProduct prbag    = new MonitoringProductBag();

            SubProductDef productDef = bag.GetSubProductDefByIdentify("DBLV");
            AlgorithmDef  alg        = productDef.GetAlgorithmDefByIdentify("BAGExtract");

            IMonitoringSubProduct product = new SubProductBinaryBag(productDef);
            //prd.SetArg("BAGExtract", alg);
            prd.DataProvider = GetRasterDataProvider();
            prd.AOI          = GetAOI(prd.DataProvider);
            //IExtractResult result = (product as SubProductBinaryBag).Make(prd,null, null);
            //idxs = (result as IPixelIndexMapper).Indexes.ToArray();
            //#endregion
            //visitor.VisitPixel(new int[] { 1 }, (index, values) =>
            //    {
            //        foreach (int item in idxs)
            //        {
            //            if (item == index)
            //            {
            //                ndvifinal.Put(index, values[0]);
            //                break;
            //            }
            //        }
            //    });
            //iirNDVI.SetExtHeader(setValue1);
            //iirNDVI.Put(ndvifinal);
            //iirNDVI.Dispose();
            #endregion
        }
コード例 #20
0
        public void CreateBandPanel(AlgorithmDef algorithmDef)
        {
            this.Controls.Clear();

            BandDef[] bands = algorithmDef.Bands;
            if (bands == null || bands.Length == 0)
            {
                return;
            }
            List <Control> bandEdits = new List <Control>();
            int            y         = 0;

            for (int i = 0; i < bands.Length; i++)
            {
                BandDef band  = bands[i];
                Label   label = new Label();
                label.Location = new Point(0, (label.Height + 2) * i + 1);
                label.AutoSize = true;
                string bandName = band.Identify;
                if (_entractHelper.BandDes.ContainsKey(bandName))
                {
                    bandName = _entractHelper.BandDes[bandName];
                }
                if (band.Wavelength != null && band.Wavelength.Length != 0)
                {
                    string bandWave = "";
                    for (int w = 0; w < band.Wavelength.Length; w++)
                    {
                        bandWave += "," + band.Wavelength[w];
                    }
                    label.Text = bandName + "(" + bandWave.TrimStart(',') + ")";
                }
                else
                {
                    label.Text = bandName;
                }
                int           defaultBand = GetDefaultBand(band);
                DoubleTextBox bandEdit    = new DoubleTextBox();
                bandEdit.DefaultValue = 1;
                bandEdit.MinValue     = 1;
                bandEdit.Width        = 80;
                bandEdit.Anchor       = AnchorStyles.Top | AnchorStyles.Right;
                bandEdit.Location     = new Point(this.Right - 80 - 2, label.Top);
                bandEdit.Text         = defaultBand.ToString();
                bandEdit.Tag          = band;
                //bandEdit.KeyPressEnter += new KeyPressEventHandler(bandEdit_OnKeyPressEnter);
                //bandEdit.LostFocus += new EventHandler(bandEdit_LostFocus);
                //bandEdit.TextChanged+=new EventHandler(bandEdit_TextChanged);
                bandEdit.LostFocusValueChanged += new EventHandler(bandEdit_LostFocusValueChanged);

                this.Controls.Add(bandEdit);
                this.Controls.Add(label);
                bandEdits.Add(bandEdit);
                y = bandEdit.Bottom;
            }

            Button btnDefault = new Button();

            btnDefault.Text     = "撤销更改";
            btnDefault.Location = new Point(0, y + 10);
            btnDefault.Click   += new EventHandler(btnDefault_Click);
            btnDefault.Tag      = bandEdits.ToArray();

            Button btnOk = new Button();

            btnOk.Text     = "应用";
            btnOk.Location = new Point(btnDefault.Right + 4, y + 10);
            btnOk.Click   += new EventHandler(btnOk_Click);
            btnOk.Tag      = bandEdits.ToArray();

            this.Controls.Add(btnDefault);
            this.Controls.Add(btnOk);
        }