Skip to content

Commit ab681e3

Browse files
committed
Code cleanup of AffineTransformations class
1 parent 36c46de commit ab681e3

14 files changed

+702
-306
lines changed

LinqToDBPostGisNetTopologySuite.Tests/AffineTransformationsTests.cs

Lines changed: 207 additions & 67 deletions
Large diffs are not rendered by default.

LinqToDBPostGisNetTopologySuite/AffineTransformations.cs

Lines changed: 366 additions & 112 deletions
Large diffs are not rendered by default.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
namespace LinqToDBPostGisNetTopologySuite
22
{
33
/// <summary>
4-
/// Endianness encoding for binary formats
4+
/// Endianness encoding for binary formats.
55
/// </summary>
66
public static class EndiannessEncoding
77
{
88
/// <summary>
9-
/// Little-endian ("NDR")
9+
/// Little-endian ("NDR").
1010
/// </summary>
1111
public static readonly string LittleEndian = "NDR";
1212

1313
/// <summary>
14-
/// Big-endian ("XDR")
14+
/// Big-endian ("XDR").
1515
/// </summary>
1616
public static readonly string BigEndian = "XDR";
1717
}
18-
}
18+
}

LinqToDBPostGisNetTopologySuite/GeometryAccessors.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace LinqToDBPostGisNetTopologySuite
1010
/// Geometry Accessors.
1111
/// </summary>
1212
/// <remarks>
13-
/// 8.4. Geometry Accessors
13+
/// 5.4. Geometry Accessors
1414
/// https://postgis.net/docs/reference.html#Geometry_Accessors
1515
/// </remarks>
1616
public static class GeometryAccessors

LinqToDBPostGisNetTopologySuite/GeometryConstructors.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace LinqToDBPostGisNetTopologySuite
1010
/// Geometry Constructors.
1111
/// </summary>
1212
/// <remarks>
13-
/// 8.3. Geometry Constructors
13+
/// 5.3. Geometry Constructors
1414
/// https://postgis.net/docs/reference.html#Geometry_Constructors
1515
/// </remarks>
1616
public static class GeometryConstructors

