Polished the updatable system.
Polished the updatable system.

--- a/KerbalEngineer/Flight/FlightEngineerCore.cs
+++ b/KerbalEngineer/Flight/FlightEngineerCore.cs
@@ -96,11 +96,26 @@
             this.UpdateModules();

         }

 

+        /// <summary>

+        ///     Update all updatable modules.

+        /// </summary>

         private void UpdateModules()

         {

             foreach (var updatable in this.UpdatableModules)

             {

-                updatable.Update();

+                if (updatable is IUpdateRequest)

+                {

+                    var request = updatable as IUpdateRequest;

+                    if (request.UpdateRequested)

+                    {

+                        updatable.Update();

+                        request.UpdateRequested = false;

+                    }

+                }

+                else

+                {

+                    updatable.Update();

+                }

             }

         }

 


--- a/KerbalEngineer/Flight/IUpdatable.cs
+++ b/KerbalEngineer/Flight/IUpdatable.cs
@@ -5,7 +5,7 @@
 namespace KerbalEngineer.Flight

 {

     /// <summary>

-    /// Interface which enabled updating via the flight engineer core.

+    ///     Interface which enables object updating via the flight engineer core.

     /// </summary>

     public interface IUpdatable

     {


--- /dev/null
+++ b/KerbalEngineer/Flight/IUpdateRequest.cs
@@ -1,1 +1,14 @@
-
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+namespace KerbalEngineer.Flight

+{

+    /// <summary>

+    ///     Interface which enables requested updates on an updatable object.

+    /// </summary>

+    public interface IUpdateRequest

+    {

+        bool UpdateRequested { get; set; }

+    }

+}

--- a/KerbalEngineer/Flight/Readouts/Rendezvous/RelativeInclination.cs
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/RelativeInclination.cs
@@ -19,12 +19,24 @@
             this.HelpString = "Shows the relative inclination between your vessel and the target object.";

         }

 

+        public override void Update()

+        {

+            RendezvousProcessor.RequestUpdate();

+        }

+

         public override void Draw()

         {

-            if (FlightGlobals.fetch.VesselTarget != null)

+            if (!RendezvousProcessor.ShowDetails)

             {

-                this.DrawLine(Vector3d.Angle(FlightGlobals.ship_orbit.GetOrbitNormal(), FlightGlobals.ActiveVessel.targetObject.GetOrbit().GetOrbitNormal()).ToAngle());

+                return;

             }

+

+            this.DrawLine(RendezvousProcessor.RelativeInclination.ToAngle());

+        }

+

+        public override void Reset()

+        {

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

         }

     }

 }

--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Rendezvous/RendezvousProcessor.cs
@@ -1,1 +1,86 @@
-
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+namespace KerbalEngineer.Flight.Readouts.Rendezvous

+{

+    public class RendezvousProcessor : IUpdatable, IUpdateRequest

+    {

+        #region Instance

+

+        private static readonly RendezvousProcessor instance = new RendezvousProcessor();

+

+        /// <summary>

+        ///     Gets the current instance of the rendezvous processor.

+        /// </summary>

+        public static RendezvousProcessor Instance

+        {

+            get { return instance; }

+        }

+

+        #endregion

+

+        #region Fields

+

+        private Orbit sourceOrbit;

+        private Orbit targetOrbit;

+

+        #endregion

+

+        #region Properties

+

+        /// <summary>

+        ///     Gets whether the details are ready to be shown.

+        /// </summary>

+        public static bool ShowDetails { get; private set; }

+

+        /// <summary>

+        ///     Gets the angular difference between the source and target orbits.

+        /// </summary>

+        public static double RelativeInclination { get; private set; }

+

+        #endregion

+

+        #region IUpdatable Members

+

+        /// <summary>

+        ///     Updates the details by recalculating if requested.

+        /// </summary>

+        public void Update()

+        {

+            if (FlightGlobals.fetch.VesselTarget == null)

+            {

+                ShowDetails = false;

+                return;

+            }

+

+            ShowDetails = true;

+

+            this.targetOrbit = FlightGlobals.fetch.VesselTarget.GetOrbit();

+            this.sourceOrbit = (FlightGlobals.ship_orbit.referenceBody == Planetarium.fetch.Sun || FlightGlobals.ship_orbit.referenceBody == FlightGlobals.ActiveVessel.targetObject.GetOrbit().referenceBody)

+                ? FlightGlobals.ship_orbit

+                : FlightGlobals.ship_orbit.referenceBody.orbit;

+

+            RelativeInclination = Vector3d.Angle(this.sourceOrbit.GetOrbitNormal(), this.targetOrbit.GetOrbitNormal());

+        }

+

+        #endregion

+

+        #region IUpdateRequest Members

+

+        /// <summary>

+        ///     Gets and sets whether the updatable object should be updated.

+        /// </summary>

+        public bool UpdateRequested { get; set; }

+

+        #endregion

+

+        /// <summary>

+        ///     Request and update to calculate the details.

+        /// </summary>

+        public static void RequestUpdate()

+        {

+            instance.UpdateRequested = true;

+        }

+    }

+}

