00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef WEATHERCAST_H
00013 #define WEATHERCAST_H
00014
00015 #include <list>
00016 #include <map>
00017 #include "pgimage.h"
00018 #include "paradialog.h"
00019 #include "weatherarea.h"
00020 #include "paradialog.h"
00021 #include "dashboard.h"
00027
00028
00029 struct WindAccu{
00030 int horizontalValue;
00031 int verticalValue;
00032 };
00033
00034 typedef list<WindData> WindStack;
00035 typedef map<const WeatherArea*, WindAccu> WeatherMap;
00036
00037
00038 class WeatherPanel: public Panel{
00039 public:
00040 WeatherPanel ( PG_Widget *parent, const PG_Rect &r, const ASCString& panelName_, bool loadTheme = true );
00041 virtual ~WeatherPanel();
00042 WindAccu getWindAccuData(const WeatherArea* wa);
00043 int getCounter();
00044 private:
00045 int counter;
00046 int windSpeed;
00047
00048 PG_Button* back;
00049 PG_Button* forward;
00050
00051 PG_Image* windRoseImage;
00052 PG_Image* windRoseArrow;
00053 PG_Image* windBar;
00054
00055 PG_Label* turnLabel;
00056 PG_Label* windspeedLabel;
00057
00058 BarGraphWidget* bgw;
00059
00060 const WeatherSystem* weatherSystem;
00061 WindStack windStack;
00062 WeatherMap warea2WindAccu;
00063 WindAccu wAccu;
00064
00065
00066 bool buttonForward( PG_Button* button );
00067 bool buttonBack( PG_Button* button );
00068 void painter (const PG_Rect &src, const ASCString& name, const PG_Rect &dst);
00069 void updateWeatherSpeed(int turn);
00070
00071 void showTurn();
00072 WindAccu updateWindAccu(const WindAccu&, unsigned int windspeed, Direction windDirection, float ratio);
00073 };
00074
00075
00076 class Weathercast: public ASC_PG_Dialog{
00077 public:
00078 Weathercast(const WeatherSystem& ws);
00079
00080 virtual ~Weathercast();
00081
00082 void painter (const PG_Rect &src, const ASCString& name, const PG_Rect &dst);
00083 bool mouseButtonDown ( const SDL_MouseButtonEvent *button);
00084 bool mouseMotion ( const SDL_MouseMotionEvent *motion);
00085 bool mouseClick ( SPoint pos );
00086 void paintWeatherArea(const WeatherArea* wa, int vMove, int hMove);
00087 private:
00088 static const int xSize;
00089 static const int ySize;
00090 static const int MAPXSIZE;
00091 static const int MAPYSIZE;
00092
00093
00094 WeatherPanel* weatherPanel;
00095
00096 int mapYPos;
00097 int mapXPos;
00098
00099
00100
00101 const WeatherSystem& weatherSystem;
00102
00103
00104 Surface s;
00105 float currentZoomX;
00106 float currentZoomY;
00107 SpecialDisplayWidget* sdw;
00108 MapDisplayPG* mapDisplayWidget;
00109
00110 PG_Button* okButton;
00111 bool closeWindow();
00112 void generateWeatherMap(int turn);
00113 void redraw() { Redraw(true); };
00114
00115 };
00116
00117 extern void weathercast();
00118
00119 #endif
00120