Path.Data , "-langauge" PathGeometry?
, - :
<Path Stroke="Black">
<Path.Data>
<PathGeometry>
<PathFigure IsClosed="true" StartPoint="10,100">
<LineSegment Point="100,100" />
<LineSegment Point="100,50" />
</PathFigure>
</PathGeometry>
</Path.Data>
</Data>
<Path Stroke="Black" Data="M 10 100 L 100 100 L 100 50 Z" />
XAML, , :
<Path Stroke="Black" Data="{Binding MyPathProperty}" />
Path.Data - , , , .
, :
F - Geometry.FillRule. 0 EvenOdd 1 NonZero. ( ).
M x, y - PathFigure . , F. , . ( ).
L x, y - LineSegment .
H x - LineSegment, X Y.
V y - LineSegment, Y X.
x, radiusY, isLargeArch, isClockwise x, y - ArcSegment . , , , IsLargeArc SweepDirection .
C x1, y1 x2, y2 x, y - BezierSegment , (x1, y1) (x2, y2).
Q x1, y1 x, y - Bezier (x1, y1).
S x2, y2 x, y - BezierSegment, BezierSegment BezierSegment.
Z - PathFigure IsClosed true. , IsClosed true - M, PathFigure .
, , (M 10 100 L 100 100 L 100 50 Z), :
- M 10 100 - 10 100
- L 100 100 - 100 100
- L 100 50 - 100,50
- Z -
, Path.Data , , M x y, x y - x, y , , , Z
, . , , , .
, "L 10 10", , 10,10 , "L 10 10" 10 10 .
, PathGeometry , PathGeometry , .
. , , , , .
Edit
, PathGeometry, PathGeometry ,
. , , , , PathGeometry, , ,
foreach (PathGeometry pg1 in firstList)
foreach (PathGeometry pg2 in secondList)
{
var s1 = ConvertGeometryToString(pg);
var s2 = ConvertGeometryToString(pg2);
PathGeometry intergeo = Geometry.Parse(s1 + s2);
}
}
string ConvertGeometryToString(PathGeometry pg)
{
StringBuilder sb = new StringBuilder();
foreach(var figure in pg.PathFigures)
{
sb.Append("M " + figure.StartPoint);
foreach(var seg in figure.Segments)
{
if (seg is LineSegment)
sb.Append(" L " + ((LineSegment)seg).Point);
else if (seg is ArcSegment)
... etc
}
if (figure.IsClosed)
sb.Append(" Z");
}
return sb.ToString();
}