Skip to content

Commit

Permalink
Some methods name changed.
Browse files Browse the repository at this point in the history
  • Loading branch information
kishikawakatsumi committed Aug 13, 2009
1 parent 3f56ecc commit cd0c53e
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 39 deletions.
4 changes: 2 additions & 2 deletions Classes/UICGDirections.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ - (void)goolgeMapsAPI:(UICGoogleMapsAPI *)goolgeMapsAPI didGetObject:(NSObject *
NSArray *routeDics = [dictionary objectForKey:@"routes"]; NSArray *routeDics = [dictionary objectForKey:@"routes"];
routes = [[NSMutableArray alloc] initWithCapacity:[routeDics count]]; routes = [[NSMutableArray alloc] initWithCapacity:[routeDics count]];
for (NSDictionary *routeDic in routeDics) { for (NSDictionary *routeDic in routeDics) {
[(NSMutableArray *)routes addObject:[UICGRoute routeWithDictionary:routeDic]]; [(NSMutableArray *)routes addObject:[UICGRoute routeWithDictionaryRepresentation:routeDic]];
} }
self.geocodes = [dictionary objectForKey:@"geocodes"]; self.geocodes = [dictionary objectForKey:@"geocodes"];
self.polyline = [UICGPolyline polylineWithDictionary:[dictionary objectForKey:@"polyline"]]; self.polyline = [UICGPolyline polylineWithDictionaryRepresentation:[dictionary objectForKey:@"polyline"]];
self.distance = [dictionary objectForKey:@"distance"]; self.distance = [dictionary objectForKey:@"distance"];
self.duration = [dictionary objectForKey:@"duration"]; self.duration = [dictionary objectForKey:@"duration"];
self.status = [dictionary objectForKey:@"status"]; self.status = [dictionary objectForKey:@"status"];
Expand Down
2 changes: 1 addition & 1 deletion Classes/UICGDirectionsOptions.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ @implementation UICGDirectionsOptions
- (id)init { - (id)init {
self = [super init]; self = [super init];
if (self != nil) { if (self != nil) {
locale = [[NSLocale currentLocale] retain]; locale = [[NSLocale alloc] initWithLocaleIdentifier:@"ja_JP"];
travelMode = UICGTravelModeDriving; travelMode = UICGTravelModeDriving;
avoidHighways = NO; avoidHighways = NO;
getPolyline = YES; getPolyline = YES;
Expand Down
9 changes: 5 additions & 4 deletions Classes/UICGPolyline.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@
#import <CoreLocation/CoreLocation.h> #import <CoreLocation/CoreLocation.h>


@interface UICGPolyline : NSObject { @interface UICGPolyline : NSObject {
NSDictionary *dictionary; NSDictionary *dictionaryRepresentation;
NSArray *vertices; NSArray *vertices;
NSMutableArray *routePoints; NSMutableArray *routePoints;
NSInteger vertexCount; NSInteger vertexCount;
NSInteger length; NSInteger length;
} }


@property (nonatomic, readonly) NSMutableArray *routePoints; @property (nonatomic, retain, readonly) NSDictionary *dictionaryRepresentation;
@property (nonatomic, retain, readonly) NSMutableArray *routePoints;
@property (nonatomic, readonly) NSInteger vertexCount; @property (nonatomic, readonly) NSInteger vertexCount;
@property (nonatomic, readonly) NSInteger length; @property (nonatomic, readonly) NSInteger length;


+ (UICGPolyline *)polylineWithDictionary:(NSDictionary *)dic; + (UICGPolyline *)polylineWithDictionaryRepresentation:(NSDictionary *)dictionary;
- (id)initWithDictionary:(NSDictionary *)dic; - (id)initWithDictionaryRepresentation:(NSDictionary *)dictionary;
- (CLLocation *)vertexAtIndex:(NSInteger)index; - (CLLocation *)vertexAtIndex:(NSInteger)index;
- (void)insertVertexAtIndex:(NSInteger)index inLocation:(CLLocation *)location; - (void)insertVertexAtIndex:(NSInteger)index inLocation:(CLLocation *)location;


Expand Down
13 changes: 7 additions & 6 deletions Classes/UICGPolyline.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@


@implementation UICGPolyline @implementation UICGPolyline


@synthesize dictionaryRepresentation;
@synthesize routePoints; @synthesize routePoints;
@synthesize vertexCount; @synthesize vertexCount;
@synthesize length; @synthesize length;


+ (UICGPolyline *)polylineWithDictionary:(NSDictionary *)dic { + (UICGPolyline *)polylineWithDictionaryRepresentation:(NSDictionary *)dictionary {
UICGPolyline *polyline = [[UICGPolyline alloc] initWithDictionary:dic]; UICGPolyline *polyline = [[UICGPolyline alloc] initWithDictionaryRepresentation:dictionary];
return [polyline autorelease]; return [polyline autorelease];
} }


- (id)initWithDictionary:(NSDictionary *)dic { - (id)initWithDictionaryRepresentation:(NSDictionary *)dictionary {
self = [super init]; self = [super init];
if (self != nil) { if (self != nil) {
dictionary = [dic retain]; dictionaryRepresentation = [dictionary retain];


vertices = [[dictionary objectForKey:@"j"] retain]; vertices = [[dictionaryRepresentation objectForKey:@"j"] retain];
vertexCount = [vertices count]; vertexCount = [vertices count];
routePoints = [NSMutableArray arrayWithCapacity:vertexCount]; routePoints = [NSMutableArray arrayWithCapacity:vertexCount];
for (NSDictionary *vertex in vertices) { for (NSDictionary *vertex in vertices) {
Expand All @@ -38,7 +39,7 @@ - (id)initWithDictionary:(NSDictionary *)dic {
} }


- (void)dealloc { - (void)dealloc {
[dictionary release]; [dictionaryRepresentation release];
[vertices release]; [vertices release];
[super dealloc]; [super dealloc];
} }
Expand Down
7 changes: 4 additions & 3 deletions Classes/UICGRoute.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#import "UICGStep.h" #import "UICGStep.h"


@interface UICGRoute : NSObject { @interface UICGRoute : NSObject {
NSDictionary *dictionary; NSDictionary *dictionaryRepresentation;
NSInteger numerOfSteps; NSInteger numerOfSteps;
NSArray *steps; NSArray *steps;
NSDictionary *distance; NSDictionary *distance;
Expand All @@ -23,6 +23,7 @@
NSInteger polylineEndIndex; NSInteger polylineEndIndex;
} }


@property (nonatomic, retain readonly) NSDictionary *dictionaryRepresentation;
@property (nonatomic, readonly) NSInteger numerOfSteps; @property (nonatomic, readonly) NSInteger numerOfSteps;
@property (nonatomic, retain, readonly) NSArray *steps; @property (nonatomic, retain, readonly) NSArray *steps;
@property (nonatomic, retain, readonly) NSDictionary *distance; @property (nonatomic, retain, readonly) NSDictionary *distance;
Expand All @@ -33,8 +34,8 @@
@property (nonatomic, retain, readonly) CLLocation *endLocation; @property (nonatomic, retain, readonly) CLLocation *endLocation;
@property (nonatomic, assign, readonly) NSInteger polylineEndIndex; @property (nonatomic, assign, readonly) NSInteger polylineEndIndex;


+ (UICGRoute *)routeWithDictionary:(NSDictionary *)dic; + (UICGRoute *)routeWithDictionaryRepresentation:(NSDictionary *)dictionary;
- (id)initWithDictionary:(NSDictionary *)dic; - (id)initWithDictionaryRepresentation:(NSDictionary *)dictionary;
- (UICGStep *)stepAtIndex:(NSInteger)index; - (UICGStep *)stepAtIndex:(NSInteger)index;


@end @end
19 changes: 10 additions & 9 deletions Classes/UICGRoute.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@


@implementation UICGRoute @implementation UICGRoute


@synthesize dictionaryRepresentation;
@synthesize numerOfSteps; @synthesize numerOfSteps;
@synthesize steps; @synthesize steps;
@synthesize distance; @synthesize distance;
Expand All @@ -20,25 +21,25 @@ @implementation UICGRoute
@synthesize endLocation; @synthesize endLocation;
@synthesize polylineEndIndex; @synthesize polylineEndIndex;


+ (UICGRoute *)routeWithDictionary:(NSDictionary *)dic { + (UICGRoute *)routeWithDictionaryRepresentation:(NSDictionary *)dictionary {
UICGRoute *route = [[UICGRoute alloc] initWithDictionary:dic]; UICGRoute *route = [[UICGRoute alloc] initWithDictionaryRepresentation:dictionary];
return [route autorelease]; return [route autorelease];
} }


- (id)initWithDictionary:(NSDictionary *)dic { - (id)initWithDictionaryRepresentation:(NSDictionary *)dictionary {
self = [super init]; self = [super init];
if (self != nil) { if (self != nil) {
dictionary = [dic retain]; dictionaryRepresentation = [dictionary retain];
NSDictionary *k = [dictionary objectForKey:@"k"]; NSDictionary *k = [dictionaryRepresentation objectForKey:@"k"];
NSArray *stepDics = [k objectForKey:@"Steps"]; NSArray *stepDics = [k objectForKey:@"Steps"];
numerOfSteps = [stepDics count]; numerOfSteps = [stepDics count];
steps = [[NSMutableArray alloc] initWithCapacity:numerOfSteps]; steps = [[NSMutableArray alloc] initWithCapacity:numerOfSteps];
for (NSDictionary *stepDic in stepDics) { for (NSDictionary *stepDic in stepDics) {
[(NSMutableArray *)steps addObject:[UICGStep stepWithDictionary:stepDic]]; [(NSMutableArray *)steps addObject:[UICGStep stepWithDictionaryRepresentation:stepDic]];
} }


endGeocode = [dictionary objectForKey:@"MJ"]; endGeocode = [dictionaryRepresentation objectForKey:@"MJ"];
startGeocode = [dictionary objectForKey:@"dT"]; startGeocode = [dictionaryRepresentation objectForKey:@"dT"];


distance = [k objectForKey:@"Distance"]; distance = [k objectForKey:@"Distance"];
duration = [k objectForKey:@"Duration"]; duration = [k objectForKey:@"Duration"];
Expand All @@ -54,7 +55,7 @@ - (id)initWithDictionary:(NSDictionary *)dic {
} }


- (void)dealloc { - (void)dealloc {
[dictionary release]; [dictionaryRepresentation release];
[steps release]; [steps release];
[distance release]; [distance release];
[duration release]; [duration release];
Expand Down
9 changes: 5 additions & 4 deletions Classes/UICGStep.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@
#import <CoreLocation/CoreLocation.h> #import <CoreLocation/CoreLocation.h>


@interface UICGStep : NSObject { @interface UICGStep : NSObject {
NSDictionary *dictionary; NSDictionary *dictionaryRepresentation;
CLLocation *location; CLLocation *location;
NSInteger polylineIndex; NSInteger polylineIndex;
NSString *descriptionHtml; NSString *descriptionHtml;
NSDictionary *distance; NSDictionary *distance;
NSDictionary *duration; NSDictionary *duration;
} }


@property (nonatomic, retain, readonly)CLLocation *location; @property (nonatomic, retain, readonly) NSDictionary *dictionaryRepresentation;
@property (nonatomic, retain, readonly) CLLocation *location;
@property (nonatomic, readonly) NSInteger polylineIndex; @property (nonatomic, readonly) NSInteger polylineIndex;
@property (nonatomic, retain, readonly) NSString *descriptionHtml; @property (nonatomic, retain, readonly) NSString *descriptionHtml;
@property (nonatomic, retain, readonly) NSDictionary *distance; @property (nonatomic, retain, readonly) NSDictionary *distance;
@property (nonatomic, retain, readonly) NSDictionary *duration; @property (nonatomic, retain, readonly) NSDictionary *duration;


+ (UICGStep *)stepWithDictionary:(NSDictionary *)dic; + (UICGStep *)stepWithDictionaryRepresentation:(NSDictionary *)dictionary;
- (id)initWithDictionary:(NSDictionary *)dic; - (id)initWithDictionaryRepresentation:(NSDictionary *)dictionary;


@end @end
21 changes: 11 additions & 10 deletions Classes/UICGStep.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,43 +10,44 @@


@implementation UICGStep @implementation UICGStep


@synthesize dictionaryRepresentation;
@synthesize location; @synthesize location;
@synthesize polylineIndex; @synthesize polylineIndex;
@synthesize descriptionHtml; @synthesize descriptionHtml;
@synthesize distance; @synthesize distance;
@synthesize duration; @synthesize duration;


+ (UICGStep *)stepWithDictionary:(NSDictionary *)dic { + (UICGStep *)stepWithDictionaryRepresentation:(NSDictionary *)dictionary {
UICGStep *step = [[UICGStep alloc] initWithDictionary:dic]; UICGStep *step = [[UICGStep alloc] initWithDictionaryRepresentation:dictionary];
return [step autorelease]; return [step autorelease];
} }


- (id)initWithDictionary:(NSDictionary *)dic { - (id)initWithDictionaryRepresentation:(NSDictionary *)dictionary {
self = [super init]; self = [super init];
if (self != nil) { if (self != nil) {
dictionary = [dic retain]; dictionaryRepresentation = [dictionary retain];


NSDictionary *point = [dictionary objectForKey:@"Point"]; NSDictionary *point = [dictionaryRepresentation objectForKey:@"Point"];
NSArray *coordinates = [point objectForKey:@"coordinates"]; NSArray *coordinates = [point objectForKey:@"coordinates"];
CLLocationDegrees latitude = [[coordinates objectAtIndex:0] doubleValue]; CLLocationDegrees latitude = [[coordinates objectAtIndex:0] doubleValue];
CLLocationDegrees longitude = [[coordinates objectAtIndex:1] doubleValue]; CLLocationDegrees longitude = [[coordinates objectAtIndex:1] doubleValue];
location = [[[CLLocation alloc] initWithLatitude:latitude longitude:longitude] autorelease]; location = [[[CLLocation alloc] initWithLatitude:latitude longitude:longitude] autorelease];


id index = [dictionary objectForKey:@"polylineIndex"]; id index = [dictionaryRepresentation objectForKey:@"polylineIndex"];
if (index == [NSNull null]) { if (index == [NSNull null]) {
polylineIndex = -1; polylineIndex = -1;
} else { } else {
polylineIndex = [index integerValue]; polylineIndex = [index integerValue];
} }
descriptionHtml = [dictionary objectForKey:@"descriptionHtml"]; descriptionHtml = [dictionaryRepresentation objectForKey:@"descriptionHtml"];
distance = [dictionary objectForKey:@"Distance"]; distance = [dictionaryRepresentation objectForKey:@"Distance"];
duration = [dictionary objectForKey:@"Duration"]; duration = [dictionaryRepresentation objectForKey:@"Duration"];
} }
return self; return self;
} }


- (void)dealloc { - (void)dealloc {
[dictionary release]; [dictionaryRepresentation release];
[location release]; [location release];
[descriptionHtml release]; [descriptionHtml release];
[distance release]; [distance release];
Expand Down

0 comments on commit cd0c53e

Please sign in to comment.