Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

OPEPoint fixes

  • Loading branch information...
commit 5bdc34897c7768deb92447459f3061b8bf92be2c 1 parent 3d92f2b
David Chiles authored
12 OPETagInterpreter.h
@@ -38,13 +38,13 @@
38 38 - (id) init;
39 39 //- (BOOL) nodeHasRecognizedTags:(OPENode *)n;
40 40 //- (NSDictionary *) getPrimaryKeyValue: (OPENode *)n;
41   -- (NSString *) category: (id<OPEPoint>)n; //getCategory
42   -- (OPEType *) type: (id<OPEPoint>)n; //getType
  41 +- (NSString *) category: (OPEPoint *)n; //getCategory
  42 +- (OPEType *) type: (OPEPoint *)n; //getType
43 43 - (void) readPlist;
44   -- (NSString *) getName: (id<OPEPoint>) node;
45   -- (NSString *) getImageForNode: (id<OPEPoint>) node;
46   -- (void)removeTagsForType:(OPEType *)type withNode:(id<OPEPoint>)node;
47   -- (BOOL)isSupported:(id<OPEPoint>)node;
  44 +- (NSString *) getName: (OPEPoint *) node;
  45 +- (NSString *) getImageForNode: (OPEPoint *) node;
  46 +- (void)removeTagsForType:(OPEType *)type withNode:(OPEPoint *)node;
  47 +- (BOOL)isSupported:(OPEPoint *)node;
48 48 - (NSDictionary *) allCategories;
49 49 - (NSDictionary *) allTypes;
50 50
12 OPETagInterpreter.m
@@ -44,12 +44,12 @@ - (id) init
44 44 return self;
45 45 }
46 46
47   -- (NSString *) category: (id<OPEPoint>)node
  47 +- (NSString *) category: (OPEPoint *)node
48 48 {
49 49 return [[self type:node] categoryName];
50 50 }
51 51
52   --(OPEType *)type:(id<OPEPoint>)node
  52 +-(OPEType *)type:(OPEPoint *)node
53 53 {
54 54 if([[node.tags objectForKey:@"highway"] isEqualToString:@"bus_stop"] )
55 55 {
@@ -157,7 +157,7 @@ - (void) readPlist
157 157
158 158 }
159 159
160   -- (NSString *) getName:(id<OPEPoint>)node
  160 +- (NSString *) getName:(OPEPoint *)node
161 161 {
162 162 NSString * name = [node.tags objectForKey:@"name"];
163 163 if(name)
@@ -171,18 +171,18 @@ - (NSString *) getName:(id<OPEPoint>)node
171 171 return @"Unknown";
172 172 }
173 173
174   -- (NSString *) getImageForNode: (id<OPEPoint>) node
  174 +- (NSString *) getImageForNode: (OPEPoint *) node
175 175 {
176 176 return [[self type:node] imageString];
177 177 }
178 178
179   -- (void)removeTagsForType:(OPEType *)type withNode:(id<OPEPoint>)node
  179 +- (void)removeTagsForType:(OPEType *)type withNode:(OPEPoint *)node
180 180 {
181 181 [node.tags removeObjectsForKeys:type.tags.allKeys];
182 182 //[node.tags removeObjectsForKeys:type.optionalTags];
183 183 }
184 184
185   -- (BOOL)isSupported:(id<OPEPoint>)node
  185 +- (BOOL)isSupported:(OPEPoint *)node
186 186 {
187 187 if([self type:node])
188 188 return YES;
4 OSM POI Editor.xcodeproj/project.pbxproj
@@ -304,6 +304,7 @@
304 304 63B748B41627844E0052148E /* map.png in Resources */ = {isa = PBXBuildFile; fileRef = 63B748B11627844E0052148E /* map.png */; };
305 305 63B748B51627844E0052148E /* embassy.png in Resources */ = {isa = PBXBuildFile; fileRef = 63B748B21627844E0052148E /* embassy.png */; };
306 306 63B748B61627844E0052148E /* guidepost.png in Resources */ = {isa = PBXBuildFile; fileRef = 63B748B31627844E0052148E /* guidepost.png */; };
  307 + 63C2035A164B153200C0F1EF /* OPEPoint.m in Sources */ = {isa = PBXBuildFile; fileRef = 63C20359164B153200C0F1EF /* OPEPoint.m */; };
307 308 63CB49D314E9C5A0008C4551 /* OPETextEdit.m in Sources */ = {isa = PBXBuildFile; fileRef = 63CB49D114E9C5A0008C4551 /* OPETextEdit.m */; };
308 309 63CB49DD14E9DE7B008C4551 /* OPECategoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 63CB49DB14E9DE7B008C4551 /* OPECategoryViewController.m */; };
309 310 63CB49DE14E9DE7B008C4551 /* OPECategoryViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 63CB49DC14E9DE7B008C4551 /* OPECategoryViewController.xib */; };
@@ -729,6 +730,7 @@
729 730 63B748B11627844E0052148E /* map.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = map.png; sourceTree = "<group>"; };
730 731 63B748B21627844E0052148E /* embassy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = embassy.png; sourceTree = "<group>"; };
731 732 63B748B31627844E0052148E /* guidepost.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = guidepost.png; sourceTree = "<group>"; };
  733 + 63C20359164B153200C0F1EF /* OPEPoint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OPEPoint.m; sourceTree = "<group>"; };
732 734 63CB49D014E9C5A0008C4551 /* OPETextEdit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OPETextEdit.h; sourceTree = "<group>"; };
733 735 63CB49D114E9C5A0008C4551 /* OPETextEdit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OPETextEdit.m; sourceTree = "<group>"; };
734 736 63CB49DA14E9DE7B008C4551 /* OPECategoryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OPECategoryViewController.h; path = ../OPECategoryViewController.h; sourceTree = "<group>"; };
@@ -1241,6 +1243,7 @@
1241 1243 isa = PBXGroup;
1242 1244 children = (
1243 1245 63AFC7BC15ACE3DB00A50C29 /* OPEPoint.h */,
  1246 + 63C20359164B153200C0F1EF /* OPEPoint.m */,
