protected RoiGraphic CreateRoiGraphic(bool initiallySelected) { //When you create a graphic from within a tool (particularly one that needs capture, like a multi-click graphic), //see it through to the end of creation. It's just cleaner, not to mention that if this tool knows how to create it, //it should also know how to (and be responsible for) cancelling it and/or deleting it appropriately. IGraphic graphic = CreateGraphic(); IAnnotationCalloutLocationStrategy strategy = CreateCalloutLocationStrategy(); RoiGraphic roiGraphic; if (strategy == null) { roiGraphic = new RoiGraphic(graphic); } else { roiGraphic = new RoiGraphic(graphic, strategy); } if (Settings.Default.AutoNameMeasurements && !string.IsNullOrEmpty(this.RoiNameFormat)) { roiGraphic.Name = string.Format(this.RoiNameFormat, ++_serialNumber); } else { roiGraphic.Name = string.Empty; } roiGraphic.State = initiallySelected ? roiGraphic.CreateSelectedState() : roiGraphic.CreateInactiveState(); return(roiGraphic); }
/// <summary> /// Releases all resources used by this <see cref="AnnotationGraphic"/>. /// </summary> protected override void Dispose(bool disposing) { if (disposing) { if (_calloutLocationStrategy != null) { _calloutLocationStrategy.Dispose(); _calloutLocationStrategy = null; } Subject.VisualStateChanged -= OnSubjectVisualStateChanged; } base.Dispose(disposing); }
private void Initialize(IAnnotationCalloutLocationStrategy calloutLocationStrategy) { if (_calloutGraphic == null) { _calloutGraphic = this.CreateCalloutGraphic(); base.Graphics.Add(_calloutGraphic); } _calloutGraphic.TextLocationChanged += OnCalloutLocationChanged; if (_calloutLocationStrategy == null) { _calloutLocationStrategy = calloutLocationStrategy ?? new AnnotationCalloutLocationStrategy(); } _calloutLocationStrategy.SetAnnotationGraphic(this); this.Subject.VisualStateChanged += OnSubjectVisualStateChanged; }
/// <summary> /// Constructs a new instance of <see cref="RoiGraphic"/>. /// </summary> /// <param name="roi">The graphic or control chain graphic representing the region of interest.</param> /// <param name="calloutLocationStrategy">An <see cref="IAnnotationCalloutLocationStrategy"/> to automatically place the callout.</param> public RoiGraphic(IGraphic roi, IAnnotationCalloutLocationStrategy calloutLocationStrategy) : base(roi, calloutLocationStrategy) { Initialize(); }
public AimRoiGraphic(IGraphic roi, IAnnotationCalloutLocationStrategy strategy) : base(roi, strategy) { }
public AimRoiGraphic(IGraphic roi, IAnnotationCalloutLocationStrategy strategy) : base(roi, strategy) { }
/// <summary> /// Initializes a new instance of <see cref="AnnotationGraphic"/> with the given <see cref="IAnnotationCalloutLocationStrategy"/>. /// </summary> public AnnotationGraphic(IGraphic subjectGraphic, IAnnotationCalloutLocationStrategy calloutLocationStrategy) : base(subjectGraphic) { Initialize(calloutLocationStrategy); }
/// <summary> /// Constructs a new instance of <see cref="RoiGraphic"/>. /// </summary> /// <param name="roi">The graphic or control chain graphic representing the region of interest.</param> /// <param name="calloutLocationStrategy">An <see cref="IAnnotationCalloutLocationStrategy"/> to automatically place the callout.</param> public RoiGraphic(IGraphic roi, IAnnotationCalloutLocationStrategy calloutLocationStrategy) : base(roi, calloutLocationStrategy) { Initialize(); }
/// <summary> /// Initializes a new instance of <see cref="AnnotationGraphic"/> with the given <see cref="IAnnotationCalloutLocationStrategy"/>. /// </summary> public AnnotationGraphic(IGraphic subjectGraphic, IAnnotationCalloutLocationStrategy calloutLocationStrategy) : base(subjectGraphic) { Initialize(calloutLocationStrategy); }
/// <summary> /// Releases all resources used by this <see cref="AnnotationGraphic"/>. /// </summary> protected override void Dispose(bool disposing) { if (disposing) { if (_calloutLocationStrategy != null) { _calloutLocationStrategy.Dispose(); _calloutLocationStrategy = null; } Subject.VisualStateChanged -= OnSubjectVisualStateChanged; } base.Dispose(disposing); }
private void Initialize(IAnnotationCalloutLocationStrategy calloutLocationStrategy) { if (_calloutGraphic == null) { _calloutGraphic = this.CreateCalloutGraphic(); base.Graphics.Add(_calloutGraphic); } _calloutGraphic.TextLocationChanged += OnCalloutLocationChanged; if (_calloutLocationStrategy == null) _calloutLocationStrategy = calloutLocationStrategy ?? new AnnotationCalloutLocationStrategy(); _calloutLocationStrategy.SetAnnotationGraphic(this); this.Subject.VisualStateChanged += OnSubjectVisualStateChanged; }
private static RoiGraphic CreateRoiGraphic(IGraphic interactiveGraphic, IAnnotationCalloutLocationStrategy strategy) { RoiGraphic roiGraphic = strategy == null ? new AimRoiGraphic(interactiveGraphic) : new AimRoiGraphic(interactiveGraphic, strategy); roiGraphic.Name = "ROI"; roiGraphic.State = roiGraphic.CreateInactiveState(); return roiGraphic; }
// Helper method private static RoiGraphic CreateRoiGraphic(IGraphic interactiveGraphic, IAnnotationCalloutLocationStrategy strategy) { RoiGraphic roiGraphic; if (strategy == null) roiGraphic = new RoiGraphic(interactiveGraphic); else roiGraphic = new RoiGraphic(interactiveGraphic, strategy); roiGraphic.Name = "ROI"; // string.Empty; roiGraphic.State = roiGraphic.CreateInactiveState(); return roiGraphic; }