Пример #1
0
        private void AnalyzeInternal()
        {
            IPresentationImage       presImage            = this.ImageViewer.SelectedPresentationImage;
            IImageGraphicProvider    imageGraphicProvider = presImage as IImageGraphicProvider;
            GrayscaleImageGraphic    imageGraphic         = imageGraphicProvider.ImageGraphic as GrayscaleImageGraphic;
            IOverlayGraphicsProvider overlayProvider      = presImage as IOverlayGraphicsProvider;

            CadOverlayGraphic cadOverlay = GetCadOverlayGraphic(overlayProvider);

            if (cadOverlay == null)
            {
                cadOverlay = new CadOverlayGraphic(imageGraphic);
                overlayProvider.OverlayGraphics.Add(cadOverlay);
            }

            MemorableUndoableCommand command = new MemorableUndoableCommand(cadOverlay);

            command.BeginState   = cadOverlay.CreateMemento();
            cadOverlay.Threshold = (int)this.Threshold;
            cadOverlay.Opacity   = (int)this.Opacity;
            cadOverlay.Analyze();
            command.EndState = cadOverlay.CreateMemento();

            this.ImageViewer.CommandHistory.AddCommand(command);
        }
Пример #2
0
        void EventBroker_PresentationImageSelected(object sender, PresentationImageSelectedEventArgs e)
        {
            IOverlayGraphicsProvider provider = e.SelectedPresentationImage as IOverlayGraphicsProvider;

            CadOverlayGraphic cadOverlay = GetCadOverlayGraphic(provider);

            if (cadOverlay == null)
            {
                this.ThresholdEnabled = false;
                this.OpacityEnabled   = false;
            }
            else
            {
                this.Threshold        = cadOverlay.Threshold;
                this.Opacity          = cadOverlay.Opacity;
                this.ThresholdEnabled = true;
                this.OpacityEnabled   = true;
            }
        }