Class Transformations
- Namespace
- SpatialNET
- Assembly
- SpatialNET.Extensions.dll
Coordinate transformations with geometric results (ADR 0025): Translate, Scale, Rotate and the general
Transform. Every vertex is mapped, X and Y by the transformation, Z and M are kept (unless Transform changes
them). Results are created through the factory and restricted to what it supports (SupportsZ, SupportsM).
public static class TransformationsInheritance
Inherited Members
Methods
Rotate(IPoint2D, double, Coordinate?, IGeometryFactory?)
Rotates a point by angle (radians, counter-clockwise) about origin; Z and M stay.
Multiples of a quarter turn are exact (no rounding error from sine and cosine).
public static IPoint2D Rotate(this IPoint2D point, double angle, Coordinate? origin = null, IGeometryFactory? factory = null)Parameters
pointIPoint2D-
The point.
angledouble-
The angle in radians, counter-clockwise; finite.
originCoordinate?-
The centre of the rotation;
null= (0, 0). factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
pointisnull. - ArgumentOutOfRangeException
-
The angle or the origin is
NaNor infinite. - InvalidOperationException
-
No factory available, or a coordinate leaves the range of System.Double.
Rotate(IMultiPoint2D, double, Coordinate?, IGeometryFactory?)
Rotates a multipoint (see SpatialNET.Transformations.Rotate(SpatialNET.IPoint2D,System.Double,System.Nullable{SpatialNET.Coordinate},SpatialNET.IGeometryFactory)).
public static IMultiPoint2D Rotate(this IMultiPoint2D multiPoint, double angle, Coordinate? origin = null, IGeometryFactory? factory = null)Parameters
multiPointIMultiPoint2D-
The multipoint.
angledouble-
The angle in radians, counter-clockwise; finite.
originCoordinate?-
The centre of the rotation;
null= (0, 0). factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
multiPointisnull. - ArgumentOutOfRangeException
-
The angle or the origin is
NaNor infinite. - InvalidOperationException
-
No factory available, or a coordinate leaves the range of System.Double.
Rotate(IPolyline2D, double, Coordinate?, IGeometryFactory?)
Rotates a polyline (see SpatialNET.Transformations.Rotate(SpatialNET.IPoint2D,System.Double,System.Nullable{SpatialNET.Coordinate},SpatialNET.IGeometryFactory)).
public static IPolyline2D Rotate(this IPolyline2D line, double angle, Coordinate? origin = null, IGeometryFactory? factory = null)Parameters
lineIPolyline2D-
The polyline.
angledouble-
The angle in radians, counter-clockwise; finite.
originCoordinate?-
The centre of the rotation;
null= (0, 0). factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
lineisnull. - ArgumentOutOfRangeException
-
The angle or the origin is
NaNor infinite. - InvalidOperationException
-
No factory available, or a coordinate leaves the range of System.Double.
Rotate(IPolygon2D, double, Coordinate?, IGeometryFactory?)
Rotates a polygon (see SpatialNET.Transformations.Rotate(SpatialNET.IPoint2D,System.Double,System.Nullable{SpatialNET.Coordinate},SpatialNET.IGeometryFactory)).
public static IPolygon2D Rotate(this IPolygon2D polygon, double angle, Coordinate? origin = null, IGeometryFactory? factory = null)Parameters
polygonIPolygon2D-
The polygon.
angledouble-
The angle in radians, counter-clockwise; finite.
originCoordinate?-
The centre of the rotation;
null= (0, 0). factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
polygonisnull. - ArgumentOutOfRangeException
-
The angle or the origin is
NaNor infinite. - InvalidOperationException
-
No factory available, or a coordinate leaves the range of System.Double.
Rotate(IGeometry2D, double, Coordinate?, IGeometryFactory?)
Rotates any geometry (see SpatialNET.Transformations.Rotate(SpatialNET.IPoint2D,System.Double,System.Nullable{SpatialNET.Coordinate},SpatialNET.IGeometryFactory)).
public static IGeometry2D Rotate(this IGeometry2D geometry, double angle, Coordinate? origin = null, IGeometryFactory? factory = null)Parameters
geometryIGeometry2D-
The geometry.
angledouble-
The angle in radians, counter-clockwise; finite.
originCoordinate?-
The centre of the rotation;
null= (0, 0). factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
geometryisnull. - ArgumentOutOfRangeException
-
The angle or the origin is
NaNor infinite. - NotSupportedException
-
geometryis not a known geometry kind. - InvalidOperationException
-
No factory available, or a coordinate leaves the range of System.Double.
Scale(IPoint2D, double, double, Coordinate?, IGeometryFactory?)
Scales a point by sx and sy about origin; Z and M stay. A negative
factor mirrors, a factor of 0 collapses the geometry onto a line or a point.
public static IPoint2D Scale(this IPoint2D point, double sx, double sy, Coordinate? origin = null, IGeometryFactory? factory = null)Parameters
pointIPoint2D-
The point.
sxdouble-
The factor in X; finite.
sydouble-
The factor in Y; finite.
originCoordinate?-
The fixed point of the scaling;
null= (0, 0). factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
pointisnull. - ArgumentOutOfRangeException
-
A factor or the origin is
NaNor infinite. - InvalidOperationException
-
No factory available, or a coordinate leaves the range of System.Double.
Scale(IMultiPoint2D, double, double, Coordinate?, IGeometryFactory?)
Scales a multipoint (see SpatialNET.Transformations.Scale(SpatialNET.IPoint2D,System.Double,System.Double,System.Nullable{SpatialNET.Coordinate},SpatialNET.IGeometryFactory)).
public static IMultiPoint2D Scale(this IMultiPoint2D multiPoint, double sx, double sy, Coordinate? origin = null, IGeometryFactory? factory = null)Parameters
multiPointIMultiPoint2D-
The multipoint.
sxdouble-
The factor in X; finite.
sydouble-
The factor in Y; finite.
originCoordinate?-
The fixed point of the scaling;
null= (0, 0). factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
multiPointisnull. - ArgumentOutOfRangeException
-
A factor or the origin is
NaNor infinite. - InvalidOperationException
-
No factory available, or a coordinate leaves the range of System.Double.
Scale(IPolyline2D, double, double, Coordinate?, IGeometryFactory?)
Scales a polyline (see SpatialNET.Transformations.Scale(SpatialNET.IPoint2D,System.Double,System.Double,System.Nullable{SpatialNET.Coordinate},SpatialNET.IGeometryFactory)).
public static IPolyline2D Scale(this IPolyline2D line, double sx, double sy, Coordinate? origin = null, IGeometryFactory? factory = null)Parameters
lineIPolyline2D-
The polyline.
sxdouble-
The factor in X; finite.
sydouble-
The factor in Y; finite.
originCoordinate?-
The fixed point of the scaling;
null= (0, 0). factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
lineisnull. - ArgumentOutOfRangeException
-
A factor or the origin is
NaNor infinite. - InvalidOperationException
-
No factory available, or a coordinate leaves the range of System.Double.
Scale(IPolygon2D, double, double, Coordinate?, IGeometryFactory?)
Scales a polygon; the orientation of the rings is restored after a mirroring scale (see SpatialNET.Transformations.Scale(SpatialNET.IPoint2D,System.Double,System.Double,System.Nullable{SpatialNET.Coordinate},SpatialNET.IGeometryFactory)).
public static IPolygon2D Scale(this IPolygon2D polygon, double sx, double sy, Coordinate? origin = null, IGeometryFactory? factory = null)Parameters
polygonIPolygon2D-
The polygon.
sxdouble-
The factor in X; finite.
sydouble-
The factor in Y; finite.
originCoordinate?-
The fixed point of the scaling;
null= (0, 0). factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
polygonisnull. - ArgumentOutOfRangeException
-
A factor or the origin is
NaNor infinite. - InvalidOperationException
-
No factory available, or a coordinate leaves the range of System.Double.
Scale(IGeometry2D, double, double, Coordinate?, IGeometryFactory?)
Scales any geometry (see SpatialNET.Transformations.Scale(SpatialNET.IPoint2D,System.Double,System.Double,System.Nullable{SpatialNET.Coordinate},SpatialNET.IGeometryFactory)).
public static IGeometry2D Scale(this IGeometry2D geometry, double sx, double sy, Coordinate? origin = null, IGeometryFactory? factory = null)Parameters
geometryIGeometry2D-
The geometry.
sxdouble-
The factor in X; finite.
sydouble-
The factor in Y; finite.
originCoordinate?-
The fixed point of the scaling;
null= (0, 0). factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
geometryisnull. - ArgumentOutOfRangeException
-
A factor or the origin is
NaNor infinite. - NotSupportedException
-
geometryis not a known geometry kind. - InvalidOperationException
-
No factory available, or a coordinate leaves the range of System.Double.
Transform(IPoint2D, Func<Coordinate, Coordinate>, IGeometryFactory?)
Maps every vertex of a point through transform. Z and M of the result are those the function returns.
public static IPoint2D Transform(this IPoint2D point, Func<Coordinate, Coordinate> transform, IGeometryFactory? factory = null)Parameters
pointIPoint2D-
The point.
transformFunc<Coordinate, Coordinate>-
The mapping; X and Y of its result must be finite.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
pointortransformisnull. - InvalidOperationException
-
No factory available, or the mapping returned a coordinate with a
NaNor infinite X or Y.
Transform(IMultiPoint2D, Func<Coordinate, Coordinate>, IGeometryFactory?)
Maps every vertex of a multipoint through transform (see SpatialNET.Transformations.Transform(SpatialNET.IPoint2D,System.Func{SpatialNET.Coordinate,SpatialNET.Coordinate},SpatialNET.IGeometryFactory)).
public static IMultiPoint2D Transform(this IMultiPoint2D multiPoint, Func<Coordinate, Coordinate> transform, IGeometryFactory? factory = null)Parameters
multiPointIMultiPoint2D-
The multipoint.
transformFunc<Coordinate, Coordinate>-
The mapping; X and Y of its result must be finite.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
multiPointortransformisnull. - InvalidOperationException
-
No factory available, or the mapping returned a coordinate with a
NaNor infinite X or Y.
Transform(IPolyline2D, Func<Coordinate, Coordinate>, IGeometryFactory?)
Maps every vertex of a polyline through transform (see SpatialNET.Transformations.Transform(SpatialNET.IPoint2D,System.Func{SpatialNET.Coordinate,SpatialNET.Coordinate},SpatialNET.IGeometryFactory)).
public static IPolyline2D Transform(this IPolyline2D line, Func<Coordinate, Coordinate> transform, IGeometryFactory? factory = null)Parameters
lineIPolyline2D-
The polyline.
transformFunc<Coordinate, Coordinate>-
The mapping; X and Y of its result must be finite.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
lineortransformisnull. - InvalidOperationException
-
No factory available, or the mapping returned a coordinate with a
NaNor infinite X or Y.
Transform(IPolygon2D, Func<Coordinate, Coordinate>, IGeometryFactory?)
Maps every vertex of a polygon through transform. The rings are normalized first and the orientation
is restored afterwards (shells counter-clockwise, holes clockwise, ADR 0003), so a mirroring mapping does not flip the
polygon inside out. A mapping that is not one-to-one and continuous can make the result invalid.
public static IPolygon2D Transform(this IPolygon2D polygon, Func<Coordinate, Coordinate> transform, IGeometryFactory? factory = null)Parameters
polygonIPolygon2D-
The polygon.
transformFunc<Coordinate, Coordinate>-
The mapping; X and Y of its result must be finite.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
polygonortransformisnull. - InvalidOperationException
-
No factory available, or the mapping returned a coordinate with a
NaNor infinite X or Y.
Transform(IGeometry2D, Func<Coordinate, Coordinate>, IGeometryFactory?)
Maps every vertex of any geometry through transform (see the overloads for the kinds).
public static IGeometry2D Transform(this IGeometry2D geometry, Func<Coordinate, Coordinate> transform, IGeometryFactory? factory = null)Parameters
geometryIGeometry2D-
The geometry.
transformFunc<Coordinate, Coordinate>-
The mapping; X and Y of its result must be finite.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
geometryortransformisnull. - NotSupportedException
-
geometryis not a known geometry kind. - InvalidOperationException
-
No factory available, or the mapping returned a coordinate with a
NaNor infinite X or Y.
Translate(IPoint2D, double, double, IGeometryFactory?)
Moves a point by (dx, dy); Z and M stay.
public static IPoint2D Translate(this IPoint2D point, double dx, double dy, IGeometryFactory? factory = null)Parameters
pointIPoint2D-
The point.
dxdouble-
The shift in X; finite.
dydouble-
The shift in Y; finite.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
pointisnull. - ArgumentOutOfRangeException
-
A parameter is
NaNor infinite. - InvalidOperationException
-
No factory available, or a coordinate leaves the range of System.Double.
Translate(IMultiPoint2D, double, double, IGeometryFactory?)
Moves a multipoint by (dx, dy); Z and M stay.
public static IMultiPoint2D Translate(this IMultiPoint2D multiPoint, double dx, double dy, IGeometryFactory? factory = null)Parameters
multiPointIMultiPoint2D-
The multipoint.
dxdouble-
The shift in X; finite.
dydouble-
The shift in Y; finite.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
multiPointisnull. - ArgumentOutOfRangeException
-
A parameter is
NaNor infinite. - InvalidOperationException
-
No factory available, or a coordinate leaves the range of System.Double.
Translate(IPolyline2D, double, double, IGeometryFactory?)
Moves a polyline by (dx, dy); Z and M stay.
public static IPolyline2D Translate(this IPolyline2D line, double dx, double dy, IGeometryFactory? factory = null)Parameters
lineIPolyline2D-
The polyline.
dxdouble-
The shift in X; finite.
dydouble-
The shift in Y; finite.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
lineisnull. - ArgumentOutOfRangeException
-
A parameter is
NaNor infinite. - InvalidOperationException
-
No factory available, or a coordinate leaves the range of System.Double.
Translate(IPolygon2D, double, double, IGeometryFactory?)
Moves a polygon by (dx, dy); Z and M stay.
public static IPolygon2D Translate(this IPolygon2D polygon, double dx, double dy, IGeometryFactory? factory = null)Parameters
polygonIPolygon2D-
The polygon.
dxdouble-
The shift in X; finite.
dydouble-
The shift in Y; finite.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
polygonisnull. - ArgumentOutOfRangeException
-
A parameter is
NaNor infinite. - InvalidOperationException
-
No factory available, or a coordinate leaves the range of System.Double.
Translate(IGeometry2D, double, double, IGeometryFactory?)
Moves any geometry by (dx, dy); Z and M stay.
public static IGeometry2D Translate(this IGeometry2D geometry, double dx, double dy, IGeometryFactory? factory = null)Parameters
geometryIGeometry2D-
The geometry.
dxdouble-
The shift in X; finite.
dydouble-
The shift in Y; finite.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- ArgumentNullException
-
geometryisnull. - ArgumentOutOfRangeException
-
A parameter is
NaNor infinite. - NotSupportedException
-
geometryis not a known geometry kind. - InvalidOperationException
-
No factory available, or a coordinate leaves the range of System.Double.