public void Update(AirPlane ap, CockpitInterface cif, double dt) { PadlockObject pobj = pObjList.PadlockObj(ap); if ((cif.padLock_sw == 0) || (pobj == null)) { double pitch; double yaw = pitch = 0.0D; if (cif.view_direction == 0) { if (cif.view_upper == 1) { pitch = -1.570796326794897D; } } else { yaw = -(cif.view_direction - 1) / 4.0D * Math.PI; if (cif.view_upper == 1) { pitch = -0.7853981633974483D; } } SetViewDirection(yaw, pitch); } else { SetViewDirection(pobj.RPosPilot(ap)); } }
public PadlockObject GetObj(String name) { int id = GetIndex(name); PadlockObject pobj = null; if (id >= 0) { pobj = (PadlockObject)obj[id]; } return(pobj); }
public void AddObject(String name, Vector3D wpos) { int id = GetIndex(name); if (id < 0) { obj.Add(new PadlockObject(name, wpos)); } else { obj[id] = new PadlockObject(name, wpos); } }
private int GetIndex(String name) { int n = GetNObject(); int ret = -1; for (int i = 0; i < n; i++) { PadlockObject pobj = (PadlockObject)obj[i]; if (pobj.name.Equals(name)) { ret = i; } } return(ret); }
public void DrawPadLock(Graphics g, AirPlane ap) { double r = 110.0D; double l = 20.0D; //g.SetColor(padLockColor); // g.SetFont(padFont); PadlockObject pobj = ap.pilot.pObjList.PadlockObj(ap); if (pobj != null) { Vector3D vec = pobj.RPosPilotView(ap); Vector3D vec2 = clip.Vs_point_clip_3df(vec); if (vec2 != null) { vec2 = proj.Project(vec2); vec2 = clip.Vs_point_clip2d(vec2); } if (vec2 != null) { int x0 = (int)(vec2.x + 0.5D); int y0 = (int)(vec2.y + 0.5D); g.DrawRectangle(new Pen(padLockColor), x0 - 10, y0 - 10, 1, 1); //g.DrawRect(x0 + 8, y0 - 10, 1, 1); //g.DrawRect(x0 + 8, y0 + 8, 1, 1); //g.DrawRect(x0 - 10, y0 + 8, 1, 1); //g.DrawString(pobj.name, x0 + 12, y0 + 9); } else { Bearing3 be3 = pobj.Bearing2PilotView(ap); double sinr = -System.Math.Sin(be3.roll.GetValue()); double cosr = -System.Math.Cos(be3.roll.GetValue()); double w = l * System.Math.Sin(be3.pitch.GetValue() / 2.0D); double h = l * System.Math.Cos(be3.pitch.GetValue() / 2.0D); int x0_0 = 300 + (int)(r * sinr); int y0_1 = 200 + (int)(r * cosr); int x1 = 300 + (int)((r + l) * sinr); int y1 = 200 + (int)((r + l) * cosr); Jp.Maker1.Util.Symbol.DrawArrow(g, x0_0, y0_1, x1, y1, (int)h, (int)w); //g.DrawString(pobj.name, (x0_0 + x1) / 2 + (int)(l * 0.71D), (y0_1 + y1) / 2 + (int)(l * 0.71D)); g.DrawString(pobj.name, padFont, new SolidBrush(padLockColor), (x0_0 + x1) / 2 + (int)(l * 0.71D), (y0_1 + y1) / 2 + (int)(l * 0.71D)); } } }