Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

OPEPoint fixes

  • Loading branch information...
commit 5bdc34897c7768deb92447459f3061b8bf92be2c 1 parent 3d92f2b
@davidchiles authored
View
12 OPETagInterpreter.h
@@ -38,13 +38,13 @@
- (id) init;
//- (BOOL) nodeHasRecognizedTags:(OPENode *)n;
//- (NSDictionary *) getPrimaryKeyValue: (OPENode *)n;
-- (NSString *) category: (id<OPEPoint>)n; //getCategory
-- (OPEType *) type: (id<OPEPoint>)n; //getType
+- (NSString *) category: (OPEPoint *)n; //getCategory
+- (OPEType *) type: (OPEPoint *)n; //getType
- (void) readPlist;
-- (NSString *) getName: (id<OPEPoint>) node;
-- (NSString *) getImageForNode: (id<OPEPoint>) node;
-- (void)removeTagsForType:(OPEType *)type withNode:(id<OPEPoint>)node;
-- (BOOL)isSupported:(id<OPEPoint>)node;
+- (NSString *) getName: (OPEPoint *) node;
+- (NSString *) getImageForNode: (OPEPoint *) node;
+- (void)removeTagsForType:(OPEType *)type withNode:(OPEPoint *)node;
+- (BOOL)isSupported:(OPEPoint *)node;
- (NSDictionary *) allCategories;
- (NSDictionary *) allTypes;
View
12 OPETagInterpreter.m
@@ -44,12 +44,12 @@ - (id) init
return self;
}
-- (NSString *) category: (id<OPEPoint>)node
+- (NSString *) category: (OPEPoint *)node
{
return [[self type:node] categoryName];
}
--(OPEType *)type:(id<OPEPoint>)node
+-(OPEType *)type:(OPEPoint *)node
{
if([[node.tags objectForKey:@"highway"] isEqualToString:@"bus_stop"] )
{
@@ -157,7 +157,7 @@ - (void) readPlist
}
-- (NSString *) getName:(id<OPEPoint>)node
+- (NSString *) getName:(OPEPoint *)node
{
NSString * name = [node.tags objectForKey:@"name"];
if(name)
@@ -171,18 +171,18 @@ - (NSString *) getName:(id<OPEPoint>)node
return @"Unknown";
}
-- (NSString *) getImageForNode: (id<OPEPoint>) node
+- (NSString *) getImageForNode: (OPEPoint *) node
{
return [[self type:node] imageString];
}
-- (void)removeTagsForType:(OPEType *)type withNode:(id<OPEPoint>)node
+- (void)removeTagsForType:(OPEType *)type withNode:(OPEPoint *)node
{
[node.tags removeObjectsForKeys:type.tags.allKeys];
//[node.tags removeObjectsForKeys:type.optionalTags];
}
-- (BOOL)isSupported:(id<OPEPoint>)node
+- (BOOL)isSupported:(OPEPoint *)node
{
if([self type:node])
return YES;
View
4 OSM POI Editor.xcodeproj/project.pbxproj
@@ -304,6 +304,7 @@
63B748B41627844E0052148E /* map.png in Resources */ = {isa = PBXBuildFile; fileRef = 63B748B11627844E0052148E /* map.png */; };
63B748B51627844E0052148E /* embassy.png in Resources */ = {isa = PBXBuildFile; fileRef = 63B748B21627844E0052148E /* embassy.png */; };
63B748B61627844E0052148E /* guidepost.png in Resources */ = {isa = PBXBuildFile; fileRef = 63B748B31627844E0052148E /* guidepost.png */; };
+ 63C2035A164B153200C0F1EF /* OPEPoint.m in Sources */ = {isa = PBXBuildFile; fileRef = 63C20359164B153200C0F1EF /* OPEPoint.m */; };
63CB49D314E9C5A0008C4551 /* OPETextEdit.m in Sources */ = {isa = PBXBuildFile; fileRef = 63CB49D114E9C5A0008C4551 /* OPETextEdit.m */; };
63CB49DD14E9DE7B008C4551 /* OPECategoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 63CB49DB14E9DE7B008C4551 /* OPECategoryViewController.m */; };
63CB49DE14E9DE7B008C4551 /* OPECategoryViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 63CB49DC14E9DE7B008C4551 /* OPECategoryViewController.xib */; };
@@ -729,6 +730,7 @@
63B748B11627844E0052148E /* map.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = map.png; sourceTree = "<group>"; };
63B748B21627844E0052148E /* embassy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = embassy.png; sourceTree = "<group>"; };
63B748B31627844E0052148E /* guidepost.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = guidepost.png; sourceTree = "<group>"; };
+ 63C20359164B153200C0F1EF /* OPEPoint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OPEPoint.m; sourceTree = "<group>"; };
63CB49D014E9C5A0008C4551 /* OPETextEdit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OPETextEdit.h; sourceTree = "<group>"; };
63CB49D114E9C5A0008C4551 /* OPETextEdit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OPETextEdit.m; sourceTree = "<group>"; };
63CB49DA14E9DE7B008C4551 /* OPECategoryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OPECategoryViewController.h; path = ../OPECategoryViewController.h; sourceTree = "<group>"; };
@@ -1241,6 +1243,7 @@
isa = PBXGroup;
children = (
63AFC7BC15ACE3DB00A50C29 /* OPEPoint.h */,
+ 63C20359164B153200C0F1EF /* OPEPoint.m */,
631539E314DCA29B000236F0 /* OPENode.h */,
631539E414DCA29B000236F0 /* OPENode.m */,
63F1F28415A7AD630027829B /* OPEWay.h */,
@@ -1951,6 +1954,7 @@
63AD8F7D15E8577E006F92B8 /* OPEType.m in Sources */,
63FCA4421643127D00A28470 /* OPEBingTileSource.m in Sources */,
63FCA4511643363800A28470 /* OPEUtility.m in Sources */,
+ 63C2035A164B153200C0F1EF /* OPEPoint.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
BIN  OSM POI Editor.xcodeproj/project.xcworkspace/xcuserdata/David.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown
View
40 OSM POI Editor.xcodeproj/xcuserdata/David.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
@@ -23,11 +23,11 @@
continueAfterRunningActions = "No"
isPathRelative = "1"
filePath = "OSM POI Editor/OPENode.m"
- timestampString = "371691561.845876"
+ timestampString = "374021749.437275"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "30"
- endingLineNumber = "30"
+ startingLineNumber = "29"
+ endingLineNumber = "29"
landmarkName = "-initWithId:coordinate:keyValues:"
landmarkType = "5">
</FileBreakpoint>
@@ -396,7 +396,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSM POI Editor/OPEWay.m"
- timestampString = "371691561.845876"
+ timestampString = "374021749.437275"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "74"
@@ -470,24 +470,11 @@
landmarkType = "3">
</FileBreakpoint>
<FileBreakpoint
- shouldBeEnabled = "Yes"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- filePath = "OSM POI Editor/OPENode.m"
- timestampString = "371691561.845876"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "240"
- endingLineNumber = "240"
- landmarkName = "-description"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSM POI Editor/OPEWay.m"
- timestampString = "371691561.845876"
+ timestampString = "374021749.437275"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "90"
@@ -500,7 +487,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSM POI Editor/OPEWay.m"
- timestampString = "371691561.845876"
+ timestampString = "374021749.437275"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "81"
@@ -512,19 +499,6 @@
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
- filePath = "OSM POI Editor/OPENode.m"
- timestampString = "371691561.845876"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "114"
- endingLineNumber = "114"
- landmarkName = "-addKey:value:"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
filePath = "OSM POI Editor/OPEOSMData.m"
timestampString = "371691561.845876"
startingColumnNumber = "9223372036854775807"
@@ -708,7 +682,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "OSM POI Editor/OPEWay.m"
- timestampString = "371691561.845876"
+ timestampString = "374021749.437275"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "40"
View
4 OSM POI Editor/OPEConstants.h
@@ -37,5 +37,7 @@
#define kLeftTextDefaultSize 76
#define kOPEAPIURL @"http://www.overpass-api.de/api/xapi?*"
+
#define kPointTypeNode @"node"
-#define kPointTypeWay @"way"
+#define kPointTypeWay @"way"
+#define kPointTypePoint @"point"
View
5 OSM POI Editor/OPENode.h
@@ -24,15 +24,16 @@
#import <CoreLocation/CoreLocation.h>
#import "OPEPoint.h"
-@interface OPENode : NSObject <OPEPoint>
+@interface OPENode : OPEPoint
-(id) initWithId: (int) i coordinate: (CLLocationCoordinate2D) coordinate keyValues: (NSMutableDictionary *) tag;
-(id) initWithId:(int)i latitude:(double) la longitude:(double) lo;
-(id) initWithId:(int)i latitude:(double) la longitude:(double) lo version:(int) ve;
-(id) initWithNode: (OPENode *) node;
--(BOOL)onlyTagCreatedBy;
+ (id) createPointWithXML:(TBXMLElement *)xml;
+
+
@end
View
118 OSM POI Editor/OPENode.m
@@ -22,20 +22,19 @@
#import "OPENode.h"
#import "OPEConstants.h"
+#import "OPETagInterpreter.h"
@implementation OPENode
-@synthesize ident, coordinate, tags, version, image;
-
-(id) initWithId: (int) i coordinate: (CLLocationCoordinate2D) newCoordinate keyValues: (NSMutableDictionary *) tag
{
self = [super init];
if(self)
{
- ident = i;
- coordinate = newCoordinate;
- tags = [[NSMutableDictionary alloc] initWithDictionary:tag];
- image = [[NSString alloc] init];
+ self.ident = i;
+ self.coordinate = newCoordinate;
+ self.tags = [[NSMutableDictionary alloc] initWithDictionary:tag];
+ self.image = [[NSString alloc] init];
}
return self;
@@ -46,10 +45,10 @@ -(id) initWithId:(int)i latitude:(double) la longitude:(double) lo
self = [super init];
if (self)
{
- ident = i;
- coordinate = CLLocationCoordinate2DMake(la,lo);
- tags = [[NSMutableDictionary alloc] init];
- image = [[NSString alloc] init];
+ self.ident = i;
+ self.coordinate = CLLocationCoordinate2DMake(la,lo);
+ self.tags = [[NSMutableDictionary alloc] init];
+ self.image = [[NSString alloc] init];
}
return self;
}
@@ -59,11 +58,11 @@ -(id) initWithId:(int)i latitude:(double) la longitude:(double) lo version: (int
self = [super init];
if (self)
{
- version = v;
- ident = i;
- coordinate = CLLocationCoordinate2DMake(la,lo);
- tags = [[NSMutableDictionary alloc] init];
- image = [[NSString alloc] init];
+ self.version = v;
+ self.ident = i;
+ self.coordinate = CLLocationCoordinate2DMake(la,lo);
+ self.tags = [[NSMutableDictionary alloc] init];
+ self.image = [[NSString alloc] init];
}
return self;
}
@@ -73,11 +72,11 @@ -(id) initWithNode: (OPENode *) node
self = [super init];
if (self)
{
- version = node.version;
- ident = node.ident;
- coordinate = CLLocationCoordinate2DMake(node.coordinate.latitude, node.coordinate.longitude);
- tags = [[NSMutableDictionary alloc] initWithDictionary:node.tags];
- image = node.image;
+ self.version = node.version;
+ self.ident = node.ident;
+ self.coordinate = CLLocationCoordinate2DMake(node.coordinate.latitude, node.coordinate.longitude);
+ self.tags = [[NSMutableDictionary alloc] initWithDictionary:node.tags];
+ self.image = node.image;
}
return self;
}
@@ -109,58 +108,6 @@ + (id) createPointWithXML:(TBXMLElement *)xml
return newNode;
}
--(void) addKey:(NSString *)key value:(NSString *)value
-{
- [self.tags setValue:value forKey:key];
-}
-
--(NSString *)name
-{
- if(tags)
- {
- NSString* name = [tags objectForKey:@"name"];
- if(name)
- return name;
- else
- return @"no name";
- }
- else
- return @"no name";
-}
-
--(BOOL)onlyTagCreatedBy
-{
- if(tags.count == 1)
- {
- for(NSString * key in tags)
- {
- if(key == @"created_by")
- return YES;
- else
- return NO;
- }
- }
- else
- return NO;
-
- return NO;
-}
-
--(BOOL) isequaltToPoint:(id<OPEPoint>)point
-{
- if(self.ident != point.ident)
- return NO;
- else if (self.coordinate.latitude != point.coordinate.latitude)
- return NO;
- else if (self.coordinate.longitude != point.coordinate.longitude)
- return NO;
- else if (![self.tags isEqualToDictionary:point.tags])
- return NO;
-
- return YES;
-
-}
-
- (NSData *) updateXMLforChangset: (NSInteger) changesetNumber
{
NSMutableString * xml = [NSMutableString stringWithFormat: @"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"];
@@ -227,28 +174,6 @@ -(NSString *)type
return kPointTypeNode;
}
--(BOOL)hasNoTags
-{
- if(![self.tags count])
- {
- return YES;
- }
- return NO;
-}
-
--(NSString *)description{
- return [NSString stringWithFormat:@"%@: %@",[self uniqueIdentifier],self.tags];
-}
-
--(NSString *)uniqueIdentifier
-{
- return [NSString stringWithFormat:@"%@%d",[self type],self.ident];
-}
-+(NSString *)uniqueIdentifierForID:(int)ident
-{
- return [NSString stringWithFormat:@"%@%d",kPointTypeNode,ident];
-}
-
-(id)copy
{
OPENode * nodeCopy = [[OPENode alloc] init];
@@ -261,4 +186,9 @@ -(id)copy
return nodeCopy;
}
++ (NSString *)uniqueIdentifierForID:(int)ident
+{
+ return [NSString stringWithFormat:@"%@%d",kPointTypeNode,ident];
+}
+
@end
View
10 OSM POI Editor/OPENodeViewController.h
@@ -33,9 +33,9 @@
@protocol OPENodeViewDelegate
@optional
--(void)createdNode:(id <OPEPoint>) newPoint;
--(void)updatedNode:(id <OPEPoint>) newPoint withOriginalAnnotation:(RMAnnotation *)annotation;
--(void)deletedNode:(id <OPEPoint>) newPoint withOriginalAnnotation:(RMAnnotation *)annotation;
+-(void)createdNode:(OPEPoint *) newPoint;
+-(void)updatedNode:(OPEPoint *) newPoint withOriginalAnnotation:(RMAnnotation *)annotation;
+-(void)deletedNode:(OPEPoint *) newPoint withOriginalAnnotation:(RMAnnotation *)annotation;
@end
@@ -46,8 +46,8 @@
float optionalTagWidth;
}
-@property (nonatomic, strong) id<OPEPoint> point;
-@property (nonatomic, strong) id<OPEPoint> theNewPoint;
+@property (nonatomic, strong) OPEPoint * point;
+@property (nonatomic, strong) OPEPoint * theNewPoint;
@property (nonatomic, strong) UITableView * nodeInfoTableView;
@property (nonatomic, strong) OPEType * nodeType;
@property (nonatomic, strong) NSString * type;
View
16 OSM POI Editor/OPEOSMData.h
@@ -38,18 +38,18 @@
- (void) getDataWithSW:(CLLocationCoordinate2D)southWest NE: (CLLocationCoordinate2D) northEast;
- (NSInteger) openChangesetWithMessage: (NSString *) message;
-- (int) createXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetNumber;
-- (int) updateXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetNumber;
-- (int) deleteXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetNumber;
+- (int) createXmlNode: (OPEPoint *) node withChangeset: (NSInteger) changesetNumber;
+- (int) updateXmlNode: (OPEPoint *) node withChangeset: (NSInteger) changesetNumber;
+- (int) deleteXmlNode: (OPEPoint *) node withChangeset: (NSInteger) changesetNumber;
- (void) closeChangeset: (NSInteger) changesetNumber;
- (BOOL) canAuth;
-- (int) createNode: (id<OPEPoint>) node;
-- (int) updateNode: (id<OPEPoint>) node;
-- (int) deleteNode: (id<OPEPoint>) node;
+- (int) createNode: (OPEPoint *) node;
+- (int) updateNode: (OPEPoint *) node;
+- (int) deleteNode: (OPEPoint *) node;
- (void) uploadComplete;
-+ (void) HTMLFix:(id<OPEPoint>)node;
-+(void) backToHTML:(id<OPEPoint>)node;
++ (void) HTMLFix:(OPEPoint *)node;
++(void) backToHTML:(OPEPoint *)node;
View
16 OSM POI Editor/OPEOSMData.m
@@ -240,7 +240,7 @@ -(void) getDataWithSW:(CLLocationCoordinate2D)southWest NE: (CLLocationCoordinat
[request startAsynchronous];
}
-- (int) createNode: (id<OPEPoint>) newPoint
+- (int) createNode: (OPEPoint *) newPoint
{
NSInteger changeset = [self openChangesetWithMessage:[NSString stringWithFormat:@"Created new POI: %@",[tagInterpreter getName:newPoint]]];
int newIdent = [self createXmlNode:newPoint withChangeset:changeset];
@@ -248,7 +248,7 @@ - (int) createNode: (id<OPEPoint>) newPoint
return newIdent;
}
-- (int) updateNode: (id<OPEPoint>) node
+- (int) updateNode: (OPEPoint *) node
{
NSInteger changeset = [self openChangesetWithMessage:[NSString stringWithFormat:@"Updated existing POI: %@",[tagInterpreter getName:node]]];
int version = [self updateXmlNode:node withChangeset:changeset];
@@ -257,7 +257,7 @@ - (int) updateNode: (id<OPEPoint>) node
return version;
}
-- (int) deleteNode: (id<OPEPoint>) node
+- (int) deleteNode: (OPEPoint *) node
{
NSInteger changeset = [self openChangesetWithMessage:[NSString stringWithFormat:@"Deleted POI: %@",[tagInterpreter getName:node]]];
int version = [self deleteXmlNode:node withChangeset:changeset];
@@ -320,7 +320,7 @@ - (NSInteger) openChangesetWithMessage: (NSString *) message
return [[[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding] intValue];
}
-- (int) updateXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetNumber
+- (int) updateXmlNode: (OPEPoint *) node withChangeset: (NSInteger) changesetNumber
{
NSData * nodeXML = [node updateXMLforChangset:changesetNumber];
@@ -350,7 +350,7 @@ - (int) updateXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetN
}
-- (int) createXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetNumber
+- (int) createXmlNode: (OPEPoint *) node withChangeset: (NSInteger) changesetNumber
{
NSData *nodeXML = [node createXMLforChangset:changesetNumber];
@@ -369,7 +369,7 @@ - (int) createXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetN
return [[[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding] intValue];
}
-- (int) deleteXmlNode: (id<OPEPoint>) node withChangeset: (NSInteger) changesetNumber
+- (int) deleteXmlNode: (OPEPoint *) node withChangeset: (NSInteger) changesetNumber
{
NSData *nodeXML = [node deleteXMLforChangset:changesetNumber];
@@ -409,7 +409,7 @@ - (void) uploadComplete
object:self
userInfo:nil];
}
-+(void) backToHTML:(id<OPEPoint>)node
++(void) backToHTML:(OPEPoint *)node
{
NSMutableDictionary * fixedTags = [[NSMutableDictionary alloc] init];
for(id item in node.tags)
@@ -421,7 +421,7 @@ +(void) backToHTML:(id<OPEPoint>)node
}
-+(void) HTMLFix:(id<OPEPoint>)node
++(void) HTMLFix:(OPEPoint *)node
{
NSMutableDictionary * fixedTags = [[NSMutableDictionary alloc] init];
for(id item in node.tags)
View
18 OSM POI Editor/OPEPoint.h
@@ -24,32 +24,26 @@
#import "TBXML.h"
#import "CoreLocation/CoreLocation.h"
-@protocol OPEPoint <NSObject>
-
+@interface OPEPoint : NSObject
@property (nonatomic,assign) CLLocationCoordinate2D coordinate;
@property (nonatomic, strong) NSMutableDictionary* tags;
@property int version;
@property (nonatomic, strong) NSString * image;
@property int ident;
+@property (nonatomic,strong) NSString * name;
- (void) addKey: (NSString *) key value: (NSString *)value;
-- (NSString *) name;
-- (BOOL) isequaltToPoint:(id <OPEPoint>)point;
+- (BOOL) isequaltToPoint:(OPEPoint*)point;
- (NSString *)type;
- (NSString *)uniqueIdentifier;
- (BOOL)hasNoTags;
-
-
- (NSData *) updateXMLforChangset: (NSInteger) changesetNumber;
-
-
-
- (id)copy;
+- (NSData *) createXMLforChangset: (NSInteger) changesetNumber;
+- (NSData *) deleteXMLforChangset: (NSInteger) changesetNumber;
+ (NSString *)uniqueIdentifierForID:(int)ident;
-@optional
-- (NSData *) createXMLforChangset: (NSInteger) changesetNumber;
-- (NSData *) deleteXMLforChangset: (NSInteger) changesetNumber;
+
@end
View
112 OSM POI Editor/OPEPoint.m
@@ -0,0 +1,112 @@
+//
+// oPoint.m
+// OSM POI Editor
+//
+// Created by David on 11/7/12.
+//
+//
+
+#import "OPEPoint.h"
+#import "OPEConstants.h"
+#import "OPETagInterpreter.h"
+
+@implementation OPEPoint
+
+@synthesize coordinate;
+@synthesize tags;
+@synthesize version;
+@synthesize image;
+@synthesize ident;
+@synthesize name;
+
+- (void) addKey: (NSString *) key value: (NSString *)value
+{
+ if (!self.tags) {
+ self.tags = [[NSMutableDictionary alloc] init];
+ }
+
+ [self.tags setValue:value forKey:key];
+}
+-(NSString *)name
+{
+ if(tags)
+ {
+ NSString* tagName = [tags objectForKey:@"name"];
+ if(tagName)
+ return tagName;
+ else
+ return [[OPETagInterpreter sharedInstance] getName:self];
+ }
+ else
+ return @"no name";
+}
+
+- (BOOL) isequaltToPoint:(OPEPoint*)point
+{
+ if(self.ident != point.ident)
+ return NO;
+ else if (self.coordinate.latitude != point.coordinate.latitude)
+ return NO;
+ else if (self.coordinate.longitude != point.coordinate.longitude)
+ return NO;
+ else if (![self.tags isEqualToDictionary:point.tags])
+ return NO;
+
+ return YES;
+}
+- (NSString *)type
+{
+ return kPointTypePoint;
+}
+-(NSString *)description{
+ return [NSString stringWithFormat:@"%@: %@",[self uniqueIdentifier],self.tags];
+}
+- (NSString *)uniqueIdentifier
+{
+ return [NSString stringWithFormat:@"%@%d",[self type],self.ident];
+}
+-(BOOL)hasNoTags
+{
+ if(![self.tags count])
+ {
+ return YES;
+ }
+ return NO;
+}
+-(id)copy
+{
+ OPEPoint * nodeCopy = [[OPEPoint alloc] init];
+ nodeCopy.coordinate = self.coordinate;
+ nodeCopy.ident = self.ident;
+ nodeCopy.tags = [self.tags mutableCopy];
+ nodeCopy.version = self.version;
+ nodeCopy.image = [self.image mutableCopy];
+
+ return nodeCopy;
+}
+- (NSData *) updateXMLforChangset: (NSInteger) changesetNumber
+{
+ @throw [NSException exceptionWithName:@"OPEPointMethodInvocation"
+ reason:@"updateXMLforChangset: invoked on OPEPoint. Override this method when instantiating an abstract class."
+ userInfo:nil];
+}
+- (NSData *) createXMLforChangset: (NSInteger) changesetNumber
+{
+ @throw [NSException exceptionWithName:@"OPEPointMethodInvocation"
+ reason:@"createXMLforChangset: invoked on OPEPoint. Override this method when instantiating an abstract class."
+ userInfo:nil];
+}
+- (NSData *) deleteXMLforChangset: (NSInteger) changesetNumber
+{
+ @throw [NSException exceptionWithName:@"OPEPointMethodInvocation"
+ reason:@"deleteXMLforChangset: invoked on OPEPoint. Override this method when instantiating an abstract class."
+ userInfo:nil];
+}
+
++ (NSString *)uniqueIdentifierForID:(int)ident
+{
+ return [NSString stringWithFormat:@"%@%d",kPointTypePoint,ident];
+}
+
+
+@end
View
14 OSM POI Editor/OPEViewController.m
@@ -215,7 +215,7 @@ - (UIImage*)imageWithBorderFromImage:(UIImage*)source //Draw box around centere
return newImage;
}
--(RMMarker *)markerWithNode:(id<OPEPoint>)node
+-(RMMarker *)markerWithNode:(OPEPoint *)node
{
UIImage * icon; //Get image from stored value in node
//UIImage * icon = [UIImage imageNamed:@"restaurant"];
@@ -237,7 +237,7 @@ -(RMMarker *)markerWithNode:(id<OPEPoint>)node
-(RMMapLayer *) mapView:(RMMapView *)mapView layerForAnnotation:(RMAnnotation *)annotation
{
- id<OPEPoint> node = annotation.userInfo;
+ OPEPoint * node = annotation.userInfo;
RMMarker * marker = [self markerWithNode:node];
marker.canShowCallout = YES;
@@ -246,7 +246,7 @@ -(RMMapLayer *) mapView:(RMMapView *)mapView layerForAnnotation:(RMAnnotation *)
return marker;
}
--(RMAnnotation *)annotationWithNode:(id<OPEPoint>)node
+-(RMAnnotation *)annotationWithNode:(OPEPoint *)node
{
RMAnnotation * annotation = [[RMAnnotation alloc] initWithMapView:mapView coordinate:node.coordinate andTitle:node.name];
annotation.userInfo = node;
@@ -298,7 +298,7 @@ -(void) tapOnAnnotation:(RMAnnotation *)annotation onMap:(RMMapView *)map
//[openMarker hideLabel];
//openMarker.zPosition = 0.5;
//marker.zPosition = 1.0;
- id<OPEPoint> tempNode = annotation.userInfo;
+ OPEPoint * tempNode = annotation.userInfo;
if(tempNode.ident == -1)
{
@@ -498,7 +498,7 @@ - (void) addMarkers:(NSNotification*)notification
//[mapView removeAllAnnotations];
for(id key in newNodes)
{
- id<OPEPoint> node = [osmData.allNodes objectForKey:key];
+ OPEPoint * node = [osmData.allNodes objectForKey:key];
[mapView addAnnotation:[self annotationWithNode:node]];
}
}
@@ -534,7 +534,7 @@ -(void) createdNode:(OPENode *)newNode
[mapView addAnnotation:newAnnotation];
}
--(void)updatedNode:(id <OPEPoint>) newPoint withOriginalAnnotation:(RMAnnotation *)annotation
+-(void)updatedNode:(OPEPoint *) newPoint withOriginalAnnotation:(RMAnnotation *)annotation
{
[self.osmData.allNodes setObject:newPoint forKey:[newPoint uniqueIdentifier]];
[mapView removeAnnotation:annotation];
@@ -542,7 +542,7 @@ -(void)updatedNode:(id <OPEPoint>) newPoint withOriginalAnnotation:(RMAnnotation
newAnnotation.userInfo = newPoint;
[mapView addAnnotation:newAnnotation];
}
--(void)deletedNode:(id <OPEPoint>) newPoint withOriginalAnnotation:(RMAnnotation *)annotation
+-(void)deletedNode:(OPEPoint *) newPoint withOriginalAnnotation:(RMAnnotation *)annotation
{
[self.osmData.allNodes removeObjectForKey:[newPoint uniqueIdentifier]];
[self.osmData.ignoreNodes setObject:newPoint forKey:[newPoint uniqueIdentifier]];
View
2  OSM POI Editor/OPEWay.h
@@ -23,7 +23,7 @@
#import "OPENode.h"
#import "OPEPoint.h"
-@interface OPEWay : NSObject <OPEPoint>
+@interface OPEWay : OPEPoint
@property (nonatomic,strong) NSArray * nodes;
View
40 OSM POI Editor/OPEWay.m
@@ -25,7 +25,7 @@
@implementation OPEWay
-@synthesize nodes,ident,tags,coordinate,version,image;
+@synthesize nodes;
-(id)init
{
@@ -133,7 +133,7 @@ - (NSData *) updateXMLforChangset: (NSInteger) changesetNumber;
}
--(BOOL)isequaltToPoint:(id<OPEPoint>)point
+-(BOOL)isequaltToPoint:(OPEPoint*)point
{
if ([[self type] isEqualToString:[point type]])
return NO;
@@ -150,35 +150,11 @@ -(BOOL)isequaltToPoint:(id<OPEPoint>)point
}
--(void)addKey:(NSString *)key value:(NSString *)value
-{
- [self.tags setValue:value forKey:key];
-}
-
--(NSString *)name
-{
- if(tags)
- {
- NSString* name = [tags objectForKey:@"name"];
- if(name)
- return name;
- else
- return @"no name";
- }
- else
- return @"no name";
-}
-
-(NSString *)type
{
return kPointTypeWay;
}
--(NSString *)uniqueIdentifier
-{
- return [NSString stringWithFormat:@"%@%d",[self type],self.ident];
-}
-
-(id)copy
{
OPEWay * wayCopy = [[OPEWay alloc] init];
@@ -193,15 +169,6 @@ -(id)copy
return wayCopy;
}
--(BOOL)hasNoTags
-{
- if(![self.tags count])
- {
- return YES;
- }
- return NO;
-}
-
-(void)prepareToDelete:(NSArray *)keys
{
NSMutableSet * tempSet = [NSMutableSet setWithArray:keys];
@@ -210,7 +177,7 @@ -(void)prepareToDelete:(NSArray *)keys
}
-+(NSString *)uniqueIdentifierForID:(int)ident
++ (NSString *)uniqueIdentifierForID:(int)ident
{
return [NSString stringWithFormat:@"%@%d",kPointTypeWay,ident];
}
@@ -218,4 +185,5 @@ +(NSString *)uniqueIdentifierForID:(int)ident
+
@end
View
13 OSM POI Editor/oPoint.h
@@ -0,0 +1,13 @@
+//
+// oPoint.h
+// OSM POI Editor
+//
+// Created by David on 11/7/12.
+//
+//
+
+#import <Foundation/Foundation.h>
+
+@interface oPoint : NSObject
+
+@end
View
BIN  icons/@1x/.DS_Store
Binary file not shown
View
BIN  icons/@2x/.DS_Store
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.