/
XRGWeatherView.h
165 lines (147 loc) · 4.87 KB
/
XRGWeatherView.h
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/*
* XRG (X Resource Graph): A system resource grapher for Mac OS X.
* Copyright (C) 2002-2016 Gaucho Software, LLC.
* You can view the complete license in the LICENSE file in the root
* of the source tree.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
//
// XRGWeatherView.h
//
#import <Cocoa/Cocoa.h>
#import "XRGURL.h"
#import "XRGGenericView.h"
#define XRGWEATHER_NONE 0
#define XRGWEATHER_WIND 1
#define XRGWEATHER_HUMIDITY 2
#define XRGWEATHER_VISIBILITY 3
#define XRGWEATHER_DEWPOINT 4
#define XRGWEATHER_PRESSURE 5
#define XRGWEATHER_TEMPERATURE_F 0
#define XRGWEATHER_TEMPERATURE_C 1
#define XRGWEATHER_DISTANCE_MI 0
#define XRGWEATHER_DISTANCE_KM 1
#define XRGWEATHER_PRESSURE_IN 0
#define XRGWEATHER_PRESSURE_HPA 1
int matchRegex(char *pattern, char *inString);
@interface XRGWeatherView : XRGGenericView {
@private
NSSize graphSize;
XRGModule *m;
// Caching variables
float STATION_WIDE;
float TEMPERATURE_WIDE;
float TEMPERATURE_NORMAL;
float TEMPERATURE_SMALL;
float HL_WIDE;
float WIND_WIDE;
float WIND_NORMAL;
float WIND_SMALL;
float HUMIDITY_WIDE;
float HUMIDITY_NORMAL;
float VISIBILITY_WIDE;
float DEWPOINT_WIDE;
float PRESSURE_WIDE;
float PRESSURE_NORMAL;
XRGURL *wurl1;
XRGURL *wurl2;
bool triedWURL1;
bool triedWURL2;
NSString *stationName;
NSMutableArray *metarArray;
bool gettingData;
bool processing;
bool haveGoodURL;
bool haveGoodMETARArray;
bool haveGoodDisplayData;
int time;
int windDirection;
int windSpeed;
int gustSpeed;
float visibilityInMiles;
float visibilityInKilometers;
int temperatureF;
float temperatureC;
int dewpointF;
float dewpointC;
float pressureIn;
int pressureHPA;
float high;
float low;
int relativeHumidity;
float *lastDayTemps;
float *lastDaySecondary;
float secondaryGraphLowerBound;
float secondaryGraphUpperBound;
NSString *shortTemp;
NSString *longTemp;
NSString *shortHL;
NSString *longHL;
NSString *shortWind;
NSString *longWind;
NSString *shortHumidity;
NSString *longHumidity;
NSString *shortVisibility;
NSString *longVisibility;
NSString *shortDewpoint;
NSString *longDewpoint;
NSString *shortPressure;
NSString *longPressure;
int interval;
}
- (void)setGraphSize:(NSSize)newSize;
- (void)updateMinSize;
- (int)convertHeight:(int) yComponent;
- (void)ticker;
- (void)graphUpdate:(NSTimer *)aTimer;
- (void)min30Update:(NSTimer *)aTimer;
- (void)min30UpdatePostProcessing;
- (void)setMETARFromText:(NSString *)s;
- (void)setCurrentWeatherDataFromMETAR;
- (void)setURL:(NSString *)icao;
- (NSInteger)findString:(char *)s inArray:(NSArray *)inArray;
- (NSArray *)getSecondaryGraphList;
- (void)setUpSecondaryGraph;
- (void)setUpTertiaryGraph;
- (void)cancelLoading;
- (bool)hasInvalidData;
- (bool)hasGoodDisplayData;
- (bool)gettingData;
- (int)getTemperatureF;
- (float)getTemperatureC;
- (char *)getWindDirection;
- (int)getWindSpeed;
- (int)getGustSpeed;
- (int)getVisibility;
- (int)getDewpointF;
- (float)getDewpointC;
- (float)getPressureIn;
- (float)getHigh;
- (float)getLow;
- (int)getRelativeHumidity;
- (int)getTimeFromMETARFields:(NSArray *)fields;
- (int)getWindDirectionFromMETARFields:(NSArray *)fields;
- (int)getWindSpeedFromMETARFields:(NSArray *)fields;
- (int)getGustSpeedFromMETARFields:(NSArray *)fields;
- (float)getVisibilityInMilesFromMETARFields:(NSArray *)fields;
- (float)getVisibilityInKilometersFromMETARFields:(NSArray *)fields;
- (float)getTemperatureFromMETARFields:(NSArray *)fields;
- (float)getDewpointFromMETARFields:(NSArray *)fields;
- (float)getPressureInFromMETARFields:(NSArray *)fields;
- (int)getPressureHPAFromMETARFields:(NSArray *)fields;
- (int)getRelativeHumidityFromTemperature: (float)t andDewpoint: (float)d;
@end