개정판 73dfc330
Fix: (FinalService) 페이지가 회전되었을때 ArrowTextControl 오류 수정
Change-Id: I18b5c8de2f48fdd1f5b19aab85046d15d5019496
FinalService/KCOM_FinalService/MarkupToPDF/Common/CommonFont.cs | ||
---|---|---|
51 | 51 |
/// <returns></returns> |
52 | 52 |
public static iTextSharp.text.Font CreateFont(FontFamily fontFamilly, FontStyle fontstyle, FontWeight fontweight, TextDecorationCollection isUnderline, iTextSharp.text.Rectangle rect, string text) |
53 | 53 |
{ |
54 |
///int iFonts = FontFactory.RegisterDirectory(Environment.GetFolderPath(Environment.SpecialFolder.Fonts)); |
|
55 |
//string sFontPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "Arial Unicode MS.TTF"); |
|
56 |
|
|
57 |
//bool bTextIsAscii = !text.Any(c => !Char.IsLetterOrDigit(c)); /// text가 ascii인지 확인 |
|
58 |
//if (bTextIsAscii) |
|
59 |
//{ |
|
60 |
// sFontPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "TIMES.TTF"); |
|
61 |
//} |
|
62 |
|
|
63 | 54 |
double dFontSize = double.MaxValue; |
64 | 55 |
|
65 | 56 |
BaseFont bf = CreateBaseFont(fontFamilly,BaseFont.IDENTITY_H, BaseFont.EMBEDDED, BaseFont.CACHED); |
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_DrawString.cs | ||
---|---|---|
35 | 35 |
FontFamily fontFamilly, FontStyle fontstyle, FontWeight fontweight, TextDecorationCollection isUnderline, |
36 | 36 |
string text, System.Drawing.SizeF size, double opac, double Angle) |
37 | 37 |
{ |
38 |
|
|
39 | 38 |
if (string.IsNullOrWhiteSpace(text)) |
40 | 39 |
{ |
41 | 40 |
text = ""; |
... | ... | |
53 | 52 |
|
54 | 53 |
double textMargin = 0.5; |
55 | 54 |
|
56 |
rect.Inflate(lineSize * textMargin, lineSize * textMargin); /// 점을 중심으로 라인 두께가 그려짐으로 사각형 안쪽으로 텍스트가 쓰여지게 사각형을 키움 |
|
55 |
/// 점을 중심으로 라인 두께가 그려짐으로 사각형 안쪽으로 텍스트가 쓰여지게 사각형을 키움 |
|
56 |
rect.Inflate(lineSize * textMargin, lineSize * textMargin); |
|
57 | 57 |
|
58 | 58 |
var calRect = MathSet.GetPointsToRectX(points); |
59 | 59 |
if (lineSize * 2 > calRect.Height) lineSize *= 0.3; /// 텍스트가 뒤집어 지는것 방지 |
... | ... | |
74 | 74 |
|
75 | 75 |
contentByte.SetLineWidth((float)lineSize); |
76 | 76 |
|
77 |
System.Drawing.Drawing2D.Matrix mat = new System.Drawing.Drawing2D.Matrix(); |
|
78 |
|
|
79 |
if (Angle == 180) |
|
80 |
{ |
|
81 |
mat.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)sp.X, (float)sp.Y)); |
|
82 |
mat.Translate((float)-rect.Width, (float)rect.Height); |
|
83 |
} |
|
84 |
else |
|
85 |
mat.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)sp.X, (float)sp.Y)); |
|
86 |
|
|
77 |
#region 보더를 그린다. |
|
87 | 78 |
/// transform text border |
88 | 79 |
System.Drawing.PointF[] border = new System.Drawing.PointF[4] |
89 | 80 |
{ |
... | ... | |
92 | 83 |
new System.Drawing.PointF((float)points[2].X, (float)points[2].Y), |
93 | 84 |
new System.Drawing.PointF((float)points[3].X, (float)points[3].Y) |
94 | 85 |
}; |
95 |
mat.TransformPoints(border); /// transform if given angle is not 0 |
|
96 |
var transformed = border.Select(param => new Point(param.X, param.Y)).ToList(); |
|
97 |
/// up to here |
|
98 | 86 |
|
99 | 87 |
contentByte.NewPath(); |
100 |
contentByte.MoveTo(transformed[0].X, transformed[0].Y);
|
|
88 |
contentByte.MoveTo(border[0].X, border[0].Y);
|
|
101 | 89 |
|
102 | 90 |
if ((PaintStyle & PaintSet.Hatch) == PaintSet.Hatch) |
103 | 91 |
{ |
104 | 92 |
/// default arc length |
105 | 93 |
List<Point> rectPoints = new List<Point>(); |
106 | 94 |
|
107 |
for (int i = 1; i <= transformed.Count; ++i)
|
|
95 |
for (int i = 1; i <= border.Count(); ++i)
|
|
108 | 96 |
{ |
109 |
rectPoints.Add(new Point(transformed[i % transformed.Count].X, transformed[i % transformed.Count].Y));
|
|
97 |
rectPoints.Add(new Point(border[i % border.Count()].X, border[i % border.Count()].Y));
|
|
110 | 98 |
} |
111 | 99 |
|
112 | 100 |
if ((PaintStyle & PaintSet.Highlight) == PaintSet.Highlight) |
113 | 101 |
{ |
114 | 102 |
contentByte.NewPath(); |
115 |
contentByte.MoveTo(transformed[0].X, transformed[0].Y);
|
|
116 |
for (int i = 1; i <= transformed.Count; ++i) contentByte.LineTo(transformed[i % transformed.Count].X, transformed[i % transformed.Count].Y);
|
|
103 |
contentByte.MoveTo(border[0].X, border[0].Y);
|
|
104 |
for (int i = 1; i <= border.Count(); ++i) contentByte.LineTo(border[i % border.Count()].X, border[i % border.Count()].Y);
|
|
117 | 105 |
|
118 | 106 |
DrawSet_Shape.PaintFill(contentByte, PaintStyle, bs, opac); |
119 | 107 |
} |
... | ... | |
122 | 110 |
|
123 | 111 |
List<Point> newPointSet = new List<Point>(); |
124 | 112 |
|
125 |
newPointSet.Add(new Point(transformed[0].X, transformed[0].Y));
|
|
126 |
for (int i = 1; i <= transformed.Count; ++i) newPointSet.Add(new Point(transformed[i % points.Count].X, transformed[i % points.Count].Y));
|
|
113 |
newPointSet.Add(new Point(border[0].X, border[0].Y));
|
|
114 |
for (int i = 1; i <= border.Count(); ++i) newPointSet.Add(new Point(border[i % points.Count].X, border[i % points.Count].Y));
|
|
127 | 115 |
|
128 | 116 |
Controls_PDF.DrawSet_Cloud.DrawCloud(newPointSet, lineSize, ArcLength, contentByte, new DoubleCollection(), color, color, PaintSet.None, opac); |
129 | 117 |
} |
130 | 118 |
else if (((PaintStyle & PaintSet.Highlight) == PaintSet.Highlight) || ((PaintStyle & PaintSet.Fill) == PaintSet.Fill)) |
131 | 119 |
{ |
132 |
for (int i = 1; i <= transformed.Count; ++i) contentByte.LineTo(transformed[i % transformed.Count].X, transformed[i % transformed.Count].Y);
|
|
120 |
for (int i = 1; i <= border.Count(); ++i) contentByte.LineTo(border[i % border.Count()].X, border[i % border.Count()].Y);
|
|
133 | 121 |
|
134 | 122 |
DrawSet_Text.PaintFill(contentByte, PaintStyle, bs); |
135 | 123 |
} |
124 |
#endregion |
|
136 | 125 |
|
126 |
System.Drawing.Drawing2D.Matrix mat = new System.Drawing.Drawing2D.Matrix(); |
|
137 | 127 |
|
138 |
|
|
139 |
iTextSharp.text.Font itextFont = CommonFont.CreateFont(fontFamilly, fontstyle, fontweight, isUnderline, calRect, text); |
|
140 |
|
|
141 |
contentByte.SetColorStroke(bs); |
|
142 |
contentByte.SetColorFill(bs); |
|
143 |
|
|
144 |
string[] tokens = text.Split(new[] { Environment.NewLine, "\r" }, StringSplitOptions.None); |
|
145 |
/// single line text |
|
146 |
if (tokens.Length == 1) |
|
128 |
iTextSharp.text.Rectangle TextBox = null; |
|
129 |
#region TextBox에 크기에 맞게 폰트를 생성한다. |
|
130 |
iTextSharp.text.Font itextFont = null; |
|
131 |
if(Convert.ToInt32(Angle) == 90) |
|
147 | 132 |
{ |
148 |
float height = itextFont.BaseFont.GetAscentPoint(text, itextFont.CalculatedSize) - itextFont.BaseFont.GetDescentPoint(text, itextFont.CalculatedSize); |
|
149 |
float spacing = (float)((calRect.Height - height) * 0.5); |
|
150 |
System.Drawing.PointF[] origin = new System.Drawing.PointF[1] |
|
151 |
{ |
|
152 |
new System.Drawing.PointF((float)((calRect.Left + calRect.Right) * 0.5), (float)((calRect.Top + calRect.Bottom - height) * 0.5)) |
|
153 |
}; |
|
154 |
mat.TransformPoints(origin); |
|
133 |
float llx = calRect.Left; |
|
134 |
float lly = calRect.Bottom + (float)textMargin; |
|
135 |
float urx = calRect.Left + calRect.Height; |
|
136 |
float ury = lly + calRect.Width; |
|
137 |
TextBox = new iTextSharp.text.Rectangle(llx, lly, urx, ury); |
|
138 |
|
|
139 |
itextFont = CommonFont.CreateFont(fontFamilly, fontstyle, fontweight, isUnderline, TextBox, text); |
|
140 |
|
|
141 |
#region 회전 후에 이동시킴 |
|
142 |
mat.Translate(TextBox.Height, (float)0.0); |
|
143 |
mat.RotateAt((float)Angle * 1, new System.Drawing.PointF(TextBox.Left, TextBox.Bottom)); |
|
144 |
#endregion |
|
145 |
} |
|
146 |
else if (Convert.ToInt32(Angle) == 270) |
|
147 |
{ |
|
148 |
float llx = calRect.Left; |
|
149 |
float lly = calRect.Top - (float)textMargin; |
|
150 |
float urx = calRect.Left + calRect.Height; |
|
151 |
float ury = lly + calRect.Width; |
|
152 |
TextBox = new iTextSharp.text.Rectangle(llx, lly, urx, ury); |
|
155 | 153 |
|
156 |
UTF8Encoding utf8 = new UTF8Encoding(); |
|
157 |
Byte[] utf8String = utf8.GetBytes(text); |
|
154 |
itextFont = CommonFont.CreateFont(fontFamilly, fontstyle, fontweight, isUnderline, TextBox, text); |
|
158 | 155 |
|
159 |
ColumnText.ShowTextAligned(contentByte, Element.ALIGN_CENTER, new Phrase(new Chunk(utf8.GetString(utf8String), itextFont)), origin[0].X, origin[0].Y, (float)-Angle);
|
|
156 |
mat.RotateAt((float)Angle * 1, new System.Drawing.PointF(TextBox.Left, TextBox.Bottom));
|
|
160 | 157 |
} |
161 |
/// multi line text |
|
162 | 158 |
else |
163 | 159 |
{ |
164 |
ColumnText ct = new ColumnText(contentByte); |
|
165 |
PdfGState gs3 = new PdfGState(); |
|
166 |
gs3.StrokeOpacity = (float)opac; |
|
167 |
gs3.FillOpacity = (float)opac; |
|
168 |
|
|
169 |
ct.Canvas.Transform(mat); |
|
170 |
ct.Canvas.SetGState(gs3); |
|
171 |
float fLeadingSize = (calRect.Height / (float)tokens.Length); |
|
172 |
float spacing = ((float)calRect.Height - tokens.Length * itextFont.CalculatedSize) / (tokens.Length + 2); |
|
173 |
/// add paddings |
|
174 |
calRect.Right += (float)(lineSize * 0.5); |
|
175 |
if (calRect.Top > calRect.Bottom) |
|
176 |
calRect.Bottom -= (float)(lineSize * 0.5); |
|
177 |
else |
|
178 |
calRect.Top -= (float)(lineSize * 0.5); |
|
179 |
/// up to here |
|
180 |
ct.SetLeading(itextFont.CalculatedSize + (float)((tokens.Length > 1) ? spacing : 0), ct.MultipliedLeading); |
|
181 |
ct.SetSimpleColumn(calRect); |
|
182 |
ct.Alignment = Element.ALIGN_MIDDLE | Element.ALIGN_CENTER; |
|
183 |
ct.SetText(new Phrase(new Chunk(text, itextFont))); |
|
184 |
ct.Go(); |
|
160 |
TextBox = calRect; |
|
161 |
itextFont = CommonFont.CreateFont(fontFamilly, fontstyle, fontweight, isUnderline, TextBox, text); |
|
185 | 162 |
} |
163 |
#endregion |
|
164 |
|
|
165 |
#region 텍스트 쓰기 |
|
166 |
contentByte.SetColorStroke(bs); |
|
167 |
contentByte.SetColorFill(bs); |
|
168 |
|
|
169 |
string[] tokens = text.Split(new[] { Environment.NewLine, "\r" }, StringSplitOptions.None); |
|
170 |
ColumnText ct = new ColumnText(contentByte); |
|
171 |
PdfGState gs3 = new PdfGState(); |
|
172 |
gs3.StrokeOpacity = (float)opac; |
|
173 |
gs3.FillOpacity = (float)opac; |
|
174 |
|
|
175 |
ct.Canvas.Transform(mat); |
|
176 |
ct.Canvas.SetGState(gs3); |
|
177 |
float fLeadingSize = (TextBox.Height / (float)tokens.Length); |
|
178 |
float spacing = ((float)TextBox.Height - tokens.Length * itextFont.CalculatedSize) / (tokens.Length + 2); |
|
179 |
/// add paddings |
|
180 |
TextBox.Right += (float)(lineSize * 0.5); |
|
181 |
if (TextBox.Top > TextBox.Bottom) |
|
182 |
TextBox.Bottom -= (float)(lineSize * 0.5); |
|
183 |
else |
|
184 |
TextBox.Top -= (float)(lineSize * 0.5); |
|
185 |
/// up to here |
|
186 |
ct.SetLeading(itextFont.CalculatedSize + (float)((tokens.Length > 1) ? spacing : 0), ct.MultipliedLeading); |
|
187 |
ct.SetSimpleColumn(TextBox); |
|
188 |
ct.Alignment = Element.ALIGN_MIDDLE | Element.ALIGN_CENTER; |
|
189 |
ct.SetText(new Phrase(new Chunk(text, itextFont))); |
|
190 |
ct.Go(); |
|
191 |
#endregion |
|
186 | 192 |
|
187 | 193 |
contentByte.RestoreState(); |
188 | 194 |
} |
... | ... | |
208 | 214 |
/// <param name="size"></param> |
209 | 215 |
/// <param name="opac"></param> |
210 | 216 |
/// <param name="Angle"></param> |
211 |
public static void DrawString_ArrowText(Point sp, Point ep, Point ptHead, Point ptMid, Point ptEnd, bool bIsFixed,
|
|
217 |
public static void DrawString_ArrowText(System.Windows.Rect rect, Point ptHead, Point ptMid, Point ptEnd, bool bIsFixed,
|
|
212 | 218 |
double lineSize, iTextSharp.text.pdf.PdfContentByte contentByte, System.Drawing.Color color, PaintSet PaintStyle, double FontSize, |
213 | 219 |
bool isHighlight, FontFamily fontFamilly, FontStyle fontstyle, FontWeight fontweight, TextDecorationCollection isUnderline, |
214 | 220 |
string text, System.Drawing.SizeF size, double opac, double Angle) |
215 | 221 |
{ |
216 |
Rect rect = new Rect(sp, ep); |
|
217 |
|
|
218 |
List<Point> points = new List<Point> |
|
219 |
{ |
|
220 |
rect.TopLeft, rect.BottomLeft, |
|
221 |
rect.BottomRight, rect.TopRight |
|
222 |
}; |
|
223 |
|
|
224 |
System.Drawing.Drawing2D.Matrix mat = new System.Drawing.Drawing2D.Matrix(); |
|
225 |
|
|
226 |
mat.RotateAt((float)Angle * -1, new System.Drawing.PointF((float)sp.X, (float)sp.Y)); |
|
227 |
|
|
228 |
/// up to here |
|
229 |
|
|
230 |
DrawSet_Text.DrawString(sp, ep, lineSize, contentByte, color, PaintStyle, FontSize, fontFamilly, fontstyle, fontweight, isUnderline, text, size, opac, Angle); |
|
231 |
|
|
232 |
if (Angle == 270 || Angle == 90) |
|
233 |
{ |
|
234 |
/// transform text border |
|
235 |
System.Drawing.PointF[] border = new System.Drawing.PointF[4] |
|
236 |
{ |
|
237 |
new System.Drawing.PointF((float)points[0].X, (float)points[0].Y), |
|
238 |
new System.Drawing.PointF((float)points[1].X, (float)points[1].Y), |
|
239 |
new System.Drawing.PointF((float)points[2].X, (float)points[2].Y), |
|
240 |
new System.Drawing.PointF((float)points[3].X, (float)points[3].Y) |
|
241 |
}; |
|
242 |
|
|
243 |
|
|
244 |
mat.TransformPoints(border); /// transform if given angle is not 0 |
|
245 |
var transformed = border.Select(param => new Point(param.X, param.Y)).ToList(); |
|
246 |
|
|
247 |
if (Angle == 90 || Angle == 270) |
|
248 |
{ |
|
249 |
transformed.Add(new Point(transformed[0].X, transformed[0].Y - (transformed[0].Y - transformed[3].Y) / 2)); |
|
250 |
transformed.Add(new Point(transformed[1].X, transformed[1].Y - (transformed[1].Y - transformed[2].Y) / 2)); |
|
251 |
} |
|
252 |
|
|
253 |
ptEnd = MathSet.getNearPoint(transformed, ptMid); |
|
254 |
} |
|
255 |
else |
|
256 |
{ |
|
257 |
if (!bIsFixed) |
|
258 |
{ |
|
259 |
List<Point> newPoints = new List<Point>(); |
|
260 |
|
|
261 |
newPoints.Add(MidPoint(points[0], points[3])); |
|
262 |
newPoints.Add(MidPoint(points[0], points[1])); |
|
263 |
newPoints.Add(MidPoint(points[1], points[2])); |
|
264 |
newPoints.Add(MidPoint(points[2], points[3])); |
|
265 |
//newPoints.AddRange(points); |
|
266 |
|
|
267 |
ptEnd = MathSet.getNearPoint(newPoints, ptMid); |
|
268 |
} |
|
269 |
} |
|
270 |
|
|
222 |
DrawSet_Text.DrawString(rect.TopLeft, rect.BottomRight, lineSize, contentByte, color, PaintStyle, FontSize, fontFamilly, fontstyle, fontweight, isUnderline, text, size, opac, Angle); |
|
271 | 223 |
DrawLeaderLineNew(ptHead, ptMid, ptEnd, bIsFixed, lineSize, contentByte, color, opac); |
272 | 224 |
} |
273 | 225 |
|
274 |
private static Point MidPoint(Point a, Point b) |
|
275 |
{ |
|
276 |
Point middle = a; |
|
277 |
|
|
278 |
middle.X = (a.X + b.X) / 2; |
|
279 |
middle.Y = (a.Y + b.Y) / 2; |
|
280 |
|
|
281 |
return middle; |
|
282 |
} |
|
283 |
/// <summary> |
|
284 |
/// draw leader line for arrow_text |
|
285 |
/// </summary> |
|
286 |
/// <author>humkyung</author> |
|
287 |
/// <date>2019.06.12</date> |
|
288 |
/// <param name="start"></param> |
|
289 |
/// <param name="mid"></param> |
|
290 |
/// <param name="border"></param> |
|
291 |
/// <param name="LineSize"></param> |
|
292 |
/// <param name="contentByte"></param> |
|
293 |
/// <param name="color"></param> |
|
294 |
/// <param name="opac"></param> |
|
295 |
private static void DrawLeaderLine(Point start, Point mid, bool bIsFixed, List<Point> border, double LineSize, iTextSharp.text.pdf.PdfContentByte contentByte, System.Drawing.Color color, double opac) |
|
296 |
{ |
|
297 |
/// prepare connection points |
|
298 |
List<Point> ptConns = new List<Point>(); |
|
299 |
for (int i = 0; i < border.Count; ++i) |
|
300 |
{ |
|
301 |
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)); |
|
302 |
} |
|
303 |
/// up to here |
|
304 |
|
|
305 |
Point? anchor = null; |
|
306 |
double dMinDist = Double.MaxValue; |
|
307 |
foreach (var point in ptConns) |
|
308 |
{ |
|
309 |
double dx = point.X - mid.X; |
|
310 |
double dy = point.Y - mid.Y; |
|
311 |
double dist = dx * dx + dy * dy; |
|
312 |
if (dist < dMinDist) |
|
313 |
{ |
|
314 |
dMinDist = dist; |
|
315 |
anchor = point; |
|
316 |
} |
|
317 |
} |
|
318 |
|
|
319 |
Controls_PDF.DrawSet_Arrow.SingleAllow(start, bIsFixed ? mid : anchor.Value, LineSize, contentByte, color, opac); |
|
320 |
Controls_PDF.DrawSet_Line.DrawLine(start, bIsFixed ? mid : anchor.Value, LineSize, contentByte, new DoubleCollection(9999), color, opac); |
|
321 |
if (bIsFixed) |
|
322 |
{ |
|
323 |
Controls_PDF.DrawSet_Line.DrawLine(mid, anchor.Value, LineSize, contentByte, new DoubleCollection(9999), color, opac); |
|
324 |
} |
|
325 |
} |
|
326 |
|
|
327 | 226 |
/// <summary> |
328 | 227 |
/// Markus의 box끝에 맞는부분과 틀려 별도로 만듬 |
329 |
/// |
|
228 |
/// </summary>
|
|
330 | 229 |
/// kimteaseong |
331 | 230 |
/// </summary> |
332 | 231 |
/// <param name="start"></param> |
... | ... | |
339 | 238 |
/// <param name="opac"></param> |
340 | 239 |
private static void DrawLeaderLineNew(Point start, Point mid, Point end, bool bIsFixed, double LineSize, iTextSharp.text.pdf.PdfContentByte contentByte, System.Drawing.Color color, double opac) |
341 | 240 |
{ |
241 |
var DashSize = new DoubleCollection(9999); |
|
242 |
|
|
342 | 243 |
Controls_PDF.DrawSet_Arrow.SingleAllow(start, bIsFixed ? mid : end, LineSize, contentByte, color, opac); |
343 |
Controls_PDF.DrawSet_Line.DrawLine(start, bIsFixed ? mid : end, LineSize, contentByte, new DoubleCollection(9999), color, opac);
|
|
244 |
Controls_PDF.DrawSet_Line.DrawLine(start, bIsFixed ? mid : end, LineSize, contentByte, DashSize, color, opac);
|
|
344 | 245 |
if (bIsFixed) |
345 | 246 |
{ |
346 |
Controls_PDF.DrawSet_Line.DrawLine(mid, end, LineSize, contentByte, new DoubleCollection(9999), color, opac);
|
|
247 |
Controls_PDF.DrawSet_Line.DrawLine(mid, end, LineSize, contentByte, DashSize, color, opac);
|
|
347 | 248 |
} |
348 | 249 |
} |
349 | 250 |
|
FinalService/KCOM_FinalService/MarkupToPDF/MarkupToPDF.cs | ||
---|---|---|
870 | 870 |
case "ArrowTextControl": |
871 | 871 |
using (S_ArrowTextControl control = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(item)) |
872 | 872 |
{ |
873 |
//using (S_TextControl textcontrol = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item)) |
|
874 |
//{ |
|
875 |
// textcontrol.Angle = control.Angle; |
|
876 |
// textcontrol.BoxH = control.BoxHeight; |
|
877 |
// textcontrol.BoxW = control.BoxWidth; |
|
878 |
// textcontrol.EndPoint = control.EndPoint; |
|
879 |
// textcontrol.FontColor = "#FFFF0000"; |
|
880 |
// textcontrol.Name = "TextControl"; |
|
881 |
// textcontrol.Opac = control.Opac; |
|
882 |
// textcontrol.PointSet = new List<Point>(); |
|
883 |
// textcontrol.SizeSet = string.Join(delimiterChars2.First(), control.SizeSet.First(), control.fontConfig[3]); |
|
884 |
// textcontrol.StartPoint = control.StartPoint; |
|
885 |
// textcontrol.Text = control.ArrowText; |
|
886 |
// textcontrol.TransformPoint = control.TransformPoint; |
|
887 |
// textcontrol.UserID = null; |
|
888 |
// textcontrol.fontConfig = control.fontConfig; |
|
889 |
// textcontrol.isHighLight = control.isHighLight; |
|
890 |
// textcontrol.paintMethod = 1; |
|
891 |
|
|
892 |
// DrawTextBox(textcontrol, contentByte, delimiterChars, delimiterChars2, _SetColor); |
|
893 |
//} |
|
894 |
|
|
895 |
//using (S_ArrowControl_Multi linecontrol = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item)) |
|
896 |
//{ |
|
897 |
// linecontrol.Angle = control.Angle; |
|
898 |
// linecontrol.DashSize = new DoubleCollection(new[] {(double)999999 }); |
|
899 |
// linecontrol.EndPoint = control.EndPoint; |
|
900 |
// linecontrol.MidPoint = control.MidPoint; |
|
901 |
// linecontrol.Name = "ArrowControl_Multi"; |
|
902 |
// linecontrol.Opac = control.Opac; |
|
903 |
// linecontrol.PointSet = control.PointSet; |
|
904 |
// linecontrol.SizeSet = control.SizeSet; |
|
905 |
// linecontrol.StartPoint = control.StartPoint; |
|
906 |
// linecontrol.StrokeColor = control.StrokeColor; |
|
907 |
// linecontrol.TransformPoint = control.TransformPoint; |
|
908 |
|
|
909 |
// DrawMultiArrowLine(linecontrol, contentByte, delimiterChars, delimiterChars2, _SetColor); |
|
910 |
//} |
|
911 | 873 |
string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
912 | 874 |
Point tempStartPoint = GetPdfPointSystem(control.StartPoint); |
913 | 875 |
Point tempMidPoint = GetPdfPointSystem(control.MidPoint); |
... | ... | |
917 | 879 |
double fontsize = 30; |
918 | 880 |
|
919 | 881 |
System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxWidth, (float)control.BoxHeight); |
920 |
Rect rect = new Rect(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight)); |
|
921 |
List<Point> tempPoint = new List<Point>(); |
|
882 |
List<Point> Connections = new List<Point>(control.GetConnectionPoints(tempEndPoint, scaleWidth, scaleHeight)); |
|
922 | 883 |
|
923 | 884 |
double Angle = control.Angle; |
924 | 885 |
|
925 |
if (Math.Abs(Angle).ToString() == "90") |
|
926 |
{ |
|
927 |
Angle = 270; |
|
928 |
} |
|
929 |
else if (Math.Abs(Angle).ToString() == "270") |
|
930 |
{ |
|
931 |
Angle = 90; |
|
932 |
} |
|
933 |
|
|
934 |
var tempRectMidPoint = MathSet.getRectMiddlePoint(rect); |
|
935 |
tempPoint.Add(new Point(rect.Left, tempRectMidPoint.Y)); |
|
936 |
tempPoint.Add(new Point(tempRectMidPoint.X, rect.Top)); |
|
937 |
tempPoint.Add(new Point(rect.Right, tempRectMidPoint.Y)); |
|
938 |
tempPoint.Add(new Point(tempRectMidPoint.X, rect.Bottom)); |
|
939 |
|
|
940 | 886 |
var newStartPoint = tempStartPoint; |
941 |
var newEndPoint = MathSet.getNearPoint(tempPoint, tempMidPoint); |
|
942 |
var newMidPoint = MathSet.getMiddlePoint(newStartPoint, newEndPoint); |
|
943 |
|
|
944 |
//Point testPoint = tempEndPoint; |
|
945 |
//if (Angle != 0) |
|
946 |
//{ |
|
947 |
// testPoint = GetArrowTextControlTestPoint(0, newMidPoint, tempPoint, control.isFixed); |
|
948 |
// //testPoint = Test(rect, newMidPoint); |
|
949 |
//} |
|
887 |
var ConnectionPoint = MathSet.getNearPoint(Connections, tempMidPoint); |
|
950 | 888 |
|
951 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()), scaleWidth);
|
|
889 |
double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2[0]), scaleWidth);
|
|
952 | 890 |
System.Drawing.Color FontColor = _SetColor; |
953 | 891 |
bool isHighlight = control.isHighLight; |
954 | 892 |
double Opacity = control.Opac; |
... | ... | |
1010 | 948 |
} |
1011 | 949 |
|
1012 | 950 |
TextDecorationCollection decoration = TextDecorations.Baseline; |
1013 |
if (control.fontConfig.Count() == 5)
|
|
951 |
if (control.fontConfig.Count == 5) |
|
1014 | 952 |
{ |
1015 | 953 |
decoration = TextDecorations.Underline; |
1016 | 954 |
} |
1017 | 955 |
|
1018 | 956 |
if (control.isTrans) |
1019 | 957 |
{ |
1020 |
//인구 수정 Arrow Text Style적용 되도록 변경
|
|
1021 |
Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
|
|
1022 |
newStartPoint, tempMidPoint, newEndPoint, control.isFixed,
|
|
958 |
var border = control.GetBorderRectangle(tempEndPoint, scaleWidth, scaleHeight);
|
|
959 |
Controls_PDF.DrawSet_Text.DrawString_ArrowText(border,
|
|
960 |
newStartPoint, tempMidPoint, ConnectionPoint, control.isFixed,
|
|
1023 | 961 |
LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
1024 | 962 |
} |
1025 | 963 |
else |
... | ... | |
1029 | 967 |
var testP = new Point(0, 0); |
1030 | 968 |
if (control.isFixed) |
1031 | 969 |
{ |
1032 |
if (tempPoint[1] == newEndPoint)
|
|
970 |
if (Connections[1] == ConnectionPoint)
|
|
1033 | 971 |
{ |
1034 |
testP = new Point(newEndPoint.X, newEndPoint.Y - 10);
|
|
972 |
testP = new Point(ConnectionPoint.X, ConnectionPoint.Y - 10);
|
|
1035 | 973 |
} |
1036 |
else if (tempPoint[3] == newEndPoint)
|
|
974 |
else if (Connections[3] == ConnectionPoint)
|
|
1037 | 975 |
{ |
1038 |
testP = new Point(newEndPoint.X, newEndPoint.Y + 10);
|
|
976 |
testP = new Point(ConnectionPoint.X, ConnectionPoint.Y + 10);
|
|
1039 | 977 |
} |
1040 |
else if (tempPoint[0] == newEndPoint)
|
|
978 |
else if (Connections[0] == ConnectionPoint)
|
|
1041 | 979 |
{ |
1042 |
testP = new Point(newEndPoint.X - 10, newEndPoint.Y);
|
|
980 |
testP = new Point(ConnectionPoint.X - 10, ConnectionPoint.Y);
|
|
1043 | 981 |
} |
1044 |
else if (tempPoint[2] == newEndPoint)
|
|
982 |
else if (Connections[2] == ConnectionPoint)
|
|
1045 | 983 |
{ |
1046 |
testP = new Point(newEndPoint.X + 10, newEndPoint.Y);
|
|
984 |
testP = new Point(ConnectionPoint.X + 10, ConnectionPoint.Y);
|
|
1047 | 985 |
} |
1048 | 986 |
} |
1049 |
//인구 수정 Arrow Text Style적용 되도록 변경 |
|
1050 |
Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight), |
|
1051 |
tempStartPoint, testP, tempEndPoint, control.isFixed, |
|
987 |
|
|
988 |
var border = control.GetBorderRectangle(tempEndPoint, scaleWidth, scaleHeight); |
|
989 |
Controls_PDF.DrawSet_Text.DrawString_ArrowText(border, |
|
990 |
tempStartPoint, testP, ConnectionPoint, control.isFixed, |
|
1052 | 991 |
LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, |
1053 | 992 |
FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
1054 | 993 |
} |
1055 | 994 |
else |
1056 | 995 |
{ |
1057 |
//인구 수정 Arrow Text Style적용 되도록 변경
|
|
1058 |
Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
|
|
1059 |
newStartPoint, tempMidPoint, tempEndPoint, control.isFixed,
|
|
996 |
var border = control.GetBorderRectangle(tempEndPoint, scaleWidth, scaleHeight);
|
|
997 |
Controls_PDF.DrawSet_Text.DrawString_ArrowText(border,
|
|
998 |
newStartPoint, tempMidPoint, ConnectionPoint, control.isFixed,
|
|
1060 | 999 |
LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle); |
1061 | 1000 |
} |
1062 | 1001 |
} |
... | ... | |
1065 | 1004 |
{ |
1066 | 1005 |
throw ex; |
1067 | 1006 |
} |
1068 |
|
|
1069 | 1007 |
} |
1070 | 1008 |
break; |
1071 | 1009 |
#endregion |
FinalService/KCOM_FinalService/MarkupToPDF/Serialize/S_Control/Detail/S_TextControl.cs | ||
---|---|---|
12 | 12 |
using System.Collections.Generic; |
13 | 13 |
using MarkupToPDF.Controls.Common; |
14 | 14 |
using MarkupToPDF.Controls.Text; |
15 |
using CommonLib.MARKUS_API; |
|
15 | 16 |
|
16 | 17 |
namespace MarkupToPDF.Serialize.S_Control |
17 | 18 |
{ |
... | ... | |
76 | 77 |
GC.Collect(); |
77 | 78 |
GC.SuppressFinalize(this); |
78 | 79 |
} |
79 |
} |
|
80 | 80 |
|
81 |
//[DataContract] |
|
82 |
//public class SolidBrushForm |
|
83 |
//{ |
|
84 |
// [DataMember] |
|
85 |
// public double B_Opac { get; set; } |
|
86 |
// [DataMember] |
|
87 |
// public Color B_Color { get; set; } |
|
88 |
//} |
|
81 |
/// <summary> |
|
82 |
/// Border 사각형을 리턴한다. |
|
83 |
/// </summary> |
|
84 |
/// <param name="Origin"></param> |
|
85 |
/// <param name="ScaleWidth"></param> |
|
86 |
/// <param name="ScaleHeight"></param> |
|
87 |
/// <returns></returns> |
|
88 |
public System.Windows.Rect GetBorderRectangle(Point Origin, float ScaleWidth, float ScaleHeight) |
|
89 |
{ |
|
90 |
if (Convert.ToInt32(this.Angle) == 90) |
|
91 |
{ |
|
92 |
double _BoxWidth = this.BoxHeight / ScaleHeight; |
|
93 |
double _BoxHeight = this.BoxWidth / ScaleWidth; |
|
94 |
Origin = new Point(Origin.X, Origin.Y + _BoxHeight); |
|
95 |
|
|
96 |
return new System.Windows.Rect(Origin, new Point(Origin.X + _BoxWidth, Origin.Y - _BoxHeight)); |
|
97 |
} |
|
98 |
else if (Convert.ToInt32(this.Angle) == 270) |
|
99 |
{ |
|
100 |
double _BoxWidth = this.BoxHeight / ScaleHeight; |
|
101 |
double _BoxHeight = this.BoxWidth / ScaleWidth; |
|
102 |
Origin = new Point(Origin.X - _BoxWidth, Origin.Y); |
|
103 |
|
|
104 |
return new System.Windows.Rect(Origin, new Point(Origin.X + _BoxWidth, Origin.Y - _BoxHeight)); |
|
105 |
} |
|
106 |
else |
|
107 |
{ |
|
108 |
double _BoxWidth = this.BoxWidth / ScaleWidth; |
|
109 |
double _BoxHeight = this.BoxHeight / ScaleHeight; |
|
110 |
|
|
111 |
return new System.Windows.Rect(Origin, new Point(Origin.X + _BoxWidth, Origin.Y - _BoxHeight)); |
|
112 |
} |
|
113 |
} |
|
114 |
|
|
115 |
/// <summary> |
|
116 |
/// 연결점을 리턴한다. |
|
117 |
/// </summary> |
|
118 |
/// <param name="Origin"></param> |
|
119 |
/// <param name="ScaleWidth"></param> |
|
120 |
/// <param name="ScaleHeight"></param> |
|
121 |
/// <returns></returns> |
|
122 |
public List<Point> GetConnectionPoints(Point Origin, float ScaleWidth, float ScaleHeight) |
|
123 |
{ |
|
124 |
List<Point> res = new List<Point>(); |
|
125 |
|
|
126 |
var rect = GetBorderRectangle(Origin, ScaleWidth, ScaleHeight); |
|
127 |
var tempRectMidPoint = MathSet.getRectMiddlePoint(rect); |
|
128 |
|
|
129 |
res.Add(new Point(rect.Left, tempRectMidPoint.Y)); |
|
130 |
res.Add(new Point(tempRectMidPoint.X, rect.Top)); |
|
131 |
res.Add(new Point(rect.Right, tempRectMidPoint.Y)); |
|
132 |
res.Add(new Point(tempRectMidPoint.X, rect.Bottom)); |
|
133 |
|
|
134 |
return res; |
|
135 |
} |
|
136 |
} |
|
89 | 137 |
} |
내보내기 Unified diff