findNextEncounter() public static method

public static findNextEncounter ( ManeuverNode node ) : Orbit
node ManeuverNode
return Orbit
Example #1
0
        public NodeManager(ManeuverNode n)
        {
            curState     = new NodeState(n);
            curNodeState = new NodeState();
            node         = n;
            updateCurrentNodeState();

            if (NodeTools.findNextEncounter(n) != null)
            {
                encounter = true;
            }
        }
Example #2
0
 public NodeManager nextState()
 {
     if (nextNode != null)
     {
         return(new NodeManager(nextNode));
     }
     if (NodeTools.findNextEncounter(node) != null)
     {
         encounter = true;
     }
     return(this);
 }
Example #3
0
        // debugging function
        private void drawEncounter(Color defaultColor)
        {
            // Additional Information
            if (options.showOrbitInfo)
            {
                // Find the next encounter, if any, in our flight plan.
                if (showEncounter)
                {
                    Orbit  nextEnc = NodeTools.findNextEncounter(curState.node);
                    string name    = "N/A";
                    string PeA     = "N/A";

                    if (nextEnc != null)
                    {
                        name = nextEnc.referenceBody.name;
                        PeA  = NodeTools.formatMeters(nextEnc.PeA);
                    }
                    else
                    {
                        curState.encounter = false;
                    }
                    // Next encounter periapsis
                    GUIParts.drawDoubleLabel("(" + name + ") Pe:", 100, PeA, 130);
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("", GUILayout.Width(100));
                    GUIParts.drawButton("Focus on " + name, defaultColor, delegate() { MapView.MapCamera.SetTarget(name); });
                    GUILayout.EndHorizontal();
                }
                else
                {
                    if (curState.node.solver.flightPlan.Count > 1)
                    {
                        // output the apoapsis and periapsis of our projected orbit.
                        GUIParts.drawDoubleLabel("Apoapsis:", 100, NodeTools.formatMeters(curState.node.nextPatch.ApA), 100);
                        GUIParts.drawDoubleLabel("Periapsis:", 100, NodeTools.formatMeters(curState.node.nextPatch.PeA), 130);
                    }
                }
            }
        }