forked from core-plot/core-plot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCPTLimitBand.m
More file actions
127 lines (98 loc) · 2.93 KB
/
Copy pathCPTLimitBand.m
File metadata and controls
127 lines (98 loc) · 2.93 KB
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
#import "CPTLimitBand.h"
#import "CPTFill.h"
#import "CPTPlotRange.h"
/**
* @brief Defines a range and fill used to highlight a band of data.
**/
@implementation CPTLimitBand
/** @property nullable CPTPlotRange *range
* @brief The data range for the band.
**/
@synthesize range;
/** @property nullable CPTFill *fill
* @brief The fill used to draw the band.
**/
@synthesize fill;
#pragma mark -
#pragma mark Init/Dealloc
/** @brief Creates and returns a new CPTLimitBand instance initialized with the provided range and fill.
* @param newRange The range of the band.
* @param newFill The fill used to draw the interior of the band.
* @return A new CPTLimitBand instance initialized with the provided range and fill.
**/
+(nonnull instancetype)limitBandWithRange:(nullable CPTPlotRange *)newRange fill:(nullable CPTFill *)newFill
{
return [[self alloc] initWithRange:newRange fill:newFill];
}
/** @brief Initializes a newly allocated CPTLimitBand object with the provided range and fill.
* @param newRange The range of the band.
* @param newFill The fill used to draw the interior of the band.
* @return The initialized CPTLimitBand object.
**/
-(nonnull instancetype)initWithRange:(nullable CPTPlotRange *)newRange fill:(nullable CPTFill *)newFill
{
if ((self = [super init])) {
range = newRange;
fill = newFill;
}
return self;
}
/// @cond
-(nonnull instancetype)init
{
return [self initWithRange:nil fill:nil];
}
/// @endcond
#pragma mark -
#pragma mark NSCopying Methods
/// @cond
-(nonnull id)copyWithZone:(nullable NSZone *)zone
{
CPTLimitBand *newBand = [[CPTLimitBand allocWithZone:zone] init];
if ( newBand ) {
newBand.range = self.range;
newBand.fill = self.fill;
}
return newBand;
}
/// @endcond
#pragma mark -
#pragma mark NSCoding Methods
/// @cond
-(void)encodeWithCoder:(nonnull NSCoder *)encoder
{
[encoder encodeObject:self.range forKey:@"CPTLimitBand.range"];
[encoder encodeObject:self.fill forKey:@"CPTLimitBand.fill"];
}
/// @endcond
/** @brief Returns an object initialized from data in a given unarchiver.
* @param decoder An unarchiver object.
* @return An object initialized from data in a given unarchiver.
*/
-(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder
{
if ((self = [super init])) {
range = [decoder decodeObjectOfClass:[CPTPlotRange class]
forKey:@"CPTLimitBand.range"];
fill = [decoder decodeObjectOfClass:[CPTFill class]
forKey:@"CPTLimitBand.fill"];
}
return self;
}
#pragma mark -
#pragma mark NSSecureCoding Methods
/// @cond
+(BOOL)supportsSecureCoding
{
return YES;
}
/// @endcond
#pragma mark -
#pragma mark Description
/// @cond
-(nullable NSString *)description
{
return [NSString stringWithFormat:@"<%@ with range: %@ and fill: %@>", super.description, self.range, self.fill];
}
/// @endcond
@end