Skip to content

Commit

Permalink
Version 1.1 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
quent authored and Ben Williamson committed Mar 22, 2011
1 parent 603dd5a commit bc6375d
Show file tree
Hide file tree
Showing 31 changed files with 829 additions and 509 deletions.
1 change: 1 addition & 0 deletions Classes/ChartLoader.m
Expand Up @@ -81,6 +81,7 @@ - (BOOL)shouldContinueWithStatusCode:(NSInteger)statusCode
if (place.chart)
{
[self.context deleteObject:place.chart];
place.chart = nil;
[self.context saveAndLogErrors];
}
return NO;
Expand Down
50 changes: 50 additions & 0 deletions Classes/ChartObservation.h
@@ -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
61 changes: 61 additions & 0 deletions Classes/ChartObservation.m
@@ -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
13 changes: 5 additions & 8 deletions Classes/ChartViewController.h
Expand Up @@ -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;
Expand All @@ -70,8 +68,7 @@
id <ChartDelegate> _chartDelegate;
int _xCoordinate;
float _viewXPosition;
NSNumber* _currentYearYCoordinate;
NSNumber* _lastYearYCoordinate;
NSMutableArray* _yCoordinates;
}

@property (nonatomic, retain) Place* place;
Expand Down

0 comments on commit bc6375d

Please sign in to comment.