--- a/KerbalEngineer/Flight/Readouts/Surface/AtmosphericDetails.cs
+++ /dev/null
@@ -1,99 +1,1 @@
-// Project:	KerbalEngineer

-// Author:	CYBUTEK

-// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

-

-#region Using Directives

-

-using System;

-using System.Linq;

-

-using KerbalEngineer.Extensions;

-

-#endregion

-

-namespace KerbalEngineer.Flight.Readouts.Surface

-{

-    public class AtmosphericDetails : IUpdatable

-    {

-        #region Instance

-

-        private static AtmosphericDetails instance;

-

-        /// <summary>

-        ///     Gets the current instance of atmospheric details.

-        /// </summary>

-        public static AtmosphericDetails Instance

-        {

-            get { return instance ?? (instance = new AtmosphericDetails()); }

-        }

-

-        #endregion

-

-        #region Fields

-

-        private bool updateRequested;

-

-        #endregion

-

-        #region Properties

-

-        private double efficiency;

-        private double terminalVelocity;

-

-        /// <summary>

-        ///     Gets whether an update has been requested.

-        /// </summary>

-        public bool UpdateRequested

-        {

-            get { return this.updateRequested; }

-        }

-

-        /// <summary>

-        ///     Gets the terminal velocity of the active vessel.

-        /// </summary>

-        public double TerminalVelocity

-        {

-            get { return this.terminalVelocity; }

-        }

-

-        /// <summary>

-        ///     Gets the difference between current velocity and terminal velocity.

-        /// </summary>

-        public double Efficiency

-        {

-            get { return this.efficiency; }

-        }

-

-        #endregion

-

-        /// <summary>

-        ///     Updated the details by recalculating if requested.

-        /// </summary>

-        public void Update()

-        {

-            if (!this.updateRequested || FlightGlobals.ActiveVessel.atmDensity == 0)

-            {

-                return;

-            }

-

-            this.updateRequested = false;

-

-            var mass = FlightGlobals.ActiveVessel.parts.Sum(p => p.GetWetMass());

-            var drag = FlightGlobals.ActiveVessel.parts.Sum(p => p.GetWetMass() * p.maximum_drag);

-            var grav = FlightGlobals.getGeeForceAtPosition(FlightGlobals.ship_position).magnitude;

-            var atmo = FlightGlobals.ActiveVessel.atmDensity;

-            var coef = FlightGlobals.DragMultiplier;

-

-            this.terminalVelocity = Math.Sqrt((2 * mass * grav) / (atmo * drag * coef));

-            this.efficiency = FlightGlobals.ship_srfSpeed / this.terminalVelocity;

-        }

-

-        /// <summary>

-        ///     Request an update to recalculate the details.

-        /// </summary>

-        public void RequestUpdate()

-        {

-            this.updateRequested = true;

-        }

-    }

-}
+

--- a/KerbalEngineer/Flight/Readouts/Surface/AtmosphericEfficiency.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/AtmosphericEfficiency.cs
@@ -17,7 +17,7 @@
 

         public override void Update()

         {

-            AtmosphericDetails.Instance.RequestUpdate();

+            AtmosphericProcessor.RequestUpdate();

         }

 

         public override void Draw()

@@ -27,8 +27,8 @@
 

             if (FlightGlobals.ActiveVessel.atmDensity > 0)

             {

-                showing = true;

-                this.DrawLine(AtmosphericDetails.Instance.Efficiency.ToString("F2"));

+                this.showing = true;

+                this.DrawLine(AtmosphericProcessor.Efficiency.ToString("F2"));

             }

 

             if (this.showing != tempShowing)

@@ -39,7 +39,7 @@
 

         public override void Reset()

         {

-            FlightEngineerCore.Instance.AddUpdatable(AtmosphericDetails.Instance);

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

         }

     }

 }

--- /dev/null
+++ b/KerbalEngineer/Flight/Readouts/Surface/AtmosphericProcessor.cs
@@ -1,1 +1,95 @@
-
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using System;

+using System.Linq;

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.Flight.Readouts.Surface

