개정판 d251456f
issue #214: adjust arrow size
Change-Id: I8aa507c61ea8a6dd72eb180f30d8493feed515ac
MarkupToPDF/Controls/Line/LineControl.cs | ||
---|---|---|
358 | 358 |
this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y); |
359 | 359 |
this.EndPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y); |
360 | 360 |
} |
361 |
public static PathGeometry SingleAllow(Point p2, Point p1, double lineSize) |
|
362 |
{ |
|
363 |
double theta = Math.Atan2((p2.Y - p1.Y), (p2.X - p1.X)) * 180 / Math.PI; |
|
364 |
PathGeometry pathGeometry = new PathGeometry(); |
|
365 |
PathFigure pathFigure = new PathFigure(); |
|
366 |
pathFigure.StartPoint = new Point(p1.X, p1.Y); |
|
367 |
//lineSize = 2; |
|
368 |
Point lpoint = new Point(p1.X + lineSize * 3, p1.Y + lineSize * 6); |
|
369 |
Point rpoint = new Point(p1.X - lineSize * 3, p1.Y + lineSize * 6); |
|
370 |
LineSegment seg1 = new LineSegment(); |
|
371 |
seg1.Point = lpoint; |
|
372 |
pathFigure.Segments.Add(seg1); |
|
373 |
LineSegment seg2 = new LineSegment(); |
|
374 |
seg2.Point = rpoint; |
|
375 |
pathFigure.Segments.Add(seg2); |
|
376 |
|
|
377 |
LineSegment seg3 = new LineSegment(); |
|
378 |
seg3.Point = p1; |
|
379 |
pathFigure.Segments.Add(seg3); |
|
380 |
|
|
381 |
pathFigure.IsClosed = true; |
|
382 |
pathFigure.IsFilled = true; |
|
383 |
pathGeometry.Figures.Add(pathFigure); |
|
384 |
pathGeometry.FillRule = FillRule.Nonzero; |
|
385 |
RotateTransform transform = new RotateTransform(); |
|
386 |
transform.Angle = theta - 90; |
|
387 |
transform.CenterX = p1.X; |
|
388 |
transform.CenterY = p1.Y; |
|
389 |
pathGeometry.Transform = transform; |
|
390 |
return pathGeometry; |
|
391 |
} |
|
392 | 361 |
|
393 |
|
|
394 |
public static PathGeometry ConverseAllow(Point p2, Point p1, double lineSize) |
|
395 |
{ |
|
396 |
//lineSize = 2; |
|
397 |
double theta = Math.Atan2((p2.Y - p1.Y), (p2.X - p1.X)) * 180 / Math.PI; |
|
398 |
PathGeometry pathGeometry2 = new PathGeometry(); |
|
399 |
PathFigure pathFigure2 = new PathFigure(); |
|
400 |
pathFigure2.StartPoint = p2; |
|
401 |
|
|
402 |
Point lpoint2 = new Point(p2.X + lineSize * 3, p2.Y + lineSize * 6); |
|
403 |
Point rpoint2 = new Point(p2.X - lineSize * 3, p2.Y + lineSize * 6); |
|
404 |
LineSegment seg1_1 = new LineSegment(); |
|
405 |
seg1_1.Point = lpoint2; |
|
406 |
pathFigure2.Segments.Add(seg1_1); |
|
407 |
|
|
408 |
LineSegment seg2_1 = new LineSegment(); |
|
409 |
seg2_1.Point = rpoint2; |
|
410 |
pathFigure2.Segments.Add(seg2_1); |
|
411 |
|
|
412 |
LineSegment seg3_1 = new LineSegment(); |
|
413 |
seg3_1.Point = p2; |
|
414 |
pathFigure2.Segments.Add(seg3_1); |
|
415 |
|
|
416 |
LineSegment seg4_1 = new LineSegment(); |
|
417 |
|
|
418 |
seg4_1.Point = new Point(lpoint2.X, lpoint2.Y); |
|
419 |
pathFigure2.Segments.Add(seg4_1); |
|
420 |
RotateTransform transform2 = new RotateTransform(); |
|
421 |
transform2.Angle = theta + 90; |
|
422 |
transform2.CenterX = p2.X; |
|
423 |
transform2.CenterY = p2.Y; |
|
424 |
pathGeometry2.Figures.Add(pathFigure2); |
|
425 |
pathGeometry2.Transform = transform2; |
|
426 |
return pathGeometry2; |
|
427 |
} |
|
428 | 362 |
public static List<LineGeometry> DimAllow(Point p1, Point p2, Double lineSize, double DimSize) |
429 | 363 |
{ |
430 | 364 |
//lineSize = 2; |
... | ... | |
494 | 428 |
switch (LineStyleSet) |
495 | 429 |
{ |
496 | 430 |
case LineStyleSet.ArrowLine: |
497 |
instanceGroup.Children.Add(SingleAllow(this.StartPoint, this.EndPoint, this.LineSize));
|
|
431 |
instanceGroup.Children.Add(DrawSet.DrawArrow(this.StartPoint, this.EndPoint, this.LineSize));
|
|
498 | 432 |
break; |
499 | 433 |
case LineStyleSet.TwinLine: |
500 |
instanceGroup.Children.Add(SingleAllow(this.StartPoint, this.EndPoint, this.LineSize));
|
|
501 |
instanceGroup.Children.Add(ConverseAllow(this.StartPoint, this.EndPoint, this.LineSize));
|
|
434 |
instanceGroup.Children.Add(DrawSet.DrawArrow(this.StartPoint, this.EndPoint, this.LineSize));
|
|
435 |
instanceGroup.Children.Add(DrawSet.DrawArrow(this.EndPoint, this.StartPoint, this.LineSize));
|
|
502 | 436 |
break; |
503 | 437 |
case LineStyleSet.DimLine: |
504 | 438 |
List<LineGeometry> metrySet = DimAllow(this.StartPoint, this.EndPoint, this.LineSize, this.DimSize); |
505 | 439 |
instanceGroup.Children.Add(metrySet[0]); |
506 | 440 |
instanceGroup.Children.Add(metrySet[1]); |
507 |
instanceGroup.Children.Add(SingleAllow(this.StartPoint, this.EndPoint, this.LineSize));
|
|
508 |
instanceGroup.Children.Add(ConverseAllow(this.StartPoint, this.EndPoint, this.LineSize));
|
|
441 |
instanceGroup.Children.Add(DrawSet.DrawArrow(this.StartPoint, this.EndPoint, this.LineSize));
|
|
442 |
instanceGroup.Children.Add(DrawSet.DrawArrow(this.EndPoint, this.StartPoint, this.LineSize));
|
|
509 | 443 |
break; |
510 | 444 |
case LineStyleSet.CancelLine: |
511 | 445 |
PathFigure pathFigure_Multi = new PathFigure(); |
... | ... | |
527 | 461 |
pathFigure_Multi.Segments.Add(lineSegment1); |
528 | 462 |
pathGeometry.Figures.Add(pathFigure_Multi); |
529 | 463 |
|
530 |
|
|
531 |
|
|
532 | 464 |
this.PathData = pathGeometry; |
533 | 465 |
this.OverViewPathData = PathData; |
534 | 466 |
|
내보내기 Unified diff