public static IEnumerable <Point> GetGroupPoints(this GeometryGroup geometryGroup) { if (geometryGroup != null) { foreach (Geometry geometry in geometryGroup.Children) { foreach (Point point in GeometryExtensions.GetPoints(geometry)) { yield return(point); } } } }
public static PathSegment Clone(this PathSegment source) { if (source == null) { return((PathSegment)null); } ArcSegment source1 = source as ArcSegment; if (source1 != null) { return((PathSegment)GeometryExtensions.CloneArcSegment(source1)); } LineSegment source2 = source as LineSegment; if (source2 != null) { return((PathSegment)GeometryExtensions.CloneLineSegment(source2)); } PolyLineSegment source3 = source as PolyLineSegment; if (source3 != null) { return((PathSegment)GeometryExtensions.ClonePolyLineSegment(source3)); } BezierSegment source4 = source as BezierSegment; if (source4 != null) { return((PathSegment)GeometryExtensions.CloneBezierSegment(source4)); } PolyBezierSegment source5 = source as PolyBezierSegment; if (source5 != null) { return((PathSegment)GeometryExtensions.ClonePolyBezierSegment(source5)); } QuadraticBezierSegment source6 = source as QuadraticBezierSegment; if (source6 != null) { return((PathSegment)GeometryExtensions.CloneQuadraticBezierSegment(source6)); } PolyQuadraticBezierSegment source7 = source as PolyQuadraticBezierSegment; if (source7 != null) { return((PathSegment)GeometryExtensions.ClonePolyQuadraticBezierSegment(source7)); } throw new NotSupportedException("This type of segment is not supported by Clone extension method"); }
public static GeometryGroup CloneGroup(this GeometryGroup source) { if (source == null) { return((GeometryGroup)null); } GeometryGroup geometryGroup = new GeometryGroup(); foreach (Geometry source1 in source.Children) { geometryGroup.Children.Add(GeometryExtensions.Clone(source1)); } geometryGroup.FillRule = source.FillRule; geometryGroup.Transform = source.Transform; return(geometryGroup); }
public static PathGeometry ClonePath(this PathGeometry source) { if (source == null) { return((PathGeometry)null); } PathGeometry pathGeometry = new PathGeometry(); foreach (PathFigure source1 in source.Figures) { PathFigure pathFigure = GeometryExtensions.CloneFigure(source1); pathGeometry.Figures.Add(pathFigure); } pathGeometry.FillRule = source.FillRule; pathGeometry.Transform = source.Transform; return(pathGeometry); }
public void UpdatePoints() { IEnumerable <Point> points = GeometryExtensions.GetPoints(this.Outline); this.Points.BeginInit(); try { this.Points.Clear(); foreach (Point point in points) { this.Points.Add(point); } } finally { this.Points.EndInit(); } }
public static Geometry Clone(this Geometry source) { if (source == null) { return((Geometry)null); } RectangleGeometry source1 = source as RectangleGeometry; if (source1 != null) { return((Geometry)GeometryExtensions.CloneRect(source1)); } EllipseGeometry source2 = source as EllipseGeometry; if (source2 != null) { return((Geometry)GeometryExtensions.CloneEllipse(source2)); } LineGeometry source3 = source as LineGeometry; if (source3 != null) { return((Geometry)GeometryExtensions.CloneLine(source3)); } PathGeometry source4 = source as PathGeometry; if (source4 != null) { return((Geometry)GeometryExtensions.ClonePath(source4)); } GeometryGroup source5 = source as GeometryGroup; if (source5 != null) { return((Geometry)GeometryExtensions.CloneGroup(source5)); } throw new NotSupportedException("This type of geometry is not supported"); }
public static IEnumerable <Point> GetPoints(this Geometry geometry) { if (geometry == null) { return(Enumerable.Empty <Point>()); } RectangleGeometry rectGeometry = geometry as RectangleGeometry; if (rectGeometry != null) { return(GeometryExtensions.GetRectPoints(rectGeometry)); } EllipseGeometry ellipseGeometry = geometry as EllipseGeometry; if (ellipseGeometry != null) { return(GeometryExtensions.GetEllipsePoints(ellipseGeometry)); } LineGeometry lineGeometry = geometry as LineGeometry; if (lineGeometry != null) { return(GeometryExtensions.GetLinePoints(lineGeometry)); } PathGeometry pathGeometry = geometry as PathGeometry; if (pathGeometry != null) { return(GeometryExtensions.GetPathPoints(pathGeometry)); } GeometryGroup geometryGroup = geometry as GeometryGroup; if (geometryGroup != null) { return(GeometryExtensions.GetGroupPoints(geometryGroup)); } throw new NotSupportedException("This type of geometry is not supported"); }