개정판 e7cb3fab
issue #1026: Cloud Polygon 오류 수정 및 Arclength 보정값 추가
Change-Id: I322ecb16c35a7c1c098d94bdd7fcf202a7b1fa07
FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_Cloud.cs | ||
---|---|---|
22 | 22 |
public static void GenerateLineWithCloud(Point p1, Point p2, double arcLength, PdfContentByte contentByte) |
23 | 23 |
{ |
24 | 24 |
double l = MathSet.DistanceTo(p1, p2); /// p1와 p2의 길이 |
25 |
arcLength = (l < arcLength) ? l : arcLength; |
|
26 |
double dx = (p2.X - p1.X) / l; |
|
27 |
double dy = (p2.Y - p1.Y) / l; |
|
28 |
Point norm = MathSet.RotateAbout(new Point(0, 0), new Point(dx, dy), 90); |
|
25 |
arcLength = arcLength * 72 / 96 * 0.4; |
|
26 |
if (l > 0) |
|
27 |
{ |
|
28 |
arcLength = (l < arcLength) ? l : arcLength; |
|
29 |
double dx = (p2.X - p1.X) / l; |
|
30 |
double dy = (p2.Y - p1.Y) / l; |
|
31 |
Point norm = MathSet.RotateAbout(new Point(0, 0), new Point(dx, dy), 90); |
|
29 | 32 |
|
30 |
int count = Convert.ToInt32(Math.Floor(l / arcLength)); // 두 선의 길이에서 normalize 된 사이즈만큼을 나눠 진행 수치의 갯수 파악 |
|
33 |
int count = Convert.ToInt32(Math.Floor(l / arcLength)); // 두 선의 길이에서 normalize 된 사이즈만큼을 나눠 진행 수치의 갯수 파악
|
|
31 | 34 |
|
32 |
Point lastPt = new Point(p1.X, p1.Y); |
|
33 |
Point uses = new Point(0, 0); //사용된 값 누적치 |
|
34 |
uses = lastPt; //Point 첫번째꺼 대입 |
|
35 |
contentByte.MoveTo((float)lastPt.X, (float)lastPt.Y); |
|
35 |
Point lastPt = new Point(p1.X, p1.Y);
|
|
36 |
Point uses = new Point(0, 0); //사용된 값 누적치
|
|
37 |
uses = lastPt; //Point 첫번째꺼 대입
|
|
38 |
contentByte.MoveTo((float)lastPt.X, (float)lastPt.Y);
|
|
36 | 39 |
|
37 |
for (int j = 0; j < count; j++) //dx , dy의 횟수차로 증감치를 결정 |
|
38 |
{ |
|
39 |
/// update last point |
|
40 |
if (j == count - 1) |
|
41 |
{ |
|
42 |
lastPt.X = p2.X; |
|
43 |
lastPt.Y = p2.Y; |
|
44 |
} |
|
45 |
else |
|
40 |
for (int j = 0; j < count; j++) //dx , dy의 횟수차로 증감치를 결정 |
|
46 | 41 |
{ |
47 |
lastPt.X = lastPt.X + dx * arcLength; |
|
48 |
lastPt.Y = lastPt.Y + dy * arcLength; |
|
49 |
} |
|
42 |
/// update last point |
|
43 |
if (j == count - 1) |
|
44 |
{ |
|
45 |
lastPt.X = p2.X; |
|
46 |
lastPt.Y = p2.Y; |
|
47 |
} |
|
48 |
else |
|
49 |
{ |
|
50 |
lastPt.X = lastPt.X + dx * arcLength; |
|
51 |
lastPt.Y = lastPt.Y + dy * arcLength; |
|
52 |
} |
|
50 | 53 |
|
51 |
var midP = MathSet.getMiddlePoint(uses, lastPt); //시작점과 끝점의 중간점 |
|
52 |
contentByte.CurveTo((float)uses.X, (float)uses.Y, (float)midP.X - norm.X * arcLength * 0.4, (float)midP.Y - norm.Y * arcLength * 0.4, (float)lastPt.X, (float)lastPt.Y); |
|
53 |
uses.X = lastPt.X; |
|
54 |
uses.Y = lastPt.Y; |
|
54 |
var midP = MathSet.getMiddlePoint(uses, lastPt); //시작점과 끝점의 중간점 |
|
55 |
contentByte.CurveTo((float)uses.X, (float)uses.Y, (float)midP.X - norm.X * arcLength * 0.4, (float)midP.Y - norm.Y * arcLength * 0.4, (float)lastPt.X, (float)lastPt.Y); |
|
56 |
uses.X = lastPt.X; |
|
57 |
uses.Y = lastPt.Y; |
|
58 |
} |
|
55 | 59 |
} |
60 |
|
|
56 | 61 |
} |
57 | 62 |
|
58 | 63 |
public static void DrawCloud(List<Point> points, double lineSize, double arcLength, PdfContentByte contentByte, System.Windows.Media.DoubleCollection DashSize, |
내보내기 Unified diff