public static string GetPointCollectionAsString(PointCollection collection) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < collection.Count; i++) { PointSerializationHelper.AppendPoint(stringBuilder, collection[i]); if (i % 23 == 22) { stringBuilder.AppendLine(); } else if (i < collection.Count - 1) { stringBuilder.Append(' '); } } return(stringBuilder.ToString()); }
private static bool GetSimpleSegmentAsString(DocumentCompositeNode simpleSegmentNode, StringBuilder stringBuilder, char symbol, params IPropertyId[] pointProperties) { stringBuilder.Append(' '); stringBuilder.Append(symbol); for (int i = 0; i < (int)pointProperties.Length; i++) { Point point = new Point(); if (PathGeometrySerializationHelper.GetPrimitiveValue <Point>(simpleSegmentNode, pointProperties[i], ref point) == PathGeometrySerializationHelper.PropertyValueKind.Composite) { return(false); } if (i > 0) { stringBuilder.Append(' '); } PointSerializationHelper.AppendPoint(stringBuilder, point); } return(true); }
private static bool GetArcSegmentAsString(DocumentCompositeNode arcSegmentNode, StringBuilder stringBuilder) { Size size = new Size(); double num = 0; bool flag = false; SweepDirection sweepDirection = SweepDirection.Counterclockwise; Point point = new Point(); if (PathGeometrySerializationHelper.GetPrimitiveValue <Size>(arcSegmentNode, PathMetadata.ArcSegmentSizeProperty, ref size) == PathGeometrySerializationHelper.PropertyValueKind.Composite || PathGeometrySerializationHelper.GetPrimitiveValue <double>(arcSegmentNode, PathMetadata.ArcSegmentRotationAngleProperty, ref num) == PathGeometrySerializationHelper.PropertyValueKind.Composite || PathGeometrySerializationHelper.GetPrimitiveValue <bool>(arcSegmentNode, PathMetadata.ArcSegmentIsLargeArcProperty, ref flag) == PathGeometrySerializationHelper.PropertyValueKind.Composite || PathGeometrySerializationHelper.GetPrimitiveValue <SweepDirection>(arcSegmentNode, PathMetadata.ArcSegmentSweepDirectionProperty, ref sweepDirection) == PathGeometrySerializationHelper.PropertyValueKind.Composite || PathGeometrySerializationHelper.GetPrimitiveValue <Point>(arcSegmentNode, PathMetadata.ArcSegmentPointProperty, ref point) == PathGeometrySerializationHelper.PropertyValueKind.Composite) { return(false); } StringBuilder stringBuilder1 = stringBuilder; object[] width = new object[] { size.Width, size.Height, num, null, null }; width[3] = (flag ? '1' : '0'); width[4] = (sweepDirection == SweepDirection.Clockwise ? '1' : '0'); stringBuilder1.AppendFormat(" A{0:G8},{1:G8},{2:G8},{3},{4},", width); PointSerializationHelper.AppendPoint(stringBuilder, point); return(true); }
private static bool GetPathFigureAsString(DocumentNode pathFigureNode, StringBuilder stringBuilder) { bool flag; bool flag1; StringBuilder stringBuilder1; DocumentCompositeNode documentCompositeNode = pathFigureNode as DocumentCompositeNode; if (documentCompositeNode == null) { return(false); } if (PathGeometrySerializationHelper.IsCompositeOrNonDefaultValue <bool>(documentCompositeNode, PathMetadata.PathFigureIsFilledProperty, true)) { return(false); } Point point = new Point(); if (PathGeometrySerializationHelper.GetPrimitiveValue <Point>(documentCompositeNode, PathMetadata.PathFigureStartPointProperty, ref point) == PathGeometrySerializationHelper.PropertyValueKind.Composite) { return(false); } stringBuilder.Append('M'); PointSerializationHelper.AppendPoint(stringBuilder, point); DocumentNode item = documentCompositeNode.Properties[PathMetadata.PathFigureSegmentsProperty]; if (item != null) { DocumentCompositeNode documentCompositeNode1 = item as DocumentCompositeNode; if (documentCompositeNode1 == null) { return(false); } using (IEnumerator <DocumentNode> enumerator = documentCompositeNode1.Children.GetEnumerator()) { while (enumerator.MoveNext()) { if (PathGeometrySerializationHelper.GetPathSegmentAsString(enumerator.Current, stringBuilder)) { continue; } flag1 = false; return(flag1); } flag = false; if (PathGeometrySerializationHelper.GetPrimitiveValue <bool>(documentCompositeNode, PathMetadata.PathFigureIsClosedProperty, ref flag) == PathGeometrySerializationHelper.PropertyValueKind.Composite) { return(false); } if (flag) { stringBuilder1 = stringBuilder.Append(" z"); } return(true); } return(flag1); } flag = false; if (PathGeometrySerializationHelper.GetPrimitiveValue <bool>(documentCompositeNode, PathMetadata.PathFigureIsClosedProperty, ref flag) == PathGeometrySerializationHelper.PropertyValueKind.Composite) { return(false); } if (flag) { stringBuilder1 = stringBuilder.Append(" z"); } return(true); }