Nextrek
@ 63
Nextrek / iOS / Location / Location / DataManager.m
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 |
// // DataManager.m // Location // // Created by Fabrizio on 11/12/12. // Copyright (c) 2012 Odyssey. All rights reserved. // #import "TBXML.h" #import "MapItem.h" @implementation DataManager @synthesize mapItems; @synthesize lastLocation; static DataManager *instance; +(DataManager *) getInstance { if (!instance) { instance = [[DataManager alloc] init]; } return instance; } #pragma mark - #pragma mark Initialisation & View Admin - (id) init { if((self = [super init])) { instance = self; self.mapItems = [NSMutableArray array]; } return self; } - (void) parcheggiXml{ TBXML * tbxml = [TBXML tbxmlWithXMLFile:@"Parcheggi.xml"]; TBXMLElement *root = tbxml.rootXMLElement; if (root) { TBXMLElement *element = [TBXML childElementNamed:@"Row" parentElement:root]; while (element != nil) { MapItem *mapItem = [[MapItem alloc]init]; TBXMLElement *elem = [TBXML childElementNamed:@"Address" parentElement:element]; if (elem) { mapItem.indirizzo = [TBXML textForElement:elem]; } elem = [TBXML childElementNamed:@"AddressNumber" parentElement:element]; if (elem) { mapItem.numero = [TBXML textForElement:elem]; } elem = [TBXML childElementNamed:@"lat" parentElement:element]; if (elem) { mapItem.lat = [[TBXML textForElement:elem] floatValue]; } elem = [TBXML childElementNamed:@"lng" parentElement:element]; if (elem) { mapItem.lon = [[TBXML textForElement:elem] floatValue]; } [mapItems addObject:mapItem]; // LOG_INFO(@"--- MAP ITEM ---"); // LOG_INFO_X(@"INDIRIZZO: %@", mapItem.indirizzo); // LOG_INFO_X(@"NUMERO:%@", mapItem.numero); // LOG_INFO_X(@"LAT:%f", mapItem.lat); // LOG_INFO_X(@"LNG:%f", mapItem.lon); // // LOG_INFO_X(@"Array count:%d", [mapItems count]); element = [TBXML nextSiblingNamed:@"Row" searchFromElement:element]; } } } @end |
Commits for Nextrek/iOS/Location/Location/DataManager.m
Revision | Author | Commited | Message |
---|---|---|---|
63 | FAquili | Sat 18 Jan, 2014 16:59:40 +0000 | Parcheggio Roma 1.0 |