ClassGeometryExtensions
Methods related to planar geometry.
Definition
Namespace:Telerik.Windows.Controls.Diagrams
Assembly:Telerik.Windows.Controls.Diagrams.dll
Syntax:
public static class GeometryExtensions
Inheritance: objectGeometryExtensions
Methods
Add(PathFigure, PathSegment)
Adds the given PathSegment to the path figure.
Declaration
public static PathFigure Add(this PathFigure pathFigure, PathSegment segment)
Parameters
pathFigure
PathFigure
The path figure.
segment
PathSegment
The segment.
Returns
PathFigure
The augmented path figure.
Add(PathFigure, PathSegment, Point)
Adds the given 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
pathFigure
PathFigure
The path figure.
segment
PathSegment
The segment.
startPoint
Point
The start point.
Returns
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
pathGeometry
PathGeometry
The path geometry.
pathFigure
PathFigure
The path figure.
Returns
PathGeometry
The resulting path geometry.
AddArc(PathFigure, Rect, double, double, bool)
Adds the arc.
Declaration
public static PathFigure AddArc(this PathFigure pathFigure, Rect rectangle, double startAngle, double sweep, bool setStartingPoint)
Parameters
pathFigure
PathFigure
The path figure.
rectangle
Rect
The bounding rectangle.
startAngle
The start angle.
sweep
The sweeping angle of the arc.
setStartingPoint
If set to true the starting point will be set.
Returns
PathFigure
AddArc(PathFigure, double, double, double, double, double, double, bool)
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
pathFigure
PathFigure
The figure.
x
The x-coordinate of the bounding rectangle.
y
The y-coordinate of the bounding rectangle.
width
The width of the bounding rectangle.
height
The height of the bounding rectangle.
startAngle
The start angle.
sweep
The sweeping angle of the arc.
startPoint
If set to true the starting point will be set.
AddBezier(PathFigure, double[])
Adds a bezier segment to the path.
Declaration
public static void AddBezier(this PathFigure pathFigure, double[] points)
Parameters
pathFigure
PathFigure
The path.
points
double[]
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
pathFigure
PathFigure
The figure.
points
Point[]
The points defining the Bezier segment.
AddLine(PathFigure, Point, Point)
Adds a line to the path.
Declaration
public static PathFigure AddLine(this PathFigure pathFigure, Point point1, Point point2)
Parameters
pathFigure
PathFigure
The path figure.
point1
Point
The start point of the line.
point2
Point
The end point of the line.
Returns
PathFigure
The augmented path figure.
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
pathFigure
PathFigure
The path figure.
x1
The x-coordinate of the start point.
y1
The y-coordinate of the start point.
x2
The x-coordinate of the end point.
y2
The y-coordinate of the end point.
Returns
PathFigure
AddPolyLine(PathFigure, IEnumerable<Point>)
Adds a polyline to the figure.
Declaration
public static void AddPolyLine(this PathFigure pathFigure, IEnumerable<Point> points)
Parameters
pathFigure
PathFigure
The figure.
points
IEnumerable<Point>
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
pathFigure
PathFigure
The figure.
collection
PointCollection
The points defining the polyline.
AddRoundRect(PathFigure, Rect, double, bool)
Adds a rounded rectangle to the path figure.
AddRoundRect(PathFigure, double, double, double, double, double, bool)
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
pathFigure
PathFigure
x
y
width
height
radius
setStartPoint
Returns
PathFigure
AsPathGeometry(Geometry)
Returns the original geometry as path geometry.
Declaration
public static PathGeometry AsPathGeometry(this Geometry original)
Parameters
original
Geometry
The original.
Returns
PathGeometry
Clone(Geometry)
Clones the specified geometry.
Declaration
public static Geometry Clone(this Geometry geometry)
Parameters
geometry
Geometry
The geometry.
Returns
Geometry
CreateBaseLineGeometry(LineSpecification)
Creates a line geometry based on the given specifications.
Declaration
public static PathGeometry CreateBaseLineGeometry(LineSpecification specs)
Parameters
specs
The specs.
Returns
PathGeometry
Remarks
- This method will create the base line of a connection. This line will including possible bridges but no end caps.
- All coordinates handled in this method are local positions.
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
startPoint
Point
The start point.
endPoint
Point
The end point.
startBezierPoint
Point
The start bezier point.
endBezierPoint
Point
The end bezier point.
tension
The tension of the Bezier curve.
Returns
Geometry
CreateConnectionGeometry(IConnection, BridgeType, bool)
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
connection
The connection for which to create a geometry.
connectionBridge
What type of bridging should be applied to the line.
connectionRoundedCorners
Whether the corners of the line should be rounded.
Returns
Geometry
The geometry of the connection path.
Remarks
- The method essentially dispatches first a calculation of the route, if required, and then hands over a specification to the CreateLineGeometry(PolylineSpecification) method.
- The points defined by the given connection and the routing service are global positions, they are converted internally to local coordinates.
CreateEllipse(Point, double, double)
Creates an ellipse.
CreateLineGeometry(Point, Point, bool, params Point[])
Creates the polyline.
Declaration
public static Geometry CreateLineGeometry(Point startPoint, Point endPoint, bool roundedCorners = false, params Point[] points)
Parameters
startPoint
Point
The start point.
endPoint
Point
The end point.
roundedCorners
If set to true the corners of the polyline will be rounded.
points
Point[]
The points.
Returns
Geometry
CreateLineGeometry(PolylineSpecification)
Creates a line geometry based on the given specifications.
Declaration
public static Geometry CreateLineGeometry(PolylineSpecification specs)
Parameters
specs
Returns
Geometry
A Geometry to be used in a Path
Remarks
- This method will create a polyline or Bezier line including possibly the end caps and the crossings.
- This method decouples between the method called by the connection (CreateConnectionGeometry(IConnection, BridgeType, bool)) on the one hand and the more specific methods for a polyline (CreatePolylineLineFigure(PolylineSpecification)) or a Bezier line () on the other.
- All coordinates handled in this method are local positions.
CreatePathGeometry(Point, IList<PathSegment>)
Creates a geometry.
Declaration
public static Geometry CreatePathGeometry(Point startPoint, IList<PathSegment> pathSegments)
Parameters
startPoint
Point
The start point.
pathSegments
IList<PathSegment>
The path segments.
Returns
Geometry
CreatePolylineLineFigure(PolylineSpecification)
Gets the polyline figure.
Declaration
public static PathGeometry CreatePolylineLineFigure(PolylineSpecification specs)
Parameters
specs
The polyline specifications.
Returns
PathGeometry
CreateRoundedPolyline(PathFigure, IList<Point>, bool)
Adds rounded corners to the existing polyline figure.
Declaration
public static void CreateRoundedPolyline(PathFigure figure, IList<Point> points, bool addLastLine)
Parameters
figure
PathFigure
The figure which will be incremented with corner arcs.
points
IList<Point>
The points of the polyline.
addLastLine
If set to true the last line segment will be added.
Remarks
The corner radius is set in the ConnectionCornerRadius and has default 5.0 pixels.
CreateSplineFigures(IList<Point>, double, bool, bool)
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
points
IList<Point>
The points defining the spline. These should be in local coordinates and include the endpoints.
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.
isClosed
If set to true the curve will be closed.
isFilled
If set to true the shape will be filled .
Returns
IList<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, bool)
Finds the intersection.
Declaration
public static Point FindIntersection(Point sourcePoint, Point targetPoint, Geometry geometry, double edgeThick, bool isArrow)
Parameters
sourcePoint
Point
The source point.
targetPoint
Point
The target point.
geometry
Geometry
The geometry.
edgeThick
The edge thick.
isArrow
If set to true [is arrow].
Returns
Point
GetPathGeometry(string)
Gets the path geometry.
Declaration
public static PathGeometry GetPathGeometry(string abbreviatedGeometry)
Parameters
abbreviatedGeometry
The abbreviated geometry.
Returns
PathGeometry
GetSplineFigureTangents(IList<Point>, out Point, out Point, double, bool)
Gets the tangents of the spline figure.
Declaration
[SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters")]
public static void GetSplineFigureTangents(IList<Point> points, out Point startTangentPoint, out Point endTangentPoint, double tension = 0.5, bool isClosed = false)
Parameters
points
IList<Point>
The points of the connection.
startTangentPoint
Point
The start tangent point.
endTangentPoint
Point
The end tangent point.
tension
The tension.
isClosed
If set to true [is closed].
GetString(Geometry)
Converts the geometry object to its string equivalent.
Declaration
public static string GetString(this Geometry geometry)
Parameters
geometry
Geometry
The geometry.
Returns