/
OperationLongitude.cs
34 lines (28 loc) · 1.4 KB
/
OperationLongitude.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
extern alias JetBrainsAnnotations;
using System.Collections.Generic;
using JetBrainsAnnotations::JetBrains.Annotations;
using KSP.Localization;
using UnityEngine;
namespace MuMech
{
[UsedImplicitly]
public class OperationLongitude : Operation
{
private static readonly string _name = Localizer.Format("#MechJeb_la_title");
public override string GetName() => _name;
private static readonly TimeReference[] _timeReferences = { TimeReference.APOAPSIS, TimeReference.PERIAPSIS };
private static readonly TimeSelector _timeSelector = new TimeSelector(_timeReferences);
public override void DoParametersGUI(Orbit o, double universalTime, MechJebModuleTargetController target)
{
_timeSelector.DoChooseTimeGUI();
GUILayout.Label(Localizer.Format("#MechJeb_la_label")); //New Surface Longitude after one orbit:
target.targetLongitude.DrawEditGUI(EditableAngle.Direction.EW);
}
protected override List<ManeuverParameters> MakeNodesImpl(Orbit o, double universalTime, MechJebModuleTargetController target)
{
double ut = _timeSelector.ComputeManeuverTime(o, universalTime, target);
Vector3d dV = OrbitalManeuverCalculator.DeltaVToShiftNodeLongitude(o, ut, target.targetLongitude);
return new List<ManeuverParameters> { new ManeuverParameters(dV, ut) };
}
}
}