Exemple #1
0
 public static bool CanSerializeAsAttribute(DocumentCompositeNode compositeNode)
 {
     if (PathGeometrySerializationHelper.SerializeAsAttribute(compositeNode) == null)
     {
         return(false);
     }
     return(!PathGeometrySerializationHelper.HasAnimations(compositeNode));
 }
Exemple #2
0
        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);
        }