1244 1247 631539E314DCA29B000236F0 /* OPENode.h */,
1245 1248 631539E414DCA29B000236F0 /* OPENode.m */,
1246 1249 63F1F28415A7AD630027829B /* OPEWay.h */,
@@ -1951,6 +1954,7 @@
1951 1954 63AD8F7D15E8577E006F92B8 /* OPEType.m in Sources */,
1952 1955 63FCA4421643127D00A28470 /* OPEBingTileSource.m in Sources */,
1953 1956 63FCA4511643363800A28470 /* OPEUtility.m in Sources */,
  1957 + 63C2035A164B153200C0F1EF /* OPEPoint.m in Sources */,
1954 1958 );
1955 1959 runOnlyForDeploymentPostprocessing = 0;
1956 1960 };
BIN  OSM POI Editor.xcodeproj/project.xcworkspace/xcuserdata/David.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown
40 OSM POI Editor.xcodeproj/xcuserdata/David.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
@@ -23,11 +23,11 @@
23 23 continueAfterRunningActions = "No"
24 24 isPathRelative = "1"
25 25 filePath = "OSM POI Editor/OPENode.m"
26   - timestampString = "371691561.845876"
  26 + timestampString = "374021749.437275"
27 27 startingColumnNumber = "9223372036854775807"
28 28 endingColumnNumber = "9223372036854775807"
29   - startingLineNumber = "30"
30   - endingLineNumber = "30"
  29 + startingLineNumber = "29"
  30 + endingLineNumber = "29"
31 31 landmarkName = "-initWithId:coordinate:keyValues:"
32 32 landmarkType = "5">
33 33 </FileBreakpoint>
@@ -396,7 +396,7 @@
396 396 ignoreCount = "0"
397 397 continueAfterRunningActions = "No"
398 398 filePath = "OSM POI Editor/OPEWay.m"
399   - timestampString = "371691561.845876"
  399 + timestampString = "374021749.437275"
400 400 startingColumnNumber = "9223372036854775807"
401 401 endingColumnNumber = "9223372036854775807"
402 402 startingLineNumber = "74"
@@ -470,24 +470,11 @@
470 470 landmarkType = "3">
471 471 </FileBreakpoint>
472 472 <FileBreakpoint
473   - shouldBeEnabled = "Yes"
474   - ignoreCount = "0"
475   - continueAfterRunningActions = "No"
476   - filePath = "OSM POI Editor/OPENode.m"
477   - timestampString = "371691561.845876"
478   - startingColumnNumber = "9223372036854775807"
479   - endingColumnNumber = "9223372036854775807"
480   - startingLineNumber = "240"
481   - endingLineNumber = "240"
482   - landmarkName = "-description"
483   - landmarkType = "5">
484   - </FileBreakpoint>
485   - <FileBreakpoint
486 473 shouldBeEnabled = "No"
487 474 ignoreCount = "0"
488 475 continueAfterRunningActions = "No"
489 476 filePath = "OSM POI Editor/OPEWay.m"
490   - timestampString = "371691561.845876"
  477 + timestampString = "374021749.437275"
491 478 startingColumnNumber = "9223372036854775807"
492 479 endingColumnNumber = "9223372036854775807"
493 480 startingLineNumber = "90"
@@ -500,7 +487,7 @@
500 487 ignoreCount = "0"
501 488 continueAfterRunningActions = "No"
502 489 filePath = "OSM POI Editor/OPEWay.m"
503   - timestampString = "371691561.845876"
  490 + timestampString = "374021749.437275"
