Added biome and slope readouts.
Added biome and slope readouts.

--- a/KerbalEngineer/Extensions/DoubleExtensions.cs
+++ b/KerbalEngineer/Extensions/DoubleExtensions.cs
@@ -170,11 +170,11 @@
         /// <summary>

         ///     Convert to string formatted as an angle.

         /// </summary>

-        public static string ToAngle(this double value)

-        {

-            try

-            {

-                return value.ToString("F3") + "°";

+        public static string ToAngle(this double value, string format = "F3")

+        {

+            try

+            {

+                return value.ToString(format) + "°";

             }

             catch (Exception ex)

             {


--- a/KerbalEngineer/Extensions/FloatExtensions.cs
+++ b/KerbalEngineer/Extensions/FloatExtensions.cs
@@ -166,11 +166,11 @@
         /// <summary>

         ///     Convert to string formatted as an angle.

         /// </summary>

-        public static string ToAngle(this float value)

-        {

-            try

-            {

-                return value.ToString("F3") + "°";

+        public static string ToAngle(this float value, string format = "F3")

+        {

+            try

+            {

+                return value.ToString(format) + "°";

             }

             catch (Exception ex)

             {


--- a/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
+++ b/KerbalEngineer/Flight/Readouts/ReadoutLibrary.cs
@@ -92,10 +92,13 @@
             this.readoutModules.Add(new GeeForce());

             this.readoutModules.Add(new TerminalVelocity());

             this.readoutModules.Add(new AtmosphericEfficiency());

+            this.readoutModules.Add(new Biome());

+            this.readoutModules.Add(new Slope());

             this.readoutModules.Add(new ImpactTime());

             this.readoutModules.Add(new ImpactLongitude());

             this.readoutModules.Add(new ImpactLatitude());

             this.readoutModules.Add(new ImpactAltitude());

+            this.readoutModules.Add(new ImpactBiome());

 

             // Vessel

             this.readoutModules.Add(new DeltaVStaged());


--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Surface/Biome.cs
@@ -1,1 +1,43 @@
-
+// 

+//     Kerbal Engineer Redux

+// 

+//     Copyright (C) 2014 CYBUTEK

+// 

+//     This program is free software: you can redistribute it and/or modify

+//     it under the terms of the GNU General Public License as published by

+//     the Free Software Foundation, either version 3 of the License, or

+//     (at your option) any later version.

+// 

+//     This program is distributed in the hope that it will be useful,

+//     but WITHOUT ANY WARRANTY; without even the implied warranty of

+//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

+//     GNU General Public License for more details.

+// 

+//     You should have received a copy of the GNU General Public License

+//     along with this program.  If not, see <http://www.gnu.org/licenses/>.

+// 

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.Flight.Readouts.Surface

+{

+    public class Biome : ReadoutModule

+    {

+        public Biome()

+        {

+            this.Name = "Biome";

+            this.Category = ReadoutCategory.Surface;

+            this.HelpString = "Shows the biome which the vessel is currently flying over.";

+            this.IsDefault = true;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(ScienceUtil.GetExperimentBiome(FlightGlobals.ActiveVessel.mainBody, FlightGlobals.ActiveVessel.latitude, FlightGlobals.ActiveVessel.longitude));

+        }

+    }

+}

--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Surface/ImpactBiome.cs
@@ -1,1 +1,64 @@
-
+// 

+//     Kerbal Engineer Redux

+// 

+//     Copyright (C) 2014 CYBUTEK

+// 

+//     This program is free software: you can redistribute it and/or modify

+//     it under the terms of the GNU General Public License as published by

+//     the Free Software Foundation, either version 3 of the License, or

+//     (at your option) any later version.

+// 

+//     This program is distributed in the hope that it will be useful,

+//     but WITHOUT ANY WARRANTY; without even the implied warranty of

+//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

+//     GNU General Public License for more details.

+// 

+//     You should have received a copy of the GNU General Public License

+//     along with this program.  If not, see <http://www.gnu.org/licenses/>.

+// 

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.Flight.Readouts.Surface

+{

+    public class ImpactBiome : ReadoutModule

+    {

+        private bool showing;

+

+        public ImpactBiome()

+        {

+            this.Name = "Impact Biome";

+            this.Category = ReadoutCategory.Surface;

+            this.HelpString = string.Empty;

+            this.IsDefault = true;

+        }

+

+        public override void Update()

+        {

+            ImpactProcessor.RequestUpdate();

+        }

+

+        public override void Draw()

+        {

+            if (ImpactProcessor.ShowDetails)

+            {

+                this.showing = true;

+                this.DrawLine(ImpactProcessor.Biome);

+            }

+            else if (this.showing)

+            {

+                this.showing = false;

+                this.ResizeRequested = true;

+            }

+        }

+

+        public override void Reset()

+        {

+            FlightEngineerCore.Instance.AddUpdatable(ImpactProcessor.Instance);

+        }

+    }

+}

--- a/KerbalEngineer/Flight/Readouts/Surface/ImpactProcessor.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/ImpactProcessor.cs
@@ -48,6 +48,7 @@
         #region Fields

 

         private double impactAltitude;

+        private string impactBiome;

         private bool impactHappening;

         private double impactLatitude;

         private double impactLongitude;

@@ -81,6 +82,11 @@
         ///     Gets the altitude of the impact coordinates.

         /// </summary>

         public static double Altitude { get; private set; }

+

+        /// <summary>

+        ///     Gets the biome of the impact coordinates.

+        /// </summary>

+        public static string Biome { get; private set; }

 

         #endregion

 

@@ -98,6 +104,7 @@
                 this.impactLongitude = 0;

                 this.impactLatitude = 0;

                 this.impactAltitude = 0;

+                this.impactBiome = "---";

                 var e = FlightGlobals.ActiveVessel.orbit.eccentricity;

                 //get current position direction vector

                 var currentpos = this.RadiusDirection(FlightGlobals.ActiveVessel.orbit.trueAnomaly);

@@ -175,6 +182,7 @@
                 Longitude = this.impactLongitude;

                 Latitude = this.impactLatitude;

                 Altitude = this.impactAltitude;

+                Biome = ScienceUtil.GetExperimentBiome(FlightGlobals.ActiveVessel.mainBody, this.impactLatitude, this.impactLongitude);

             }

             else

             {


--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Surface/Slope.cs
@@ -1,1 +1,99 @@
-
+// 

+//     Kerbal Engineer Redux

+// 

+//     Copyright (C) 2014 CYBUTEK

+// 

+//     This program is free software: you can redistribute it and/or modify

+//     it under the terms of the GNU General Public License as published by

+//     the Free Software Foundation, either version 3 of the License, or

+//     (at your option) any later version.

+// 

+//     This program is distributed in the hope that it will be useful,

+//     but WITHOUT ANY WARRANTY; without even the implied warranty of

+//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

+//     GNU General Public License for more details.

+// 

+//     You should have received a copy of the GNU General Public License

+//     along with this program.  If not, see <http://www.gnu.org/licenses/>.

+// 

+

+#region Using Directives

+

+using System;

+

+using KerbalEngineer.Extensions;

+

+using UnityEngine;

+

+#endregion

+

+namespace KerbalEngineer.Flight.Readouts.Surface

+{

+    public class Slope : ReadoutModule

+    {

+        public Slope()

+        {

+            this.Name = "Slope";

+            this.Category = ReadoutCategory.Surface;

+            this.HelpString = "Shows the slope of the terrain below your vessel.";

+            this.IsDefault = true;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(this.GetSlopeAngleAndHeading());

+        }

+

+        private string GetSlopeAngleAndHeading()

+        {

+            try

+            {

+                var result = "--° @ ---°";

+                var mainBody = FlightGlobals.ActiveVessel.mainBody;

+                var rad = (FlightGlobals.ActiveVessel.CoM - mainBody.position).normalized;

+                RaycastHit hit;

+                if (Physics.Raycast(FlightGlobals.ActiveVessel.CoM, -rad, out hit, Mathf.Infinity, 1 << 15)) // Just "Local Scenery" please

+                {

+                    var norm = hit.normal;

+                    norm = norm.normalized;

+                    var raddotnorm = Vector3d.Dot(rad, norm);

+                    if (raddotnorm > 1.0)

+                    {

+                        raddotnorm = 1.0;

+                    }

+                    else if (raddotnorm < 0.0)

+                    {

+                        raddotnorm = 0.0;

+                    }

+                    var slope = Math.Acos(raddotnorm) * 180 / Math.PI;

+                    result = slope.ToAngle("F1");

+                    if (slope < 0.05)

+                    {

+                        result += " @ ---°";

+                    }

+                    else

+                    {

+                        var side = Vector3d.Cross(rad, norm).normalized;

+                        var east = Vector3d.Cross(rad, Vector3d.up).normalized;

+                        var north = Vector3d.Cross(rad, east).normalized;

+                        var sidedoteast = Vector3d.Dot(side, east);

+                        var direction = Math.Acos(sidedoteast) * 180 / Math.PI;

+                        var sidedotnorth = Vector3d.Dot(side, north);

+                        if (sidedotnorth < 0)

+                        {

+                            direction = 360 - direction;

+                        }

+                        result += " @ " + direction.ToAngle("F0");

+                    }

+                }

+

+                return result;

+            }

+            catch (Exception ex)

+            {

+                Logger.Exception(ex, "Surface->Slope->GetSlopeAngleAndHeading");

+                return "--° @ ---°";

+            }

+        }

+    }

+}

--- a/KerbalEngineer/KerbalEngineer.csproj
+++ b/KerbalEngineer/KerbalEngineer.csproj
@@ -61,6 +61,9 @@
     <Compile Include="CelestialBodies.cs" />

     <Compile Include="Editor\BuildToolbar.cs" />

     <Compile Include="Flight\FlightEngineerPartless.cs" />

+    <Compile Include="Flight\Readouts\Surface\ImpactBiome.cs" />

+    <Compile Include="Flight\Readouts\Surface\Slope.cs" />

+    <Compile Include="Flight\Readouts\Surface\Biome.cs" />

     <Compile Include="Flight\Readouts\Vessel\SimulationDelay.cs" />

     <Compile Include="Logger.cs" />

     <Compile Include="EngineerGlobals.cs" />


 Binary files a/Output/KerbalEngineer/KerbalEngineer.dll and b/Output/KerbalEngineer/KerbalEngineer.dll differ