/// <summary> /// SendStraightLine sends a straight line annotation to the handler. /// </summary> /// <param name="handler">The handler.</param> /// <param name="properties">The properties.</param> /// <returns>true if the operation succeeded otherwise returns false.</returns> private static bool SendStraightLine(IWangAnnotationHandler handler, WangAnnotationProperties properties) { /* * Straight Line * Definition: A line with a defined starting and ending point. * Attributes: rgbColor1, bHighlighting, uLineSize * Named Blocks and Associated Structures: * - OiAnoDat AN_POINTS * - OiFilNam Not used * - OiDIB Not used * - OiGroup STR * - OiIndex STR * - OiAnText Not used */ if (properties.HasPoints && WangAnnotationTranslation.PointsLength(properties.Points) == 2) { SendStraightLine(handler, properties.OiGroup, properties.OiIndex, properties.MarkAttributes.Bounds, properties.Points, properties.MarkAttributes.Color1, properties.MarkAttributes.Highlighting, properties.MarkAttributes.LineSize); return(true); } return(false); }
/// <summary> /// SendStraightLine sends a straight line annotation to the handler. /// </summary> /// <param name="handler">The handler.</param> /// <param name="oiGroup">The group.</param> /// <param name="oiIndex">The index.</param> /// <param name="bounds">The rectangle surrouding the annotation.</param> /// <param name="points">The points for the line.</param> /// <param name="colorComponents">The components for the color of the line.</param> /// <param name="highlighting">A flag indicating whether it's an highlighter line or a regular line.</param> /// <param name="lineSize">The size of the line, i.e. width of the line.</param> private static void SendStraightLine(IWangAnnotationHandler handler, string oiGroup, string oiIndex, int[] bounds, int[] points, byte[] colorComponents, bool highlighting, uint lineSize) { // TODO - David Ometto - 2016-11-22 - Translate to GdPicture.NET proper annotation type. // Please see in detail the parameters that are just ignored for the moment. if (highlighting) { // The coordinates for the line are relative to the upper left corner of the annotation // bounding box. Also convert a straight line to a free hand because of highlither handler.AddFreeHandHighligtherAnnot(PointsInImage(bounds, points), colorComponents, (int)lineSize); } else { // The coordinates for the line are relative to the upper left corner of the annotation // bounding box. handler.AddLineAnnot( bounds[WangAnnotationTranslation.LeftIndex] + WangAnnotationTranslation.PointX(0, points), WangAnnotationTranslation.PointY(0, points), WangAnnotationTranslation.PointX(1, points), WangAnnotationTranslation.PointY(1, points), colorComponents, (int)lineSize); } }