LinqToDBPostGisNetTopologySuite/GeometryEditors.cs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ namespace LinqToDBPostGisNetTopologySuite
1010
/// Geometry Editors.
1111
/// </summary>
1212
/// <remarks>
13-
/// 8.5. Geometry Editors
14-
/// https://postgis.net/docs/manual-3.0/reference.html#Geometry_Editors
13+
/// 5.5. Geometry Editors
14+
/// https://postgis.net/docs/reference.html#Geometry_Editors
1515
/// </remarks>
1616
public static class GeometryEditors
1717
{
1818
/// <summary>
1919
/// Append a point to a LineString
2020
/// </summary>
2121
/// <remarks>
22-
/// See https://postgis.net/docs/manual-3.0/ST_AddPoint.html
22+
/// See https://postgis.net/docs/ST_AddPoint.html
2323
/// </remarks>
2424
/// <param name="lineString">LineString</param>
2525
/// <param name="point">Point</param>
@@ -34,7 +34,7 @@ public static NTSG STAddPoint(this NTSG lineString, NTSG point)
3434
/// Insert a point to a LineString at given position(zero based)
3535
/// </summary>
3636
/// <remarks>
37-
/// See https://postgis.net/docs/manual-3.0/ST_AddPoint.html
37+
/// See https://postgis.net/docs/ST_AddPoint.html
3838
/// </remarks>
3939
/// <param name="lineString">Linestring</param>
4040
/// <param name="point">Point</param>
@@ -50,7 +50,7 @@ public static NTSG STAddPoint(this NTSG lineString, NTSG point, int position)
5050
/// Given a (multi)geometry, returns a (multi)geometry consisting only of elements of the specified type. If there are no sub-geometries of the right type, an EMPTY geometry will be returned
5151
/// </summary>
5252
/// <remarks>
53-
/// See https://postgis.net/docs/manual-3.0/ST_CollectionExtract.html
53+
/// See https://postgis.net/docs/ST_CollectionExtract.html
5454
/// </remarks>
5555
/// <param name="collection">Geometry</param>
5656
/// <param name="type">Type(1 == POINT, 2 == LINESTRING, 3 == POLYGON)</param>
@@ -65,7 +65,7 @@ public static NTSG STCollectionExtract(this NTSG collection, int type)
6565
/// Given a geometry collection, returns the "simplest" representation of the contents
6666
/// </summary>
6767
/// <remarks>
68-
/// See https://postgis.net/docs/manual-3.0/ST_CollectionHomogenize.html
68+
/// See https://postgis.net/docs/ST_CollectionHomogenize.html
6969
/// </remarks>
7070
/// <param name="collection">Geometry collection</param>
7171
/// <returns>Simplest" representation of the geometry collection</returns>
@@ -79,7 +79,7 @@ public static NTSG STCollectionHomogenize(this NTSG collection)
7979
/// Forces the geometries into a "2-dimensional mode" so that all output representations will only have the X and Y coordinates
8080
/// </summary>
8181
/// <remarks>
82-
/// See https://postgis.net/docs/manual-3.0/ST_Force2D.html
82+
/// See https://postgis.net/docs/ST_Force2D.html
8383
/// </remarks>
8484
/// <param name="geometry">Input geometry</param>
8585
/// <returns>Geometry in XY mode</returns>
@@ -93,7 +93,7 @@ public static NTSG STForce2D(this NTSG geometry)
9393
/// Forces the geometries into XYZ mode. This is an alias for ST_Force_3DZ. If a geometry has no Z component, then a 0 Z coordinate is tacked on
9494
/// </summary>
9595
/// <remarks>
96-
/// See https://postgis.net/docs/manual-3.0/ST_Force_3D.html
96+
/// See https://postgis.net/docs/ST_Force_3D.html
9797
/// </remarks>
9898
/// <param name="geometry">Input geometry</param>
9999
/// <returns>Geometry in XYZ mode</returns>
@@ -107,7 +107,7 @@ public static NTSG STForce3D(this NTSG geometry)
107107
/// Forces the geometries into XYZ mode. This is a synonym for ST_Force3DZ. If a geometry has no Z component, then a 0 Z coordinate is tacked on
108108
/// </summary>
109109
/// <remarks>
110-
/// See https://postgis.net/docs/manual-3.0/ST_Force_3DZ.html
110+
/// See https://postgis.net/docs/ST_Force_3DZ.html
111111
/// </remarks>
112112
/// <param name="geometry">Input geometry</param>
113113
/// <returns>Geometry in XYZ mode</returns>
@@ -121,7 +121,7 @@ public static NTSG STForce3DZ(this NTSG geometry)
121121
/// Forces the geometries into XYM mode. If a geometry has no M component, then a 0 M coordinate is tacked on. If it has a Z component, then Z is removed
122122
/// </summary>
123123
/// <remarks>
124-
/// See https://postgis.net/docs/manual-3.0/ST_Force_3DM.html
124+
/// See https://postgis.net/docs/ST_Force_3DM.html
125125
/// </remarks>
126126
/// <param name="geometry">Input geometry</param>
127127
/// <returns>Geometry in XYM mode</returns>
@@ -135,7 +135,7 @@ public static NTSG STForce3DM(this NTSG geometry)
135135
/// Forces the geometries into XYZM mode. 0 is tacked on for missing Z and M dimensions.
136136
/// </summary>
137137
/// <remarks>
138-
/// See https://postgis.net/docs/manual-3.0/ST_Force_4D.html
138+
/// See https://postgis.net/docs/ST_Force_4D.html
139139
/// </remarks>
140140
/// <param name="geometry">Input geometry</param>
141141
/// <returns>Geometry in XYZM mode</returns>
@@ -149,7 +149,7 @@ public static NTSG STForce4D(this NTSG geometry)
149149
/// Forces (Multi)Polygons to use a counter-clockwise orientation for their exterior ring, and a clockwise orientation for their interior rings.Non-polygonal geometries are returned unchanged
150150
/// </summary>
151151
/// <remarks>
152-
/// See https://postgis.net/docs/manual-3.0/ST_ForcePolygonCCW.html
152+
/// See https://postgis.net/docs/ST_ForcePolygonCCW.html
153153
/// </remarks>
154154
/// <param name="geometry">Input geometry</param>
155155
/// <returns>Geometry with counter-clockwise/clockwise exterior/interior orientaion ring</returns>
@@ -163,7 +163,7 @@ public static NTSG STForcePolygonCCW(this NTSG geometry)
163163
/// Converts the geometry into a GEOMETRYCOLLECTION
164164
/// </summary>
165165
/// <remarks>
166-
/// See https://postgis.net/docs/manual-3.0/ST_Force_Collection.html
166+
/// See https://postgis.net/docs/ST_Force_Collection.html
167167
/// </remarks>
168168
/// <param name="geometry">Input geometry</param>
169169
/// <returns>Geometry Collection</returns>
@@ -177,7 +177,7 @@ public static NTSG STForceCollection(this NTSG geometry)
177177
/// Forces (Multi)Polygons to use a clockwise orientation for their exterior ring, and a counter-clockwise orientation for their interior rings. Non-polygonal geometries are returned unchanged
178178
/// </summary>
179179
/// <remarks>
180-
/// See https://postgis.net/docs/manual-3.0/ST_ForcePolygonCW.html
180+
/// See https://postgis.net/docs/ST_ForcePolygonCW.html
181181
/// </remarks>
182182
/// <param name="geometry">Input geometry</param>
183183
/// <returns>Geometry with counter-clockwise/clockwise interior/exterior orientaion ring</returns>
@@ -221,7 +221,7 @@ public static NTSG STForceSFS(string geometry)
221221
/// Forces the orientation of the vertices in a polygon to follow a Right-Hand-Rule, in which the area that is bounded by the polygon is to the right of the boundary. In particular, the exterior ring is orientated in a clockwise direction and the interior rings in a counter-clockwise direction
222222
/// </summary>
223223
/// <remarks>
224-
/// See https://postgis.net/docs/manual-3.0/ST_ForceRHR.html
224+
/// See https://postgis.net/docs/ST_ForceRHR.html
225225
/// </remarks>
226226
/// <param name="geometry">Input geometry</param>
227227
/// <returns>Geometry with vertices following a Right-Hand-Rule</returns>
@@ -235,7 +235,7 @@ public static NTSG STForceRHR(this NTSG geometry)
235235
/// Turns a geometry into its curved representation. Lines become compoundcurves, multilines become multicurves, polygons become curvepolygons, multipolygons become multisurfaces. A curved geometry returns back same as input
236236
/// </summary>
237237
/// <remarks>
238-
/// See https://postgis.net/docs/manual-3.0/ST_ForceCurve.html
238+
/// See https://postgis.net/docs/ST_ForceCurve.html
239239
/// </remarks>
240240
/// <param name="geometry">Input geometry</param>
241241
/// <returns>Geometry with curved representation</returns>
@@ -249,7 +249,7 @@ public static NTSG STForceCurve(this NTSG geometry)
249249
/// Returns a (set of) LineString(s) formed by sewing together the constituent line work of a MULTILINESTRING(Only use with MULTILINESTRING/LINESTRINGs. If you feed a polygon or geometry collection into this function, it will return an empty GEOMETRYCOLLECTION)
250250
/// </summary>
251251
/// <remarks>
252-
/// See https://postgis.net/docs/manual-3.0/ST_LineMerge.html
252+
/// See https://postgis.net/docs/ST_LineMerge.html
253253
/// </remarks>
254254
/// <param name="geometry">Input geometry(MULTILINESTRING/LINESTRINGs only,polygon/geometry collection will return empty geomtry collection)</param>
255255
/// <returns>A (set of) LineString(s) formed by sewing together the constituent line work of a MULTILINESTRING</returns>
@@ -263,7 +263,7 @@ public static NTSG STLineMerge(this NTSG geometry)
263263
/// Returns the geometry as a MULTI* geometry. If the geometry is already a MULTI*, it is returned unchanged
264264
/// </summary>
265265
/// <remarks>
266-
/// See https://postgis.net/docs/manual-3.0/ST_Multi.html
266+
/// See https://postgis.net/docs/ST_Multi.html
267267
/// </remarks>
268268
/// <param name="geometry">Input geometry</param>
269269
/// <returns>A MULTI* geometry</returns>
@@ -277,7 +277,7 @@ public static NTSG STMulti(this NTSG geometry)
277277
/// Returns geometry in its normalized/canonical form.
278278
/// </summary>
279279
/// <remarks>
280-
/// See https://postgis.net/docs/manual-3.0/ST_Normalize.html
280+
/// See https://postgis.net/docs/ST_Normalize.html
281281
/// </remarks>
282282
/// <param name="geometry">Input geometry</param>
283283
/// <returns>Normalized geometry</returns>
@@ -324,7 +324,7 @@ public static NTSG STQuantizeCoordinates(this NTSG geometry, int precision)
324324
/// Removes point from input geometry (LineString)
325325
/// </summary>
326326
/// <remarks>
327-
/// See https://postgis.net/docs/manual-3.0/ST_RemovePoint.html
327+
/// See https://postgis.net/docs/ST_RemovePoint.html
328328
/// </remarks>
329329
/// <param name="geometry">Input geometry (LineString)</param>
330330
/// <param name="index">Index of point to remove (zero-based)</param>
@@ -339,7 +339,7 @@ public static NTSG STRemovePoint(this NTSG geometry, int index) // TODO: test
339339
/// Returns geometry with reversed order of the vertexes.
340340
/// </summary>
341341
/// <remarks>
342-
/// See https://postgis.net/docs/manual-3.0/ST_Reverse.html
342+
/// See https://postgis.net/docs/ST_Reverse.html
343343
/// </remarks>
344344
/// <param name="geometry">Input geometry</param>
345345
/// <returns>Geometry with reversed order of the vertexes</returns>
@@ -383,7 +383,7 @@ public static NTSG STSegmentize(string geometry, double maxSegmentLength)
383383
/// Replace point of input geometry with given point.
384384
/// </summary>
385385
/// <remarks>
386-
/// See https://postgis.net/docs/manual-3.0/ST_SetPoint.html
386+
/// See https://postgis.net/docs/ST_SetPoint.html
387387
/// </remarks>
388388
/// <param name="geometry">Input geometry (LineString)</param>
389389
/// <param name="index">Index of point to remove (zero-based)</param>
@@ -399,7 +399,7 @@ public static NTSG STSetPoint(this NTSG geometry, int index, NTSG point)
399399
/// Snaps all points of input <paramref name="geometry"/> to the grid defined by its origin and cell size.
400400
/// </summary>
401401
/// <remarks>
402-
/// See https://postgis.net/docs/manual-3.0/ST_SnapToGrid.html
402+
/// See https://postgis.net/docs/ST_SnapToGrid.html
403403
/// </remarks>
404404
/// <param name="geometry">Input geometry.</param>
405405
/// <param name="originX">X coordinate of grid origin.</param>
@@ -417,7 +417,7 @@ public static NTSG STSnapToGrid(this NTSG geometry, double originX, double origi
417417
/// Snaps all points of input <paramref name="geometry"/> to the grid defined by its cell size.
418418
/// </summary>
419419
/// <remarks>
420-
/// See https://postgis.net/docs/manual-3.0/ST_SnapToGrid.html
420+
/// See https://postgis.net/docs/ST_SnapToGrid.html
421421
/// </remarks>
422422
/// <param name="geometry">Input geometry.</param>
423423
/// <param name="sizeX">Grid cell size by X axis.</param>
@@ -433,7 +433,7 @@ public static NTSG STSnapToGrid(this NTSG geometry, double sizeX, double sizeY)
433433
/// Snaps all points of input <paramref name="geometry"/> to the grid defined by its cell size.
434434
/// </summary>
435435
/// <remarks>
436-
/// See https://postgis.net/docs/manual-3.0/ST_SnapToGrid.html
436+
/// See https://postgis.net/docs/ST_SnapToGrid.html
437437
/// </remarks>
438438
/// <param name="geometry">Input geometry.</param>
439439
/// <param name="size">Grid cell size.</param>
@@ -448,7 +448,7 @@ public static NTSG STSnapToGrid(this NTSG geometry, double size)
448448
/// Snaps all points of input <paramref name="geometry"/> to the grid defined by its origin point and cell sizes.
449449
/// </summary>
450450
/// <remarks>
451-
/// See https://postgis.net/docs/manual-3.0/ST_SnapToGrid.html
451+
/// See https://postgis.net/docs/ST_SnapToGrid.html
452452
/// </remarks>
453453
/// <param name="geometry">Input geometry.</param>
454454
/// <param name="origin">Grid origin (Point).</param>
@@ -467,7 +467,7 @@ public static NTSG STSnapToGrid(this NTSG geometry, NTSG origin, double sizeX, d
467467
/// Snaps the vertices and segments of input <paramref name="geometry"/> to <paramref name="reference"/> geometry vertices.
468468
/// </summary>
469469
/// <remarks>
470-
/// See https://postgis.net/docs/manual-3.0/ST_Snap.html
470+
/// See https://postgis.net/docs/ST_Snap.html
471471
/// </remarks>
472472
/// <param name="geometry">Input geometry.</param>
473473
/// <param name="reference">Reference geometry.</param>
@@ -483,7 +483,7 @@ public static NTSG STSnap(this NTSG geometry, NTSG reference, double tolerance)
483483
/// Returns a version of input <paramref name="geometry"/> with given ordinates swapped.
484484
/// </summary>
485485
/// <remarks>
486-
/// See https://postgis.net/docs/manual-3.0/ST_SwapOrdinates.html
486+
/// See https://postgis.net/docs/ST_SwapOrdinates.html
487487
/// </remarks>
488488
/// <param name="geometry">Input geometry.</param>
489489
/// <param name="ordinates">Two-characters string naming the ordinates to swap. Valid names are: x,y,z and m.</param>
@@ -498,7 +498,7 @@ public static NTSG STSwapOrdinates(this NTSG geometry, string ordinates)
498498
/// Returns a version of input <paramref name="geometry"/> in text representation with given ordinates swapped.
499499
/// </summary>
500500
/// <remarks>
501-
/// See https://postgis.net/docs/manual-3.0/ST_SwapOrdinates.html
501+
/// See https://postgis.net/docs/ST_SwapOrdinates.html
502502
/// </remarks>
503503
/// <param name="geometry">Input geometry.</param>
504504
/// <param name="ordinates">Two-characters string naming the ordinates to swap. Valid names are: x,y,z and m.</param>

LinqToDBPostGisNetTopologySuite/GeometryInput.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ namespace LinqToDBPostGisNetTopologySuite
1010
/// Geometry Input.
1111
/// </summary>
1212
/// <remarks>
13-
/// 8.8. Geometry Input
13+
/// 5.8. Geometry Input
1414
/// https://postgis.net/docs/reference.html#Geometry_Inputs
1515
/// </remarks>
1616
public static class GeometryInput
1717
{
18-
#region 8.8.1. Well-Known Text (WKT)
18+
#region 5.8.1. Well-Known Text (WKT)
1919
/// <summary>
2020
/// Constructs the geometry (Polygon) from arbitrary collection of closed LineStrings as MultiLineString Well-Known Text representation.
2121
/// </summary>
@@ -337,9 +337,9 @@ public static NTSG STWKTToSQL(string wkt)
337337
{
338338
throw new InvalidOperationException();
339339
}
340-
#endregion 8.8.1. Well-Known Text (WKT)
340+
#endregion 5.8.1. Well-Known Text (WKT)
341341

342-
#region 8.8.2. Well-Known Binary (WKB)
342+
#region 5.8.2. Well-Known Binary (WKB)
343343
// TODO: geography ST_GeogFromWKB(bytea wkb);
344344

345345
/// <summary>
@@ -485,9 +485,9 @@ public static NTSG STWKBToSQL(byte[] wkb)
485485
{
486486
throw new InvalidOperationException();
487487
}
488-
#endregion 8.8.2. Well-Known Binary (WKB)
488+
#endregion 5.8.2. Well-Known Binary (WKB)
489489

490-
#region 8.8.3. Other Formats
490+
#region 5.8.3. Other Formats
491491
// TODO: ST_Box2dFromGeoHash return type NTS mapping?
492492
// https://github.com/npgsql/efcore.pg/issues/1313#issuecomment-635202797
493493

@@ -679,6 +679,6 @@ public static NTSG STPointFromGeoHash(string geoHash, int precision)
679679
{
680680
throw new InvalidOperationException();
681681
}
682-
#endregion 8.8.3. Other Formats
682+
#endregion 5.8.3. Other Formats
683683
}
684684
}

LinqToDBPostGisNetTopologySuite/GeometryOutput.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ namespace LinqToDBPostGisNetTopologySuite
1010
/// Geometry Output.
1111
/// </summary>
1212
/// <remarks>
13-
/// 8.9. Geometry Output
13+
/// 5.9. Geometry Output
1414
/// https://postgis.net/docs/reference.html#Geometry_Outputs
1515
/// </remarks>
1616
public static class GeometryOutput
1717
{
18-
#region 8.9.1. Well-Known Text (WKT)
18+
#region 5.9.1. Well-Known Text (WKT)
1919
/// <summary>
2020
/// Returns the Extended Well-Known Text (EWKT) representation of input <paramref name="geometry"/>.
2121
/// </summary>
@@ -92,9 +92,9 @@ public static string STAsText(this NTSG geometry, int maxDecimalDigits)
9292
{
9393
throw new InvalidOperationException();
9494
}
95-
#endregion 8.9.1. Well-Known Text (WKT)
95+
#endregion 5.9.1. Well-Known Text (WKT)
9696

97-
#region 8.9.2. Well-Known Binary (WKB)
97+
#region 5.9.2. Well-Known Binary (WKB)
9898
/// <summary>
9999
/// Returns the Well-Known Binary (WKB) representation of input <paramref name="geometry"/>.
100100
/// </summary>
@@ -214,9 +214,9 @@ public static string STAsHEXEWKB(string geometry, string encoding)
214214
{
215215
throw new InvalidOperationException();
216216
}
217-
#endregion 8.9.2. Well-Known Binary (WKB)
217+
#endregion 5.9.2. Well-Known Binary (WKB)
218218

219-
#region 8.9.3. Other Formats
219+
#region 5.9.3. Other Formats
220220
/// <summary>
221221
/// Returns the Encoded Polyline representation of input <paramref name="geometry"/>.
222222
/// </summary>
@@ -606,6 +606,6 @@ public static string STGeoHash(this NTSG geometry, int maxchars)
606606
{
607607
throw new InvalidOperationException();
608608
}
609-
#endregion 8.9.3. Other Formats
609+
#endregion 5.9.3. Other Formats
610610
}
611611
}

0 commit comments

Comments
 (0)