diff --git a/GameData/WaypointManager/WaypointManager.dll b/GameData/WaypointManager/WaypointManager.dll
index e648c3e..f391c6a 100644
Binary files a/GameData/WaypointManager/WaypointManager.dll and b/GameData/WaypointManager/WaypointManager.dll differ
diff --git a/source/WaypointManager/Config.cs b/source/WaypointManager/Config.cs
index b94b945..0dd2e16 100644
--- a/source/WaypointManager/Config.cs
+++ b/source/WaypointManager/Config.cs
@@ -50,6 +50,7 @@ public enum WaypointDisplay
public static bool hudTime = true;
public static bool hudHeading = false;
public static bool hudAngle = false;
+ public static bool hudCoordinates = false;
public static bool useStockToolbar = true;
@@ -80,7 +81,7 @@ public static void Save()
configNode.AddValue("hudAngle", hudAngle);
configNode.AddValue("useStockToolbar", useStockToolbar);
configNode.AddValue("opacity", opacity);
-
+ configNode.AddValue("hudCoordinates", hudCoordinates);
configNode.Save(ConfigFileName,
"Waypoint Manager Configuration File\r\n" +
"//\r\n" +
@@ -111,6 +112,7 @@ public static void Load()
hudDistance = Convert.ToBoolean(configNode.GetValue("hudDistance"));
hudTime = Convert.ToBoolean(configNode.GetValue("hudTime"));
hudHeading = Convert.ToBoolean(configNode.GetValue("hudHeading"));
+ hudCoordinates = Convert.ToBoolean(configNode.GetValue("hudCoordinates"));
hudAngle = configNode.HasValue("hudAngle") ? Convert.ToBoolean(configNode.GetValue("hudAngle")) : false;
opacity = configNode.HasValue("opacity") ? (float)Convert.ToDouble(configNode.GetValue("opacity")) : 1.0f;
if (configNode.HasValue("useStockToolbar"))
diff --git a/source/WaypointManager/Util.cs b/source/WaypointManager/Util.cs
index 7e5896b..8d3a82d 100644
--- a/source/WaypointManager/Util.cs
+++ b/source/WaypointManager/Util.cs
@@ -301,5 +301,23 @@ public static void DrawWaypoint(CelestialBody targetBody, double latitude, doubl
Graphics.DrawTexture(iconRect, ContractDefs.textures[id], new Rect(0.0f, 0.0f, 1f, 1f), 0, 0, 0, 0, SystemUtilities.RandomColor(seed, alpha));
}
+ ///
+ /// Converts decimal degrees to a string of DMS formatted degrees with N/S, E/W prefix
+ ///
+ ///
+ /// boolean to determin latitude or longitude for compass prefix
+ ///
+ public static string DecimalDegreesToDMS(double decimalDegrees, bool latitude)
+ {
+ string dms = string.Empty;
+ string direction = latitude ? (decimalDegrees >= 0 ? "N" : "S") : (decimalDegrees >= 0 ? "E" : "W");
+ decimalDegrees = Math.Abs(decimalDegrees);
+ int d =(int)(decimalDegrees);
+ double decimalpart = decimalDegrees - d;
+ int m = (int)(decimalpart * 60);
+ double s = (decimalpart - m / 60f) * 3600;
+ dms = string.Format("{3} {0}\x00B0 {1}\' {2:F1}\"", d, m, s, direction);
+ return dms;
+ }
}
}
diff --git a/source/WaypointManager/WaypointFlightRenderer.cs b/source/WaypointManager/WaypointFlightRenderer.cs
index 88851f1..c743e67 100644
--- a/source/WaypointManager/WaypointFlightRenderer.cs
+++ b/source/WaypointManager/WaypointFlightRenderer.cs
@@ -299,6 +299,14 @@ protected void DrawWaypoint(WaypointData wpd)
ybase += 18f;
}
}
+ if(Config.hudCoordinates&&v.mainBody==wpd.celestialBody)
+ {
+ ybase += 9;
+ GUI.Label(new Rect((float)Screen.width / 2.0f - 188f, ybase, 240f, 38f), "Coordinates of " + label + ":", nameStyle);
+ GUI.Label(new Rect((float)Screen.width / 2.0f + 60f, ybase, 120f, 38f),
+ v.state != Vessel.State.DEAD ? string.Format("{0}\r\n{1}", Util.DecimalDegreesToDMS(wpd.waypoint.latitude,true), Util.DecimalDegreesToDMS(wpd.waypoint.longitude,false)) : "N/A", valueStyle);
+ ybase += 18f;
+ }
}
}
}
diff --git a/source/WaypointManager/WaypointManager.cs b/source/WaypointManager/WaypointManager.cs
index a78e4d5..21570c9 100644
--- a/source/WaypointManager/WaypointManager.cs
+++ b/source/WaypointManager/WaypointManager.cs
@@ -573,6 +573,10 @@ protected void SettingsGUI(int windowID)
{
Config.hudAngle = !Config.hudAngle;
}
+ if (GUILayout.Toggle(Config.hudCoordinates, "Coordinates of target")!=Config.hudCoordinates)
+ {
+ Config.hudCoordinates = !Config.hudCoordinates;
+ }
// Toolbar
GUILayout.Label("Toolbar Display", headingStyle);