示例#1
0
        public override bool CalculateCalloutLocation(out PointF location, out CoordinateSystem coordinateSystem)
        {
            // if the user has manually positioned the callout, we won't override it
            if (_manuallyPositionedCallout)
            {
                location         = PointF.Empty;
                coordinateSystem = CoordinateSystem.Destination;
                return(false);
            }

            Callout.CoordinateSystem           = CoordinateSystem.Destination;
            AnnotationSubject.CoordinateSystem = CoordinateSystem.Destination;
            try
            {
                var roiBoundingBox  = AnnotationSubject.BoundingBox;
                var clientRectangle = AnnotationSubject.ParentPresentationImage.ClientRectangle;

                var textSize = Callout.TextBoundingBox.Size;
                if (textSize.IsEmpty)
                {
                    textSize = new SizeF(100, 50);
                }

                coordinateSystem = CoordinateSystem.Destination;
                location         = new PointF(ComputeCalloutLocationX(textSize, clientRectangle, roiBoundingBox), ComputeCalloutLocationY(textSize, clientRectangle, roiBoundingBox));
            }
            finally
            {
                Callout.ResetCoordinateSystem();
                AnnotationSubject.ResetCoordinateSystem();
            }
            return(true);
        }
示例#2
0
        /// <summary>
        /// Calculates the initial callout location only; returns false thereafter.
        /// </summary>
        public virtual bool CalculateCalloutLocation(out PointF location, out CoordinateSystem coordinateSystem)
        {
            location         = PointF.Empty;
            coordinateSystem = CoordinateSystem.Destination;

            if (!_initialLocationSet)
            {
                _initialLocationSet = true;

                SizeF offset = new SizeF(0, 55);

                // Setup the callout
                AnnotationSubject.CoordinateSystem = CoordinateSystem.Destination;
                location = RectangleUtilities.ConvertToPositiveRectangle(AnnotationSubject.BoundingBox).Location - offset;
                AnnotationSubject.ResetCoordinateSystem();
                return(true);
            }

            return(false);
        }