| 1 | /*************************************************************************** |
| 2 | Sonar.h - description |
| 3 | ------------------- |
| 4 | begin : Fri Apr 11 2002 |
| 5 | copyright : (C) 2002 by Michael Bridak |
| 6 | email : [email protected] |
| 7 | $Id: sonar.h,v 1.10 2003/09/20 22:53:15 mbridak Exp $ |
| 8 | ***************************************************************************/ |
| 9 | |
| 10 | /*************************************************************************** |
| 11 | * * |
| 12 | * This program is free software; you can redistribute it and/or modify * |
| 13 | * it under the terms of the GNU General Public License as published by * |
| 14 | * the Free Software Foundation; either version 2 of the License. * |
| 15 | * . * |
| 16 | * * |
| 17 | ***************************************************************************/ |
| 18 | |
| 19 | #ifndef SONAR_H |
| 20 | #define SONAR_H |
| 21 | /** |
| 22 | *@author Michael Bridak |
| 23 | */ |
| 24 | |
| 25 | class AnBqq5{ |
| 26 | public: |
| 27 | Submarine *Subs; |
| 28 | int cursorBearing; |
| 29 | bool bearingdisplay5by6; |
| 30 | bool arraychoice5by6; |
| 31 | bool sonarwidget; |
| 32 | bool assigntracker; |
| 33 | float flowandambientnoise; |
| 34 | AnBqq5(Submarine *temp, TowedArray &temp2, TargetMotionAnalysis &temp3, msg &temp4); |
| 35 | ~AnBqq5(); |
| 36 | |
| 37 | /** Initialize the graphic for this class, *screen is the main |
| 38 | display screen passed in from main. */ |
| 39 | |
| 40 | void InitGraphics(); |
| 41 | |
| 42 | inline void DPixel(SDL_Surface *screen, int x, int y, Uint32 color); |
| 43 | |
| 44 | inline void DLine(SDL_Surface *screen, int X1, int Y1, int X2, int Y2, Uint32 Color); |
| 45 | |
| 46 | void Sonar(bool center); |
| 47 | |
| 48 | void DisplaySonar(); |
| 49 | |
| 50 | /** The Main entery point to do a gross update of all the Sonar |
| 51 | stations sub screen. */ |
| 52 | |
| 53 | void UpdateDisplay(Submarine *target); |
| 54 | void ClearSonarData(); |
| 55 | |
| 56 | void TowedSonar(bool center); |
| 57 | |
| 58 | void AdvanceSonarDisplay(); |
| 59 | |
| 60 | void AdvanceTB16Screen(); |
| 61 | |
| 62 | /** Displays the degree bearing scale in the waterfall displays |
| 63 | the bool center flag is to chech if we want north (0 degree) |
| 64 | or south (180 degree) as the scales center. */ |
| 65 | |
| 66 | void DisplayBearingScale(bool center); |
| 67 | |
| 68 | /** Loads in the widgets */ |
| 69 | |
| 70 | void LoadWidgets(); |
| 71 | |
| 72 | /** Displays the widgets needed for the sonar display*/ |
| 73 | |
| 74 | void DisplaySonarWidgets(); |
| 75 | |
| 76 | /** Switches the upper sonar waterfall display screen to show the |
| 77 | history of the Spherical array. */ |
| 78 | |
| 79 | void UpperCRT_Spherical(); |
| 80 | |
| 81 | /** Switches the lower sonar waterfall display screen to show the |
| 82 | history of the Spherical array. */ |
| 83 | |
| 84 | void LowerCRT_Spherical(); |
| 85 | |
| 86 | /** Switches the upper sonar waterfall display screen to show the |
| 87 | history of the TB16 array. */ |
| 88 | |
| 89 | void UpperCRT_TowedArray(); |
| 90 | |
| 91 | /** Switches the lower sonar waterfall display screen to show the |
| 92 | history of the TB16 array. */ |
| 93 | |
| 94 | void LowerCRT_TowedArray(); |
| 95 | |
| 96 | /** Toggles the bool variable arraychoice which affects the sonar |
| 97 | widget display and decided which array, Spherical or the towed |
| 98 | TB16, will appear when either the upper crt or lower crt widget |
| 99 | is clicked. */ |
| 100 | |
| 101 | void ToggleArrayChoice(); |
| 102 | |
| 103 | /** Toggles the truerel bool variable. At this time the only affect |
| 104 | it to the sonar widget display. But will soon determin if the |
| 105 | waterfall display shows us true or reletive traces. */ |
| 106 | |
| 107 | void ToggleTrueRel(); |
| 108 | |
| 109 | /** Called when the user clickes the "Upper CRT" widget on the sonar |
| 110 | screen. When called, it will switch the upper waterfall display |
| 111 | to show the desired sonar sensors history. */ |
| 112 | |
| 113 | void UpperCRT_Button(); |
| 114 | |
| 115 | /** Called when the user clickes the "Lower CRT" widget on the sonar |
| 116 | screen. When called, it will switch the lower waterfall display |
| 117 | to show the desired sonar sensors history. */ |
| 118 | |
| 119 | void LowerCRT_Button(); |
| 120 | |
| 121 | /** Called when the user clicks on the assign tracker widget on the |
| 122 | sonar screen. Toggles the assigntracker bool variable. When the |
| 123 | flag is true, and the user clicks on one of the tracker widgets, |
| 124 | that tracker will be assigned to the sound source currently |
| 125 | under the sonar cursor. */ |
| 126 | |
| 127 | void ToggleAssignTracker(); |
| 128 | |
| 129 | bool GetNorthCenterState(); |
| 130 | |
| 131 | void ToggleNorthCenter(); |
| 132 | |
| 133 | |
| 134 | /** Called when the user clicks on the "Stop TB16 Winch" widget on |
| 135 | the sonar screen. This unhighlights the widget and calls the |
| 136 | TB16.Stop() routine. */ |
| 137 | |
| 138 | void StopWinch(); |
| 139 | |
| 140 | int RandInt(int TO); |
| 141 | |
| 142 | int ReciprocalBearing(int bearing); |
| 143 | |
| 144 | void DisplayCursor(); |
| 145 | void UpdateCursor(); |
| 146 | |
| 147 | private: |
| 148 | SDL_Rect destination_rectangle; |
| 149 | SDL_Rect source_rectangle; |
| 150 | SDL_Surface *screen; |
| 151 | SDL_Surface *sonarscreen; |
| 152 | SDL_Surface *towedarrayscreen; |
| 153 | SDL_Surface *uppersonarcrt; |
| 154 | SDL_Surface *lowersonarcrt; |
| 155 | SDL_Surface *ncscale; |
| 156 | SDL_Surface *scscale; |
| 157 | SDL_Surface *sonarbuttondown; |
| 158 | SDL_Surface *sonarbuttonup; |
| 159 | SDL_Surface *truerel[2]; |
| 160 | SDL_Surface *sphertowed[2]; |
| 161 | SDL_Surface *uppercrtoff; |
| 162 | SDL_Surface *uppercrton; |
| 163 | SDL_Surface *lowercrtoff; |
| 164 | SDL_Surface *lowercrton; |
| 165 | SDL_Surface *tb16winchoff; |
| 166 | SDL_Surface *tb16winchon; |
| 167 | SDL_Surface *extendtb16[2]; |
| 168 | SDL_Surface *retracttb16[2]; |
| 169 | SDL_Surface *cutarray; |
| 170 | SDL_Surface *sendping; |
| 171 | SDL_Surface *assigntrackerwidget[2]; |
| 172 | SDL_Surface *tracker1[2]; |
| 173 | SDL_Surface *tracker2[2]; |
| 174 | SDL_Surface *tracker3[2]; |
| 175 | SDL_Surface *tracker4[2]; |
| 176 | DFont largeFont(const char*, const char *); |
| 177 | TowedArray &TB16; |
| 178 | TargetMotionAnalysis &Tma; |
| 179 | msg &Message; |
| 180 | int tempint; |
| 181 | int tempval; |
| 182 | float deAngle; |
| 183 | static char text[120]; |
| 184 | Uint32 black; |
| 185 | Uint32 white; |
| 186 | Uint32 green; |
| 187 | bool northcenter; |
| 188 | }; |
| 189 | |
| 190 | #endif |