New to Telerik UI for WinFormsStart a free 30-day trial

Methods related to planar geometry.

Definition

Namespace:Telerik.WinControls.UI.Diagrams

Assembly:Telerik.WinControls.RadDiagram.dll

Syntax:

C#
public static class GeometryExtensions

Inheritance: objectGeometryExtensions

Methods

Adds the given PathSegment to the path figure and sets the starting point at the same time.

C#
public static PathFigure Add(this PathFigure pathFigure, PathSegment segment, Point startPoint)
Parameters:pathFigurePathFigure

The path figure.

segmentPathSegment

The segment.

startPointPoint

The start point.

Returns:

PathFigure

The augmented path figure.

Adds the given PathSegment to the path figure.

C#
public static PathFigure Add(this PathFigure pathFigure, PathSegment segment)
Parameters:pathFigurePathFigure

The path figure.

segmentPathSegment

The segment.

Returns:

PathFigure

The augmented path figure.

Adds the given figure to the geometry.

C#
public static PathGeometry Add(this PathGeometry pathGeometry, PathFigure pathFigure)
Parameters:pathGeometryPathGeometry

The path geometry.

pathFigurePathFigure

The path figure.

Returns:

PathGeometry

The resulting path geometry.

Adds an arc to the path figure.

C#
public static void AddArc(this PathFigure pathFigure, double x, double y, double width, double height, double startAngle, double sweep, bool startPoint)
Parameters:pathFigurePathFigure

The figure.

xdouble

The x-coordinate of the bounding rectangle.

ydouble

The y-coordinate of the bounding rectangle.

widthdouble

The width of the bounding rectangle.

heightdouble

The height of the bounding rectangle.

startAngledouble

The start angle.

sweepdouble

The sweeping angle of the arc.

startPointbool

If set to true the starting point will be set.

Adds a bezier segment to the path.

C#
public static void AddBezier(this PathFigure pathFigure, double[] points)
Parameters:pathFigurePathFigure

The path.

pointsdouble[]

The eight values specifying the eight coordinates of the four Bezier points.

Adds a bezier segment to the path.

C#
public static void AddBeziers(this PathFigure pathFigure, Point[] points)
Parameters:pathFigurePathFigure

The figure.

pointsPoint[]

The points defining the Bezier segment.

Adds a line to the path.

C#
public static PathFigure AddLine(this PathFigure pathFigure, double x1, double y1, double x2, double y2)
Parameters:pathFigurePathFigure

The path figure.

x1double

The x-coordinate of the start point.

y1double

The y-coordinate of the start point.

x2double

The x-coordinate of the end point.

y2double

The y-coordinate of the end point.

Returns:

PathFigure

Adds a line to the path.

C#
public static PathFigure AddLine(this PathFigure pathFigure, Point point1, Point point2)
Parameters:pathFigurePathFigure

The path figure.

point1Point

The start point of the line.

point2Point

The end point of the line.

Returns:

PathFigure

The augmented path figure.

Adds a polyline to the figure.

C#
public static void AddPolyLine(this PathFigure pathFigure, IEnumerable<Point> points)
Parameters:pathFigurePathFigure

The figure.

pointsIEnumerable<Point>

The points defining the polyline.

Adds a polyline to the figure.

C#
public static void AddPolyLine(this PathFigure pathFigure, PointCollection collection)
Parameters:pathFigurePathFigure

The figure.

collectionPointCollection

The points defining the polyline.

Creates a line geometry based on the given specifications.

C#
public static PathGeometry CreateBaseLineGeometry(LineSpecification specs)
Parameters:specsLineSpecification

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.

Creates a bezier geometry.

C#
public static Geometry CreateBezier(Point startPoint, Point endPoint, Point startBezierPoint, Point endBezierPoint, double tension = 1)
Parameters:startPointPoint

The start point.

endPointPoint

The end point.

startBezierPointPoint

The start bezier point.

endBezierPointPoint

The end bezier point.

tensiondouble

The tension of the Bezier curve.

Returns:

Geometry

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.

C#
public static Geometry CreateConnectionGeometry(IConnection connection, BridgeType connectionBridge, bool connectionRoundedCorners)
Parameters:connectionIConnection

The connection for which to create a geometry.

connectionBridgeBridgeType

What type of bridging should be applied to the line.

connectionRoundedCornersbool

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.

Creates an ellipse.

C#
public static Geometry CreateEllipse(Point center, double radiusX, double radiusY)
Parameters:centerPoint

The center.

radiusXdouble

The x radius.

radiusYdouble

The y radius.

Returns:

Geometry

Creates the polyline.

C#
public static Geometry CreateLineGeometry(Point startPoint, Point endPoint, bool roundedCorners = false, params Point[] points)
Parameters:startPointPoint

The start point.

endPointPoint

The end point.

roundedCornersbool

If set to true the corners of the polyline will be rounded.

pointsPoint[]

The points.

Returns:

Geometry

Creates a line geometry based on the given specifications.

C#
public static Geometry CreateLineGeometry(PolylineSpecification specs)
Parameters:specsPolylineSpecificationReturns:

Geometry

A Geometry to be used in a Path

Remarks:

Creates a geometry.

C#
public static Geometry CreatePathGeometry(Point startPoint, IList<PathSegment> pathSegments)
Parameters:startPointPoint

The start point.

pathSegmentsIList<PathSegment>

The path segments.

Returns:

Geometry

Gets the polyline figure.

C#
public static PathGeometry CreatePolylineLineFigure(PolylineSpecification specs)
Parameters:specsPolylineSpecification

The polyline specifications.

Returns:

PathGeometry

Adds rounded corners to the existing polyline figure.

C#
public static void CreateRoundedPolyline(PathFigure figure, IList<Point> points, bool addLastLine)
Parameters:figurePathFigure

The figure which will be incremented with corner arcs.

pointsIList<Point>

The points of the polyline.

addLastLinebool

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.

Creates a canonical spline figure.

C#
public static IList<PathFigure> CreateSplineFigures(IList<Point> points, double tension = 0.5, bool isClosed = false, bool isFilled = false)
Parameters:pointsIList<Point>

The points defining the spline. These should be in local coordinates and include the endpoints.

tensiondouble

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.

isClosedbool

If set to true the curve will be closed.

isFilledbool

If set to true the shape will be filled .

Returns:

IList<PathFigure>

Finds the intersection.

C#
public static Point FindIntersection(Point sourcePoint, Point targetPoint, Geometry geometry, double edgeThick, bool isArrow)
Parameters:sourcePointPoint

The source point.

targetPointPoint

The target point.

geometryGeometry

The geometry.

edgeThickdouble

The edge thick.

isArrowbool

If set to true [is arrow].

Returns:

Point

C#
public static GraphicsPath GetGeometry(PathGeometry geometry)
Parameters:geometryPathGeometryReturns:

GraphicsPath

Gets the tangents of the spline figure.

C#
public static void GetSplineFigureTangents(IList<Point> points, out Point startTangentPoint, out Point endTangentPoint, double tension = 0.5, bool isClosed = false)
Parameters:pointsIList<Point>

The points of the connection.

startTangentPointPoint

The start tangent point.

endTangentPointPoint

The end tangent point.

tensiondouble

The tension.

isClosedbool

If set to true [is closed].

Converts the geometry object to its string equivalent.

C#
public static string GetString(this Geometry geometry)
Parameters:geometryGeometry

The geometry.

Returns:

string