Skip to content

Commit

Permalink
Adds precision options for both L/L formats
Browse files Browse the repository at this point in the history
Adds precision argument for GetLLString functions
Moves MGRS precision next to MGRS output
Adjusts Tabstop indices to be consistent with new layout
  • Loading branch information
FalcoGer committed Sep 20, 2023
1 parent 7b1b510 commit 9d2d7dd
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 66 deletions.
14 changes: 7 additions & 7 deletions CoordinateConverter/CoordinateDataEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ override public string ToString()
{
// altitude value of the point
string altStr = GetAltitudeString(true);
return string.Format("ID: {0}, Name: {1}, Position: {2} | {3}", Id, Name, GetCoordinateStrLLDecDeg(), altStr);
return string.Format("ID: {0}, Name: {1}, Position: {2} | {3}", Id, Name, GetCoordinateStrLLDecDeg(8), altStr);
}

/// <summary>
Expand Down Expand Up @@ -329,9 +329,9 @@ public void SwapIds(CoordinateDataEntry other)
/// Gets the coordinate in ll format as a string.
/// </summary>
/// <returns></returns>
public string GetCoordinateStrLLDecSec()
public string GetCoordinateStrLLDecSec(int precision)
{
formatOptions.Round = 2;
formatOptions.Round = precision;
formatOptions.Format = CoordinateSharp.CoordinateFormatType.Degree_Minutes_Seconds;
Coordinate.FormatOptions = formatOptions;
return Coordinate.Display.Replace("º", "°").Replace(",", ".");
Expand All @@ -341,10 +341,10 @@ public string GetCoordinateStrLLDecSec()
/// Gets the coordinate in ll decimal format as a string.
/// </summary>
/// <returns></returns>
public string GetCoordinateStrLLDecMin()
public string GetCoordinateStrLLDecMin(int precision)
{
formatOptions.Format = CoordinateSharp.CoordinateFormatType.Degree_Decimal_Minutes;
formatOptions.Round = 4;
formatOptions.Round = precision;
Coordinate.FormatOptions = formatOptions;
return Coordinate.Display.Replace("º", "°").Replace(",", ".");
}
Expand All @@ -353,10 +353,10 @@ public string GetCoordinateStrLLDecMin()
/// Gets the coordinate in ll deg format as a string.
/// </summary>
/// <returns></returns>
public string GetCoordinateStrLLDecDeg()
public string GetCoordinateStrLLDecDeg(int precision)
{
formatOptions.Format = CoordinateSharp.CoordinateFormatType.Decimal_Degree;
formatOptions.Round = 10;
formatOptions.Round = precision;
Coordinate.FormatOptions = formatOptions;
return Coordinate.Display.Replace("º", "°").Replace(",", ".");
}
Expand Down
Loading

0 comments on commit 9d2d7dd

Please sign in to comment.