504 491 startingColumnNumber = "9223372036854775807"
505 492 endingColumnNumber = "9223372036854775807"
506 493 startingLineNumber = "81"
@@ -512,19 +499,6 @@
512 499 shouldBeEnabled = "No"
513 500 ignoreCount = "0"
514 501 continueAfterRunningActions = "No"
515   - filePath = "OSM POI Editor/OPENode.m"
516   - timestampString = "371691561.845876"
517   - startingColumnNumber = "9223372036854775807"
518   - endingColumnNumber = "9223372036854775807"
519   - startingLineNumber = "114"
520   - endingLineNumber = "114"
521   - landmarkName = "-addKey:value:"
522   - landmarkType = "5">
523   - </FileBreakpoint>
524   - <FileBreakpoint
525   - shouldBeEnabled = "No"
526   - ignoreCount = "0"
527   - continueAfterRunningActions = "No"
528 502 filePath = "OSM POI Editor/OPEOSMData.m"
529 503 timestampString = "371691561.845876"
530 504 startingColumnNumber = "9223372036854775807"
@@ -708,7 +682,7 @@
708 682 ignoreCount = "0"
709 683 continueAfterRunningActions = "No"
710 684 filePath = "OSM POI Editor/OPEWay.m"
711   - timestampString = "371691561.845876"
  685 + timestampString = "374021749.437275"
712 686 startingColumnNumber = "9223372036854775807"
713 687 endingColumnNumber = "9223372036854775807"
714 688 startingLineNumber = "40"
4 OSM POI Editor/OPEConstants.h
@@ -37,5 +37,7 @@
37 37
38 38 #define kLeftTextDefaultSize 76
39 39 #define kOPEAPIURL @"http://www.overpass-api.de/api/xapi?*"
  40 +
40 41 #define kPointTypeNode @"node"
41   -#define kPointTypeWay @"way"
  42 +#define kPointTypeWay @"way"
  43 +#define kPointTypePoint @"point"
5 OSM POI Editor/OPENode.h
@@ -24,15 +24,16 @@
24 24 #import <CoreLocation/CoreLocation.h>
25 25 #import "OPEPoint.h"
26 26
27   -@interface OPENode : NSObject <OPEPoint>
  27 +@interface OPENode : OPEPoint
28 28
29 29 -(id) initWithId: (int) i coordinate: (CLLocationCoordinate2D) coordinate keyValues: (NSMutableDictionary *) tag;
30 30 -(id) initWithId:(int)i latitude:(double) la longitude:(double) lo;
31 31 -(id) initWithId:(int)i latitude:(double) la longitude:(double) lo version:(int) ve;
32 32 -(id) initWithNode: (OPENode *) node;
33   --(BOOL)onlyTagCreatedBy;
34 33
35 34 + (id) createPointWithXML:(TBXMLElement *)xml;
36 35
37 36
  37 +
  38 +
38 39 @end
118 OSM POI Editor/OPENode.m
@@ -22,20 +22,19 @@
22 22
23 23 #import "OPENode.h"
24 24 #import "OPEConstants.h"
  25 +#import "OPETagInterpreter.h"
