mergeNodeDown() public static method

Merges the given node into the next lowest node (n's index - 1). If there is no lower node, does nothing.
public static mergeNodeDown ( ManeuverNode n ) : void
n ManeuverNode The ManeuverNode to merge down.
return void
Beispiel #1
0
        public void drawTripWindow(int id)
        {
            PatchedConicSolver solver = NodeTools.getSolver();

            GUILayout.BeginVertical();
            if (solver.maneuverNodes.Count < 1)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("No nodes to show.", GUILayout.Width(200));
                GUILayout.EndHorizontal();
            }
            else
            {
                double total   = 0.0;
                double timeNow = Planetarium.GetUniversalTime();

                GUILayout.BeginHorizontal();
                GUILayout.Label("", GUILayout.Width(60));
                GUILayout.Label("Δv", GUILayout.Width(90));
                GUILayout.Label("Time Until", GUILayout.Width(200));
                GUILayout.Label("", GUILayout.Width(120));
                GUILayout.EndHorizontal();

                foreach (ManeuverNode curNode in solver.maneuverNodes)
                {
                    int    idx      = solver.maneuverNodes.IndexOf(curNode);
                    double timeDiff = curNode.UT - timeNow;
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Node " + idx, GUILayout.Width(60));
                    GUILayout.Label(curNode.DeltaV.magnitude.ToString("F2") + "m/s", GUILayout.Width(90));
                    GUILayout.Label(NodeTools.convertUTtoHumanDuration(timeDiff), GUILayout.Width(200));
                    // these will be scheduled for during the next layout pass
                    if (idx > 0)
                    {
                        GUIParts.drawButton("merge ▲", Color.white, delegate() { scheduledForLayout.Add(new Action(() => { NodeTools.mergeNodeDown(solver.maneuverNodes[idx]); })); });
                    }
                    GUILayout.EndHorizontal();
                    total += curNode.DeltaV.magnitude;
                }

                GUILayout.BeginHorizontal();
                GUILayout.Label("Total", GUILayout.Width(60));
                GUILayout.Label(total.ToString("F2") + "m/s", GUILayout.Width(90));
                GUILayout.Label("", GUILayout.Width(200));
                GUILayout.EndHorizontal();
            }

            GUILayout.EndVertical();
            GUI.DragWindow();
        }