private void SetCalloutEndPoint() { // We're attaching the callout to the ROI, so make sure the two // graphics are in the same coordinate system before we do that. // This sets all the graphics coordinate systems to be the same. this.CoordinateSystem = Subject.CoordinateSystem; PointF endPoint; CoordinateSystem coordinateSystem; _calloutLocationStrategy.CalculateCalloutEndPoint(out endPoint, out coordinateSystem); this.ResetCoordinateSystem(); _calloutGraphic.CoordinateSystem = coordinateSystem; _calloutGraphic.AnchorPoint = endPoint; _calloutGraphic.ResetCoordinateSystem(); }
private static void SerializeCallout(ICalloutGraphic calloutGraphic, GraphicAnnotationSequenceItem serializationState) { calloutGraphic.CoordinateSystem = CoordinateSystem.Source; try { RectangleF textBoundingBox = RectangleUtilities.ConvertToPositiveRectangle(calloutGraphic.TextBoundingBox); TextObject text = new TextObject(); text.BoundingBoxAnnotationUnits = GraphicAnnotationSequenceItem.BoundingBoxAnnotationUnits.Pixel; text.BoundingBoxBottomRightHandCorner = new PointF(textBoundingBox.Right, textBoundingBox.Bottom); text.BoundingBoxTextHorizontalJustification = GraphicAnnotationSequenceItem.BoundingBoxTextHorizontalJustification.Center; text.BoundingBoxTopLeftHandCorner = textBoundingBox.Location; text.UnformattedTextValue = calloutGraphic.Text; serializationState.AppendTextObjectSequence(text); // draw the callout line manually instead of anchoring the text, // since we do not want the text to be moveable as permitted if we have an anchor point SerializeDashedLine(calloutGraphic.TextLocation, calloutGraphic.AnchorPoint, calloutGraphic.SpatialTransform, serializationState, false); } finally { calloutGraphic.ResetCoordinateSystem(); } }