~ubuntu-branches/ubuntu/quantal/flightgear/quantal

« back to all changes in this revision

Viewing changes to src/WeatherCM/FGWeatherParse.h

  • Committer: Bazaar Package Importer
  • Author(s): Ove Kaaven
  • Date: 2002-03-27 21:50:15 UTC
  • Revision ID: james.westby@ubuntu.com-20020327215015-0rvi3o8iml0a8s93
Tags: upstream-0.7.9
ImportĀ upstreamĀ versionĀ 0.7.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 
 
3
 Header:       FGWeatherParse.h 
 
4
 Author:       Christian Mayer
 
5
 Date started: 28.05.99
 
6
 
 
7
 -------- Copyright (C) 1999 Christian Mayer (fgfs@christianmayer.de) --------
 
8
 
 
9
 This program is free software; you can redistribute it and/or modify it under
 
10
 the terms of the GNU General Public License as published by the Free Software
 
11
 Foundation; either version 2 of the License, or (at your option) any later
 
12
 version.
 
13
 
 
14
 This program is distributed in the hope that it will be useful, but WITHOUT
 
15
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
16
 FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
17
 details.
 
18
 
 
19
 You should have received a copy of the GNU General Public License along with
 
20
 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
21
 Place - Suite 330, Boston, MA  02111-1307, USA.
 
22
 
 
23
 Further information about the GNU General Public License can also be found on
 
24
 the world wide web at http://www.gnu.org.
 
25
 
 
26
FUNCTIONAL DESCRIPTION
 
27
------------------------------------------------------------------------------
 
28
Parse the weather that can be downloaded from 
 
29
 
 
30
    http://129.13.102.67/out/flight/yymmddhhdata.txt.gz
 
31
 
 
32
where yy stands for the year, mm for the month, dd for the day and hh for the
 
33
hour.
 
34
The columns are explained at
 
35
 
 
36
    http://129.13.102.67/out/flight/kopf.txt
 
37
 
 
38
and a list of the stations can be found at
 
39
 
 
40
    http://129.13.102.67/out/flight/wmoconv.txt.gz
 
41
 
 
42
Many thanks to Georg Mueller (Georg.Mueller@imk.fzk.de) of the 
 
43
 
 
44
    Institut fuer Meteorologie und Klimaforschung, Universitaet Karlsruhe
 
45
 
 
46
for makeking such a service aviable. 
 
47
You can also visit his homepage at http://www.wetterzentrale.de
 
48
 
 
49
HISTORY
 
50
------------------------------------------------------------------------------
 
51
18.10.1999 Christian Mayer      Created
 
52
14.12.1999 Christian Mayer      minor internal changes
 
53
*****************************************************************************/
 
54
 
 
55
/****************************************************************************/
 
56
/* SENTRY                                                                   */
 
57
/****************************************************************************/
 
58
#ifndef FGWeatherParse_H
 
59
#define FGWeatherParse_H
 
60
 
 
61
/****************************************************************************/
 
62
/* INCLUDES                                                                 */
 
63
/****************************************************************************/
 
64
#ifdef HAVE_CONFIG_H
 
65
#  include <config.h>
 
66
#endif
 
67
 
 
68
#include <simgear/compiler.h>
 
69
#include <vector>
 
70
 
 
71
#include <simgear/misc/sgstream.hxx>
 
72
 
 
73
#include "FGPhysicalProperties.h"
 
74
 
 
75
/****************************************************************************/
 
76
/* DEFINES                                                                  */
 
77
/****************************************************************************/
 
78
SG_USING_STD(vector);
 
79
 
 
80
/****************************************************************************/
 
81
/* CLASS DECLARATION                                                        */
 
82
/****************************************************************************/
 
83
class FGWeatherParse
 
84
{
 
85
public:
 
86
    struct entry;
 
87
 
 
88
private:
 
89
    vector<entry> weather_station;
 
90
 
 
91
protected:
 
92
public:
 
93
    /************************************************************************/
 
94
    /* A line (i.e. entry) in the data file looks like:                     */
 
95
    /*  yyyy mm dd hh XXXXX BBBBB LLLLLL UUUUU VVVVV TTTTT DDDDD PPPPP pppp */
 
96
    /************************************************************************/
 
97
    struct entry
 
98
    {
 
99
        int year;                       // The yyyy
 
100
        int month;                      // The mm
 
101
        int day;                        // The dd
 
102
        int hour;                       // The hh
 
103
        unsigned int station_number;    // The XXXXX
 
104
        float lat;                      // The BBBBBB   negative = south
 
105
        float lon;                      // The LLLLLLL  negative = west 
 
106
        float x_wind;                   // The UUUUU    negative = to the weat
 
107
        float y_wind;                   // The VVVVV    negative = to the south
 
108
        float temperature;              // The TTTTT    in degC
 
109
        float dewpoint;                 // The DDDDD    in degC
 
110
        float airpressure;              // The PPPPP    in hPa
 
111
        float airpressure_history[4];   // The pppp     in hPa
 
112
    };
 
113
 
 
114
    FGWeatherParse();
 
115
    ~FGWeatherParse();
 
116
 
 
117
    void input(const char *file);
 
118
 
 
119
    unsigned int stored_stations(void) const
 
120
    {
 
121
        return weather_station.size();
 
122
    }
 
123
 
 
124
    entry getEntry(const unsigned int nr) const
 
125
    {
 
126
        return weather_station[nr];
 
127
    }
 
128
 
 
129
    FGPhysicalProperties getFGPhysicalProperties(const unsigned int nr) const;
 
130
    void getPosition(const unsigned int nr, sgVec2 pos) const;
 
131
};
 
132
 
 
133
/****************************************************************************/
 
134
#endif /*FGWeatherParse_H*/