ArrowLineBase 구조체 예제
2021. 11. 3. 17:18ㆍ프로그래밍
반응형
ArrowLineBase 구조체 예제
public abstract class ArrowLineBase : Shape
{
protected PathGeometry pathgeo;
protected PathFigure pathfigLine;
protected PolyLineSegment polysegLine;
PathFigure pathfigHead1;
PolyLineSegment polysegHead1;
PathFigure pathfigHead2;
PolyLineSegment polysegHead2;
public static readonly DependencyProperty ArrowAngleProperty =
DependencyProperty.Register("ArrowAngle",
typeof(double), typeof(ArrowLineBase),
new FrameworkPropertyMetadata(45.0,
FrameworkPropertyMetadataOptions.AffectsMeasure));
public double ArrowAngle
{
set { SetValue(ArrowAngleProperty, value); }
get { return (double)GetValue(ArrowAngleProperty); }
}
public static readonly DependencyProperty ArrowLengthProperty =
DependencyProperty.Register("ArrowLength",
typeof(double), typeof(ArrowLineBase),
new FrameworkPropertyMetadata(12.0,
FrameworkPropertyMetadataOptions.AffectsMeasure));
public double ArrowLength
{
set { SetValue(ArrowLengthProperty, value); }
get { return (double)GetValue(ArrowLengthProperty); }
}
public static readonly DependencyProperty ArrowEndsProperty =
DependencyProperty.Register("ArrowEnds",
typeof(ArrowEnds), typeof(ArrowLineBase),
new FrameworkPropertyMetadata(ArrowEnds.End,
FrameworkPropertyMetadataOptions.AffectsMeasure));
public ArrowEnds ArrowEnds
{
set { SetValue(ArrowEndsProperty, value); }
get { return (ArrowEnds)GetValue(ArrowEndsProperty); }
}
public static readonly DependencyProperty IsArrowClosedProperty =
DependencyProperty.Register("IsArrowClosed",
typeof(bool), typeof(ArrowLineBase),
new FrameworkPropertyMetadata(false,
FrameworkPropertyMetadataOptions.AffectsMeasure));
public bool IsArrowClosed
{
set { SetValue(IsArrowClosedProperty, value); }
get { return (bool)GetValue(IsArrowClosedProperty); }
}
public ArrowLineBase()
{
pathgeo = new PathGeometry();
pathfigLine = new PathFigure();
polysegLine = new PolyLineSegment();
pathfigLine.Segments.Add(polysegLine);
pathfigHead1 = new PathFigure();
polysegHead1 = new PolyLineSegment();
pathfigHead1.Segments.Add(polysegHead1);
pathfigHead2 = new PathFigure();
polysegHead2 = new PolyLineSegment();
pathfigHead2.Segments.Add(polysegHead2);
}
protected override Geometry DefiningGeometry
{
get
{
int count = polysegLine.Points.Count;
if (count > 0)
{
if ((ArrowEnds & ArrowEnds.Start) == ArrowEnds.Start)
{
Point pt1 = pathfigLine.StartPoint;
Point pt2 = polysegLine.Points[0];
pathgeo.Figures.Add(CalculateArrow(pathfigHead1, pt2, pt1));
}
if ((ArrowEnds & ArrowEnds.End) == ArrowEnds.End)
{
Point pt1 = count == 1 ? pathfigLine.StartPoint :
polysegLine.Points[count - 2];
Point pt2 = polysegLine.Points[count - 1];
pathgeo.Figures.Add(CalculateArrow(pathfigHead2, pt1, pt2));
}
}
return pathgeo;
}
}
반응형
'프로그래밍' 카테고리의 다른 글
QueueProc_Tick 처리 함수 예제 (2) | 2021.12.27 |
---|---|
Degree 관련 각종 Convert 함수들 (4) | 2021.12.03 |
WaterfallInfo에 따른 그래프 변경 함수 예제 (2) | 2021.10.16 |
타겟 추적 알고리즘 예제 소스 (0) | 2021.10.10 |
레이더 윈도우 리프레쉬 예제 소스 (0) | 2021.09.23 |