Permalink
Browse files

Version 1.1 release.

  • Loading branch information...
1 parent 603dd5a commit bc6375dc6572c112ba9fd7a0376f7e84b10c7947 @quent quent committed with Ben Williamson Mar 15, 2011
View
@@ -81,6 +81,7 @@ - (BOOL)shouldContinueWithStatusCode:(NSInteger)statusCode
if (place.chart)
{
[self.context deleteObject:place.chart];
+ place.chart = nil;
[self.context saveAndLogErrors];
}
return NO;
View
@@ -0,0 +1,50 @@
+//
+// ChartObservation.h
+// Slake
+//
+// Created by Quentin Leseney on 13/01/11.
+// Copyright (c) 2010 Bureau of Meteorology
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+// Light version of Observation class and not a managed object
+
+@class Measurement;
+
+@interface ChartObservation : NSObject
+{
+ NSDate* _date;
+ Measurement* _percentageVolume;
+ Measurement* _volume;
+}
+
+@property (nonatomic, retain) NSDate* date;
+@property (nonatomic, retain) Measurement* percentageVolume;
+@property (nonatomic, retain) Measurement* volume;
+
++ (ChartObservation*)chartObservationWithDate:(NSDate*)date
+ percentageVolume:(Measurement*)percentageVolume
+ volume:(Measurement*)volume;
+
+@end
View
@@ -0,0 +1,61 @@
+//
+// ChartObservation.m
+// Slake
+//
+// Created by Quentin Leseney on 13/01/11.
+// Copyright (c) 2010 Bureau of Meteorology
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+#import "ChartObservation.h"
+#import "Measurement.h"
+
+@implementation ChartObservation
+
+@synthesize date = _date;
+@synthesize percentageVolume = _percentageVolume;
+@synthesize volume = _volume;
+
+- (void)dealloc
+{
+ [_date release];
+ [_percentageVolume release];
+ [_volume release];
+ [super dealloc];
+}
+
++ (ChartObservation*)chartObservationWithDate:(NSDate*)date
+ percentageVolume:(Measurement*)percentageVolume
+ volume:(Measurement*)volume
+{
+ ChartObservation* res = [[[ChartObservation alloc] init] autorelease];
+ if (res) {
+ res.date = date;
+ res.percentageVolume = percentageVolume;
+ res.volume = volume;
+ }
+ return res;
+}
+
+@end
@@ -39,12 +39,10 @@
@protocol MarkerLabelDelegate
-- (void)showLabelsCurrentYearDate:(NSDate*)date
- currentYearPercentage:(Measurement*)currentYearPercentage
- currentYearVolume:(Measurement*)currentYearVolume
- lastYearDate:(NSDate*)date
- lastYearPercentage:(Measurement*)lastYearPercentage
- lastYearVolume:(Measurement*)lastYearVolume
+// observations is to be an array of ChartObservation, starting from current year, last year...
+// if there is no value for a given year, ChartObservation with date and
+// nil Measurement for volume and percentage should be given
+- (void)showLabelsForChartObservations:(NSArray*)observations
awayFrom:(float)viewXPosition;
- (void)hideLabels;
@@ -70,8 +68,7 @@
id <ChartDelegate> _chartDelegate;
int _xCoordinate;
float _viewXPosition;
- NSNumber* _currentYearYCoordinate;
- NSNumber* _lastYearYCoordinate;
+ NSMutableArray* _yCoordinates;
}
@property (nonatomic, retain) Place* place;
Oops, something went wrong.

0 comments on commit bc6375d

Please sign in to comment.