Пример #1
0
        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;
        }
Пример #4
0
		/// <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();
		}
Пример #5
0
 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);
 }
Пример #8
0
 /// <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();
 }
Пример #9
0
		/// <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);
		}
Пример #10
0
		/// <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);
		}
Пример #11
0
		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;
        }
Пример #13
0
		// 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;
		}