コード例 #1
0
        public override void Execute(string argument)
        {
            ISmartViewer viewer = _smartSession.SmartWindowManager.ActiveViewer;

            if (viewer != null)
            {
                ICanvasViewer canViewer = viewer as ICanvasViewer;
                if (canViewer == null)
                {
                    return;
                }
                IRasterDrawing rd     = canViewer.ActiveObject as IRasterDrawing;
                IGeoPanAdjust  adjust = rd as IGeoPanAdjust;
                if (adjust != null && adjust.IsHasUnsavedGeoAdjusted)
                {
                    DialogResult ret = MsgBox.ShowQuestionYesNoCancel("对当前影像的平移校正结果未保存,请确认是否保存?\n按【是】保存。\n按【否】不保存。\n按【取消】返回。");
                    if (ret == DialogResult.Cancel)
                    {
                        return;
                    }
                    else if (ret == DialogResult.Yes)
                    {
                        adjust.Save();
                    }
                    else
                    {
                        adjust.Cancel();
                    }
                }
            }
            _smartSession.UIFrameworkHelper.SetVisible(argument, false);
            _smartSession.UIFrameworkHelper.SetLockBesideX(argument, false);
        }
コード例 #2
0
        public override void Execute()
        {
            ISmartViewer viewer = _smartSession.SmartWindowManager.ActiveViewer;

            if (viewer == null)
            {
                return;
            }
            ICanvasViewer  canViewer = viewer as ICanvasViewer;
            IRasterDrawing rd        = canViewer.ActiveObject as IRasterDrawing;
            IGeoPanAdjust  adjust    = rd as IGeoPanAdjust;

            adjust.Cancel();
            canViewer.Canvas.Refresh(Core.DrawEngine.enumRefreshType.All);
        }
コード例 #3
0
 void _radDock_DockWindowClosing(object sender, DockWindowCancelEventArgs e)
 {
     _linkableViewerManager.Unlink(e.NewWindow as ILinkableViewer);
     if (e.NewWindow is IStatResultDisplayWindow)
     {
         (e.NewWindow as Telerik.WinControls.IGeoDoFree).Free();
     }
     else if (e.NewWindow is ICanvasViewer)
     {
         ICanvasViewer  canViewer = e.NewWindow as ICanvasViewer;
         IRasterDrawing rd        = canViewer.ActiveObject as IRasterDrawing;
         IGeoPanAdjust  adjust    = rd as IGeoPanAdjust;
         if (adjust != null && adjust.IsHasUnsavedGeoAdjusted)
         {
             DialogResult ret = MsgBox.ShowQuestionYesNoCancel("当前影像的平移校正结果未保存,请确认是否保存?\n按【是】保存。\n按【否】不保存。\n按【取消】返回。");
             if (ret == DialogResult.Cancel)
             {
                 e.Cancel = true;
                 return;
             }
             else if (ret == DialogResult.Yes)
             {
                 adjust.Save();
             }
             else
             {
                 adjust.Cancel();
             }
         }
         //退出平移校正状态
         ICommand cmd = _session.CommandEnvironment.Get(30006);
         if (cmd != null)
         {
             cmd.Execute();
         }
         //退出平移校正2状态
         ICommand cmd2 = _session.CommandEnvironment.Get(30106);
         if (cmd2 != null)
         {
             cmd2.Execute();
         }
     }
 }
