Class GeometryExtensions
Methods related to planar geometry.
Inheritance
Namespace: Telerik.Windows.Controls.Diagrams
Assembly: Telerik.Windows.Controls.Diagrams.dll
Syntax
public static class GeometryExtensions : Object
Methods
Add(PathFigure, PathSegment)
Adds the given System.Windows.Media.PathSegment to the path figure.
Declaration
public static PathFigure Add(this PathFigure pathFigure, PathSegment segment)
Parameters
System.Windows.Media.PathFigure
pathFigure
The path figure. |
System.Windows.Media.PathSegment
segment
The segment. |
Returns
System.Windows.Media.PathFigure
The augmented path figure. |
Add(PathFigure, PathSegment, Point)
Adds the given System.Windows.Media.PathSegment to the path figure and sets the starting point at the same time.
Declaration
public static PathFigure Add(this PathFigure pathFigure, PathSegment segment, Point startPoint)
Parameters
System.Windows.Media.PathFigure
pathFigure
The path figure. |
System.Windows.Media.PathSegment
segment
The segment. |
System.Windows.Point
startPoint
The start point. |
Returns
System.Windows.Media.PathFigure
The augmented path figure. |
Add(PathGeometry, PathFigure)
Adds the given figure to the geometry.
Declaration
public static PathGeometry Add(this PathGeometry pathGeometry, PathFigure pathFigure)
Parameters
System.Windows.Media.PathGeometry
pathGeometry
The path geometry. |
System.Windows.Media.PathFigure
pathFigure
The path figure. |
Returns
System.Windows.Media.PathGeometry
The resulting path geometry. |
AddArc(PathFigure, Double, Double, Double, Double, Double, Double, Boolean)
Adds an arc to the path figure.
Declaration
public static void AddArc(this PathFigure pathFigure, double x, double y, double width, double height, double startAngle, double sweep, bool startPoint)
Parameters
System.Windows.Media.PathFigure
pathFigure
The figure. |
System.Double
x
The x-coordinate of the bounding rectangle. |
System.Double
y
The y-coordinate of the bounding rectangle. |
System.Double
width
The width of the bounding rectangle. |
System.Double
height
The height of the bounding rectangle. |
System.Double
startAngle
The start angle. |
System.Double
sweep
The sweeping angle of the arc. |
System.Boolean
startPoint
If set to |
AddArc(PathFigure, Rect, Double, Double, Boolean)
Adds the arc.
Declaration
public static PathFigure AddArc(this PathFigure pathFigure, Rect rectangle, double startAngle, double sweep, bool setStartingPoint)
Parameters
System.Windows.Media.PathFigure
pathFigure
The path figure. |
System.Windows.Rect
rectangle
The bounding rectangle. |
System.Double
startAngle
The start angle. |
System.Double
sweep
The sweeping angle of the arc. |
System.Boolean
setStartingPoint
If set to |
Returns
System.Windows.Media.PathFigure
|
AddBezier(PathFigure, Double[])
Adds a bezier segment to the path.
Declaration
public static void AddBezier(this PathFigure pathFigure, double[] points)
Parameters
System.Windows.Media.PathFigure
pathFigure
The path. |
System.Double[]
points
The eight values specifying the eight coordinates of the four Bezier points. |
AddBeziers(PathFigure, Point[])
Adds a bezier segment to the path.
Declaration
public static void AddBeziers(this PathFigure pathFigure, Point[] points)
Parameters
System.Windows.Media.PathFigure
pathFigure
The figure. |
System.Windows.Point[]
points
The points defining the Bezier segment. |
AddLine(PathFigure, Double, Double, Double, Double)
Adds a line to the path.
Declaration
public static PathFigure AddLine(this PathFigure pathFigure, double x1, double y1, double x2, double y2)
Parameters
System.Windows.Media.PathFigure
pathFigure
The path figure. |
System.Double
x1
The x-coordinate of the start point. |
System.Double
y1
The y-coordinate of the start point. |
System.Double
x2
The x-coordinate of the end point. |
System.Double
y2
The y-coordinate of the end point. |
Returns
System.Windows.Media.PathFigure
|
AddLine(PathFigure, Point, Point)
Adds a line to the path.
Declaration
public static PathFigure AddLine(this PathFigure pathFigure, Point point1, Point point2)
Parameters
System.Windows.Media.PathFigure
pathFigure
The path figure. |
System.Windows.Point
point1
The start point of the line. |
System.Windows.Point
point2
The end point of the line. |
Returns
System.Windows.Media.PathFigure
The augmented path figure. |
AddPolyLine(PathFigure, IEnumerable<Point>)
Adds a polyline to the figure.
Declaration
public static void AddPolyLine(this PathFigure pathFigure, IEnumerable<Point> points)
Parameters
System.Windows.Media.PathFigure
pathFigure
The figure. |
System.Collections.Generic.IEnumerable<System.Windows.Point>
points
The points defining the polyline. |
AddPolyLine(PathFigure, PointCollection)
Adds a polyline to the figure.
Declaration
public static void AddPolyLine(this PathFigure pathFigure, PointCollection collection)
Parameters
System.Windows.Media.PathFigure
pathFigure
The figure. |
System.Windows.Media.PointCollection
collection
The points defining the polyline. |
AddRoundRect(PathFigure, Double, Double, Double, Double, Double, Boolean)
Adds a rounded rectangle to the path figure.
Declaration
public static PathFigure AddRoundRect(this PathFigure pathFigure, double x, double y, double width, double height, double radius, bool setStartPoint)
Parameters
System.Windows.Media.PathFigure
pathFigure
|
System.Double
x
|
System.Double
y
|
System.Double
width
|
System.Double
height
|
System.Double
radius
|
System.Boolean
setStartPoint
|
Returns
System.Windows.Media.PathFigure
|
AddRoundRect(PathFigure, Rect, Double, Boolean)
Adds a rounded rectangle to the path figure.
Declaration
public static PathFigure AddRoundRect(this PathFigure pathFigure, Rect rectangle, double radius, bool setStartPoint)
Parameters
System.Windows.Media.PathFigure
pathFigure
|
System.Windows.Rect
rectangle
|
System.Double
radius
|
System.Boolean
setStartPoint
|
Returns
System.Windows.Media.PathFigure
|
AsPathGeometry(Geometry)
Returns the original geometry as path geometry.
Declaration
public static PathGeometry AsPathGeometry(this Geometry original)
Parameters
System.Windows.Media.Geometry
original
The original. |
Returns
System.Windows.Media.PathGeometry
|
Clone(Geometry)
Clones the specified geometry.
Declaration
public static Geometry Clone(this Geometry geometry)
Parameters
System.Windows.Media.Geometry
geometry
The geometry. |
Returns
System.Windows.Media.Geometry
|
CreateBaseLineGeometry(LineSpecification)
Creates a line geometry based on the given specifications.
Declaration
public static PathGeometry CreateBaseLineGeometry(LineSpecification specs)
Parameters
LineSpecification
specs
The specs. |
Returns
System.Windows.Media.PathGeometry
|
Remarks
CreateBezier(Point, Point, Point, Point, Double)
Creates a bezier geometry.
Declaration
public static Geometry CreateBezier(Point startPoint, Point endPoint, Point startBezierPoint, Point endBezierPoint, double tension = 1)
Parameters
System.Windows.Point
startPoint
The start point. |
System.Windows.Point
endPoint
The end point. |
System.Windows.Point
startBezierPoint
The start bezier point. |
System.Windows.Point
endBezierPoint
The end bezier point. |
System.Double
tension
The tension of the Bezier curve. |
Returns
System.Windows.Media.Geometry
|
CreateConnectionGeometry(IConnection, BridgeType, Boolean)
This method is called by the connection update process to create a geometry which is then plugged into the Path in the XAML template of the connection.
Declaration
public static Geometry CreateConnectionGeometry(IConnection connection, BridgeType connectionBridge, bool connectionRoundedCorners)
Parameters
IConnection
connection
The connection for which to create a geometry. |
BridgeType
connectionBridge
What type of bridging should be applied to the line. |
System.Boolean
connectionRoundedCorners
Whether the corners of the line should be rounded. |
Returns
System.Windows.Media.Geometry
The geometry of the connection path. |
Remarks
See Also
CreateEllipse(Point, Double, Double)
Creates an ellipse.
Declaration
public static Geometry CreateEllipse(Point center, double radiusX, double radiusY)
Parameters
System.Windows.Point
center
The center. |
System.Double
radiusX
The x radius. |
System.Double
radiusY
The y radius. |
Returns
System.Windows.Media.Geometry
|
CreateLineGeometry(Point, Point, Boolean, Point[])
Creates the polyline.
Declaration
public static Geometry CreateLineGeometry(Point startPoint, Point endPoint, bool roundedCorners = false, params Point[] points)
Parameters
System.Windows.Point
startPoint
The start point. |
System.Windows.Point
endPoint
The end point. |
System.Boolean
roundedCorners
If set to |
System.Windows.Point[]
points
The points. |
Returns
System.Windows.Media.Geometry
|
CreateLineGeometry(PolylineSpecification)
Creates a line geometry based on the given specifications.
Declaration
public static Geometry CreateLineGeometry(PolylineSpecification specs)
Parameters
PolylineSpecification
specs
|
Returns
System.Windows.Media.Geometry
A System.Windows.Media.Geometry to be used in a System.Windows.Shapes.Path |
Remarks
See Also
CreatePathGeometry(Point, IList<PathSegment>)
Creates a geometry.
Declaration
public static Geometry CreatePathGeometry(Point startPoint, IList<PathSegment> pathSegments)
Parameters
System.Windows.Point
startPoint
The start point. |
System.Collections.Generic.IList<System.Windows.Media.PathSegment>
pathSegments
The path segments. |
Returns
System.Windows.Media.Geometry
|
CreatePolylineLineFigure(PolylineSpecification)
Gets the polyline figure.
Declaration
public static PathGeometry CreatePolylineLineFigure(PolylineSpecification specs)
Parameters
PolylineSpecification
specs
The polyline specifications. |
Returns
System.Windows.Media.PathGeometry
|
CreateRoundedPolyline(PathFigure, IList<Point>, Boolean)
Adds rounded corners to the existing polyline figure.
Declaration
public static void CreateRoundedPolyline(PathFigure figure, IList<Point> points, bool addLastLine)
Parameters
System.Windows.Media.PathFigure
figure
The figure which will be incremented with corner arcs. |
System.Collections.Generic.IList<System.Windows.Point>
points
The points of the polyline. |
System.Boolean
addLastLine
If set to |
Remarks
The corner radius is set in the ConnectionCornerRadius and has default 5.0
pixels.
CreateSplineFigures(IList<Point>, Double, Boolean, Boolean)
Creates a canonical spline figure.
Declaration
public static IList<PathFigure> CreateSplineFigures(IList<Point> points, double tension = 0.5, bool isClosed = false, bool isFilled = false)
Parameters
System.Collections.Generic.IList<System.Windows.Point>
points
The points defining the spline. These should be in local coordinates and include the endpoints. |
System.Double
tension
The tension of the spline. A tension or zero will result in a polyline, a tension between 0.5 and 0.8 is pleasing, other values lead to wild curves. |
System.Boolean
isClosed
If set to |
System.Boolean
isFilled
If set to |
Returns
System.Collections.Generic.IList<System.Windows.Media.PathFigure>
|
Remarks
Based on the code in http://www.charlespetzold.com/blog/2009/01/canonical-splines-in-wpf-and-silverlight.html
.
FindIntersection(Point, Point, Geometry, Double, Boolean)
Finds the intersection.
Declaration
public static Point FindIntersection(Point sourcePoint, Point targetPoint, Geometry geometry, double edgeThick, bool isArrow)
Parameters
System.Windows.Point
sourcePoint
The source point. |
System.Windows.Point
targetPoint
The target point. |
System.Windows.Media.Geometry
geometry
The geometry. |
System.Double
edgeThick
The edge thick. |
System.Boolean
isArrow
If set to |
Returns
System.Windows.Point
|
GetPathGeometry(String)
Gets the path geometry.
Declaration
public static PathGeometry GetPathGeometry(string abbreviatedGeometry)
Parameters
System.String
abbreviatedGeometry
The abbreviated geometry. |
Returns
System.Windows.Media.PathGeometry
|
GetSplineFigureTangents(IList<Point>, out Point, out Point, Double, Boolean)
Gets the tangents of the spline figure.
Declaration
public static void GetSplineFigureTangents(IList<Point> points, out Point startTangentPoint, out Point endTangentPoint, double tension = 0.5, bool isClosed = false)
Parameters
System.Collections.Generic.IList<System.Windows.Point>
points
The points of the connection. |
System.Windows.Point
startTangentPoint
The start tangent point. |
System.Windows.Point
endTangentPoint
The end tangent point. |
System.Double
tension
The tension. |
System.Boolean
isClosed
If set to |
GetString(Geometry)
Converts the geometry object to its string equivalent.
Declaration
public static string GetString(this Geometry geometry)
Parameters
System.Windows.Media.Geometry
geometry
The geometry. |
Returns
System.String
|