개정판 53eada70
issue #937: calculate points of leader line of arrow text
Change-Id: I1120ef0970201d22359e7f3a9ba7241a7019b46c
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/HoneyPDFLib_DrawSet_DrawString.cs | ||
---|---|---|
163 | 163 |
contentByte.RestoreState(); |
164 | 164 |
} |
165 | 165 |
|
166 |
public static void DrawString_ArrowText(Point sp, Point ep, double lineSize, iTextSharp.text.pdf.PdfContentByte contentByte, SolidColorBrush color, PaintSet PaintStyle, double FontSize, |
|
166 |
public static void DrawString_ArrowText(Point sp, Point ep, Point ptHead, Point ptMid, |
|
167 |
double lineSize, iTextSharp.text.pdf.PdfContentByte contentByte, SolidColorBrush color, PaintSet PaintStyle, double FontSize, |
|
167 | 168 |
bool isHighlight, FontFamily fontFamilly, FontStyle fontstyle, FontWeight fontweight, TextDecorationCollection isUnderline, |
168 | 169 |
string text, System.Drawing.SizeF size, double opac, double Angle) |
169 | 170 |
{ |
... | ... | |
267 | 268 |
ct.Go(); |
268 | 269 |
|
269 | 270 |
contentByte.RestoreState(); |
271 |
|
|
272 |
DrawLeaderLine(ptHead, ptMid, transformed, (int)lineSize, contentByte, color, opac); |
|
273 |
} |
|
274 |
|
|
275 |
/// <summary> |
|
276 |
/// draw leader line for arrow_text |
|
277 |
/// </summary> |
|
278 |
/// <author>humkyung</author> |
|
279 |
/// <date>2019.06.12</date> |
|
280 |
/// <param name="start"></param> |
|
281 |
/// <param name="mid"></param> |
|
282 |
/// <param name="border"></param> |
|
283 |
/// <param name="LineSize"></param> |
|
284 |
/// <param name="contentByte"></param> |
|
285 |
/// <param name="color"></param> |
|
286 |
/// <param name="opac"></param> |
|
287 |
private static void DrawLeaderLine(Point start, Point mid, List<Point> border, int LineSize, iTextSharp.text.pdf.PdfContentByte contentByte, SolidColorBrush color, double opac) |
|
288 |
{ |
|
289 |
/// prepare connection points |
|
290 |
List<Point> ptConns = new List<Point>(); |
|
291 |
for (int i = 0; i < border.Count; ++i) |
|
292 |
{ |
|
293 |
ptConns.Add(border[i]); |
|
294 |
ptConns.Add(new Point((border[i].X + border[(i + 1) % border.Count].X) * 0.5, (border[i].Y + border[(i + 1) % border.Count].Y) * 0.5)); |
|
295 |
} |
|
296 |
/// up to here |
|
297 |
|
|
298 |
Point? anchor = null; |
|
299 |
double dMinDist = Double.MaxValue; |
|
300 |
foreach (var point in ptConns) |
|
301 |
{ |
|
302 |
double dx = point.X - mid.X; |
|
303 |
double dy = point.Y - mid.Y; |
|
304 |
double dist = dx * dx + dy * dy; |
|
305 |
if(dist < dMinDist) |
|
306 |
{ |
|
307 |
dMinDist = dist; |
|
308 |
anchor = point; |
|
309 |
} |
|
310 |
} |
|
311 |
|
|
312 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(start, mid, (int)LineSize, contentByte, color, opac); |
|
313 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(start, mid, (int)LineSize, contentByte, new DoubleCollection(9999), color, opac); |
|
314 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(mid, anchor.Value, (int)LineSize, contentByte, new DoubleCollection(9999), color, opac); |
|
270 | 315 |
} |
271 | 316 |
|
272 | 317 |
private static void PaintFill(PdfContentByte contentByte, PaintSet PaintStyle, BaseColor bs) |
FinalService/KCOM_FinalService/MarkupToPDF/MarkupToPDF.cs | ||
---|---|---|
933 | 933 |
|
934 | 934 |
if (control.isTrans) |
935 | 935 |
{ |
936 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(newStartPoint, tempMidPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
937 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(newStartPoint, tempMidPoint, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity); |
|
938 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(tempMidPoint, tempEndPoint, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity); |
|
936 |
//Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(newStartPoint, tempMidPoint, (int)LineSize, contentByte, _SetColor, Opacity);
|
|
937 |
//Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(newStartPoint, tempMidPoint, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity);
|
|
938 |
//Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(tempMidPoint, tempEndPoint, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity);
|
|
939 | 939 |
//인구 수정 Arrow Text Style적용 되도록 변경 |
940 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), LineSize, |
|
941 |
contentByte, _SetColor, Paint, fontsize, isHighlight, new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
|
940 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), |
|
941 |
newStartPoint, tempMidPoint, |
|
942 |
LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
|
942 | 943 |
} |
943 | 944 |
else |
944 | 945 |
{ |
... | ... | |
964 | 965 |
testP = new Point(newEndPoint.X + 10, newEndPoint.Y); |
965 | 966 |
} |
966 | 967 |
} |
967 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(tempStartPoint, testP, (int)LineSize, contentByte, _SetColor, Opacity); |
|
968 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(tempStartPoint, testP, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity); |
|
969 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(testP, tempEndPoint, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity); |
|
968 |
//Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(tempStartPoint, testP, (int)LineSize, contentByte, _SetColor, Opacity);
|
|
969 |
//Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(tempStartPoint, testP, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity);
|
|
970 |
//Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(testP, tempEndPoint, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity);
|
|
970 | 971 |
|
971 | 972 |
//인구 수정 Arrow Text Style적용 되도록 변경 |
972 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, |
|
973 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), |
|
974 |
tempStartPoint, testP, |
|
975 |
LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, |
|
973 | 976 |
new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
974 | 977 |
} |
975 | 978 |
else |
976 | 979 |
{ |
977 |
Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(newStartPoint, newMidPoint, (int)LineSize, contentByte, _SetColor, Opacity); |
|
978 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(newStartPoint, newMidPoint, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity); |
|
979 |
Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(newMidPoint, tempEndPoint, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity); |
|
980 |
//Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(newStartPoint, newMidPoint, (int)LineSize, contentByte, _SetColor, Opacity);
|
|
981 |
//Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(newStartPoint, newMidPoint, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity);
|
|
982 |
//Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(newMidPoint, tempEndPoint, (int)LineSize, contentByte, new DoubleCollection(9999), _SetColor, Opacity);
|
|
980 | 983 |
|
981 | 984 |
//인구 수정 Arrow Text Style적용 되도록 변경 |
982 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
|
985 |
Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), |
|
986 |
newStartPoint, newMidPoint, |
|
987 |
LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
|
983 | 988 |
|
984 | 989 |
|
985 | 990 |
} |
내보내기 Unified diff