Skip to content

Commit

Permalink
Height to Elevation changed; ISrtmData used;
Browse files Browse the repository at this point in the history
  • Loading branch information
alpinechough committed Feb 19, 2017
1 parent 50a16ae commit 54149a5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Alpinechough.Srtm.csproj
Expand Up @@ -3,13 +3,13 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{CD10A6E7-745F-4C82-9AAB-C5AA90944195}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Alpinechough.Srtm</RootNamespace>
<AssemblyName>Alpinechough.Srtm</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
6 changes: 3 additions & 3 deletions ISrtmData.cs
Expand Up @@ -36,18 +36,18 @@ public interface ISrtmData
void Unload ();

/// <summary>
/// Gets the height.
/// Gets the elevation.
/// </summary>
/// <returns>
/// The height. Null, if height is not available.
/// The height. Null, if elevation is not available.
/// </returns>
/// <param name='coordinates'>
/// Coordinates.
/// </param>
/// <exception cref='Exception'>
/// Represents errors that occur during application execution.
/// </exception>
int? GetHeight (IGeographicalCoordinates coordinates);
int? GetElevation (IGeographicalCoordinates coordinates);
}
}

12 changes: 6 additions & 6 deletions SrtmData.cs
Expand Up @@ -34,7 +34,7 @@ namespace Alpinechough.Srtm
/// <exception cref='DirectoryNotFoundException'>
/// Is thrown when part of a file or directory argument cannot be found.
/// </exception>
public class SrtmData
public class SrtmData : ISrtmData
{
#region Lifecycle

Expand Down Expand Up @@ -89,18 +89,18 @@ public void Unload ()
}

/// <summary>
/// Gets the height.
/// Gets the elevation.
/// </summary>
/// <returns>
/// The height. Null, if height is not available.
/// The height. Null, if elevation is not available.
/// </returns>
/// <param name='coordinates'>
/// Coordinates.
/// </param>
/// <exception cref='Exception'>
/// Represents errors that occur during application execution.
/// </exception>
public int? GetHeight (IGeographicalCoordinates coordinates)
public int? GetElevation (IGeographicalCoordinates coordinates)
{
int cellLatitude = (int)Math.Floor (Math.Abs (coordinates.Latitude));
if (coordinates.Latitude < 0)
Expand All @@ -118,7 +118,7 @@ public void Unload ()

SrtmDataCell dataCell = DataCells.Where (dc => dc.Latitude == cellLatitude && dc.Longitude == cellLongitude).FirstOrDefault ();
if (dataCell != null)
return dataCell.GetHeight (coordinates);
return dataCell.GetElevation (coordinates);

string filename = string.Format ("{0}{1:D2}{2}{3:D3}.hgt",
cellLatitude < 0 ? "S" : "N",
Expand All @@ -133,7 +133,7 @@ public void Unload ()

dataCell = new SrtmDataCell (filePath);
DataCells.Add (dataCell);
return dataCell.GetHeight (coordinates);
return dataCell.GetElevation (coordinates);
}

#endregion
Expand Down
11 changes: 5 additions & 6 deletions SrtmDataCell.cs
Expand Up @@ -133,19 +133,18 @@ public SrtmDataCell (string filepath)
#region Public Methods

/// <summary>
/// Gets the height.
/// Gets the elevation.
/// </summary>
/// <returns>
/// The height.
/// The height. Null, if elevation is not available.
/// </returns>
/// <param name='coordinates'>
/// Coordinates.
/// </param>
/// <exception cref='ArgumentOutOfRangeException'>
/// Is thrown when an argument passed to a method is invalid because it is outside the allowable range of values as
/// specified by the method.
/// <exception cref='Exception'>
/// Represents errors that occur during application execution.
/// </exception>
public int? GetHeight (IGeographicalCoordinates coordinates)
public int? GetElevation (IGeographicalCoordinates coordinates)
{
int localLat = (int)((coordinates.Latitude - Latitude) * PointsPerCell);
int localLon = (int)(((coordinates.Longitude - Longitude)) * PointsPerCell);
Expand Down

0 comments on commit 54149a5

Please sign in to comment.