25 26
26 27 @implementation OPENode
27 28
28   -@synthesize ident, coordinate, tags, version, image;
29   -
30 29 -(id) initWithId: (int) i coordinate: (CLLocationCoordinate2D) newCoordinate keyValues: (NSMutableDictionary *) tag
31 30 {
32 31 self = [super init];
33 32 if(self)
34 33 {
35   - ident = i;
36   - coordinate = newCoordinate;
37   - tags = [[NSMutableDictionary alloc] initWithDictionary:tag];
38   - image = [[NSString alloc] init];
  34 + self.ident = i;
  35 + self.coordinate = newCoordinate;
  36 + self.tags = [[NSMutableDictionary alloc] initWithDictionary:tag];
  37 + self.image = [[NSString alloc] init];
39 38 }
40 39 return self;
41 40
@@ -46,10 +45,10 @@ -(id) initWithId:(int)i latitude:(double) la longitude:(double) lo
46 45 self = [super init];
47 46 if (self)
48 47 {
49   - ident = i;
50   - coordinate = CLLocationCoordinate2DMake(la,lo);
51   - tags = [[NSMutableDictionary alloc] init];
52   - image = [[NSString alloc] init];
  48 + self.ident = i;
  49 + self.coordinate = CLLocationCoordinate2DMake(la,lo);
  50 + self.tags = [[NSMutableDictionary alloc] init];
  51 + self.image = [[NSString alloc] init];
53 52 }
54 53 return self;
55 54 }
@@ -59,11 +58,11 @@ -(id) initWithId:(int)i latitude:(double) la longitude:(double) lo version: (int
59 58 self = [super init];
60 59 if (self)
61 60 {
62   - version = v;
63   - ident = i;
64   - coordinate = CLLocationCoordinate2DMake(la,lo);
65   - tags = [[NSMutableDictionary alloc] init];
66   - image = [[NSString alloc] init];
  61 + self.version = v;
  62 + self.ident = i;
  63 + self.coordinate = CLLocationCoordinate2DMake(la,lo);
  64 + self.tags = [[NSMutableDictionary alloc] init];
  65 + self.image = [[NSString alloc] init];
67 66 }
68 67 return self;
69 68 }
@@ -73,11 +72,11 @@ -(id) initWithNode: (OPENode *) node
73 72 self = [super init];
74 73 if (self)
75 74 {
76   - version = node.version;
77   - ident = node.ident;
78   - coordinate = CLLocationCoordinate2DMake(node.coordinate.latitude, node.coordinate.longitude);
79   - tags = [[NSMutableDictionary alloc] initWithDictionary:node.tags];
80   - image = node.image;
  75 + self.version = node.version;
  76 + self.ident = node.ident;
  77 + self.coordinate = CLLocationCoordinate2DMake(node.coordinate.latitude, node.coordinate.longitude);
  78 + self.tags = [[NSMutableDictionary alloc] initWithDictionary:node.tags];
  79 + self.image = node.image;
81 80 }
82 81 return self;
83 82 }
@@ -109,58 +108,6 @@ + (id) createPointWithXML:(TBXMLElement *)xml
109 108 return newNode;
110 109 }
111 110
112   --(void) addKey:(NSString *)key value:(NSString *)value
113   -{
114   - [self.tags setValue:value forKey:key];
115   -}
116   -
117   --(NSString *)name
118   -{
119   - if(tags)
120   - {
121   - NSString* name = [tags objectForKey:@"name"];
122   - if(name)
123   - return name;
124   - else
125   - return @"no name";
126   - }
127   - else
128   - return @"no name";
129   -}
130   -
131   --(BOOL)onlyTagCreatedBy
132   -{
133   - if(tags.count == 1)
134   - {
135   - for(NSString * key in tags)
136   - {
137   - if(key == @"created_by")
138   - return YES;
139   - else
140   - return NO;
141   - }
142   - }
143   - else
144   - return NO;
145   -
146   - return NO;
147   -}
148   -
149   --(BOOL) isequaltToPoint:(id<OPEPoint>)point
150   -{
151   - if(self.ident != point.ident)
152   - return NO;
153   - else if (self.coordinate.latitude != point.coordinate.latitude)
154   - return NO;
155   - else if (self.coordinate.longitude != point.coordinate.longitude)
156   - return NO;
157   - else if (![self.tags isEqualToDictionary:point.tags])
158   - return NO;
159   -
160   - return YES;
161   -
162   -}
163   -
164 111 - (NSData *) updateXMLforChangset: (NSInteger) changesetNumber
165 112 {
166 113 NSMutableString * xml = [NSMutableString stringWithFormat: @"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"];
@@ -227,28 +174,6 @@ -(NSString *)type
227 174 return kPointTypeNode;
228 175 }
229 176
230   --(BOOL)hasNoTags
231   -{
232   - if(![self.tags count])
233   - {
234   - return YES;
235   - }
236   - return NO;
237   -}
238   -
239   --(NSString *)description{
240   - return [NSString stringWithFormat:@"%@: %@",[self uniqueIdentifier],self.tags];
241   -}
242   -
243   --(NSString *)uniqueIdentifier
244   -{
245   - return [NSString stringWithFormat:@"%@%d",[self type],self.ident];
246   -}
247   -+(NSString *)uniqueIdentifierForID:(int)ident
248   -{
249   - return [NSString stringWithFormat:@"%@%d",kPointTypeNode,ident];
250   -}
251   -
252 177 -(id)copy
253 178 {
254 179 OPENode * nodeCopy = [[OPENode alloc] init];
@@ -261,4 +186,9 @@ -(id)copy
261 186 return nodeCopy;
262 187 }
263 188
  189 ++ (NSString *)uniqueIdentifierForID:(int)ident
  190 +{
  191 + return [NSString stringWithFormat:@"%@%d",kPointTypeNode,ident];
  192 +}
  193 +
264 194 @end
10 OSM POI Editor/OPENodeViewController.h
@@ -33,9 +33,9 @@
33 33
34 34 @protocol OPENodeViewDelegate
35 35 @optional
36   --(void)createdNode:(id <OPEPoint>) newPoint;
37   --(void)updatedNode:(id <OPEPoint>) newPoint withOriginalAnnotation:(RMAnnotation *)annotation;
38   --(void)deletedNode:(id <OPEPoint>) newPoint withOriginalAnnotation:(RMAnnotation *)annotation;
  36 +-(void)createdNode:(OPEPoint *) newPoint;
  37 +-(void)updatedNode:(OPEPoint *) newPoint withOriginalAnnotation:(RMAnnotation *)annotation;
  38 +-(void)deletedNode:(OPEPoint *) newPoint withOriginalAnnotation:(RMAnnotation *)annotation;
