]> git.mxchange.org Git - flightgear.git/blob - src/WeatherCM/FGMicroWeather.h
Added first stab at a socket class.
[flightgear.git] / src / WeatherCM / FGMicroWeather.h
1 /*****************************************************************************
2
3  Header:       FGMicroWeather.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 Store the single weather areas
29
30 HISTORY
31 ------------------------------------------------------------------------------
32 28.05.1999 Christian Mayer      Created
33 16.06.1999 Durk Talsma          Portability for Linux
34 20.06.1999 Christian Mayer      added lots of consts
35 30.06.1999 Christian Mayer      STL portability
36 11.10.1999 Christian Mayer      changed set<> to map<> on Bernie Bright's 
37                                 suggestion
38 19.10.1999 Christian Mayer      change to use PLIB's sg instead of Point[2/3]D
39                                 and lots of wee code cleaning
40 *****************************************************************************/
41
42 /****************************************************************************/
43 /* SENTRY                                                                   */
44 /****************************************************************************/
45 #ifndef FGMicroWeather_H
46 #define FGMicroWeather_H
47
48 /****************************************************************************/
49 /* INCLUDES                                                                 */
50 /****************************************************************************/
51 #include <set>
52
53 #include "sg.h"
54 #include "FGWeatherVectorWrap.h"
55
56 #include "FGWeatherDefs.h"
57
58 //Include all the simulated weather features
59 #include "FGCloud.h"
60 #include "FGSnowRain.h"
61
62 #include "FGAirPressureItem.h"
63 #include "FGWindItem.h"
64 #include "FGTurbulenceItem.h"
65
66 #include "FGPhysicalProperties.h"
67 #include "FGPhysicalProperty.h"
68
69 /****************************************************************************/
70 /* DEFINES                                                                  */
71 /****************************************************************************/
72 FG_USING_STD(set);
73 FG_USING_NAMESPACE(std);
74
75 /****************************************************************************/
76 /* CLASS DECLARATION                                                        */
77 /****************************************************************************/
78 class FGMicroWeather
79 {
80 private:
81 protected:
82     typedef vector<sgVec2Wrap>           positionList;
83     typedef positionList::iterator       positionListIt;
84     typedef positionList::const_iterator const_positionListIt;
85     positionList position;      //the points that specify the outline of the
86                                 //micro weather (lat/lon)
87
88     FGPhysicalProperties2D StoredWeather;    //property if nothing is specified
89
90 public:
91     /************************************************************************/
92     /* Constructor and Destructor                                           */
93     /************************************************************************/
94     FGMicroWeather(const FGPhysicalProperties2D& p, const positionList& points);
95     ~FGMicroWeather();
96
97     /************************************************************************/
98     /* Add a feature to the micro weather                                   */
99     /************************************************************************/
100     void addWind         (const WeatherPrecision alt, const FGWindItem&       x);
101     void addTurbulence   (const WeatherPrecision alt, const FGTurbulenceItem& x);
102     void addTemperature  (const WeatherPrecision alt, const WeatherPrecision  x);
103     void addAirPressure  (const WeatherPrecision alt, const WeatherPrecision  x);
104     void addVaporPressure(const WeatherPrecision alt, const WeatherPrecision  x);
105     void addCloud        (const WeatherPrecision alt, const FGCloudItem&      x);
106
107     void setSnowRainIntensity   (const WeatherPrecision x);
108     void setSnowRainType        (const SnowRainType x);
109     void setLightningProbability(const WeatherPrecision x);
110
111     void setStoredWeather       (const FGPhysicalProperties2D& x);
112
113     /************************************************************************/
114     /* get physical properties in the micro weather                         */
115     /* NOTE: I don't neet to speify a positon as the properties don't       */
116     /*       change in a micro weather                                      */
117     /************************************************************************/
118     FGPhysicalProperties get(void) const
119     {
120         return FGPhysicalProperties();
121     }
122
123     FGPhysicalProperty   get(const WeatherPrecision altitude) const
124     {
125         return FGPhysicalProperty(StoredWeather, altitude);
126     }
127
128     /************************************************************************/
129     /* return true if p is inside this micro weather                        */
130     /************************************************************************/
131     bool hasPoint(const sgVec2& p) const;
132     bool hasPoint(const sgVec3& p) const 
133     { 
134         sgVec2 temp;
135         sgSetVec2(temp, p[0], p[1]);
136
137         return hasPoint( temp ); 
138     } 
139 };
140
141 /****************************************************************************/
142 #endif /*FGMicroWeather_H*/