private static bool IsCompositeOrNonDefaultValue <T>(DocumentCompositeNode compositeNode, IPropertyId propertyKey, T defaultValue) { T t = defaultValue; PathGeometrySerializationHelper.PropertyValueKind primitiveValue = PathGeometrySerializationHelper.GetPrimitiveValue <T>(compositeNode, propertyKey, ref t); if (primitiveValue == PathGeometrySerializationHelper.PropertyValueKind.Composite) { return(true); } if (primitiveValue == PathGeometrySerializationHelper.PropertyValueKind.Primitive && !object.Equals(t, defaultValue)) { return(true); } return(false); }
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()); }