39 39 @end
40 40
41 41
@@ -46,8 +46,8 @@
46 46 float optionalTagWidth;
47 47 }
48 48
49   -@property (nonatomic, strong) id<OPEPoint> point;
50   -@property (nonatomic, strong) id<OPEPoint> theNewPoint;
  49 +@property (nonatomic, strong) OPEPoint * point;
  50 +@property (nonatomic, strong) OPEPoint * theNewPoint;
51 51 @property (nonatomic, strong) UITableView * nodeInfoTableView;
52 52 @property (nonatomic, strong) OPEType * nodeType;
53 53 @property (nonatomic, strong) NSString * type;
16 OSM POI Editor/OPEOSMData.h
@@ -38,18 +38,18 @@
38 38
39 39 - (void) getDataWithSW:(CLLocationCoordinate2D)southWest NE: (CLLocationCoordinate2D) northEast;
40 40 - (NSInteger) openChangesetWithMessage: (NSString *) message;
41   -- (int) createXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetNumber;
42   -- (int) updateXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetNumber;
43   -- (int) deleteXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetNumber;
  41 +- (int) createXmlNode: (OPEPoint *) node withChangeset: (NSInteger) changesetNumber;
  42 +- (int) updateXmlNode: (OPEPoint *) node withChangeset: (NSInteger) changesetNumber;
  43 +- (int) deleteXmlNode: (OPEPoint *) node withChangeset: (NSInteger) changesetNumber;
44 44 - (void) closeChangeset: (NSInteger) changesetNumber;
45 45 - (BOOL) canAuth;
46 46
47   -- (int) createNode: (id<OPEPoint>) node;
48   -- (int) updateNode: (id<OPEPoint>) node;
49   -- (int) deleteNode: (id<OPEPoint>) node;
  47 +- (int) createNode: (OPEPoint *) node;
  48 +- (int) updateNode: (OPEPoint *) node;
  49 +- (int) deleteNode: (OPEPoint *) node;
50 50 - (void) uploadComplete;
51   -+ (void) HTMLFix:(id<OPEPoint>)node;
52   -+(void) backToHTML:(id<OPEPoint>)node;
  51 ++ (void) HTMLFix:(OPEPoint *)node;
  52 ++(void) backToHTML:(OPEPoint *)node;
53 53
54 54
55 55
16 OSM POI Editor/OPEOSMData.m
@@ -240,7 +240,7 @@ -(void) getDataWithSW:(CLLocationCoordinate2D)southWest NE: (CLLocationCoordinat
240 240 [request startAsynchronous];
241 241 }
242 242
243   -- (int) createNode: (id<OPEPoint>) newPoint
  243 +- (int) createNode: (OPEPoint *) newPoint
244 244 {
245 245 NSInteger changeset = [self openChangesetWithMessage:[NSString stringWithFormat:@"Created new POI: %@",[tagInterpreter getName:newPoint]]];
246 246 int newIdent = [self createXmlNode:newPoint withChangeset:changeset];
@@ -248,7 +248,7 @@ - (int) createNode: (id<OPEPoint>) newPoint
248 248 return newIdent;
249 249
250 250 }
251   -- (int) updateNode: (id<OPEPoint>) node
  251 +- (int) updateNode: (OPEPoint *) node
252 252 {
253 253 NSInteger changeset = [self openChangesetWithMessage:[NSString stringWithFormat:@"Updated existing POI: %@",[tagInterpreter getName:node]]];
254 254 int version = [self updateXmlNode:node withChangeset:changeset];
@@ -257,7 +257,7 @@ - (int) updateNode: (id<OPEPoint>) node
257 257 return version;
258 258
259 259 }
260   -- (int) deleteNode: (id<OPEPoint>) node
  260 +- (int) deleteNode: (OPEPoint *) node
