All Classes Functions
LaunchCompass.h
1 // ==============================================================
2 // ORBITER MODULE: LaunchMFD
3 // Part of the ORBITER SDK
4 //
5 // Copyright (C) 2004 rjcroy - robust time based pitch autopilot (borrowed code)
6 // Copyright (C) 2004 Dave "Daver" Rowbotham - conversion of rjcroy's autopolot to C++ (borrowed code)
7 // Copyright (C) 2004 Erik H. "Sputnik" Anderson - conversion of the autopilot to energy based (borrowed code)
8 // Copyright (C) 2007 "Vanguard" - dressing up azimuth calcualtions into an MFD (author)
9 // Copyright (C) 2007 Pawel "She'da'Lier" Stiasny - yaw error visual representation (contributor)
10 // Copyright (C) 2008 Mohd "Computerex" Ali - borrowed his code (multiple vessels support) (borrowed code)
11 // Copyright (C) 2008 Chris "Kwan" Jeppesen - borrowed his code (peg guidance) (borrowed code)
12 // Copyright (C) 2008 Steve "agentgonzo" Arch - peg integration, offplane correction, compass, hud display (co-developer)
13 // Copyright (C) 2007-2012 Szymon "Enjo" Ender - everything else ;> (author and maintainer)
14 // All rights reserved
15 //
16 // LaunchCompass.h - Calculations of compass for vertical launches
17 // Authors - Steve "agentgonzo" Arch
18 //
19 // This module calculates the appropriate launch azimuth given
20 // desired orbital inclination and desired orbit altitude. This
21 // MFD takes the planets rotation into account, which provides a
22 // much more accurate azimuth. The calculations are performed
23 // 'on the fly' (technically and methaphorically), meaning that
24 // you get info about necessary course corrections.
25 //
26 // This file is part of LaunchMFD.
27 //
28 // LaunchMFD is free software: you can redistribute it and/or modify
29 // it under the terms of the GNU General Public License as published by
30 // the Free Software Foundation, either version 3 of the License, or
31 // (at your option) any later version.
32 //
33 // LaunchMFD is distributed in the hope that it will be useful,
34 // but WITHOUT ANY WARRANTY; without even the implied warranty of
35 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 // GNU General Public License for more details.
37 //
38 // You should have received a copy of the GNU General Public License
39 // along with LaunchMFD. If not, see <http://www.gnu.org/licenses/>.
40 // ==============================================================
41 
42 
43 #pragma once
44 
45 #include "MFDPage.h"
46 #include "globals.h"
47 #include "HUDCompass.h"
48 #include "PEG/PEG.h"
49 #include "Pens.h"
50 
51 class LaunchCompass : public MFDPage
52 {
53 public:
54  LaunchCompass (DWORD w, DWORD h, VESSEL *v);
55  virtual ~LaunchCompass ();
56  MFD_RETURN_TYPE Update( MyDC hDC, MFDDataLaunchMFD * data );
57  void SetTargetAzimuth(double azimuth, LAUNCH_AZIMUTH azFlag);
58  void SetApses(double PeA, double ApA);
59  void SetTargetPitch(double pitch);
60 
61  virtual void DrawHUD(int mode, const HUDPAINTSPEC *hps, MyDC hDC);
62 
63  enum DisplayMode
64  {
65  NorthUp,
66  HeadUp,
67  HeadingUp
68  };
69 
70 private:
71  void DrawCompassRose(MyDC hDC);
72  void DrawTargetPitchAndLines(MyDC hDC, double targetIncl, double radius);
73  void DrawVessel(MyDC hDC);
74  void PrintWords(MyDC hDC, bool launched);
75 
76  double GetHeadBearing();
77  static bool SetTargetCallback(void *id, char *str, void *user);
78  void SetTargetBearing();
79 
80  double PeA, ApA;
81 
82  Pens pens;
83 
84  double targetBearing;
85  double targetPitch;
86  LAUNCH_AZIMUTH azFlag;
88 };