forked from nippysaurus/WeatherRock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RainfallValueTraining.m
70 lines (55 loc) · 1.73 KB
/
RainfallValueTraining.m
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
//
// RailfallValueTraining.m
// BrissyBom
//
// Created by Michael Dawson on 7/02/11.
// Copyright 2011 Nippysaurus. All rights reserved.
//
#import "RainfallValueTraining.h"
@implementation RainfallValueTraining
static float currentRainfallValue;
+(void)setCurrentRainfallValue:(float)value
{
currentRainfallValue = value;
}
+(void)createFileWithWarningLevel:(NSString*)warningLevel
{
NSLog(@"creating rainfall value training file");
@try
{
// NSString* timestamp = nil;
//
// // populate timestamp
// NSDateFormatter* fileNameDateFormat = [[NSDateFormatter alloc] init]; // 1
// [fileNameDateFormat setDateFormat:@"yyyyMMddHHmm"];
// timestamp = [fileNameDateFormat stringFromDate:[NSDate date]];
// [fileNameDateFormat release];
NSString* library = [Helpers pathFromUserLibraryPath:@"BrissyBom"];
// NSString* filename = [NSString stringWithFormat:@"[%@][%@][%f].png", timestamp, warningLevel, currentRainfallValue]; // auto
NSString* filename = [NSString stringWithFormat:@"%f.png", currentRainfallValue]; // auto
NSString* radarImageSrcPath = [library stringByAppendingPathComponent:@"IDR663.png"];
NSString* radarImageDstPath = [library stringByAppendingPathComponent:filename];
[[NSFileManager defaultManager] copyItemAtPath:radarImageSrcPath toPath:radarImageDstPath error:nil];
}
@catch (NSException * e)
{
NSLog(@"error creating training file");
}
}
-(void)setZero:(id)sender
{
[RainfallValueTraining createFileWithWarningLevel:@"0"];
}
-(void)setOne:(id)sender
{
[RainfallValueTraining createFileWithWarningLevel:@"1"];
}
-(void)setTwo:(id)sender
{
[RainfallValueTraining createFileWithWarningLevel:@"2"];
}
-(void)setThree:(id)sender
{
[RainfallValueTraining createFileWithWarningLevel:@"3"];
}
@end