| 1 | /*************************************************************************** |
| 2 | targetmotionanalysis.h - description |
| 3 | ------------------- |
| 4 | begin : Sat Mar 16 2002 |
| 5 | copyright : (C) 2002 by Michael Bridak |
| 6 | email : [email protected] |
| 7 | $Id: targetmotionanalysis.h,v 1.6 2003/04/20 16:55:49 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 TARGETMOTIONANALYSIS_H |
| 20 | #define TARGETMOTIONANALYSIS_H |
| 21 | #define MAXTRACKERS 13 |
| 22 | |
| 23 | #include "boatpositionlog.h" |
| 24 | #include "contact.h" |
| 25 | |
| 26 | /** |
| 27 | *@author Michael Bridak |
| 28 | */ |
| 29 | |
| 30 | class TargetMotionAnalysis : public BoatPositionLog { |
| 31 | public: |
| 32 | Contact Solution[12]; |
| 33 | Uint32 textcolor, black, white, red, green, yellow, mapcolor;//Place to hold color info |
| 34 | |
| 35 | double our_heading; |
| 36 | double target_heading; |
| 37 | |
| 38 | float our_speed; |
| 39 | float target_speed; |
| 40 | |
| 41 | /** an SDL surface to plot our GeoPlot on */ |
| 42 | SDL_Surface *GeoPlotScreen; |
| 43 | |
| 44 | /** */ |
| 45 | int plotscale; |
| 46 | |
| 47 | /** Geoplot centering flag */ |
| 48 | bool centerGeoPlot; |
| 49 | |
| 50 | TargetMotionAnalysis(); |
| 51 | ~TargetMotionAnalysis(); |
| 52 | |
| 53 | /** Frees a tracker to be used later. */ |
| 54 | void ClearTracker(int tracker); |
| 55 | |
| 56 | /** Returns the TRUE if tracker is in use */ |
| 57 | bool GetTrackerState(int tracker) const; |
| 58 | |
| 59 | /** Assign a tracker to a target */ |
| 60 | void AssignTracker(int tracker, int target); |
| 61 | |
| 62 | /** Assign Target designation and Tracker to trace currently under |
| 63 | cursor on SONAR screen. |
| 64 | */ |
| 65 | void DesignateContact(); |
| 66 | |
| 67 | /** Display a GeoPlot for the designated contact based on the |
| 68 | position of the boat and the bearing history of the contact. |
| 69 | */ |
| 70 | void DisplayGeoPlot(int xoffset, int yoffset); |
| 71 | |
| 72 | /** Display the LOS Diagram |
| 73 | */ |
| 74 | void DisplayLOS(); |
| 75 | |
| 76 | /** Creates a speed ruler which we will use to drag around the |
| 77 | GeoPlot to test solutions. |
| 78 | */ |
| 79 | void CreateSpeedRuler(); |
| 80 | |
| 81 | /** Plots the amount of error from the expected bearing to target |
| 82 | and the actual bearing recieved. |
| 83 | */ |
| 84 | void BearingDevitaionPlot(); |
| 85 | |
| 86 | /** Record the boats current position |
| 87 | */ |
| 88 | void RecordBoatPosition(float latitude, float longitude, double bearing, Uint32 tick); |
| 89 | |
| 90 | /** Lock Mutex */ |
| 91 | void Lock(); |
| 92 | |
| 93 | /** Unlock Mutex */ |
| 94 | void UnLock(); |
| 95 | |
| 96 | /** Initialize the graphics */ |
| 97 | void InitGraphics(); |
| 98 | |
| 99 | /** No descriptions */ |
| 100 | void PlotPixel(int x, int y, Uint32 color); |
| 101 | |
| 102 | /** erases the work screen */ |
| 103 | void ClearGeoPlot(); |
| 104 | |
| 105 | /** Plot the boats history */ |
| 106 | void PlotHistory(int scale, int change_scrollx, int change_scrolly); |
| 107 | |
| 108 | /** Draws a line....What were you expecting? */ |
| 109 | void DrawLine(int X1,int Y1,int X2,int Y2,Uint32 Color); |
| 110 | |
| 111 | /** No descriptions */ |
| 112 | void DrawDot(int x, int y, Uint32 color); |
| 113 | |
| 114 | /** Increments plotscale to zoom in on the GeoPlot */ |
| 115 | void IncreasePlotScale(); |
| 116 | |
| 117 | /** Decriment the plotscale to zoom out of GeoPlot */ |
| 118 | void DecreasePlotScale(); |
| 119 | |
| 120 | /** No descriptions */ |
| 121 | void ToggleGeoPlotCenter(); |
| 122 | |
| 123 | /** Fill in the initial values for the solution. */ |
| 124 | void InitializeSolution(float LatYards, float LonYards, int Speed, int Heading); |
| 125 | |
| 126 | private: // Private attributes |
| 127 | /** */ |
| 128 | bool trackerstate[MAXTRACKERS]; |
| 129 | struct packet { |
| 130 | float LatYards; |
| 131 | float LonYards; |
| 132 | float BearingToTarget; |
| 133 | }; |
| 134 | |
| 135 | |
| 136 | |
| 137 | SDL_mutex *MutexLock; |
| 138 | }; |
| 139 | |
| 140 | #endif |