public override List <ManeuverParameters> MakeNodesImpl(Orbit o, double UT, MechJebModuleTargetController target) { // Check preconditions string message = CheckPreconditions(o, target); if (message != null) { throw new OperationException(message); } // Check if computation is finished if (worker != null && !worker.Finished) { throw new OperationException(Localizer.Format("#MechJeb_adv_Exception1"));//Computation not finished } if (worker == null) { ComputeStuff(o, UT, target); throw new OperationException(Localizer.Format("#MechJeb_adv_Exception2"));//Started computation } List <ManeuverParameters> NodeList = new List <ManeuverParameters>(); if (worker.arrivalDate < 0) { throw new OperationException(Localizer.Format("#MechJeb_adv_Exception3"));//Computation failed } if (selectionMode == Mode.Porkchop) { if (plot == null || plot.selectedPoint == null) { throw new OperationException(Localizer.Format("#MechJeb_adv_Exception4"));//Invalid point selected. } NodeList.Add(worker.OptimizeEjection( worker.DateFromIndex(plot.selectedPoint[0]), o, worker.destinationOrbit, target.Target as CelestialBody, worker.DateFromIndex(plot.selectedPoint[0]) + worker.DurationFromIndex(plot.selectedPoint[1]), UT) ); return(NodeList); } NodeList.Add(worker.OptimizeEjection( worker.DateFromIndex(worker.bestDate), o, worker.destinationOrbit, target.Target as CelestialBody, worker.DateFromIndex(worker.bestDate) + worker.DurationFromIndex(worker.bestDuration), UT) ); return(NodeList); }
public override ManeuverParameters MakeNodeImpl(Orbit o, double UT, MechJebModuleTargetController target) { // Check preconditions string message = CheckPreconditions(o, target); if (message != null) throw new OperationException(message); // Check if computation is finished if (worker != null && !worker.Finished) throw new OperationException("Computation not finished"); if (worker == null) { ComputeStuff(o, UT, target); throw new OperationException("Started computation"); } if (worker.result == null) { throw new OperationException("Computation failed"); } if (selectionMode == Mode.Porkchop) { if (plot == null || plot.selectedPoint == null) throw new OperationException("Invalid point selected."); return TransferCalculator.OptimizeEjection( worker.computed[plot.selectedPoint[0], plot.selectedPoint[1]], o, worker.destinationOrbit, worker.DateFromIndex(plot.selectedPoint[0]) + worker.DurationFromIndex(plot.selectedPoint[1]), UT); } return worker.OptimizedResult; }
public override ManeuverParameters MakeNodeImpl(Orbit o, double UT, MechJebModuleTargetController target) { // Check preconditions string message = CheckPreconditions(o, target); if (message != null) { throw new OperationException(message); } // Check if computation is finished if (worker != null && !worker.Finished) { throw new OperationException("Computation not finished"); } if (worker == null) { ComputeStuff(o, UT, target); throw new OperationException("Started computation"); } if (worker.arrivalDate < 0) { throw new OperationException("Computation failed"); } if (selectionMode == Mode.Porkchop) { if (plot == null || plot.selectedPoint == null) { throw new OperationException("Invalid point selected."); } return(worker.OptimizeEjection( worker.DateFromIndex(plot.selectedPoint[0]), o, worker.destinationOrbit, target.Target as CelestialBody, worker.DateFromIndex(plot.selectedPoint[0]) + worker.DurationFromIndex(plot.selectedPoint[1]), UT)); } return(worker.OptimizeEjection( worker.DateFromIndex(worker.bestDate), o, worker.destinationOrbit, target.Target as CelestialBody, worker.DateFromIndex(worker.bestDate) + worker.DurationFromIndex(worker.bestDuration), UT)); }