Exemple #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            IMonitoringSubProduct subProduct = GetCurrentSubProduct();

            if (subProduct == null)
            {
                return;
            }
            if (!subProduct.Definition.IsNeedCurrentRaster)
            {
                return;
            }
            IWorkspace wks = (_session.MonitoringSession as IMonitoringSession).Workspace;

            (_session.MonitoringSession as IMonitoringSession).ExtractingSession.AddToWorkspace(wks);
            (_session.MonitoringSession as IMonitoringSession).ExtractingSession.Saved();

            //后续产品制作
            IPixelIndexMapper piexd  = (_session.MonitoringSession as IMonitoringSession).ExtractingSession.GetBinaryValuesMapper(subProduct.Definition.ProductDef.Identify, subProduct.Definition.Identify);
            IExtractResult    result = (subProduct).MakeExtProduct(piexd, null);

            if (result == null)
            {
                return;
            }
            if (!(result is IPixelIndexMapper) && !(result is IExtractResultArray))
            {
                _isAutoSave = false;
            }
            DisplayResultClass.DisplayResult(_session, subProduct, result, true);
        }
        private void ApplayExtractResult(IRasterDataProvider dataProvider, ImportFilesObj[] objs)
        {
            IDataImportDriver driver = null;
            string            error  = null;

            foreach (ImportFilesObj obj in objs)
            {
                if (string.IsNullOrEmpty(obj.ProIdentify) || string.IsNullOrEmpty(obj.SubProIdentify))
                {
                    obj.ProIdentify    = _monitoringSession.ActiveMonitoringProduct.Identify;
                    obj.SubProIdentify = _monitoringSession.ActiveMonitoringSubProduct.Identify;
                }
                driver = DataImport.GetDriver(obj.ProIdentify, obj.SubProIdentify, obj.FullFilename, null);
                if (driver == null)
                {
                    continue;
                }
                IExtractResult result = driver.Do(obj.ProIdentify, obj.SubProIdentify, dataProvider, obj.FullFilename, out error);
                if (result == null)
                {
                    continue;
                }
                DisplayResultClass.DisplayResult(_smartSession, _monitoringSession.ActiveMonitoringSubProduct, result, true);
            }
        }
Exemple #3
0
        private void btnExtract_Click(object sender, EventArgs e)
        {
            IMonitoringSubProduct subProduct = GetCurrentSubProduct();

            if (subProduct == null)
            {
                return;
            }
            IContextMessage msg = _session.SmartWindowManager.SmartToolWindowFactory.GetSmartToolWindow(9006) as IContextMessage;

            SetAOIArgument(subProduct);
            IProgressMonitor tracker = _session.ProgressMonitorManager.DefaultProgressMonitor;
            IExtractResult   result  = null;

            try
            {
                subProduct.ArgumentProvider.SetArg("SmartSession", _session);
                //不能在这里设置SelectedPrimaryFiles参数,会将界面上设置好参数值的覆盖掉。
                //TrySetSelectedPrimaryFilesArgs(_session, subProduct);

                tracker.Start(false);
                tracker.Reset("正在生成...", 100);
                result = subProduct.Make((pro, tip) =>
                {
                    if (tracker != null)
                    {
                        tracker.Boost(pro, tip);
                    }
                },
                                         msg);
                if (result == null)
                {
                    _isNullResult = true;
                    return;
                }
            }
            finally
            {
                tracker.Finish();
            }
            if (!(result is IPixelIndexMapper) && !(result is IExtractResultArray))
            {
                _isAutoSave = false;
            }
            if (result is IExtractResultArray)
            {
                SetIsAutoSave(result as IExtractResultArray);
            }
            DisplayResultClass.DisplayResult(_session, subProduct, result, true);
        }
        public void HandleResult(IContextEnvironment contextEnvironment, IMonitoringProduct product, IMonitoringSubProduct subProduct, IExtractResult result)
        {
            (_session.MonitoringSession as IMonitoringSession).ChangeActiveSubProduct(subProduct.Identify);
            if (subProduct.Identify == "DBLV")//只有判识结果在叠加在影像上
            {
                (_session.MonitoringSession as IMonitoringSession).ExtractingSession.Start((_session.SmartWindowManager.ActiveCanvasViewer), product, subProduct);
                DisplayResultClass.DisplayResult(_session, subProduct, result, true);
            }
            else
            {
                DisplayResultClass.DisplayResult(_session, subProduct, result, true);
            }
            string fname;

            if (result is IPixelIndexMapper)
            {
                fname = (_session.MonitoringSession as IMonitoringSession).ExtractingSession.AddToWorkspace((_session.MonitoringSession as IMonitoringSession).Workspace);
                DisplayResultClass._contextEnvironment.PutContextVar(subProduct.Identify, fname);
            }
            else if (result is IExtractResultArray)
            {
                IExtractResultArray  extResultMapper = result as ExtractResultArray;
                IExtractResultBase[] mappers         = extResultMapper.PixelMappers;
                if (mappers == null || mappers.Length == 0)
                {
                    return;
                }
                foreach (IExtractResultBase mapper in mappers)
                {
                    if (mapper is IPixelIndexMapper)
                    {
                        fname = (_session.MonitoringSession as IMonitoringSession).ExtractingSession.AddToWorkspace((_session.MonitoringSession as IMonitoringSession).Workspace);
                        DisplayResultClass._contextEnvironment.PutContextVar(subProduct.Identify, fname);
                    }
                }
            }
            else if (result is IFileExtractResult && subProduct.Identify == "DBLV")
            {
                DisplayResultClass._contextEnvironment.PutContextVar(subProduct.Identify, (result as IFileExtractResult).FileName);
            }
        }