private static bool GetPolySegmentAsString(DocumentCompositeNode polySegmentNode, StringBuilder stringBuilder, char symbol, IPropertyId pointsProperty) { DocumentPrimitiveNode item = polySegmentNode.Properties[pointsProperty] as DocumentPrimitiveNode; if (item == null) { return(false); } PointCollection value = item.GetValue <PointCollection>(); stringBuilder.Append(' '); stringBuilder.Append(symbol); stringBuilder.Append(PointSerializationHelper.GetPointCollectionAsString(value)); return(true); }
public virtual string GetValueAsString(DocumentNode node) { ITypeId type = node.Type; Type targetType = node.TargetType; DocumentPrimitiveNode documentPrimitiveNode = node as DocumentPrimitiveNode; DocumentCompositeNode documentCompositeNode = node as DocumentCompositeNode; if (documentPrimitiveNode != null) { DocumentNodeStringValue value = documentPrimitiveNode.Value as DocumentNodeStringValue; TypeConverter valueConverter = documentPrimitiveNode.ValueConverter; if (value != null && valueConverter != null && valueConverter.CanConvertFrom(typeof(string))) { if (typeof(Vector3DCollection) == targetType) { Vector3DCollection vector3DCollections = (Vector3DCollection)valueConverter.ConvertFromInvariantString(value.Value); return(PointSerializationHelper.GetVector3DCollectionAsString(vector3DCollections)); } if (typeof(Point3DCollection) == targetType) { Point3DCollection point3DCollections = (Point3DCollection)valueConverter.ConvertFromInvariantString(value.Value); return(PointSerializationHelper.GetPoint3DCollectionAsString(point3DCollections)); } if (typeof(PointCollection) == targetType) { PointCollection pointCollections = (PointCollection)valueConverter.ConvertFromInvariantString(value.Value); return(PointSerializationHelper.GetPointCollectionAsString(pointCollections)); } } } else if (documentCompositeNode != null) { if (PlatformTypes.PathGeometry.IsAssignableFrom(type)) { return(PathGeometrySerializationHelper.SerializeAsAttribute(documentCompositeNode)); } if (PlatformTypes.PathFigureCollection.IsAssignableFrom(type)) { return(PathGeometrySerializationHelper.SerializeAsAttribute(documentCompositeNode)); } if (PlatformTypes.DoubleCollection.IsAssignableFrom(type)) { return(PointSerializationHelper.SerializeDoubleCollectionAsAttribute(documentCompositeNode)); } } return(null); }