Skip to content

Commit

Permalink
Fixing build issue with Atanh and fixing some build warnings (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
driekus77 authored Jul 8, 2024
1 parent 246879e commit 7770918
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 7 deletions.
26 changes: 26 additions & 0 deletions src/ProjNet/CoordinateSystemServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ public ICoordinateTransformation CreateTransformation(CoordinateSystem source, C
return _ctFactory.CreateFromCoordinateSystems(source, target);
}

/// <summary>
/// AddCoordinateSystem
/// </summary>
/// <param name="srid"></param>
/// <param name="coordinateSystem"></param>
protected void AddCoordinateSystem(int srid, CoordinateSystem coordinateSystem)
{
lock (((IDictionary) _csBySrid).SyncRoot)
Expand Down Expand Up @@ -332,6 +337,11 @@ protected void AddCoordinateSystem(int srid, CoordinateSystem coordinateSystem)
}
}

/// <summary>
/// AddCoordinateSystem
/// </summary>
/// <param name="coordinateSystem"></param>
/// <returns></returns>
protected virtual int AddCoordinateSystem(CoordinateSystem coordinateSystem)
{
int srid = (int) coordinateSystem.AuthorityCode;
Expand All @@ -340,11 +350,17 @@ protected virtual int AddCoordinateSystem(CoordinateSystem coordinateSystem)
return srid;
}

/// <summary>
/// Clear
/// </summary>
protected void Clear()
{
_csBySrid.Clear();
}

/// <summary>
/// Count
/// </summary>
protected int Count
{
get
Expand All @@ -354,11 +370,21 @@ protected int Count
}
}

/// <summary>
/// RemoveCoordinateSystem
/// </summary>
/// <param name="srid"></param>
/// <returns></returns>
/// <exception cref="NotSupportedException"></exception>
public bool RemoveCoordinateSystem(int srid)
{
throw new NotSupportedException();
}

/// <summary>
/// GetEnumerator
/// </summary>
/// <returns></returns>
public IEnumerator<KeyValuePair<int, CoordinateSystem>> GetEnumerator()
{
_initialization.WaitOne();
Expand Down
7 changes: 2 additions & 5 deletions src/ProjNet/CoordinateSystems/CoordinateSystemFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ namespace ProjNet.CoordinateSystems
/// </summary>
/// <remarks>
/// <para>CoordinateSystemFactory allows applications to make coordinate systems that
/// cannot be created by a <see cref="CoordinateSystemAuthorityFactory"/>. This factory is very
/// flexible, whereas the authority factory is easier to use.</para>
/// <para>So <see cref="ICoordinateSystemAuthorityFactory"/>can be used to make 'standard' coordinate
/// systems, and <see cref="CoordinateSystemFactory"/> can be used to make 'special'
/// coordinate systems.</para>
/// is very flexible, whereas the other factories are easier to use.</para>
/// <para>So this Factory can be used to make 'special' coordinate systems.</para>
/// <para>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
Expand Down
2 changes: 1 addition & 1 deletion src/ProjNet/CoordinateSystems/Info.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public abstract class Info : IInfo
/// were specified in the Simple Features interfaces, so they have been kept here.</para>
/// <para>This specification does not dictate what the contents of these items
/// should be. However, the following guidelines are suggested:</para>
/// <para>When <see cref="ICoordinateSystemAuthorityFactory"/> is used to create an object, the ‘Authority’
/// <para>When <see href="ICoordinateSystemAuthorityFactory"/> 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.)</para>
Expand Down
20 changes: 20 additions & 0 deletions src/ProjNet/CoordinateSystems/Projections/MapProjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,19 @@ namespace ProjNet.CoordinateSystems.Projections
[Serializable]
public abstract class MapProjection : MathTransform, IProjection
{
/// <summary>
/// EPS10 => 1e-10.
/// </summary>
protected const double EPS10 = 1e-10;

/// <summary>
/// EPS7 => 1e-7.
/// </summary>
protected const double EPS7 = 1e-7;

/// <summary>
/// HUGE_VAL => double.NaN.
/// </summary>
protected const double HUGE_VAL = double.NaN;

// ReSharper disable InconsistentNaming
Expand Down Expand Up @@ -1154,6 +1163,11 @@ protected static double LatitudeToRadians(double y, bool edge)
private const double P20 = 0.01677689594356261023; /* 761 / 45360 */


/// <summary>
/// authset
/// </summary>
/// <param name="es"></param>
/// <returns></returns>
protected static double[] authset(double es)
{
double[] APA = new double[3];
Expand All @@ -1169,6 +1183,12 @@ protected static double[] authset(double es)
return APA;
}

/// <summary>
/// authlat
/// </summary>
/// <param name="beta"></param>
/// <param name="APA"></param>
/// <returns></returns>
protected static double authlat(double beta, double[] APA)
{
double t = beta + beta;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


/// <summary>
/// Atanh - Inverse of Math.Tanh
/// </summary>
/// <remarks>The Math.Atanh is not available for netstandard2.0.</remarks>
/// <param name="x"></param>
private static double Atanh(double x)
{
return Math.Log((1 + x) / (1 - x)) * 0.5;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,17 @@ public override string XML
}
}

/// <summary>
/// DimSource
/// </summary>
public override int DimSource
{
get { return SourceGCS.Dimension; }
}

/// <summary>
/// DimTarget
/// </summary>
public override int DimTarget
{
get { return TargetGCS.Dimension; }
Expand Down
3 changes: 3 additions & 0 deletions src/ProjNet/CoordinateSystems/VerticalDatum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public VerticalDatum(DatumType type, string name, string authority, long code, s
{
}

/// <summary>
/// ODN - VerticalDatum
/// </summary>
public static VerticalDatum ODN
{
get
Expand Down

0 comments on commit 7770918

Please sign in to comment.