File: weathercast.h

package info (click to toggle)
asc 2.1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 59,052 kB
  • ctags: 25,676
  • sloc: cpp: 145,189; sh: 8,705; ansic: 5,564; makefile: 551; perl: 150
file content (120 lines) | stat: -rw-r--r-- 2,605 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//
// C++ Interface: weathercast
//
// Description: 
//
//
// Author: Kevin Hirschmann <hirsch@dhcppc0>, (C) 2005
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef WEATHERCAST_H
#define WEATHERCAST_H

#include <list>
#include <map>
#include "pgimage.h"
#include "paradialog.h"
#include "weatherarea.h"
#include "paradialog.h"
#include "dashboard.h"
/**
@author Kevin Hirschmann
*/


//SDLmm::Color  LRCOLOR = 700;

struct WindAccu{
  int horizontalValue;
  int verticalValue;
};

typedef list<WindData> WindStack;
typedef map<const WeatherArea*, WindAccu> WeatherMap;


class WeatherPanel: public Panel{
public:
WeatherPanel ( PG_Widget *parent, const PG_Rect &r, const ASCString& panelName_, bool loadTheme = true );
virtual ~WeatherPanel();
WindAccu getWindAccuData(const WeatherArea* wa);
int getCounter();
private:
  int counter;
  int windSpeed;
    
  PG_Button* back;
  PG_Button* forward;  
  
  PG_Image* windRoseImage;
  PG_Image* windRoseArrow;  
  PG_Image* windBar;  
  
  PG_Label* turnLabel;
  PG_Label* windspeedLabel; 
  
  BarGraphWidget* bgw;  
  
  const WeatherSystem* weatherSystem;  
  WindStack windStack;  
  WeatherMap warea2WindAccu;
  WindAccu wAccu;
    
  
  bool buttonForward( PG_Button* button );  
  bool buttonBack( PG_Button* button );  
  void painter (const PG_Rect &src, const ASCString& name, const PG_Rect &dst);
  void updateWeatherSpeed(int turn);
  
  void showTurn();  
  WindAccu updateWindAccu(const WindAccu&, unsigned int windspeed, Direction windDirection, float ratio);  
};


class Weathercast: public ASC_PG_Dialog{
public:        
    Weathercast(const WeatherSystem& ws);    

    virtual ~Weathercast();
     
    void painter (const PG_Rect &src, const ASCString& name, const PG_Rect &dst);
    bool mouseButtonDown ( const SDL_MouseButtonEvent *button);
    bool mouseMotion (  const SDL_MouseMotionEvent *motion);
    bool mouseClick ( SPoint pos );
    void paintWeatherArea(const WeatherArea* wa, int vMove, int hMove);
private:
  static const int xSize;
  static const int ySize;
  static const int MAPXSIZE;
  static const int MAPYSIZE;
  
  
  WeatherPanel* weatherPanel;
  
  int mapYPos;
  int mapXPos;
  
  
      
  const WeatherSystem& weatherSystem;    
    
    
  Surface s;  
  float currentZoomX;  
  float currentZoomY;
  SpecialDisplayWidget* sdw;
  MapDisplayPG* mapDisplayWidget;    
  //PG_Image* weatherMapImage;    
  PG_Button* okButton;      
  bool closeWindow();      
  void generateWeatherMap(int turn);
  void redraw() { Redraw(true); };      

};

extern void weathercast();

#endif