261 261 {
262 262 NSInteger changeset = [self openChangesetWithMessage:[NSString stringWithFormat:@"Deleted POI: %@",[tagInterpreter getName:node]]];
263 263 int version = [self deleteXmlNode:node withChangeset:changeset];
@@ -320,7 +320,7 @@ - (NSInteger) openChangesetWithMessage: (NSString *) message
320 320 return [[[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding] intValue];
321 321 }
322 322
323   -- (int) updateXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetNumber
  323 +- (int) updateXmlNode: (OPEPoint *) node withChangeset: (NSInteger) changesetNumber
324 324 {
325 325
326 326 NSData * nodeXML = [node updateXMLforChangset:changesetNumber];
@@ -350,7 +350,7 @@ - (int) updateXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetN
350 350
351 351 }
352 352
353   -- (int) createXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetNumber
  353 +- (int) createXmlNode: (OPEPoint *) node withChangeset: (NSInteger) changesetNumber
354 354 {
355 355
356 356 NSData *nodeXML = [node createXMLforChangset:changesetNumber];
@@ -369,7 +369,7 @@ - (int) createXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetN
369 369 return [[[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding] intValue];
370 370 }
371 371
372   -- (int) deleteXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetNumber
  372 +- (int) deleteXmlNode: (OPEPoint *) node withChangeset: (NSInteger) changesetNumber
373 373 {
374 374
375 375 NSData *nodeXML = [node deleteXMLforChangset:changesetNumber];
@@ -409,7 +409,7 @@ - (void) uploadComplete
409 409 object:self
410 410 userInfo:nil];
411 411 }
412   -+(void) backToHTML:(id<OPEPoint>)node
  412 ++(void) backToHTML:(OPEPoint *)node
413 413 {
414 414 NSMutableDictionary * fixedTags = [[NSMutableDictionary alloc] init];
415 415 for(id item in node.tags)
@@ -421,7 +421,7 @@ +(void) backToHTML:(id<OPEPoint>)node
421 421
422 422 }
423 423
424   -+(void) HTMLFix:(id<OPEPoint>)node
  424 ++(void) HTMLFix:(OPEPoint *)node
425 425 {
426 426 NSMutableDictionary * fixedTags = [[NSMutableDictionary alloc] init];
427 427 for(id item in node.tags)
18 OSM POI Editor/OPEPoint.h
@@ -24,32 +24,26 @@
24 24 #import "TBXML.h"
25 25 #import "CoreLocation/CoreLocation.h"
26 26
27   -@protocol OPEPoint <NSObject>
28   -
  27 +@interface OPEPoint : NSObject
29 28
30 29 @property (nonatomic,assign) CLLocationCoordinate2D coordinate;
31 30 @property (nonatomic, strong) NSMutableDictionary* tags;
32 31 @property int version;
33 32 @property (nonatomic, strong) NSString * image;
34 33 @property int ident;
  34 +@property (nonatomic,strong) NSString * name;
35 35
36 36 - (void) addKey: (NSString *) key value: (NSString *)value;
37   -- (NSString *) name;
38   -- (BOOL) isequaltToPoint:(id <OPEPoint>)point;
  37 +- (BOOL) isequaltToPoint:(OPEPoint*)point;
39 38 - (NSString *)type;
40 39 - (NSString *)uniqueIdentifier;
41 40 - (BOOL)hasNoTags;
42   -
43   -
44 41 - (NSData *) updateXMLforChangset: (NSInteger) changesetNumber;
45   -
46   -
47   -
48 42 - (id)copy;
  43 +- (NSData *) createXMLforChangset: (NSInteger) changesetNumber;
  44 +- (NSData *) deleteXMLforChangset: (NSInteger) changesetNumber;
49 45
50 46 + (NSString *)uniqueIdentifierForID:(int)ident;
51 47
52   -@optional
53   -- (NSData *) createXMLforChangset: (NSInteger) changesetNumber;
54   -- (NSData *) deleteXMLforChangset: (NSInteger) changesetNumber;
  48 +
55 49 @end
112 OSM POI Editor/OPEPoint.m
... ... @@ -0,0 +1,112 @@
  1 +//
  2 +// oPoint.m
  3 +// OSM POI Editor
  4 +//
  5 +// Created by David on 11/7/12.
  6 +//
  7 +//
  8 +
  9 +#import "OPEPoint.h"
  10 +#import "OPEConstants.h"
  11 +#import "OPETagInterpreter.h"
  12 +
  13 +@implementation OPEPoint
  14 +
  15 +@synthesize coordinate;
  16 +@synthesize tags;
  17 +@synthesize version;
  18 +@synthesize image;
  19 +@synthesize ident;
  20 +@synthesize name;
  21 +
  22 +- (void) addKey: (NSString *) key value: (NSString *)value
  23 +{
  24 + if (!self.tags) {
  25 + self.tags = [[NSMutableDictionary alloc] init];
  26 + }
  27 +
  28 + [self.tags setValue:value forKey:key];
  29 +}
  30 +-(NSString *)name
  31 +{
  32 + if(tags)
  33 + {
  34 + NSString* tagName = [tags objectForKey:@"name"];
  35 + if(tagName)
  36 + return tagName;
  37 + else
  38 + return [[OPETagInterpreter sharedInstance] getName:self];
  39 + }
  40 + else
  41 + return @"no name";
  42 +}
  43 +
  44 +- (BOOL) isequaltToPoint:(OPEPoint*)point
  45 +{
  46 + if(self.ident != point.ident)
  47 + return NO;
  48 + else if (self.coordinate.latitude != point.coordinate.latitude)
  49 + return NO;
  50 + else if (self.coordinate.longitude != point.coordinate.longitude)
  51 + return NO;
  52 + else if (![self.tags isEqualToDictionary:point.tags])
  53 + return NO;
  54 +
  55 + return YES;
  56 +}
  57 +- (NSString *)type
  58 +{
  59 + return kPointTypePoint;
  60 +}
  61 +-(NSString *)description{
  62 + return [NSString stringWithFormat:@"%@: %@",[self uniqueIdentifier],self.tags];
  63 +}
  64 +- (NSString *)uniqueIdentifier
  65 +{
  66 + return [NSString stringWithFormat:@"%@%d",[self type],self.ident];
  67 +}
  68 +-(BOOL)hasNoTags
  69 +{
  70 + if(![self.tags count])
  71 + {
  72 + return YES;
  73 + }
  74 + return NO;
  75 +}
  76 +-(id)copy
  77 +{
  78 + OPEPoint * nodeCopy = [[OPEPoint alloc] init];
  79 + nodeCopy.coordinate = self.coordinate;
  80 + nodeCopy.ident = self.ident;
  81 + nodeCopy.tags = [self.tags mutableCopy];
  82 + nodeCopy.version = self.version;
  83 + nodeCopy.image = [self.image mutableCopy];
  84 +
  85 + return nodeCopy;
  86 +}
  87 +- (NSData *) updateXMLforChangset: (NSInteger) changesetNumber
  88 +{
  89 + @throw [NSException exceptionWithName:@"OPEPointMethodInvocation"
  90 + reason:@"updateXMLforChangset: invoked on OPEPoint. Override this method when instantiating an abstract class."
  91 + userInfo:nil];
  92 +}
  93 +- (NSData *) createXMLforChangset: (NSInteger) changesetNumber
  94 +{
  95 + @throw [NSException exceptionWithName:@"OPEPointMethodInvocation"
  96 + reason:@"createXMLforChangset: invoked on OPEPoint. Override this method when instantiating an abstract class."
  97 + userInfo:nil];
  98 +}
  99 +- (NSData *) deleteXMLforChangset: (NSInteger) changesetNumber
  100 +{
  101 + @throw [NSException exceptionWithName:@"OPEPointMethodInvocation"
  102 + reason:@"deleteXMLforChangset: invoked on OPEPoint. Override this method when instantiating an abstract class."
  103 + userInfo:nil];
  104 +}
  105 +
  106 ++ (NSString *)uniqueIdentifierForID:(int)ident
  107 +{
  108 + return [NSString stringWithFormat:@"%@%d",kPointTypePoint,ident];
  109 +}
  110 +
  111 +
  112 +@end
14 OSM POI Editor/OPEViewController.m
@@ -215,7 +215,7 @@ - (UIImage*)imageWithBorderFromImage:(UIImage*)source //Draw box around centere
215 215 return newImage;
216 216 }
217 217
218   --(RMMarker *)markerWithNode:(id<OPEPoint>)node
  218 +-(RMMarker *)markerWithNode:(OPEPoint *)node
219 219 {
220 220 UIImage * icon; //Get image from stored value in node
221 221 //UIImage * icon = [UIImage imageNamed:@"restaurant"];
@@ -237,7 +237,7 @@ -(RMMarker *)markerWithNode:(id<OPEPoint>)node
237 237
238 238 -(RMMapLayer *) mapView:(RMMapView *)mapView layerForAnnotation:(RMAnnotation *)annotation
239 239 {
240   - id<OPEPoint> node = annotation.userInfo;
  240 + OPEPoint * node = annotation.userInfo;
241 241
242 242 RMMarker * marker = [self markerWithNode:node];
243 243 marker.canShowCallout = YES;
@@ -246,7 +246,7 @@ -(RMMapLayer *) mapView:(RMMapView *)mapView layerForAnnotation:(RMAnnotation *)
246 246 return marker;
247 247 }
248 248
249   --(RMAnnotation *)annotationWithNode:(id<OPEPoint>)node
  249 +-(RMAnnotation *)annotationWithNode:(OPEPoint *)node
250 250 {
251 251 RMAnnotation * annotation = [[RMAnnotation alloc] initWithMapView:mapView coordinate:node.coordinate andTitle:node.name];
252 252 annotation.userInfo = node;
@@ -298,7 +298,7 @@ -(void) tapOnAnnotation:(RMAnnotation *)annotation onMap:(RMMapView *)map
298 298 //[openMarker hideLabel];
299 299 //openMarker.zPosition = 0.5;
300 300 //marker.zPosition = 1.0;
301   - id<OPEPoint> tempNode = annotation.userInfo;
  301 + OPEPoint * tempNode = annotation.userInfo;
302 302
303 303 if(tempNode.ident == -1)
304 304 {
@@ -498,7 +498,7 @@ - (void) addMarkers:(NSNotification*)notification
498 498 //[mapView removeAllAnnotations];
499 499 for(id key in newNodes)
500 500 {
501   - id<OPEPoint> node = [osmData.allNodes objectForKey:key];
  501 + OPEPoint * node = [osmData.allNodes objectForKey:key];
502 502 [mapView addAnnotation:[self annotationWithNode:node]];
503 503 }
504 504 }
@@ -534,7 +534,7 @@ -(void) createdNode:(OPENode *)newNode
534 534 [mapView addAnnotation:newAnnotation];
535 535
536 536 }
537   --(void)updatedNode:(id <OPEPoint>) newPoint withOriginalAnnotation:(RMAnnotation *)annotation
  537 +-(void)updatedNode:(OPEPoint *) newPoint withOriginalAnnotation:(RMAnnotation *)annotation
538 538 {
539 539 [self.osmData.allNodes setObject:newPoint forKey:[newPoint uniqueIdentifier]];
540 540 [mapView removeAnnotation:annotation];
@@ -542,7 +542,7 @@ -(void)updatedNode:(id <OPEPoint>) newPoint withOriginalAnnotation:(RMAnnotation
542 542 newAnnotation.userInfo = newPoint;
543 543 [mapView addAnnotation:newAnnotation];
544 544 }
545   --(void)deletedNode:(id <OPEPoint>) newPoint withOriginalAnnotation:(RMAnnotation *)annotation
  545 +-(void)deletedNode:(OPEPoint *) newPoint withOriginalAnnotation:(RMAnnotation *)annotation
546 546 {
547 547 [self.osmData.allNodes removeObjectForKey:[newPoint uniqueIdentifier]];
548 548 [self.osmData.ignoreNodes setObject:newPoint forKey:[newPoint uniqueIdentifier]];
2  OSM POI Editor/OPEWay.h
@@ -23,7 +23,7 @@
23 23 #import "OPENode.h"
24 24 #import "OPEPoint.h"
25 25
26   -@interface OPEWay : NSObject <OPEPoint>
  26 +@interface OPEWay : OPEPoint
27 27
28 28 @property (nonatomic,strong) NSArray * nodes;
29 29
40 OSM POI Editor/OPEWay.m
@@ -25,7 +25,7 @@
25 25
26 26 @implementation OPEWay
27 27
28   -@synthesize nodes,ident,tags,coordinate,version,image;
  28 +@synthesize nodes;
29 29
30 30 -(id)init
31 31 {
@@ -133,7 +133,7 @@ - (NSData *) updateXMLforChangset: (NSInteger) changesetNumber;
133 133
134 134 }
135 135
136   --(BOOL)isequaltToPoint:(id<OPEPoint>)point
  136 +-(BOOL)isequaltToPoint:(OPEPoint*)point
137 137 {
138 138 if ([[self type] isEqualToString:[point type]])
139 139 return NO;
@@ -150,35 +150,11 @@ -(BOOL)isequaltToPoint:(id<OPEPoint>)point
150 150
151 151 }
152 152
153   --(void)addKey:(NSString *)key value:(NSString *)value
154   -{
155   - [self.tags setValue:value forKey:key];
156   -}
157   -
158   --(NSString *)name
159   -{
160   - if(tags)
161   - {
162   - NSString* name = [tags objectForKey:@"name"];
163   - if(name)
164   - return name;
165   - else
166   - return @"no name";
167   - }
168   - else
169   - return @"no name";
170   -}
171   -
172 153 -(NSString *)type
173 154 {
174 155 return kPointTypeWay;
175 156 }
176 157
177   --(NSString *)uniqueIdentifier
178   -{
179   - return [NSString stringWithFormat:@"%@%d",[self type],self.ident];
180   -}
181   -
182 158 -(id)copy
183 159 {
184 160 OPEWay * wayCopy = [[OPEWay alloc] init];
@@ -193,15 +169,6 @@ -(id)copy
193 169 return wayCopy;
194 170 }
195 171
196   --(BOOL)hasNoTags
197   -{
198   - if(![self.tags count])
199   - {
200   - return YES;
201   - }
202   - return NO;
203   -}
204   -
205 172 -(void)prepareToDelete:(NSArray *)keys
206 173 {
207 174 NSMutableSet * tempSet = [NSMutableSet setWithArray:keys];
@@ -210,7 +177,7 @@ -(void)prepareToDelete:(NSArray *)keys
210 177
211 178 }
212 179
213   -+(NSString *)uniqueIdentifierForID:(int)ident
  180 ++ (NSString *)uniqueIdentifierForID:(int)ident
214 181 {
215 182 return [NSString stringWithFormat:@"%@%d",kPointTypeWay,ident];
216 183 }
@@ -218,4 +185,5 @@ +(NSString *)uniqueIdentifierForID:(int)ident
218 185
219 186
220 187
  188 +
221 189 @end
13 OSM POI Editor/oPoint.h
... ... @@ -0,0 +1,13 @@
  1 +//
  2 +// oPoint.h
  3 +// OSM POI Editor
  4 +//
  5 +// Created by David on 11/7/12.
  6 +//
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +@interface oPoint : NSObject
  12 +
  13 +@end
BIN  icons/@1x/.DS_Store
Binary file not shown
BIN  icons/@2x/.DS_Store
Binary file not shown

0 comments on commit 5bdc348

Please sign in to comment.
Something went wrong with that request. Please try again.