コード例 #4
0
        public override void  Execute()
        {
            ISmartViewer viewer = _smartSession.SmartWindowManager.ActiveViewer;

            if (viewer == null)
            {
                return;
            }
            ICanvasViewer  canViewer = viewer as ICanvasViewer;
            IRasterDrawing rd        = canViewer.ActiveObject as IRasterDrawing;
            IGeoPanAdjust  adjust    = rd as IGeoPanAdjust;

            if (rd == null)
            {
                return;
            }
            PanAdjustTool adjustTool = new PanAdjustTool();
            string        fileName   = null;

            try
            {
                fileName = adjustTool.SaveGeoAdjust(rd.EnvelopeBeforeAdjusting, rd.DataProviderCopy);
                adjust.Cancel();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            if (fileName != null && File.Exists(fileName))
            {
                string adjustTxtDir = AppDomain.CurrentDomain.BaseDirectory + "MonitoringProductArgs\\COMM\\";
                if (!Directory.Exists(adjustTxtDir))
                {
                    Directory.CreateDirectory(adjustTxtDir);
                }
                string txtFileName = Path.Combine(adjustTxtDir, "AdjustSaveFile.txt");
                using (StreamWriter sw = new StreamWriter(txtFileName, true, Encoding.Default))
                {
                    sw.WriteLine(fileName);
                }
            }
        }
コード例 #5
0
        public override void Execute(string argument)
        {
            ISmartViewer viewer = _smartSession.SmartWindowManager.ActiveViewer;

            if (viewer != null)
            {
                ICanvasViewer canViewer = viewer as ICanvasViewer;
                if (canViewer == null)
                {
                    return;
                }
                IRasterDrawing rd = canViewer.ActiveObject as IRasterDrawing;
                if (rd == null || rd.RgbProcessorStack == null)
                {
                    return;
                }
                List <IRgbProcessor> rgbProcessors = new List <IRgbProcessor>();
                foreach (IRgbProcessor processor in rd.RgbProcessorStack.Processors)
                {
                    rgbProcessors.Add(processor);
                }
                rgbProcessors.Reverse();
                int[]         selectBands = rd.SelectedBandNos;
                IGeoPanAdjust adjust      = rd as IGeoPanAdjust;
                if (adjust != null)
                {
                    if (adjust.IsHasUnsavedGeoAdjusted)
                    {
                        DialogResult ret = MsgBox.ShowQuestionYesNoCancel("对当前影像的平移校正结果未保存,请确认是否保存?\n按【是】保存。\n按【否】不保存。\n按【取消】返回。");
                        if (ret == DialogResult.Cancel)
                        {
                            return;
                        }
                        else if (ret == DialogResult.Yes)
                        {
                            PanAdjustTool adjustTool = new PanAdjustTool();
                            string        fileName   = null;
                            try
                            {
                                fileName = adjustTool.SaveGeoAdjust(rd.EnvelopeBeforeAdjusting, rd.DataProviderCopy);
                            }
                            catch (Exception e)
                            {
                                MessageBox.Show(e.Message);
                            }
                            adjust.Cancel();
                            if (File.Exists(fileName))
                            {
                                OpenFileFactory.Open(fileName);
                                IRasterDrawing draw = _smartSession.SmartWindowManager.ActiveViewer.ActiveObject as IRasterDrawing;
                                draw.SelectedBandNos = selectBands;
                                if (rgbProcessors != null && rgbProcessors.Count > 0)
                                {
                                    draw.RgbProcessorStack.Clear();
                                    foreach (IRgbProcessor processor in rgbProcessors)
                                    {
                                        draw.RgbProcessorStack.Process(processor);
                                    }
                                }
                            }
                        }
                        else
                        {
                            adjust.Cancel();
                        }
                    }
                    else
                    {
                        string dirTXTFname = AppDomain.CurrentDomain.BaseDirectory + "MonitoringProductArgs\\COMM\\AdjustSaveFile.txt";
                        if (File.Exists(dirTXTFname))
                        {
                            string[]     fileNames    = File.ReadAllLines(dirTXTFname, Encoding.Default);
                            int          length       = fileNames.Length;
                            string       lastFile     = fileNames[length - 1];
                            AdjustConfig config       = new AdjustConfig();
                            bool         IsOpenResult = true;
                            bool.TryParse(config.GetConfigValue("IsOpenResult"), out IsOpenResult);
                            if (IsOpenResult && File.Exists(lastFile))
                            {
                                try
                                {
                                    OpenFileFactory.Open(lastFile);
                                    IRasterDrawing draw = _smartSession.SmartWindowManager.ActiveViewer.ActiveObject as IRasterDrawing;
                                    draw.SelectedBandNos = selectBands;
                                    if (rgbProcessors != null && rgbProcessors.Count > 0)
                                    {
                                        draw.RgbProcessorStack.Clear();
                                        foreach (IRgbProcessor processor in rgbProcessors)
                                        {
                                            draw.RgbProcessorStack.Process(processor);
                                        }
                                    }
                                }
                                catch (Exception e)
                                {
                                    MessageBox.Show(e.Message);
                                }
                            }
                            File.Delete(dirTXTFname);
                        }
                    }
                }
            }
            _smartSession.UIFrameworkHelper.SetVisible(argument, false);
            _smartSession.UIFrameworkHelper.SetLockBesideX(argument, false);
        }
コード例 #6
0
        public override void  Execute()
        {
            ISmartViewer viewer = _smartSession.SmartWindowManager.ActiveViewer;

            if (viewer == null)
            {
                return;
            }
            ICanvasViewer  canViewer = viewer as ICanvasViewer;
            IRasterDrawing rd        = canViewer.ActiveObject as IRasterDrawing;

            if (rd == null || rd.RgbProcessorStack == null)
            {
                return;
            }
            List <IRgbProcessor> rgbProcessors = new List <IRgbProcessor>();

            foreach (IRgbProcessor processor in rd.RgbProcessorStack.Processors)
            {
                rgbProcessors.Add(processor);
            }
            rgbProcessors.Reverse();
            int[]         selectBands = rd.SelectedBandNos;
            IGeoPanAdjust adjust      = rd as IGeoPanAdjust;

            if (rd == null)
            {
                return;
            }
            GeoAdjustHelper helper       = new GeoAdjustHelper();
            string          fileName     = null;
            string          dblvFileName = null;

            try
            {
                CoordEnvelope envelopeAfter = new CoordEnvelope(rd.Envelope.MinX, rd.Envelope.MinY, rd.Envelope.Width, rd.Envelope.Height);
                fileName = helper.SaveGeoAdjustByChangeCoordEnvelope(envelopeAfter, rd.DataProviderCopy);
                //调整对应的判识结果文件
                dblvFileName = AdjustDBLVFile(envelopeAfter, rd.DataProviderCopy);
                adjust.Cancel();
                if (File.Exists(fileName))
                {
                    OpenFileFactory.Open(fileName);
                    IRasterDrawing draw = _smartSession.SmartWindowManager.ActiveViewer.ActiveObject as IRasterDrawing;
                    draw.SelectedBandNos = selectBands;
                    if (rgbProcessors != null && rgbProcessors.Count > 0)
                    {
                        draw.RgbProcessorStack.Clear();
                        foreach (IRgbProcessor processor in rgbProcessors)
                        {
                            draw.RgbProcessorStack.Process(processor);
                        }
                    }
                    //生成多通道合成图
                    LayoutCreater layoutCreater = new LayoutCreater();
                    string        mcsiFileName  = layoutCreater.CreateMCSI(_smartSession);
                    if (!string.IsNullOrEmpty(mcsiFileName) && File.Exists(mcsiFileName))
                    {
                        OpenFileFactory.Open(mcsiFileName);
                    }
                    //生成二值图
                    if (!string.IsNullOrEmpty(dblvFileName))
                    {
                        string imgFileName = layoutCreater.CreateDBLVLayout(dblvFileName, draw.FileName);
                        if (!string.IsNullOrEmpty(imgFileName) && File.Exists(imgFileName))
                        {
                            OpenFileFactory.Open(imgFileName);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            if (fileName != null && File.Exists(fileName))
            {
                string adjustTxtDir = AppDomain.CurrentDomain.BaseDirectory + "MonitoringProductArgs\\COMM\\";
                if (!Directory.Exists(adjustTxtDir))
                {
                    Directory.CreateDirectory(adjustTxtDir);
                }
                string txtFileName = Path.Combine(adjustTxtDir, "AdjustSaveFile.txt");
                using (StreamWriter sw = new StreamWriter(txtFileName, true, Encoding.Default))
                {
                    sw.WriteLine(fileName);
                    if (dblvFileName != null && File.Exists(dblvFileName))
                    {
                        sw.WriteLine(dblvFileName);
                    }
                }
            }
        }
コード例 #7
0
        public override void Execute(string argument)
        {
            ISmartViewer viewer = _smartSession.SmartWindowManager.ActiveViewer;

            if (viewer != null)
            {
                ICanvasViewer canViewer = viewer as ICanvasViewer;
                if (canViewer == null)
                {
                    return;
                }
                IRasterDrawing rd = canViewer.ActiveObject as IRasterDrawing;
                if (rd == null || rd.RgbProcessorStack == null)
                {
                    return;
                }
                List <IRgbProcessor> rgbProcessors = new List <IRgbProcessor>();
                foreach (IRgbProcessor processor in rd.RgbProcessorStack.Processors)
                {
                    rgbProcessors.Add(processor);
                }
                rgbProcessors.Reverse();
                int[]         selectBands = rd.SelectedBandNos;
                IGeoPanAdjust adjust      = rd as IGeoPanAdjust;
                if (adjust != null)
                {
                    if (adjust.IsHasUnsavedGeoAdjusted)
                    {
                        DialogResult ret = MsgBox.ShowQuestionYesNoCancel("对当前影像的平移校正结果未保存,请确认是否保存?\n按【是】保存。\n按【否】不保存。\n按【取消】返回。");
                        if (ret == DialogResult.Cancel)
                        {
                            return;
                        }
                        else if (ret == DialogResult.Yes)
                        {
                            GeoAdjustHelper adjustTool   = new GeoAdjustHelper();
                            string          fileName     = null;
                            string          dblvFileName = null;
                            try
                            {
                                fileName     = adjustTool.SaveGeoAdjustByChangeCoordEnvelope(rd.DataProvider.CoordEnvelope, rd.DataProviderCopy);
                                dblvFileName = AdjustDBLVFile(rd.DataProvider.CoordEnvelope, rd.DataProviderCopy);
                            }
                            catch (Exception e)
                            {
                                MessageBox.Show(e.Message);
                            }
                            adjust.Cancel();
                            if (File.Exists(fileName))
                            {
                                OpenFileFactory.Open(fileName);
                                IRasterDrawing draw = _smartSession.SmartWindowManager.ActiveViewer.ActiveObject as IRasterDrawing;
                                draw.SelectedBandNos = selectBands;
                                if (rgbProcessors != null && rgbProcessors.Count > 0)
                                {
                                    draw.RgbProcessorStack.Clear();
                                    foreach (IRgbProcessor processor in rgbProcessors)
                                    {
                                        draw.RgbProcessorStack.Process(processor);
                                    }
                                }
                                //生成多通道合成图
                                LayoutCreater layoutCreater = new LayoutCreater();
                                string        mcsiFileName  = layoutCreater.CreateMCSI(_smartSession);
                                if (!string.IsNullOrEmpty(mcsiFileName) && File.Exists(mcsiFileName))
                                {
                                    OpenFileFactory.Open(mcsiFileName);
                                }
                                //生成二值图
                                if (!string.IsNullOrEmpty(dblvFileName))
                                {
                                    string imgFileName = layoutCreater.CreateDBLVLayout(dblvFileName, draw.FileName);
                                    if (!string.IsNullOrEmpty(imgFileName) && File.Exists(imgFileName))
                                    {
                                        OpenFileFactory.Open(imgFileName);
                                    }
                                }
                            }
                        }
                        else
                        {
                            adjust.Cancel();
                        }
                    }
                    else
                    {
                        string dirTXTFname = AppDomain.CurrentDomain.BaseDirectory + "MonitoringProductArgs\\COMM\\AdjustSaveFile.txt";
                        if (File.Exists(dirTXTFname))
                        {
                            string[] fileNames = File.ReadAllLines(dirTXTFname, Encoding.Default);
                            int      length    = fileNames.Length;
                            string   lastFile  = fileNames[length - 1];
                            if (File.Exists(lastFile))
                            {
                                try
                                {
                                    OpenFileFactory.Open(lastFile);
                                    IRasterDrawing draw = _smartSession.SmartWindowManager.ActiveViewer.ActiveObject as IRasterDrawing;
                                    draw.SelectedBandNos = selectBands;
                                    if (rgbProcessors != null && rgbProcessors.Count > 0)
                                    {
                                        draw.RgbProcessorStack.Clear();
                                        foreach (IRgbProcessor processor in rgbProcessors)
                                        {
                                            draw.RgbProcessorStack.Process(processor);
                                        }
                                    }
                                }
                                catch (Exception e)
                                {
                                    MessageBox.Show(e.Message);
                                }
                            }
                            File.Delete(dirTXTFname);
                        }
                    }
                }
            }
            //_smartSession.UIFrameworkHelper.SetVisible(argument, false);
            //_smartSession.UIFrameworkHelper.SetLockBesideX(argument, false);
        }