+{

+    public class AtmosphericProcessor : IUpdatable, IUpdateRequest

+    {

+        #region Instance

+

+        private static readonly AtmosphericProcessor instance = new AtmosphericProcessor();

+

+        /// <summary>

+        ///     Gets the current instance of the atmospheric processor.

+        /// </summary>

+        public static AtmosphericProcessor Instance

+        {

+            get { return instance; }

+        }

+

+        #endregion

+

+        #region Properties

+

+        /// <summary>

+        ///     Gets whether the details are ready to be shown.

+        /// </summary>

+        public static bool ShowDetails { get; private set; }

+

+        /// <summary>

+        ///     Gets the terminal velocity of the active vessel.

+        /// </summary>

+        public static double TerminalVelocity { get; private set; }

+

+        /// <summary>

+        ///     Gets the difference between current velocity and terminal velocity.

+        /// </summary>

+        public static double Efficiency { get; private set; }

+

+        #endregion

+

+        #region IUpdatable Members

+

+        /// <summary>

+        ///     Updates the details by recalculating if requested.

+        /// </summary>

+        public void Update()

+        {

+            if (FlightGlobals.ActiveVessel.atmDensity < double.Epsilon)

+            {

+                ShowDetails = false;

+                return;

+            }

+

+            ShowDetails = true;

+

+            var mass = FlightGlobals.ActiveVessel.parts.Sum(p => p.GetWetMass());

+            var drag = FlightGlobals.ActiveVessel.parts.Sum(p => p.GetWetMass() * p.maximum_drag);

+            var grav = FlightGlobals.getGeeForceAtPosition(FlightGlobals.ship_position).magnitude;

+            var atmo = FlightGlobals.ActiveVessel.atmDensity;

+            var coef = FlightGlobals.DragMultiplier;

+

+            TerminalVelocity = Math.Sqrt((2 * mass * grav) / (atmo * drag * coef));

+            Efficiency = FlightGlobals.ship_srfSpeed / TerminalVelocity;

+        }

+

+        #endregion

+

+        #region IUpdateRequest Members

+

+        /// <summary>

+        ///     Gets and sets whether the updatable object should be updated.

+        /// </summary>

+        public bool UpdateRequested { get; set; }

+

+        #endregion

+

+        /// <summary>

+        ///     Request an update to calculate the details.

+        /// </summary>

+        public static void RequestUpdate()

+        {

+            instance.UpdateRequested = true;

+        }

+    }

+}

--- a/KerbalEngineer/Flight/Readouts/Surface/TerminalVelocity.cs
+++ b/KerbalEngineer/Flight/Readouts/Surface/TerminalVelocity.cs
@@ -23,7 +23,7 @@
 

         public override void Update()

         {

-            AtmosphericDetails.Instance.RequestUpdate();

+            AtmosphericProcessor.RequestUpdate();

         }

 

         public override void Draw()

@@ -34,7 +34,7 @@
             if (FlightGlobals.ActiveVessel.atmDensity > 0)

             {

                 this.showing = true;

-                this.DrawLine(AtmosphericDetails.Instance.TerminalVelocity.ToSpeed());

+                this.DrawLine(AtmosphericProcessor.TerminalVelocity.ToSpeed());

             }

 

             if (this.showing != tempShowing)

@@ -45,7 +45,7 @@
 

         public override void Reset()

         {

-            FlightEngineerCore.Instance.AddUpdatable(AtmosphericDetails.Instance);

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

         }

     }

 }

--- a/KerbalEngineer/KerbalEngineer.csproj
+++ b/KerbalEngineer/KerbalEngineer.csproj
@@ -67,6 +67,7 @@
     <Compile Include="Flight\FlightEngineerCore.cs" />

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

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

+    <Compile Include="Flight\IUpdateRequest.cs" />

     <Compile Include="Flight\Readouts\Orbital\ApoapsisHeight.cs" />

     <Compile Include="Flight\Readouts\Orbital\Eccentricity.cs" />

     <Compile Include="Flight\Readouts\Orbital\Inclination.cs" />

@@ -83,10 +84,11 @@
     <Compile Include="Flight\Readouts\ReadoutLibrary.cs" />

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

     <Compile Include="Flight\Readouts\Rendezvous\RelativeInclination.cs" />

+    <Compile Include="Flight\Readouts\Rendezvous\RendezvousProcessor.cs" />

     <Compile Include="Flight\Readouts\Rendezvous\TargetSelector.cs" />

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

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

-    <Compile Include="Flight\Readouts\Surface\AtmosphericDetails.cs" />

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

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

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

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


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