When dealing with a PathGeometry object, if you call ToString() you get back the 'path markup syntax' representing the paths. However, the same is not true for GeometryGroup and CombinedGeometry.
Consider the following code:
var hBar = Geometry.Parse("F1M10,20L40,20L40,30L10,30z");
var vBar = Geometry.Parse("F1M20,10L30,10L30,40L20,40z");
var cross = Geometry.Parse("F1M20,10L20,10L30,10L30,20L40,20L40,30L30,30L30,40L20,40L20,30L10,30L10,20L20,20z");
var combined = new GeometryGroup(){ FillRule = FillRule.Nonzero };
combined.Children.Add(hBar);
combined.Children.Add(vBar);
var union = new CombinedGeometry(GeometryCombineMode.Union, HBar.Geometry, VBar.Geometry);
Console.WriteLine($"hBar : {hBar}");
Console.WriteLine($"vBar : {vBar}");
Console.WriteLine($"cross : {cross}");
Console.WriteLine($"combined : {combined}");
Console.WriteLine($"union : {union}");
The output from the code is as follows:
hBar : F1M10,20L40,20 40,30 10,30z
vBar : F1M20,10L30,10 30,40 20,40z
cross : F1M20,10L20,10 30,10 30,20 40,20 40,30 30,30 30,40 20,40 20,30 10,30 10,20 20,20z
combined : System.Windows.Media.GeometryGroup
union : System.Windows.Media.CombinedGeometry
What I'm hoping is to get the resulting path markup syntax for the CombinedGeometry and GeometryGroup objects. For instance, specifically in the case of 'union', I'm hoping to get back something similar to the cross entry.
(* Note: I don't care about the order of the vertices or the drawing direction as long as it shows as an identical shape/path.)
Here's the Microsoft page all about Path Markup Syntax. This is the format I'm trying to get.
So is this possible?
