public static void TrySaveFileToWorkspace(IMonitoringSubProduct subProduct, IMonitoringSession mession, string fname, IExtractResult restult)
        {
            if (string.IsNullOrEmpty(fname))
            {
                return;
            }
            IWorkspace     wks = mession.GetWorkspace();
            RasterIdentify rst = new RasterIdentify(fname);
            ICatalog       c   = wks.GetCatalog("CurrentExtracting");

            if (c != null)
            {
                c.AddItem(new CatalogItem(fname, c.Definition as SubProductCatalogDef));
            }
            if (_contextEnvironment != null && subProduct != null)
            {
                rst.SubProductIdentify = subProduct.Identify;

                IExtractResultBase erb = restult as IExtractResultBase;
                if (erb != null && !string.IsNullOrEmpty(erb.OutIdentify))
                {
                    rst.SubProductIdentify = erb.OutIdentify;
                }
                GetOutFileIdentify(ref rst, subProduct);
                if (!string.IsNullOrEmpty(restult.Name) && restult.Name != rst.SubProductIdentify)
                {
                    rst.SubProductIdentify = restult.Name;
                }
                _contextEnvironment.PutContextVar(rst.SubProductIdentify, fname);
            }
        }
Beispiel #2
0
        void oprBar_Click(object sender, EventArgs e)
        {
            ICatalog             c          = _catalogs[(sender as ToolStripButton).Tag.ToString()];
            SubProductCatalogDef catalogDef = c.Definition as SubProductCatalogDef;
            string filter = catalogDef.Filter;

            using (OpenFileDialog dlg = new OpenFileDialog())
            {
                dlg.Filter           = filter;
                dlg.Multiselect      = true;
                dlg.InitialDirectory = MifEnvironment.GetWorkspaceDir();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    string[] fnames = dlg.FileNames;
                    if (fnames == null || fnames.Length == 0)
                    {
                        return;
                    }
                    foreach (string f in fnames)
                    {
                        c.AddItem(new CatalogItem(f, catalogDef, null));
                    }
                }
            }
        }
Beispiel #3
0
        public string AddToWorkspace(IWorkspace wks)
        {
            if (_currentProduct == null || _currentSubProduct == null || wks == null)
            {
                return(null);
            }
            ICatalog            c      = wks.GetCatalog("CurrentExtracting");
            string              name   = GetName(_currentProduct, _currentSubProduct);
            IPixelIndexMapper   result = _resultObjects[name].BinaryValues;
            IRasterDataProvider prd    = GetRasterDataProvider(_canvasViewer);

            if (prd == null)
            {
                return(null);
            }
            RasterIdentify rstIdentify = GetRasterIdentify(prd);
            string         fname       = InterestedRaster <Int16> .GetWorkspaceFileName(rstIdentify);

            if (File.Exists(fname))
            {
                //GeoDo.RSS.UI.AddIn.Theme.AutoGeneratorSettings.enumActionOfExisted action = GetActionOfFileIsExisted(fname);
                //if (action == AutoGeneratorSettings.enumActionOfExisted.Overide)
                //{
                try
                {
                    fname = WriteInterestedRaster(result, prd, rstIdentify, fname);
                }
                catch (Exception e)
                {
                    MsgBox.ShowError(e.Message);
                }
                //}
                //else if (action == AutoGeneratorSettings.enumActionOfExisted.ReName)
                //{
                //    fname = fname.Replace(".dat", DateTime.Now.ToString("_yyyyMMddHHmmss") + ".dat");
                //    using (IInterestedRaster<Int16> rst = new InterestedRaster<Int16>(fname,
                //        new Size(prd.Width, prd.Height), prd.CoordEnvelope.Clone()))
                //    {
                //        rst.Put(result.Indexes.ToArray(), 1);
                //    }
                //}
                //else if (action == AutoGeneratorSettings.enumActionOfExisted.Skip)
                //{
                //}
            }
            else
            {
                fname = WriteInterestedRaster(result, prd, rstIdentify, fname);
            }
            //
            c.AddItem(new CatalogItem(fname, wks.GetCatalogByIdentify(rstIdentify.SubProductIdentify).Definition as SubProductCatalogDef));
            return(fname);
        }
Beispiel #4
0
        private void AddOtherCatalog(string identify, ICatalogItem item)
        {
            if (string.IsNullOrEmpty(identify))
            {
                return;
            }
            ICatalog catalog = _wks.GetCatalogByIdentify(identify);

            if (catalog != null)
            {
                catalog.AddItem(item);
            }
        }
Beispiel #5
0
        void btn_Click(object sender, EventArgs e)
        {
            IWorkspace wks     = (sender as Button).Tag as IWorkspace;
            ICatalog   catalog = wks.ActiveCatalog;

            if (catalog != null)
            {
                catalog.AddItem(new CatalogItem("f:\\FOG_DBLV_NUL_NUL_NUL_00010101000000_00010101000000.dat", null, null));
                //ICatalogItem[] items = catalog.GetSelectedItems();
                //if (items != null)
                //{
                //    foreach (ICatalogItem it in items)
                //        Console.WriteLine(it.FileName.ToString());
                //}
                //else
                //{
                //    this.Text = catalog.Definition.Text +" selected is null!";
                //}
            }
            else
            {
                this.Text = "ActiveCatalog is null";
            }
        }