Skip to content
This repository was archived by the owner on Jun 22, 2023. It is now read-only.

Commit efbfb9c

Browse files
authored
Remove all obsolete items and item members (#54) (#56)
* Remove all obolete items and item members (#54) The following items are removed: * GeoAPI.Geometries.ICoordinate * GeoAPI.Geometries.IEnvelope * GeoAPI.Operation.Buffer.BufferStyle The folling members were removed: * Envelope.Overlaps * IMultiLineString.Reversed * ICoordinateSequence.Reversed * IGeometry.Equals * IGeometryFactory.CreateMultiLineString(CoordinateXY[]) * minor changes to Interval * Changed IMathTransform to use CoordinateXY * Add IComparable, ICloneable to CoordinateXY due to removal of ICoordinate * Fix semantics of CompareTo according to #58 * Remove unused delegate from IGeometryServices * Update referenced NuGet packages Unit test have been adapted; Fixes #31 Fixes #54 Fixes #58
1 parent fc8494e commit efbfb9c

20 files changed

+274
-1658
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,4 @@ FakesAssemblies/
189189
*.old
190190
*.lock.json
191191
_pj_tmp_/
192+
/.idea/

GeoAPI.sln.DotSettings

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SRID/@EntryIndexedValue">SRID</s:String>
23
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=XY/@EntryIndexedValue">XY</s:String>
34
<s:Boolean x:Key="/Default/UserDictionary/Words/=XYZM/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

src/GeoAPI.CoordinateSystems/CoordinateSystems/Transformations/IMathTransform.cs

+3-11
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
namespace GeoAPI.CoordinateSystems.Transformations
2323
{
2424
/// <summary>
25-
/// Transforms muti-dimensional coordinate points.
25+
/// Transforms multi-dimensional coordinate points.
2626
/// </summary>
2727
/// <remarks>
2828
/// If a client application wishes to query the source and target coordinate
@@ -131,15 +131,7 @@ public interface IMathTransform
131131
/// </summary>
132132
/// <param name="coordinate">The coordinate to transform</param>
133133
/// <returns>The transformed coordinate</returns>
134-
[Obsolete("Use Coordinate Transform(Coordinate coordinate) instead.")]
135-
ICoordinate Transform(ICoordinate coordinate);
136-
137-
/// <summary>
138-
/// Transforms a a coordinate. The input coordinate remains unchanged.
139-
/// </summary>
140-
/// <param name="coordinate">The coordinate to transform</param>
141-
/// <returns>The transformed coordinate</returns>
142-
Coordinate Transform(Coordinate coordinate);
134+
CoordinateXY Transform(CoordinateXY coordinate);
143135

144136

145137
/// <summary>
@@ -178,7 +170,7 @@ public interface IMathTransform
178170
/// </remarks>
179171
/// <param name="points"></param>
180172
/// <returns></returns>
181-
IList<Coordinate> TransformList(IList<Coordinate> points);
173+
IList<CoordinateXY> TransformList(IList<CoordinateXY> points);
182174

183175

184176
/// <summary>

src/GeoAPI/DataStructures/Interval.cs

+4-50
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,6 @@ private Interval(double min, double max)
4444
Max = max;
4545
}
4646

47-
// /// <summary>
48-
// /// Method to expand
49-
// /// </summary>
50-
// /// <param name="p"></param>
51-
// /// <returns></returns>
52-
// public void ExpandByValue(double p)
53-
// {
54-
//#if picky
55-
// // This is not a valid value, ignore it
56-
// if (p.Equals(Coordinate.NullOrdinate))
57-
// return;
58-
59-
// // This interval has not seen a valid ordinate
60-
// if (Min.Equals(Coordinate.NullOrdinate))
61-
// return;
62-
//#endif
63-
// Min = p < Min ? p : Min;
64-
// Max = p > Max ? p : Max;
65-
// }
66-
6747
/// <summary>
6848
/// Method to expand
6949
/// </summary>
@@ -158,32 +138,6 @@ public Interval ExpandedByInterval(Interval interval)
158138
return new Interval(min, max);
159139
}
160140

161-
///// <summary>
162-
///// Function to compute an interval that contains this and <paramref name="interval"/> <see cref="Interval"/>
163-
///// </summary>
164-
///// <param name="interval">The interval</param>
165-
///// <returns>An interval</returns>
166-
//public void ExpandByInterval(Interval interval)
167-
//{
168-
// if (IsEmpty && interval.IsEmpty)
169-
// return;
170-
171-
// if (!IsEmpty && interval.IsEmpty)
172-
// return;
173-
174-
// if (IsEmpty)
175-
// {
176-
// Min = interval.Min;
177-
// Max = interval.Max;
178-
// }
179-
// else
180-
// {
181-
// Min = Min < interval.Min ? Min : interval.Min;
182-
// Max = Max > interval.Max ? Max : interval.Max;
183-
// }
184-
//}
185-
186-
187141
/// <summary>
188142
/// Function to test if this <see cref="Interval"/> overlaps <paramref name="interval"/>.
189143
/// </summary>
@@ -197,7 +151,7 @@ public bool Overlaps(Interval interval)
197151
/// <summary>
198152
/// Function to test if this <see cref="Interval"/> overlaps the interval &#x211d;[<paramref name="min"/>, <paramref name="max"/>].
199153
/// </summary>
200-
/// <param name="min">The mimimum value of the interval</param>
154+
/// <param name="min">The minimum value of the interval</param>
201155
/// <param name="max">The maximum value of the interval</param>
202156
/// <returns><c>true</c> if this interval overlaps the interval &#x211d;[<paramref name="min"/>, <paramref name="max"/>]</returns>
203157
public bool Overlaps(double min, double max)
@@ -220,7 +174,7 @@ public bool Contains(Interval interval)
220174
/// Function to test if this <see cref="Interval"/> contains the interval &#x211d;[<paramref name="min"/>, <paramref name="max"/>].
221175
/// </summary>
222176
/// <remarks>This is more rigid than <see cref="Overlaps(double, double)"/></remarks>
223-
/// <param name="min">The mimimum value of the interval</param>
177+
/// <param name="min">The minimum value of the interval</param>
224178
/// <param name="max">The maximum value of the interval</param>
225179
/// <returns><c>true</c> if this interval contains the interval &#x211d;[<paramref name="min"/>, <paramref name="max"/>]</returns>
226180
public bool Contains(double min, double max)
@@ -252,7 +206,7 @@ public bool Intersects(Interval other)
252206
/// <summary>
253207
/// Function to test if this <see cref="Interval"/> intersects the interval &#x211d;[<paramref name="min"/>, <paramref name="max"/>].
254208
/// </summary>
255-
/// <param name="min">The mimimum value of the interval</param>
209+
/// <param name="min">The minimum value of the interval</param>
256210
/// <param name="max">The maximum value of the interval</param>
257211
/// <returns><value>true</value> if this interval intersects the interval &#x211d;[<paramref name="min"/>, <paramref name="max"/>].</returns>
258212
public bool Intersects(double min, double max)
@@ -261,7 +215,7 @@ public bool Intersects(double min, double max)
261215
}
262216

