private static string GetPathGeometryAsString(DocumentCompositeNode pathGeometryNode) { StringBuilder stringBuilder = new StringBuilder(); Transform transform = null; PathGeometrySerializationHelper.PropertyValueKind primitiveValue = PathGeometrySerializationHelper.GetPrimitiveValue <Transform>(pathGeometryNode, PathMetadata.GeometryTransformProperty, ref transform); if (primitiveValue == PathGeometrySerializationHelper.PropertyValueKind.Composite || transform != null) { return(null); } FillRule fillRule = FillRule.EvenOdd; primitiveValue = PathGeometrySerializationHelper.GetPrimitiveValue <FillRule>(pathGeometryNode, PathMetadata.PathGeometryFillRuleProperty, ref fillRule); if (primitiveValue == PathGeometrySerializationHelper.PropertyValueKind.Composite) { return(null); } if (primitiveValue == PathGeometrySerializationHelper.PropertyValueKind.Primitive && fillRule != FillRule.EvenOdd) { stringBuilder.Append("F1 "); } DocumentNode item = pathGeometryNode.Properties[PathMetadata.PathGeometryFiguresProperty]; if (item != null) { DocumentCompositeNode documentCompositeNode = item as DocumentCompositeNode; if (documentCompositeNode == null) { return(null); } if (!PathGeometrySerializationHelper.GetPathFigureCollectionAsString(documentCompositeNode, stringBuilder)) { return(null); } } return(stringBuilder.ToString()); }
public static string SerializeAsAttribute(DocumentCompositeNode compositeNode) { if (PlatformTypes.PathGeometry.IsAssignableFrom(compositeNode.Type)) { return(PathGeometrySerializationHelper.GetPathGeometryAsString(compositeNode)); } if (PlatformTypes.PathFigureCollection.IsAssignableFrom(compositeNode.Type)) { StringBuilder stringBuilder = new StringBuilder(); if (compositeNode.TypeResolver.IsCapabilitySet(PlatformCapability.SupportsPathFigureTypeConverter) && PathGeometrySerializationHelper.GetPathFigureCollectionAsString(compositeNode, stringBuilder)) { return(stringBuilder.ToString()); } } return(null); }