示例#1
0
 private void DisplayArgEditor(IRgbProcessor processor, IRasterDrawing drawing, ICanvasViewer viewer)
 {
     if (_registeredEditors == null)
     {
         _registeredEditors = GetRegisteredEditors();
     }
     if (_registeredEditors == null)
     {
         return;
     }
     foreach (IRgbProcessorArgEditor editor in _registeredEditors)
     {
         if (editor.IsSupport(processor.GetType()))
         {
             IRgbProcessorArgEditor argeditor = Activator.CreateInstance(editor.GetType()) as IRgbProcessorArgEditor;
             if (processor.Arguments == null)
             {
                 processor.CreateDefaultArguments();
             }
             if (drawing.SelectedBandNos.Length == 1 || drawing.BandCount == 1)
             {
                 processor.BytesPerPixel = 1;
                 if (argeditor is frmReversalColorEditor)
                 {
                     return;
                 }
             }
             else
             {
                 processor.BytesPerPixel = 3;
             }
             argeditor.OnPreviewing += new OnArgEditorPreviewing((senser, arg) =>
             {
                 viewer.Canvas.Refresh(Core.DrawEngine.enumRefreshType.RasterLayer);
             }
                                                                 );
             argeditor.OnApplyClicked += new OnArgEditorApplyClick((senser, arg) =>
             {
                 viewer.Canvas.Refresh(Core.DrawEngine.enumRefreshType.RasterLayer);
             }
                                                                   );
             argeditor.OnCancelClicked += new OnArgEditorCancelClick((senser, arg) =>
             {
                 drawing.RgbProcessorStack.RemoveLast();
                 viewer.Canvas.Refresh(Core.DrawEngine.enumRefreshType.RasterLayer);
             });
             if (argeditor is Form)
             {
                 (argeditor as Form).Owner         = _smartSession.SmartWindowManager.MainForm as Form;
                 (argeditor as Form).StartPosition = FormStartPosition.Manual;
                 (argeditor as Form).Location      = _smartSession.SmartWindowManager.ViewLeftUpperCorner;
                 (argeditor as Form).Text          = processor.Name + "参数设置...";
             }
             argeditor.Init(viewer.RgbProcessorArgEditorEnvironment as IRgbArgEditorEnvironmentSupport, processor);
             argeditor.Show(processor.Arguments);
             return;
         }
     }
 }
示例#2
0
        private void ImgHistEven_Click(object sender, EventArgs e)
        {
            IRasterDrawing drawing = canvasHost1.Canvas.PrimaryDrawObject as IRasterDrawing;

            if (drawing == null)
            {
                return;
            }

            IRgbProcessor pro = new HisEqualizing();

            drawing.RgbProcessorStack.Process(pro);

            foreach (IRgbProcessorArgEditor editor in _registeredEditors)
            {
                if (editor.IsSupport(pro.GetType()))
                {
                    IRgbProcessorArgEditor argeditor = Activator.CreateInstance(editor.GetType()) as IRgbProcessorArgEditor;
                    if (pro.Arguments == null)
                    {
                        pro.CreateDefaultArguments();
                    }
                    if (drawing.SelectedBandNos.Length == 1 || drawing.BandCount == 1)
                    {
                        pro.BytesPerPixel = 1;
                        if (argeditor is frmReversalColorEditor)
                        {
                            return;
                        }
                    }
                    else
                    {
                        pro.BytesPerPixel = 3;
                    }
                    argeditor.OnPreviewing += new OnArgEditorPreviewing((senser, arg) =>
                    {
                        canvasHost1.Canvas.Refresh(Core.DrawEngine.enumRefreshType.RasterLayer);
                    }
                                                                        );
                    argeditor.OnApplyClicked += new OnArgEditorApplyClick((senser, arg) =>
                    {
                        canvasHost1.Canvas.Refresh(Core.DrawEngine.enumRefreshType.RasterLayer);
                    }
                                                                          );
                    argeditor.OnCancelClicked += new OnArgEditorCancelClick((senser, arg) =>
                    {
                        drawing.RgbProcessorStack.RemoveLast();
                        canvasHost1.Canvas.Refresh(Core.DrawEngine.enumRefreshType.RasterLayer);
                    });
                    if (argeditor is Form)
                    {
                        (argeditor as Form).Owner         = _smartSession.SmartWindowManager.MainForm as Form;
                        (argeditor as Form).StartPosition = FormStartPosition.Manual;
                        (argeditor as Form).Location      = _smartSession.SmartWindowManager.ViewLeftUpperCorner;
                        (argeditor as Form).Text          = pro.Name + "参数设置...";
                    }
                    argeditor.Init(null, pro);
                    argeditor.Show(pro.Arguments);
                    return;
                }
            }
            canvasHost1.Canvas.Refresh(enumRefreshType.All);
        }