263217
/// <summary>
264-
/// Creates an empty or uninitialzed Interval
218+
/// Creates an empty or uninitialized Interval
265219
/// </summary>
266220
/// <returns>An empty or uninitialized <see cref="Interval"/></returns>
267221
public static Interval Create()

src/GeoAPI/Geometries/Coordinate.cs

+8-212
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace GeoAPI.Geometries
3030
#endif
3131
[Obsolete("Use concrete classes like CoordinateXY, CoordinateXYM, CoordinateXYZ or CoordinateXYZM")]
3232
#pragma warning disable 612,618
33-
public class Coordinate : ICoordinate, IComparable<Coordinate>
33+
public class Coordinate : IComparable<Coordinate>
3434
{
3535

3636
///<summary>
@@ -82,14 +82,6 @@ public Coordinate(double x, double y, double z)
8282
/// </summary>
8383
public Coordinate() : this(0.0, 0.0, NullOrdinate) { }
8484

85-
/// <summary>
86-
/// Constructs a <c>Coordinate</c> having the same (x,y,z) values as
87-
/// <c>other</c>.
88-
/// </summary>
89-
/// <param name="c"><c>Coordinate</c> to copy.</param>
90-
[Obsolete]
91-
public Coordinate(ICoordinate c) : this(c.X, c.Y, c.Z) { }
92-
9385
/// <summary>
9486
/// Constructs a <c>Coordinate</c> having the same (x,y,z) values as
9587
/// <c>other</c>.
@@ -201,18 +193,14 @@ private static bool EqualsWithTolerance(double v1, double v2, double tolerance)
201193
/// </summary>
202194
/// <param name="other"><c>Coordinate</c> with which to do the comparison.</param>
203195
/// <returns><c>true</c> if <c>other</c> is a <c>Coordinate</c> with the same values for the x and y ordinates.</returns>
204-
public override bool Equals(object other)
196+
public override bool Equals(object o)
205197
{
206-
if (other == null)
207-
return false;
208-
var otherC = other as Coordinate;
209-
if (otherC != null)
210-
return Equals(otherC);
211-
#pragma warning disable 612,618
212-
if (!(other is ICoordinate))
213-
return false;
214-
return ((ICoordinate)this).Equals((ICoordinate)other);
215-
#pragma warning restore 612,618
198+
if (o is Coordinate other)
199+
return Equals(other);
200+
if (o is CoordinateXY otherXY)
201+
return ((CoordinateXY) this).Equals(otherXY);
202+
203+
return false;
216204
}
217205

218206
/// <summary>
@@ -337,16 +325,6 @@ public virtual Coordinate Copy()
337325
return new Coordinate(X, Y, Z);
338326
}
339327

