개정판 43e1d368
issue #0000 코드 정리
Change-Id: I7c8ba4ef6d78a7e4f51b72f226507cddac722939
MarkupToPDF/Controls/Shape/RectCloudControl.cs | ||
---|---|---|
464 | 464 |
/// up to here |
465 | 465 |
this._pathGeometry = new PathGeometry(); |
466 | 466 |
int count = this.PointSet.Count; |
467 |
PathFigure pathSubFigure = RectCloudControl.GenerateLineWithCloud(this.StartPoint, this.LeftBottomPoint, this.ArcLength, reverse);
|
|
467 |
PathFigure pathSubFigure = Polygon.CloudControl.GenerateLineWithCloud(this.StartPoint, this.LeftBottomPoint, this.ArcLength, reverse);
|
|
468 | 468 |
_pathGeometry.Figures.Add(pathSubFigure); |
469 | 469 |
|
470 |
pathSubFigure = RectCloudControl.GenerateLineWithCloud(this.LeftBottomPoint, this.EndPoint, this.ArcLength, reverse);
|
|
470 |
pathSubFigure = Polygon.CloudControl.GenerateLineWithCloud(this.LeftBottomPoint, this.EndPoint, this.ArcLength, reverse);
|
|
471 | 471 |
_pathGeometry.Figures.Add(pathSubFigure); |
472 | 472 |
|
473 |
pathSubFigure = RectCloudControl.GenerateLineWithCloud(this.EndPoint, this.TopRightPoint, this.ArcLength, reverse);
|
|
473 |
pathSubFigure = Polygon.CloudControl.GenerateLineWithCloud(this.EndPoint, this.TopRightPoint, this.ArcLength, reverse);
|
|
474 | 474 |
_pathGeometry.Figures.Add(pathSubFigure); |
475 | 475 |
|
476 |
pathSubFigure = RectCloudControl.GenerateLineWithCloud(this.TopRightPoint, this.StartPoint, this.ArcLength, reverse);
|
|
476 |
pathSubFigure = Polygon.CloudControl.GenerateLineWithCloud(this.TopRightPoint, this.StartPoint, this.ArcLength, reverse);
|
|
477 | 477 |
_pathGeometry.Figures.Add(pathSubFigure); |
478 | 478 |
|
479 | 479 |
if (this.Paint != PaintSet.None) |
... | ... | |
516 | 516 |
this.TopRightPoint = new Point(this.PointSet[3].X, this.PointSet[3].Y); |
517 | 517 |
} |
518 | 518 |
|
519 |
public static PathFigure GenerateLineWithCloud(Point p1, Point p2, double arcLength_, bool reverse) |
|
520 |
{ |
|
521 |
PathFigure pathFigure = new PathFigure(); |
|
522 |
pathFigure.StartPoint = p1; |
|
523 |
|
|
524 |
double arcLength = arcLength_; |
|
525 |
/// draw arcs which has arcLength between p1 and p2 - 2012.06.21 added by humkyung |
|
526 |
double dx = p2.X - p1.X; |
|
527 |
double dy = p2.Y - p1.Y; |
|
528 |
double l = MathSet.DistanceTo(p1, p2); /// distance between p1 and p2 |
|
529 |
double theta = Math.Atan2(Math.Abs(dy), Math.Abs(dx)) * 180 / Math.PI; |
|
530 |
Point lastPt = new Point(p1.X, p1.Y); |
|
531 |
double count = l / arcLength; |
|
532 |
/// normalize |
|
533 |
dx /= l; |
|
534 |
dy /= l; |
|
535 |
Double j = 1; |
|
536 |
for (j = 1; j < (count - 1); j++) |
|
537 |
{ |
|
538 |
ArcSegment arcSeg = new ArcSegment(); |
|
539 |
arcSeg.Size = new Size(arcLength * RectCloudControl._CloudArcDepth, arcLength * RectCloudControl._CloudArcDepth); /// x size and y size of arc |
|
540 |
arcSeg.Point = new Point(p1.X + j * dx * arcLength, p1.Y + j * dy * arcLength); /// end point of arc |
|
541 |
lastPt = arcSeg.Point; /// save last point |
|
542 |
arcSeg.RotationAngle = theta + 90; |
|
543 |
if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise; |
|
544 |
pathFigure.Segments.Add(arcSeg); |
|
545 |
} |
|
546 |
|
|
547 |
/// draw arc between last point and end point |
|
548 |
if ((count > j) || (count > 0)) |
|
549 |
{ |
|
550 |
arcLength = MathSet.DistanceTo(lastPt, p2); |
|
551 |
ArcSegment arcSeg = new ArcSegment(); |
|
552 |
arcSeg.Size = new Size(arcLength * RectCloudControl._CloudArcDepth, arcLength * RectCloudControl._CloudArcDepth); /// x size and y size of arc |
|
553 |
arcSeg.Point = new Point(p2.X, p2.Y); /// end point of arc |
|
554 |
arcSeg.RotationAngle = theta; |
|
555 |
if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise; |
|
556 |
pathFigure.Segments.Add(arcSeg); |
|
557 |
} |
|
558 |
pathFigure.IsClosed = false; |
|
559 |
pathFigure.IsFilled = false; |
|
560 |
/// up to here |
|
561 |
//pathFigure.IsFilled = true; |
|
562 |
return pathFigure; |
|
563 |
} |
|
519 |
//public static PathFigure GenerateLineWithCloud(Point p1, Point p2, double arcLength_, bool reverse)
|
|
520 |
//{
|
|
521 |
// PathFigure pathFigure = new PathFigure();
|
|
522 |
// pathFigure.StartPoint = p1;
|
|
523 |
|
|
524 |
// double arcLength = arcLength_;
|
|
525 |
// /// draw arcs which has arcLength between p1 and p2 - 2012.06.21 added by humkyung
|
|
526 |
// double dx = p2.X - p1.X;
|
|
527 |
// double dy = p2.Y - p1.Y;
|
|
528 |
// double l = MathSet.DistanceTo(p1, p2); /// distance between p1 and p2
|
|
529 |
// double theta = Math.Atan2(Math.Abs(dy), Math.Abs(dx)) * 180 / Math.PI;
|
|
530 |
// Point lastPt = new Point(p1.X, p1.Y);
|
|
531 |
// double count = l / arcLength;
|
|
532 |
// /// normalize
|
|
533 |
// dx /= l;
|
|
534 |
// dy /= l;
|
|
535 |
// Double j = 1;
|
|
536 |
// for (j = 1; j < (count - 1); j++)
|
|
537 |
// {
|
|
538 |
// ArcSegment arcSeg = new ArcSegment();
|
|
539 |
// arcSeg.Size = new Size(arcLength * RectCloudControl._CloudArcDepth, arcLength * RectCloudControl._CloudArcDepth); /// x size and y size of arc
|
|
540 |
// arcSeg.Point = new Point(p1.X + j * dx * arcLength, p1.Y + j * dy * arcLength); /// end point of arc
|
|
541 |
// lastPt = arcSeg.Point; /// save last point
|
|
542 |
// arcSeg.RotationAngle = theta + 90;
|
|
543 |
// if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise;
|
|
544 |
// pathFigure.Segments.Add(arcSeg);
|
|
545 |
// }
|
|
546 |
|
|
547 |
// /// draw arc between last point and end point
|
|
548 |
// if ((count > j) || (count > 0))
|
|
549 |
// {
|
|
550 |
// arcLength = MathSet.DistanceTo(lastPt, p2);
|
|
551 |
// ArcSegment arcSeg = new ArcSegment();
|
|
552 |
// arcSeg.Size = new Size(arcLength * RectCloudControl._CloudArcDepth, arcLength * RectCloudControl._CloudArcDepth); /// x size and y size of arc
|
|
553 |
// arcSeg.Point = new Point(p2.X, p2.Y); /// end point of arc
|
|
554 |
// arcSeg.RotationAngle = theta;
|
|
555 |
// if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise;
|
|
556 |
// pathFigure.Segments.Add(arcSeg);
|
|
557 |
// }
|
|
558 |
// pathFigure.IsClosed = false;
|
|
559 |
// pathFigure.IsFilled = false;
|
|
560 |
// /// up to here
|
|
561 |
// //pathFigure.IsFilled = true;
|
|
562 |
// return pathFigure;
|
|
563 |
//}
|
|
564 | 564 |
|
565 | 565 |
/// <summary> |
566 | 566 |
/// call when mouse is moving while drawing control |
내보내기 Unified diff