public override void Initialize() { base.Initialize(); if (this.SliceImageBox == null) { throw new InvalidOperationException("Tool has nothing to control because the specified slice set is not visible."); } _resliceGraphic = new ResliceToolGraphic(this); _resliceGraphic.Color = this.NormalColor; _resliceGraphic.HotColor = this.HotColor; _resliceGraphic.Points.PointChanged += OnAnchorPointChanged; _resliceGraphic.Text = this.SliceImageBox.DisplaySet.Description; // draw the reslice graphic on the first imagebox that isn't showing the slicing this tool controls and is not parallel foreach (IImageBox imageBox in this.ImageViewer.PhysicalWorkspace.ImageBoxes) { if (imageBox != this.SliceImageBox) { if (_resliceGraphic.SetLine(this.SliceImageBox.TopLeftPresentationImage, imageBox.TopLeftPresentationImage)) { TranslocateGraphic(_resliceGraphic, imageBox.TopLeftPresentationImage); break; } } } ColorizeDisplaySetDescription(this.SliceImageBox.TopLeftPresentationImage, this.NormalColor); this.ImageViewer.EventBroker.ImageBoxDrawing += OnImageViewerImageBoxDrawing; }
public SliceControlGraphic(IGraphic subject, ResliceToolGraphic topParent) : base(subject) { _topParent = topParent; _textGraphic = new InvariantTextPrimitive(); _textGraphic.BoundingBoxChanged += TextGraphic_BoundingBoxChanged; base.Graphics.Add(_textGraphic); base.DecoratedGraphic.VisualStateChanged += DecoratedGraphic_VisualStateChanged; }
protected override void Dispose(bool disposing) { base.DecoratedGraphic.VisualStateChanged -= DecoratedGraphic_VisualStateChanged; if (_textGraphic != null) { _textGraphic.BoundingBoxChanged -= TextGraphic_BoundingBoxChanged; _textGraphic = null; } _topParent = null; base.Dispose(disposing); }
protected override void Dispose(bool disposing) { this.ImageViewer.EventBroker.ImageBoxDrawing -= OnImageViewerImageBoxDrawing; if (disposing) { if (this.SliceSet != null) { this.SliceSet = null; } if (_resliceGraphic != null) { TranslocateGraphic(_resliceGraphic, null); _resliceGraphic.Points.PointChanged -= OnAnchorPointChanged; _resliceGraphic.Dispose(); _resliceGraphic = null; } } _resliceToolGroup = null; base.Dispose(disposing); }
public override void Initialize() { base.Initialize(); if (this.SliceImageBox == null) throw new InvalidOperationException("Tool has nothing to control because the specified slice set is not visible."); _resliceGraphic = new ResliceToolGraphic(this); _resliceGraphic.Color = this.NormalColor; _resliceGraphic.HotColor = this.HotColor; _resliceGraphic.Points.PointChanged += OnAnchorPointChanged; _resliceGraphic.Text = this.SliceImageBox.DisplaySet.Description; // draw the reslice graphic on the first imagebox that isn't showing the slicing this tool controls and is not parallel foreach (IImageBox imageBox in this.ImageViewer.PhysicalWorkspace.ImageBoxes) { if (imageBox != this.SliceImageBox) { if (_resliceGraphic.SetLine(this.SliceImageBox.TopLeftPresentationImage, imageBox.TopLeftPresentationImage)) { TranslocateGraphic(_resliceGraphic, imageBox.TopLeftPresentationImage); break; } } } ColorizeDisplaySetDescription(this.SliceImageBox.TopLeftPresentationImage, this.NormalColor); this.ImageViewer.EventBroker.ImageBoxDrawing += OnImageViewerImageBoxDrawing; }