340-
/// <summary>
341-
/// Create a new object as copy of this instance.
342-
/// </summary>
343-
/// <returns></returns>
344-
[Obsolete("Use Copy")]
345-
public object Clone()
346-
{
347-
return MemberwiseClone();
348-
}
349-
350328
/// <summary>
351329
/// Computes the 2-dimensional Euclidean distance to another location.
352330
/// </summary>
@@ -403,188 +381,6 @@ public static int GetHashCode(double value)
403381
*/
404382
}
405383

406-
#region ICoordinate
407-
408-
/// <summary>
409-
/// X coordinate.
410-
/// </summary>
411-
[Obsolete]
412-
double ICoordinate.X
413-
{
414-
get { return X; }
415-
set { X = value; }
416-
}
417-
418-
/// <summary>
419-
/// Y coordinate.
420-
/// </summary>
421-
[Obsolete]
422-
double ICoordinate.Y
423-
{
424-
get { return Y; }
425-
set { Y = value; }
426-
}
427-
428-
/// <summary>
429-
/// Z coordinate.
430-
/// </summary>
431-
[Obsolete]
432-
double ICoordinate.Z
433-
{
434-
get { return Z; }
435-
set { Z = value; }
436-
}
437-
438-
/// <summary>
439-
/// The measure value
440-
/// </summary>
441-
[Obsolete]
442-
double ICoordinate.M
443-
{
444-
get { return NullOrdinate; }
445-
set { }
446-
}
447-
448-
/// <summary>
449-
/// Gets/Sets <c>Coordinate</c>s (x,y,z) values.
450-
/// </summary>
451-
[Obsolete]
452-
ICoordinate ICoordinate.CoordinateValue
453-
{
454-
get { return this; }
455-
set
456-
{
457-
X = value.X;
458-
Y = value.Y;
459-
Z = value.Z;
460-
}
461-
}
462-
463-
/// <summary>
464-
/// Gets/Sets the ordinate value for a given index
465-
/// </summary>
466-
/// <param name="index">The index of the ordinate</param>
467-
/// <returns>The ordinate value</returns>
468-
[Obsolete]
469-
Double ICoordinate.this[Ordinate index]
470-
{
471-
get
472-
{
473-
switch (index)
474-
{
475-
case Ordinate.X:
476-
return X;
477-
case Ordinate.Y:
478-
return Y;
479-
case Ordinate.Z:
480-
return Z;
481-
default:
482-
return NullOrdinate;
483-
}
484-
}
485-
set
486-
{
487-
switch (index)
488-
{
489-
case Ordinate.X:
490-
X = value;
491-
break;
492-
case Ordinate.Y:
493-
Y = value;
494-
break;
495-
case Ordinate.Z:
496-
Z = value;
497-
break;
498-
}
499-
}
500-
}
501-
502-
/// <summary>
503-
/// Returns whether the planar projections of the two <c>Coordinate</c>s are equal.
504-
///</summary>
505-
/// <param name="other"><c>Coordinate</c> with which to do the 2D comparison.</param>
506-
/// <returns>
507-
/// <c>true</c> if the x- and y-coordinates are equal;
508-
/// the Z coordinates do not have to be equal.
509-
/// </returns>
510-
[Obsolete]
511-
bool ICoordinate.Equals2D(ICoordinate other)
512-
{
513-
return X == other.X && Y == other.Y;
514-
}
515-
516-
/// <summary>
517-
/// Compares this object with the specified object for order.
518-
/// Since Coordinates are 2.5D, this routine ignores the z value when making the comparison.
519-
/// Returns
520-
/// -1 : this.x lowerthan other.x || ((this.x == other.x) AND (this.y lowerthan other.y))
521-
/// 0 : this.x == other.x AND this.y = other.y
522-
/// 1 : this.x greaterthan other.x || ((this.x == other.x) AND (this.y greaterthan other.y))
523-
/// </summary>
524-
/// <param name="other"><c>Coordinate</c> with which this <c>Coordinate</c> is being compared.</param>
525-
/// <returns>
526-
/// A negative integer, zero, or a positive integer as this <c>Coordinate</c>
527-
/// is less than, equal to, or greater than the specified <c>Coordinate</c>.
528-
/// </returns>
529-
[Obsolete]
530-
int IComparable<ICoordinate>.CompareTo(ICoordinate other)
531-
{
532-
if (X < other.X)
533-
return -1;
534-
if (X > other.X)
535-
return 1;
536-
if (Y < other.Y)
537-
return -1;
538-
return Y > other.Y ? 1 : 0;
539-
}
540-
541-
/// <summary>
542-
/// Compares this object with the specified object for order.
543-
/// Since Coordinates are 2.5D, this routine ignores the z value when making the comparison.
544-
/// Returns
545-
/// -1 : this.x lowerthan other.x || ((this.x == other.x) AND (this.y lowerthan other.y))
546-
/// 0 : this.x == other.x AND this.y = other.y
547-
/// 1 : this.x greaterthan other.x || ((this.x == other.x) AND (this.y greaterthan other.y))
548-
/// </summary>
549-
/// <param name="o"><c>Coordinate</c> with which this <c>Coordinate</c> is being compared.</param>
550-
/// <returns>
551-
/// A negative integer, zero, or a positive integer as this <c>Coordinate</c>
552-
/// is less than, equal to, or greater than the specified <c>Coordinate</c>.
553-
/// </returns>
554-
int IComparable.CompareTo(object o)
555-
{
556-
var other = (Coordinate)o;
557-
return CompareTo(other);
558-
}
559-
560-
/// <summary>
561-
/// Returns <c>true</c> if <c>other</c> has the same values for x, y and z.
562-
/// </summary>
563-
/// <param name="other"><c>Coordinate</c> with which to do the 3D comparison.</param>
564-
/// <returns><c>true</c> if <c>other</c> is a <c>Coordinate</c> with the same values for x, y and z.</returns>
565-
[Obsolete]
566-
bool ICoordinate.Equals3D(ICoordinate other)
567-
{
568-
return (X == other.X) && (Y == other.Y) &&
569-
((Z == other.Z) || (Double.IsNaN(Z) && Double.IsNaN(other.Z)));
570-
}
571-
572-
/// <summary>
573-
/// Computes the 2-dimensional Euclidean distance to another location.
574-
/// The Z-ordinate is ignored.
575-
/// </summary>
576-
/// <param name="p"><c>Coordinate</c> with which to do the distance comparison.</param>
577-
/// <returns>the 2-dimensional Euclidean distance between the locations</returns>
578-
[Obsolete]
579-
double ICoordinate.Distance(ICoordinate p)
580-
{
581-
var dx = X - p.X;
582-
var dy = Y - p.Y;
583-
return Math.Sqrt(dx * dx + dy * dy);
584-
}
585-
586-
#endregion ICoordinate
587-
588384
/// <summary>
589385
/// Implicit conversion operator to get a <see cref="CoordinateXY"/> from a <see cref="Coordinate"/>.
590386
/// </summary>

0 commit comments

Comments
 (0)