From 7770918b99d7dc0bab54ad19b3d22d849ba9071d Mon Sep 17 00:00:00 2001 From: Henry Roeland Date: Mon, 8 Jul 2024 22:24:16 +0200 Subject: [PATCH] Fixing build issue with Atanh and fixing some build warnings (#120) --- src/ProjNet/CoordinateSystemServices.cs | 26 +++++++++++++++++++ .../CoordinateSystemFactory.cs | 7 ++--- src/ProjNet/CoordinateSystems/Info.cs | 2 +- .../Projections/MapProjection.cs | 20 ++++++++++++++ .../PolarStereographicProjection.cs | 13 +++++++++- .../Transformations/GeographicTransform.cs | 6 +++++ .../CoordinateSystems/VerticalDatum.cs | 3 +++ 7 files changed, 70 insertions(+), 7 deletions(-) diff --git a/src/ProjNet/CoordinateSystemServices.cs b/src/ProjNet/CoordinateSystemServices.cs index 84c992f..94fd8e3 100644 --- a/src/ProjNet/CoordinateSystemServices.cs +++ b/src/ProjNet/CoordinateSystemServices.cs @@ -305,6 +305,11 @@ public ICoordinateTransformation CreateTransformation(CoordinateSystem source, C return _ctFactory.CreateFromCoordinateSystems(source, target); } + /// + /// AddCoordinateSystem + /// + /// + /// protected void AddCoordinateSystem(int srid, CoordinateSystem coordinateSystem) { lock (((IDictionary) _csBySrid).SyncRoot) @@ -332,6 +337,11 @@ protected void AddCoordinateSystem(int srid, CoordinateSystem coordinateSystem) } } + /// + /// AddCoordinateSystem + /// + /// + /// protected virtual int AddCoordinateSystem(CoordinateSystem coordinateSystem) { int srid = (int) coordinateSystem.AuthorityCode; @@ -340,11 +350,17 @@ protected virtual int AddCoordinateSystem(CoordinateSystem coordinateSystem) return srid; } + /// + /// Clear + /// protected void Clear() { _csBySrid.Clear(); } + /// + /// Count + /// protected int Count { get @@ -354,11 +370,21 @@ protected int Count } } + /// + /// RemoveCoordinateSystem + /// + /// + /// + /// public bool RemoveCoordinateSystem(int srid) { throw new NotSupportedException(); } + /// + /// GetEnumerator + /// + /// public IEnumerator> GetEnumerator() { _initialization.WaitOne(); diff --git a/src/ProjNet/CoordinateSystems/CoordinateSystemFactory.cs b/src/ProjNet/CoordinateSystems/CoordinateSystemFactory.cs index 044bb6c..28d831d 100644 --- a/src/ProjNet/CoordinateSystems/CoordinateSystemFactory.cs +++ b/src/ProjNet/CoordinateSystems/CoordinateSystemFactory.cs @@ -27,11 +27,8 @@ namespace ProjNet.CoordinateSystems /// /// /// CoordinateSystemFactory allows applications to make coordinate systems that - /// cannot be created by a . This factory is very - /// flexible, whereas the authority factory is easier to use. - /// So can be used to make 'standard' coordinate - /// systems, and can be used to make 'special' - /// coordinate systems. + /// is very flexible, whereas the other factories are easier to use. + /// So this Factory can be used to make 'special' coordinate systems. /// For example, the EPSG authority has codes for USA state plane coordinate systems /// using the NAD83 datum, but these coordinate systems always use meters. EPSG does not /// have codes for NAD83 state plane coordinate systems that use feet units. This factory diff --git a/src/ProjNet/CoordinateSystems/Info.cs b/src/ProjNet/CoordinateSystems/Info.cs index edab9a5..56caa3e 100644 --- a/src/ProjNet/CoordinateSystems/Info.cs +++ b/src/ProjNet/CoordinateSystems/Info.cs @@ -35,7 +35,7 @@ public abstract class Info : IInfo /// were specified in the Simple Features interfaces, so they have been kept here. /// This specification does not dictate what the contents of these items /// should be. However, the following guidelines are suggested: - /// When is used to create an object, the ‘Authority’ + /// When is used to create an object, the ‘Authority’ /// and 'AuthorityCode' values should be set to the authority name of the factory object, and the authority /// code supplied by the client, respectively. The other values may or may not be set. (If the authority is /// EPSG, the implementer may consider using the corresponding metadata values in the EPSG tables.) diff --git a/src/ProjNet/CoordinateSystems/Projections/MapProjection.cs b/src/ProjNet/CoordinateSystems/Projections/MapProjection.cs index a369567..4dac204 100644 --- a/src/ProjNet/CoordinateSystems/Projections/MapProjection.cs +++ b/src/ProjNet/CoordinateSystems/Projections/MapProjection.cs @@ -49,10 +49,19 @@ namespace ProjNet.CoordinateSystems.Projections [Serializable] public abstract class MapProjection : MathTransform, IProjection { + /// + /// EPS10 => 1e-10. + /// protected const double EPS10 = 1e-10; + /// + /// EPS7 => 1e-7. + /// protected const double EPS7 = 1e-7; + /// + /// HUGE_VAL => double.NaN. + /// protected const double HUGE_VAL = double.NaN; // ReSharper disable InconsistentNaming @@ -1154,6 +1163,11 @@ protected static double LatitudeToRadians(double y, bool edge) private const double P20 = 0.01677689594356261023; /* 761 / 45360 */ + /// + /// authset + /// + /// + /// protected static double[] authset(double es) { double[] APA = new double[3]; @@ -1169,6 +1183,12 @@ protected static double[] authset(double es) return APA; } + /// + /// authlat + /// + /// + /// + /// protected static double authlat(double beta, double[] APA) { double t = beta + beta; diff --git a/src/ProjNet/CoordinateSystems/Projections/PolarStereographicProjection.cs b/src/ProjNet/CoordinateSystems/Projections/PolarStereographicProjection.cs index 703f13a..42692a9 100644 --- a/src/ProjNet/CoordinateSystems/Projections/PolarStereographicProjection.cs +++ b/src/ProjNet/CoordinateSystems/Projections/PolarStereographicProjection.cs @@ -212,7 +212,18 @@ public override MathTransform Inverse() private double tsfn(double cosphi, double sinphi, double e) { double t = (sinphi > 0.0) ? cosphi / (1.0 + sinphi) : (1.0 - sinphi) / cosphi; - return Math.Exp(e * Math.Atanh(e * sinphi)) * t; + return Math.Exp(e * Atanh(e * sinphi)) * t; + } + + + /// + /// Atanh - Inverse of Math.Tanh + /// + /// The Math.Atanh is not available for netstandard2.0. + /// + private static double Atanh(double x) + { + return Math.Log((1 + x) / (1 - x)) * 0.5; } } } diff --git a/src/ProjNet/CoordinateSystems/Transformations/GeographicTransform.cs b/src/ProjNet/CoordinateSystems/Transformations/GeographicTransform.cs index 88766d0..bc419a8 100644 --- a/src/ProjNet/CoordinateSystems/Transformations/GeographicTransform.cs +++ b/src/ProjNet/CoordinateSystems/Transformations/GeographicTransform.cs @@ -65,11 +65,17 @@ public override string XML } } + /// + /// DimSource + /// public override int DimSource { get { return SourceGCS.Dimension; } } + /// + /// DimTarget + /// public override int DimTarget { get { return TargetGCS.Dimension; } diff --git a/src/ProjNet/CoordinateSystems/VerticalDatum.cs b/src/ProjNet/CoordinateSystems/VerticalDatum.cs index f2634f4..8705bdb 100644 --- a/src/ProjNet/CoordinateSystems/VerticalDatum.cs +++ b/src/ProjNet/CoordinateSystems/VerticalDatum.cs @@ -24,6 +24,9 @@ public VerticalDatum(DatumType type, string name, string authority, long code, s { } + /// + /// ODN - VerticalDatum + /// public static VerticalDatum ODN { get