Class
GeometryExtensions

Methods related to planar geometry.

Definition

Namespace:Telerik.Windows.Controls.Diagrams

Assembly:Telerik.Windows.Controls.Diagrams.dll

Syntax:

cs-api-definition
public static class GeometryExtensions

Inheritance: objectGeometryExtensions

Methods

Add(PathFigure, PathSegment)

Adds the given PathSegment to the path figure.

Declaration

cs-api-definition
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

cs-api-definition
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

cs-api-definition
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

cs-api-definition
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

double

The start angle.

sweep

double

The sweeping angle of the arc.

setStartingPoint

bool

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

cs-api-definition
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

double

The x-coordinate of the bounding rectangle.

y

double

The y-coordinate of the bounding rectangle.

width

double

The width of the bounding rectangle.

height

double

The height of the bounding rectangle.

startAngle

double

The start angle.

sweep

double

The sweeping angle of the arc.

startPoint

bool

If set to true the starting point will be set.

AddBezier(PathFigure, double[])

Adds a bezier segment to the path.

Declaration

cs-api-definition
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

cs-api-definition
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

cs-api-definition
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

cs-api-definition
public static PathFigure AddLine(this PathFigure pathFigure, double x1, double y1, double x2, double y2)

Parameters

pathFigure

PathFigure

The path figure.

x1

double

The x-coordinate of the start point.

y1

double

The y-coordinate of the start point.

x2

double

The x-coordinate of the end point.

y2

double

The y-coordinate of the end point.

Returns

PathFigure

AddPolyLine(PathFigure, IEnumerable<Point>)

Adds a polyline to the figure.

Declaration

cs-api-definition
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

cs-api-definition
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.

Declaration

cs-api-definition
public static PathFigure AddRoundRect(this PathFigure pathFigure, Rect rectangle, double radius, bool setStartPoint)

Parameters

pathFigure

PathFigure

rectangle

Rect

radius

double

setStartPoint

bool

Returns

PathFigure

AddRoundRect(PathFigure, double, double, double, double, double, bool)

Adds a rounded rectangle to the path figure.

Declaration

cs-api-definition
public static PathFigure AddRoundRect(this PathFigure pathFigure, double x, double y, double width, double height, double radius, bool setStartPoint)

Parameters

pathFigure

PathFigure

x

double

y

double

width

double

height

double

radius

double

setStartPoint

bool

Returns

PathFigure

AsPathGeometry(Geometry)

Returns the original geometry as path geometry.

Declaration

cs-api-definition
public static PathGeometry AsPathGeometry(this Geometry original)

Parameters

original

Geometry

The original.

Returns

PathGeometry

Clone(Geometry)

Clones the specified geometry.

Declaration

cs-api-definition
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

cs-api-definition
public static PathGeometry CreateBaseLineGeometry(LineSpecification specs)

Parameters

specs

LineSpecification

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

cs-api-definition
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

double

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

cs-api-definition
public static Geometry CreateConnectionGeometry(IConnection connection, BridgeType connectionBridge, bool connectionRoundedCorners)

Parameters

connection

IConnection

The connection for which to create a geometry.

connectionBridge

BridgeType

What type of bridging should be applied to the line.

connectionRoundedCorners

bool

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.

Declaration

cs-api-definition
public static Geometry CreateEllipse(Point center, double radiusX, double radiusY)

Parameters

center

Point

The center.

radiusX

double

The x radius.

radiusY

double

The y radius.

Returns

Geometry

CreateLineGeometry(Point, Point, bool, params Point[])

Creates the polyline.

Declaration

cs-api-definition
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

bool

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

cs-api-definition
public static Geometry CreateLineGeometry(PolylineSpecification specs)

Parameters

specs

PolylineSpecification

Returns

Geometry

A Geometry to be used in a Path

Remarks

CreatePathGeometry(Point, IList<PathSegment>)

Creates a geometry.

Declaration

cs-api-definition
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

cs-api-definition
public static PathGeometry CreatePolylineLineFigure(PolylineSpecification specs)

Parameters

specs

PolylineSpecification

The polyline specifications.

Returns

PathGeometry

CreateRoundedPolyline(PathFigure, IList<Point>, bool)

Adds rounded corners to the existing polyline figure.

Declaration

cs-api-definition
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

bool

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

cs-api-definition
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

double

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

bool

If set to true the curve will be closed.

isFilled

bool

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

cs-api-definition
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

double

The edge thick.

isArrow

bool

If set to true [is arrow].

Returns

Point

GetPathGeometry(string)

Gets the path geometry.

Declaration

cs-api-definition
public static PathGeometry GetPathGeometry(string abbreviatedGeometry)

Parameters

abbreviatedGeometry

string

The abbreviated geometry.

Returns

PathGeometry

GetSplineFigureTangents(IList<Point>, out Point, out Point, double, bool)

Gets the tangents of the spline figure.

Declaration

cs-api-definition
[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

double

The tension.

isClosed

bool

If set to true [is closed].

GetString(Geometry)

Converts the geometry object to its string equivalent.

Declaration

cs-api-definition
public static string GetString(this Geometry geometry)

Parameters

geometry

Geometry

The geometry.

Returns

string