Example #1
0
 private void RemoveGraphicBuilder()
 {
     if (_lineGraphicBuilder != null)
     {
         _lineGraphicBuilder.GraphicComplete  -= OnGraphicBuilderDone;
         _lineGraphicBuilder.GraphicCancelled -= OnGraphicBuilderCancelled;
         _lineGraphicBuilder = null;
     }
 }
Example #2
0
            public override bool Start(IMouseInformation mouseInformation)
            {
                // don't let the tool start if we're disabled!
                if (!this.Enabled)
                {
                    return(false);
                }

                base.Start(mouseInformation);

                if (_lineGraphicBuilder != null)
                {
                    return(_lineGraphicBuilder.Start(mouseInformation));
                }

                IPresentationImage image = mouseInformation.Tile.PresentationImage;

                IOverlayGraphicsProvider provider = image as IOverlayGraphicsProvider;

                if (provider == null)
                {
                    return(false);
                }

                // this memento will be consumed when the graphic builder is completed or cancelled
                _originalResliceToolsState = _resliceToolGroup.ToolGroupState.CreateMemento();

                TranslocateGraphic(_resliceGraphic, this.SelectedPresentationImage);

                // The interactive graphic builders typically operate on new, pristine graphics
                // Since our graphic isn't new, clear the points from it! (Otherwise you'll end up with a polyline)
                _resliceGraphic.Points.Clear();

                _lineGraphicBuilder = new InteractivePolylineGraphicBuilder(2, _resliceGraphic);
                _lineGraphicBuilder.GraphicComplete  += OnGraphicBuilderDone;
                _lineGraphicBuilder.GraphicCancelled += OnGraphicBuilderCancelled;

                if (_lineGraphicBuilder.Start(mouseInformation))
                {
                    return(true);
                }

                this.Cancel();
                return(false);
            }