├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── SpatialDBKit.podspec ├── SpatialDBKit ├── FMResultSet+SpatialDBKit.h ├── FMResultSet+SpatialDBKit.m ├── SpatialDBKit.h ├── SpatialDatabase.h ├── SpatialDatabase.m ├── SpatialDatabaseQueue.h └── SpatialDatabaseQueue.m └── SpatialDBKitExample ├── Assets ├── test-2.3.sqlite └── test-network-2.3.sqlite ├── Podfile ├── SpatialDBKitExample.xcodeproj └── project.pbxproj ├── SpatialDBKitExample ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.mm └── SpatialDBKitExampleTests ├── Info.plist └── SpatialDBKitExampleTests.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | *.xcworkspace 13 | !default.xcworkspace 14 | xcuserdata 15 | profile 16 | *.moved-aside 17 | DerivedData 18 | .idea/ 19 | 20 | Pods 21 | Podfile.lock 22 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andreacremaschi/SpatialDBKit/8cdeb00b590c74c46144f872044932d100956a28/.gitmodules -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MOZILLA PUBLIC LICENSE 2 | Version 1.1 3 | 4 | --------------- 5 | 6 | 1. Definitions. 7 | 8 | 1.0.1. "Commercial Use" means distribution or otherwise making the 9 | Covered Code available to a third party. 10 | 11 | 1.1. "Contributor" means each entity that creates or contributes to 12 | the creation of Modifications. 13 | 14 | 1.2. "Contributor Version" means the combination of the Original 15 | Code, prior Modifications used by a Contributor, and the Modifications 16 | made by that particular Contributor. 17 | 18 | 1.3. "Covered Code" means the Original Code or Modifications or the 19 | combination of the Original Code and Modifications, in each case 20 | including portions thereof. 21 | 22 | 1.4. "Electronic Distribution Mechanism" means a mechanism generally 23 | accepted in the software development community for the electronic 24 | transfer of data. 25 | 26 | 1.5. "Executable" means Covered Code in any form other than Source 27 | Code. 28 | 29 | 1.6. "Initial Developer" means the individual or entity identified 30 | as the Initial Developer in the Source Code notice required by Exhibit 31 | A. 32 | 33 | 1.7. "Larger Work" means a work which combines Covered Code or 34 | portions thereof with code not governed by the terms of this License. 35 | 36 | 1.8. "License" means this document. 37 | 38 | 1.8.1. "Licensable" means having the right to grant, to the maximum 39 | extent possible, whether at the time of the initial grant or 40 | subsequently acquired, any and all of the rights conveyed herein. 41 | 42 | 1.9. "Modifications" means any addition to or deletion from the 43 | substance or structure of either the Original Code or any previous 44 | Modifications. When Covered Code is released as a series of files, a 45 | Modification is: 46 | A. Any addition to or deletion from the contents of a file 47 | containing Original Code or previous Modifications. 48 | 49 | B. Any new file that contains any part of the Original Code or 50 | previous Modifications. 51 | 52 | 1.10. "Original Code" means Source Code of computer software code 53 | which is described in the Source Code notice required by Exhibit A as 54 | Original Code, and which, at the time of its release under this 55 | License is not already Covered Code governed by this License. 56 | 57 | 1.10.1. "Patent Claims" means any patent claim(s), now owned or 58 | hereafter acquired, including without limitation, method, process, 59 | and apparatus claims, in any patent Licensable by grantor. 60 | 61 | 1.11. "Source Code" means the preferred form of the Covered Code for 62 | making modifications to it, including all modules it contains, plus 63 | any associated interface definition files, scripts used to control 64 | compilation and installation of an Executable, or source code 65 | differential comparisons against either the Original Code or another 66 | well known, available Covered Code of the Contributor's choice. The 67 | Source Code can be in a compressed or archival form, provided the 68 | appropriate decompression or de-archiving software is widely available 69 | for no charge. 70 | 71 | 1.12. "You" (or "Your") means an individual or a legal entity 72 | exercising rights under, and complying with all of the terms of, this 73 | License or a future version of this License issued under Section 6.1. 74 | For legal entities, "You" includes any entity which controls, is 75 | controlled by, or is under common control with You. For purposes of 76 | this definition, "control" means (a) the power, direct or indirect, 77 | to cause the direction or management of such entity, whether by 78 | contract or otherwise, or (b) ownership of more than fifty percent 79 | (50%) of the outstanding shares or beneficial ownership of such 80 | entity. 81 | 82 | 2. Source Code License. 83 | 84 | 2.1. The Initial Developer Grant. 85 | The Initial Developer hereby grants You a world-wide, royalty-free, 86 | non-exclusive license, subject to third party intellectual property 87 | claims: 88 | (a) under intellectual property rights (other than patent or 89 | trademark) Licensable by Initial Developer to use, reproduce, 90 | modify, display, perform, sublicense and distribute the Original 91 | Code (or portions thereof) with or without Modifications, and/or 92 | as part of a Larger Work; and 93 | 94 | (b) under Patents Claims infringed by the making, using or 95 | selling of Original Code, to make, have made, use, practice, 96 | sell, and offer for sale, and/or otherwise dispose of the 97 | Original Code (or portions thereof). 98 | 99 | (c) the licenses granted in this Section 2.1(a) and (b) are 100 | effective on the date Initial Developer first distributes 101 | Original Code under the terms of this License. 102 | 103 | (d) Notwithstanding Section 2.1(b) above, no patent license is 104 | granted: 1) for code that You delete from the Original Code; 2) 105 | separate from the Original Code; or 3) for infringements caused 106 | by: i) the modification of the Original Code or ii) the 107 | combination of the Original Code with other software or devices. 108 | 109 | 2.2. Contributor Grant. 110 | Subject to third party intellectual property claims, each Contributor 111 | hereby grants You a world-wide, royalty-free, non-exclusive license 112 | 113 | (a) under intellectual property rights (other than patent or 114 | trademark) Licensable by Contributor, to use, reproduce, modify, 115 | display, perform, sublicense and distribute the Modifications 116 | created by such Contributor (or portions thereof) either on an 117 | unmodified basis, with other Modifications, as Covered Code 118 | and/or as part of a Larger Work; and 119 | 120 | (b) under Patent Claims infringed by the making, using, or 121 | selling of Modifications made by that Contributor either alone 122 | and/or in combination with its Contributor Version (or portions 123 | of such combination), to make, use, sell, offer for sale, have 124 | made, and/or otherwise dispose of: 1) Modifications made by that 125 | Contributor (or portions thereof); and 2) the combination of 126 | Modifications made by that Contributor with its Contributor 127 | Version (or portions of such combination). 128 | 129 | (c) the licenses granted in Sections 2.2(a) and 2.2(b) are 130 | effective on the date Contributor first makes Commercial Use of 131 | the Covered Code. 132 | 133 | (d) Notwithstanding Section 2.2(b) above, no patent license is 134 | granted: 1) for any code that Contributor has deleted from the 135 | Contributor Version; 2) separate from the Contributor Version; 136 | 3) for infringements caused by: i) third party modifications of 137 | Contributor Version or ii) the combination of Modifications made 138 | by that Contributor with other software (except as part of the 139 | Contributor Version) or other devices; or 4) under Patent Claims 140 | infringed by Covered Code in the absence of Modifications made by 141 | that Contributor. 142 | 143 | 3. Distribution Obligations. 144 | 145 | 3.1. Application of License. 146 | The Modifications which You create or to which You contribute are 147 | governed by the terms of this License, including without limitation 148 | Section 2.2. The Source Code version of Covered Code may be 149 | distributed only under the terms of this License or a future version 150 | of this License released under Section 6.1, and You must include a 151 | copy of this License with every copy of the Source Code You 152 | distribute. You may not offer or impose any terms on any Source Code 153 | version that alters or restricts the applicable version of this 154 | License or the recipients' rights hereunder. However, You may include 155 | an additional document offering the additional rights described in 156 | Section 3.5. 157 | 158 | 3.2. Availability of Source Code. 159 | Any Modification which You create or to which You contribute must be 160 | made available in Source Code form under the terms of this License 161 | either on the same media as an Executable version or via an accepted 162 | Electronic Distribution Mechanism to anyone to whom you made an 163 | Executable version available; and if made available via Electronic 164 | Distribution Mechanism, must remain available for at least twelve (12) 165 | months after the date it initially became available, or at least six 166 | (6) months after a subsequent version of that particular Modification 167 | has been made available to such recipients. You are responsible for 168 | ensuring that the Source Code version remains available even if the 169 | Electronic Distribution Mechanism is maintained by a third party. 170 | 171 | 3.3. Description of Modifications. 172 | You must cause all Covered Code to which You contribute to contain a 173 | file documenting the changes You made to create that Covered Code and 174 | the date of any change. You must include a prominent statement that 175 | the Modification is derived, directly or indirectly, from Original 176 | Code provided by the Initial Developer and including the name of the 177 | Initial Developer in (a) the Source Code, and (b) in any notice in an 178 | Executable version or related documentation in which You describe the 179 | origin or ownership of the Covered Code. 180 | 181 | 3.4. Intellectual Property Matters 182 | (a) Third Party Claims. 183 | If Contributor has knowledge that a license under a third party's 184 | intellectual property rights is required to exercise the rights 185 | granted by such Contributor under Sections 2.1 or 2.2, 186 | Contributor must include a text file with the Source Code 187 | distribution titled "LEGAL" which describes the claim and the 188 | party making the claim in sufficient detail that a recipient will 189 | know whom to contact. If Contributor obtains such knowledge after 190 | the Modification is made available as described in Section 3.2, 191 | Contributor shall promptly modify the LEGAL file in all copies 192 | Contributor makes available thereafter and shall take other steps 193 | (such as notifying appropriate mailing lists or newsgroups) 194 | reasonably calculated to inform those who received the Covered 195 | Code that new knowledge has been obtained. 196 | 197 | (b) Contributor APIs. 198 | If Contributor's Modifications include an application programming 199 | interface and Contributor has knowledge of patent licenses which 200 | are reasonably necessary to implement that API, Contributor must 201 | also include this information in the LEGAL file. 202 | 203 | (c) Representations. 204 | Contributor represents that, except as disclosed pursuant to 205 | Section 3.4(a) above, Contributor believes that Contributor's 206 | Modifications are Contributor's original creation(s) and/or 207 | Contributor has sufficient rights to grant the rights conveyed by 208 | this License. 209 | 210 | 3.5. Required Notices. 211 | You must duplicate the notice in Exhibit A in each file of the Source 212 | Code. If it is not possible to put such notice in a particular Source 213 | Code file due to its structure, then You must include such notice in a 214 | location (such as a relevant directory) where a user would be likely 215 | to look for such a notice. If You created one or more Modification(s) 216 | You may add your name as a Contributor to the notice described in 217 | Exhibit A. You must also duplicate this License in any documentation 218 | for the Source Code where You describe recipients' rights or ownership 219 | rights relating to Covered Code. You may choose to offer, and to 220 | charge a fee for, warranty, support, indemnity or liability 221 | obligations to one or more recipients of Covered Code. However, You 222 | may do so only on Your own behalf, and not on behalf of the Initial 223 | Developer or any Contributor. You must make it absolutely clear than 224 | any such warranty, support, indemnity or liability obligation is 225 | offered by You alone, and You hereby agree to indemnify the Initial 226 | Developer and every Contributor for any liability incurred by the 227 | Initial Developer or such Contributor as a result of warranty, 228 | support, indemnity or liability terms You offer. 229 | 230 | 3.6. Distribution of Executable Versions. 231 | You may distribute Covered Code in Executable form only if the 232 | requirements of Section 3.1-3.5 have been met for that Covered Code, 233 | and if You include a notice stating that the Source Code version of 234 | the Covered Code is available under the terms of this License, 235 | including a description of how and where You have fulfilled the 236 | obligations of Section 3.2. The notice must be conspicuously included 237 | in any notice in an Executable version, related documentation or 238 | collateral in which You describe recipients' rights relating to the 239 | Covered Code. You may distribute the Executable version of Covered 240 | Code or ownership rights under a license of Your choice, which may 241 | contain terms different from this License, provided that You are in 242 | compliance with the terms of this License and that the license for the 243 | Executable version does not attempt to limit or alter the recipient's 244 | rights in the Source Code version from the rights set forth in this 245 | License. If You distribute the Executable version under a different 246 | license You must make it absolutely clear that any terms which differ 247 | from this License are offered by You alone, not by the Initial 248 | Developer or any Contributor. You hereby agree to indemnify the 249 | Initial Developer and every Contributor for any liability incurred by 250 | the Initial Developer or such Contributor as a result of any such 251 | terms You offer. 252 | 253 | 3.7. Larger Works. 254 | You may create a Larger Work by combining Covered Code with other code 255 | not governed by the terms of this License and distribute the Larger 256 | Work as a single product. In such a case, You must make sure the 257 | requirements of this License are fulfilled for the Covered Code. 258 | 259 | 4. Inability to Comply Due to Statute or Regulation. 260 | 261 | If it is impossible for You to comply with any of the terms of this 262 | License with respect to some or all of the Covered Code due to 263 | statute, judicial order, or regulation then You must: (a) comply with 264 | the terms of this License to the maximum extent possible; and (b) 265 | describe the limitations and the code they affect. Such description 266 | must be included in the LEGAL file described in Section 3.4 and must 267 | be included with all distributions of the Source Code. Except to the 268 | extent prohibited by statute or regulation, such description must be 269 | sufficiently detailed for a recipient of ordinary skill to be able to 270 | understand it. 271 | 272 | 5. Application of this License. 273 | 274 | This License applies to code to which the Initial Developer has 275 | attached the notice in Exhibit A and to related Covered Code. 276 | 277 | 6. Versions of the License. 278 | 279 | 6.1. New Versions. 280 | Netscape Communications Corporation ("Netscape") may publish revised 281 | and/or new versions of the License from time to time. Each version 282 | will be given a distinguishing version number. 283 | 284 | 6.2. Effect of New Versions. 285 | Once Covered Code has been published under a particular version of the 286 | License, You may always continue to use it under the terms of that 287 | version. You may also choose to use such Covered Code under the terms 288 | of any subsequent version of the License published by Netscape. No one 289 | other than Netscape has the right to modify the terms applicable to 290 | Covered Code created under this License. 291 | 292 | 6.3. Derivative Works. 293 | If You create or use a modified version of this License (which you may 294 | only do in order to apply it to code which is not already Covered Code 295 | governed by this License), You must (a) rename Your license so that 296 | the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", 297 | "MPL", "NPL" or any confusingly similar phrase do not appear in your 298 | license (except to note that your license differs from this License) 299 | and (b) otherwise make it clear that Your version of the license 300 | contains terms which differ from the Mozilla Public License and 301 | Netscape Public License. (Filling in the name of the Initial 302 | Developer, Original Code or Contributor in the notice described in 303 | Exhibit A shall not of themselves be deemed to be modifications of 304 | this License.) 305 | 306 | 7. DISCLAIMER OF WARRANTY. 307 | 308 | COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, 309 | WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, 310 | WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF 311 | DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. 312 | THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE 313 | IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, 314 | YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE 315 | COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER 316 | OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF 317 | ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 318 | 319 | 8. TERMINATION. 320 | 321 | 8.1. This License and the rights granted hereunder will terminate 322 | automatically if You fail to comply with terms herein and fail to cure 323 | such breach within 30 days of becoming aware of the breach. All 324 | sublicenses to the Covered Code which are properly granted shall 325 | survive any termination of this License. Provisions which, by their 326 | nature, must remain in effect beyond the termination of this License 327 | shall survive. 328 | 329 | 8.2. If You initiate litigation by asserting a patent infringement 330 | claim (excluding declatory judgment actions) against Initial Developer 331 | or a Contributor (the Initial Developer or Contributor against whom 332 | You file such action is referred to as "Participant") alleging that: 333 | 334 | (a) such Participant's Contributor Version directly or indirectly 335 | infringes any patent, then any and all rights granted by such 336 | Participant to You under Sections 2.1 and/or 2.2 of this License 337 | shall, upon 60 days notice from Participant terminate prospectively, 338 | unless if within 60 days after receipt of notice You either: (i) 339 | agree in writing to pay Participant a mutually agreeable reasonable 340 | royalty for Your past and future use of Modifications made by such 341 | Participant, or (ii) withdraw Your litigation claim with respect to 342 | the Contributor Version against such Participant. If within 60 days 343 | of notice, a reasonable royalty and payment arrangement are not 344 | mutually agreed upon in writing by the parties or the litigation claim 345 | is not withdrawn, the rights granted by Participant to You under 346 | Sections 2.1 and/or 2.2 automatically terminate at the expiration of 347 | the 60 day notice period specified above. 348 | 349 | (b) any software, hardware, or device, other than such Participant's 350 | Contributor Version, directly or indirectly infringes any patent, then 351 | any rights granted to You by such Participant under Sections 2.1(b) 352 | and 2.2(b) are revoked effective as of the date You first made, used, 353 | sold, distributed, or had made, Modifications made by that 354 | Participant. 355 | 356 | 8.3. If You assert a patent infringement claim against Participant 357 | alleging that such Participant's Contributor Version directly or 358 | indirectly infringes any patent where such claim is resolved (such as 359 | by license or settlement) prior to the initiation of patent 360 | infringement litigation, then the reasonable value of the licenses 361 | granted by such Participant under Sections 2.1 or 2.2 shall be taken 362 | into account in determining the amount or value of any payment or 363 | license. 364 | 365 | 8.4. In the event of termination under Sections 8.1 or 8.2 above, 366 | all end user license agreements (excluding distributors and resellers) 367 | which have been validly granted by You or any distributor hereunder 368 | prior to termination shall survive termination. 369 | 370 | 9. LIMITATION OF LIABILITY. 371 | 372 | UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT 373 | (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL 374 | DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, 375 | OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR 376 | ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY 377 | CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, 378 | WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER 379 | COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN 380 | INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF 381 | LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY 382 | RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW 383 | PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE 384 | EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO 385 | THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. 386 | 387 | 10. U.S. GOVERNMENT END USERS. 388 | 389 | The Covered Code is a "commercial item," as that term is defined in 390 | 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer 391 | software" and "commercial computer software documentation," as such 392 | terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 393 | C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), 394 | all U.S. Government End Users acquire Covered Code with only those 395 | rights set forth herein. 396 | 397 | 11. MISCELLANEOUS. 398 | 399 | This License represents the complete agreement concerning subject 400 | matter hereof. If any provision of this License is held to be 401 | unenforceable, such provision shall be reformed only to the extent 402 | necessary to make it enforceable. This License shall be governed by 403 | California law provisions (except to the extent applicable law, if 404 | any, provides otherwise), excluding its conflict-of-law provisions. 405 | With respect to disputes in which at least one party is a citizen of, 406 | or an entity chartered or registered to do business in the United 407 | States of America, any litigation relating to this License shall be 408 | subject to the jurisdiction of the Federal Courts of the Northern 409 | District of California, with venue lying in Santa Clara County, 410 | California, with the losing party responsible for costs, including 411 | without limitation, court costs and reasonable attorneys' fees and 412 | expenses. The application of the United Nations Convention on 413 | Contracts for the International Sale of Goods is expressly excluded. 414 | Any law or regulation which provides that the language of a contract 415 | shall be construed against the drafter shall not apply to this 416 | License. 417 | 418 | 12. RESPONSIBILITY FOR CLAIMS. 419 | 420 | As between Initial Developer and the Contributors, each party is 421 | responsible for claims and damages arising, directly or indirectly, 422 | out of its utilization of rights under this License and You agree to 423 | work with Initial Developer and Contributors to distribute such 424 | responsibility on an equitable basis. Nothing herein is intended or 425 | shall be deemed to constitute any admission of liability. 426 | 427 | 13. MULTIPLE-LICENSED CODE. 428 | 429 | Initial Developer may designate portions of the Covered Code as 430 | "Multiple-Licensed". "Multiple-Licensed" means that the Initial 431 | Developer permits you to utilize portions of the Covered Code under 432 | Your choice of the NPL or the alternative licenses, if any, specified 433 | by the Initial Developer in the file described in Exhibit A. 434 | 435 | EXHIBIT A -Mozilla Public License. 436 | 437 | ``The contents of this file are subject to the Mozilla Public License 438 | Version 1.1 (the "License"); you may not use this file except in 439 | compliance with the License. You may obtain a copy of the License at 440 | http://www.mozilla.org/MPL/ 441 | 442 | Software distributed under the License is distributed on an "AS IS" 443 | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 444 | License for the specific language governing rights and limitations 445 | under the License. 446 | 447 | The Original Code is the SpatialDBKit library. 448 | 449 | The Initial Developer of the Original Code is Andrea Cremaschi. 450 | 451 | Alternatively, the contents of this file may be used under the terms of 452 | either the GNU General Public License Version 2 or later (the "GPL"), or 453 | the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 454 | in which case the provisions of the GPL or the LGPL are applicable instead 455 | of those above. If you wish to allow use of your version of this file only 456 | under the terms of either the GPL or the LGPL, and not to allow others to 457 | use your version of this file under the terms of the MPL, indicate your 458 | decision by deleting the provisions above and replace them with the notice 459 | and other provisions required by the GPL or the LGPL. If you do not delete 460 | the provisions above, a recipient may use your version of this file under 461 | the terms of any one of the MPL, the GPL or the LGPL. 462 | 463 | [NOTE: The text of this Exhibit A may differ slightly from the text of 464 | the notices in the Source Code files of the Original Code. You should 465 | use the text of this Exhibit A rather than the text found in the 466 | Original Code Source Code for Your Modifications.] 467 | 468 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SpatialDBKit 2 | ============ 3 | 4 | An Objective-C lightweight spatial RDBMS (based on SQLite/SpatiaLite). 5 | The project manages a whole stack of technologies that allow combined together to perform spatial SQL queries (i.e. queries based on distance, intersection between geometries etc.) to obtain easy-to-use Cocoa objects. 6 | 7 | While fully working, the project is in alpha stage, please be careful using this in production projects. 8 | 9 | ## Features ## 10 | 11 | With SpatialDBKit you will be able to: 12 | 13 | * Open a spatialite database: 14 | 15 | ```Objective-C 16 | // Open a spatialite database 17 | SpatialDatabase *db = [SpatialDatabase databaseWithPath: [[NSBundle mainBundle] pathForResource:@"test" ofType:@"sqlite"]]; 18 | [db open]; 19 | ``` 20 | 21 | * fetch geometries in form of Shapekit objects: 22 | 23 | ```Objective-C 24 | FMResultSet *rs = [db executeQuery:@"select Name, geometry FROM Regions"]; 25 | while ([rs next]) { 26 | NSLog(@"%@", [resultSet resultDictionary]); 27 | } 28 | ``` 29 | 30 | * or in textual form: 31 | 32 | ```Objective-C 33 | FMResultSet *rs = [db executeQuery:@"select Name, AsText(geometry) as geom_text FROM Regions"]; 34 | ``` 35 | 36 | * calculating distance from a point if you need to: 37 | 38 | ```Objective-C 39 | FMResultSet *rs = [db executeQuery:@"select distance(geometry, MakePoint(45.694216,9.676909,4326)) AS text FROM Regions"]; 40 | ``` 41 | 42 | * or filtering points by distance: 43 | 44 | ```Objective-C 45 | FMResultSet *resultSet= [db executeQuery:@"SELECT astext(geometry) as geometry, distance(geometry, MakePoint(45.694216,9.676909,4326)) as geometry, Name FROM Towns where distance(geometry, MakePoint(45.694216,9.676909,4326)) < 5000"]; 46 | ``` 47 | 48 | 49 | This is just the point of the iceberg.. check [spatialite SQL functions reference list](https://www.gaia-gis.it/fossil/libspatialite/index) to be sure you don't miss anything of this awesome library! 50 | 51 | ## How to use it ## 52 | 53 | Since importing C libraries is a sort of nightmare, SpatialDBKit has been thought to be used with [CocoaPods](http://cocoapods.org) that should address all the boring stuff for you. 54 | But before you must install the [GNU build system](http://en.wikipedia.org/wiki/GNU_build_system) if you haven't already: 55 | 56 | ``` 57 | brew install automake autoconf libtool 58 | ``` 59 | 60 | Now you can create your Podfile as usual: 61 | 62 | ``` 63 | platform :ios, '5.0' 64 | pod 'SpatialDBKit' 65 | ``` 66 | 67 | Of course now you should ```#import ``` 68 | 69 | Now ___two extra step are required___: 70 | 71 | 1. rename your main file main.m to main.mm 72 | The long story is that SpatialDBKit dependencies reside on C++ libraries, so we should tell the compiler that our project files should be treated as Objective-C++. The podspec correctly sets C++ Standard Library project's build setting to libstdc++ (GNU c++ standard library), but Xcode 5.1 can't find any Objective-C++ file in the main project, so ignores the setting and links with libc++. Renaming a file with .mm extension does the trick. 73 | 74 | 2. manually open ```spatialite.c``` and replace (line 87): 75 | 76 | ``` 77 | #include 78 | ``` 79 | 80 | with: 81 | 82 | ``` 83 | #include 84 | ``` 85 | 86 | This is a workaround to fix the issue tracked here: https://github.com/andreacremaschi/SpatialDBKit/issues/12 (while I figure out something better, or it is fixed in CocoaPods, or in the spatialite's pod specification). 87 | 88 | ## Documentation ## 89 | 90 | Since SpatialDBKit actually sits on a stack of technology, you should refer to the submodules documentation. The most relevant are: 91 | 92 | - [spatialite](https://www.gaia-gis.it/fossil/libspatialite/index) 93 | - [ShapeKit](https://github.com/andreacremaschi/ShapeKit) 94 | - [FMDB](https://github.com/ccgus/fmdb) 95 | 96 | 97 | ## License ## 98 | 99 | * [PROJ.4](http://trac.osgeo.org/proj/) is under the MIT license. 100 | 101 | * [GEOS](http://trac.osgeo.org/geos/) is available under the terms of [GNU Lesser General Public License (LGPL)](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html), and is a project of [OSGeo](http://www.osgeo.org). 102 | * [ShapeKit](https://github.com/andreacremaschi/ShapeKit), being a GEOS wrapper, is under the terms of GNU Lesser General Public License. 103 | 104 | * [spatialite](https://www.gaia-gis.it/fossil/libspatialite/index) is developed and maintained by Alessandro Furieri and are licensed under the [MPL tri-license](http://www.mozilla.org/MPL/boilerplate-1.1/mpl-tri-license-html) terms. 105 | * SpatialDBKit itself is licensed under the same MPL tri-license terms. 106 | 107 | * [SQLite](http://www.sqlite.org/copyright.html) has been dedicated to the public domain by the authors (thanks!). 108 | * Its Objective-C wrapper, [FMDB](https://github.com/ccgus/fmdb) by Gus Mueller, is under the MIT License. 109 | 110 | **License note: Be aware that LGPL v2.1 (GEOS license) and Apple Store compatibility is at least controversial** (search for "LGPL iOS" on Google to know why). 111 | -------------------------------------------------------------------------------- /SpatialDBKit.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "SpatialDBKit" 3 | s.version = "0.1.1" 4 | s.summary = "SpatialDBKit is the spatial RDBMS for iOS." 5 | s.description = "An Objective-C wrapper of SpatiaLite, the smallest and simplest while powerful Spatial RDBMS in the world!" 6 | s.homepage = "https://github.com/andreacremaschi/SpatialDBKit" 7 | s.license = { :type => "Mozilla Public License v1.1", 8 | :file => "LICENSE" } 9 | s.author = { "Andrea Cremaschi" => "andreacremaschi@libero.it" } 10 | s.source = { :git => "https://github.com/andreacremaschi/SpatialDBKit.git", :tag => "0.1.1"} 11 | 12 | s.platform = :ios, "5.0" 13 | 14 | s.dependency "spatialite" 15 | s.dependency "FMDB/common" 16 | s.dependency "sqlite3/rtree" 17 | s.dependency "ShapeKit" 18 | s.requires_arc = true 19 | 20 | s.source_files = "SpatialDBKit/*.{h,m}" 21 | 22 | s.public_header_files = "SpatialDBKit/*.h" 23 | 24 | end 25 | -------------------------------------------------------------------------------- /SpatialDBKit/FMResultSet+SpatialDBKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // FMResultSet+SpatialDBKit.h 3 | // SpatialDBKit 4 | // 5 | // Created by Andrea Cremaschi on 11/03/13. 6 | // Copyright (c) 2013 redcluster.eu. All rights reserved. 7 | // 8 | 9 | #import "FMResultSet.h" 10 | 11 | @interface FMResultSet (SpatialDBKit) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SpatialDBKit/FMResultSet+SpatialDBKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // FMResultSet+SpatialDBKit.m 3 | // SpatialDBKit 4 | // 5 | // Created by Andrea Cremaschi on 11/03/13. 6 | // Copyright (c) 2013 redcluster.eu. All rights reserved. 7 | // 8 | 9 | #import "FMResultSet+SpatialDBKit.h" 10 | #import 11 | #import 12 | #import 13 | 14 | @implementation FMResultSet (SpatialDBKit) 15 | 16 | - (ShapeKitGeometry*)geometryForColumnIndex:(int)columnIdx { 17 | 18 | if (sqlite3_column_type([_statement statement], columnIdx) == SQLITE_NULL || (columnIdx < 0)) { 19 | return nil; 20 | } 21 | 22 | const void *blob; 23 | int blob_size; 24 | gaiaGeomCollPtr geom; 25 | ShapeKitGeometry * shapekitGeom; 26 | 27 | sqlite3_stmt *stmt = [_statement statement]; 28 | 29 | blob = sqlite3_column_blob (stmt, columnIdx); 30 | blob_size = sqlite3_column_bytes (stmt, columnIdx); 31 | 32 | /* checking if this BLOB actually is a GEOMETRY */ 33 | geom = gaiaFromSpatiaLiteBlobWkb (blob, blob_size); 34 | if (!geom) 35 | { // not a geometry 36 | return nil; 37 | } 38 | else 39 | { 40 | shapekitGeom = [[ShapeKitFactory defaultFactory] geometryWithGEOSGeometry: gaiaToGeos(geom)]; 41 | /* we have now to free the GEOMETRY */ 42 | gaiaFreeGeomColl (geom); 43 | 44 | } 45 | return shapekitGeom; 46 | } 47 | 48 | - (id)_swizzleObjectForColumnIndex:(int)columnIdx { 49 | 50 | sqlite3_stmt *stmt = [_statement statement]; 51 | 52 | int columnType = sqlite3_column_type(stmt, columnIdx); 53 | id obj; 54 | switch (columnType) { 55 | case SQLITE_BLOB: 56 | obj = [self geometryForColumnIndex:columnIdx]; 57 | if (obj) break; 58 | default: 59 | obj = [self _swizzleObjectForColumnIndex:columnIdx]; 60 | } 61 | return obj; 62 | 63 | /* } else if ([obj isKindOfClass:[NSString class]]) 64 | { 65 | // If a valid geometry object, pack it using ShapeKit 66 | ShapeKitGeometry *geom = [[ShapeKitFactory defaultFactory] geometryWithWKT: obj]; 67 | if (geom) obj=geom; 68 | } 69 | return obj;*/ 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /SpatialDBKit/SpatialDBKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // SpatialDBKit.h 3 | // Pods 4 | // 5 | // Created by Andrea Cremaschi on 04/12/14. 6 | // 7 | // 8 | 9 | #ifndef Pods_SpatialDBKit_h 10 | #define Pods_SpatialDBKit_h 11 | 12 | #import 13 | #import 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /SpatialDBKit/SpatialDatabase.h: -------------------------------------------------------------------------------- 1 | // 2 | // SpatialDatabase.h 3 | // SpatialDBKit 4 | // 5 | // Created by Andrea Cremaschi on 11/03/13. 6 | // 7 | // * This is free software; you can redistribute and/or modify it under 8 | // the terms of the Mozilla Public License Version 1.1 9 | // 10 | // Alternatively, the contents of this file may be used under the terms of 11 | // either the GNU General Public License Version 2 or later (the "GPL"), or 12 | // the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 13 | // See the LICENSE file for more information. 14 | 15 | 16 | #import 17 | 18 | @interface SpatialDatabase : FMDatabase 19 | + (NSString*)spatialiteLibVersion; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /SpatialDBKit/SpatialDatabase.m: -------------------------------------------------------------------------------- 1 | // 2 | // SpatialDatabase.m 3 | // SpatialDBKit 4 | // 5 | // Created by Andrea Cremaschi on 11/03/13. 6 | // 7 | // * This is free software; you can redistribute and/or modify it under 8 | // the terms of the Mozilla Public License Version 1.1 9 | // 10 | // Alternatively, the contents of this file may be used under the terms of 11 | // either the GNU General Public License Version 2 or later (the "GPL"), or 12 | // the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 13 | // See the LICENSE file for more information. 14 | 15 | 16 | #import "SpatialDatabase.h" 17 | #import 18 | #import 19 | #import 20 | #import "FMResultSet+SpatialDBKit.h" 21 | #import 22 | 23 | @interface FMResultSet (MyCategory) 24 | - (id)objectForColumnIndex:(int)columnIdx; 25 | - (id)_swizzleObjectForColumnIndex:(int)columnIdx; 26 | @end 27 | 28 | static char const * const SpatialiteTagKey = "SpatialiteTagKey"; 29 | 30 | static NSUInteger SpatialDatabaseInstances = 0; 31 | 32 | 33 | void Swizzle(Class c, SEL orig, SEL new) 34 | { 35 | Method origMethod = class_getInstanceMethod(c, orig); 36 | Method newMethod = class_getInstanceMethod(c, new); 37 | if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))) 38 | class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod)); 39 | else 40 | method_exchangeImplementations(origMethod, newMethod); 41 | } 42 | 43 | @implementation SpatialDatabase { 44 | void *spatialite_conn; 45 | } 46 | 47 | + (NSString*)spatialiteLibVersion 48 | { 49 | return [NSString stringWithFormat:@"%s", spatialite_version()]; 50 | } 51 | 52 | 53 | - (id)initWithPath:(NSString *)inPath 54 | { 55 | self = [super initWithPath:inPath]; 56 | if (self) 57 | { 58 | SpatialDatabaseInstances++; 59 | if (SpatialDatabaseInstances==1) 60 | { 61 | Swizzle([FMResultSet class], @selector(objectForColumnIndex:), @selector(_swizzleObjectForColumnIndex:)); 62 | } 63 | } 64 | return self; 65 | } 66 | 67 | - (BOOL)open 68 | { 69 | BOOL opened = [super open]; 70 | 71 | if (opened) 72 | { 73 | [self initSpatialite]; 74 | } 75 | 76 | return opened; 77 | } 78 | 79 | - (BOOL)openWithFlags:(int)flags 80 | { 81 | BOOL opened = [super openWithFlags:flags]; 82 | 83 | if (opened) 84 | { 85 | [self initSpatialite]; 86 | } 87 | 88 | return opened; 89 | } 90 | 91 | - (void)initSpatialite 92 | { 93 | NSLog(@"Spatialite initialization"); 94 | spatialite_init_geos(); 95 | spatialite_conn = spatialite_alloc_connection(); 96 | spatialite_init_ex(_db, spatialite_conn, 1); 97 | } 98 | 99 | -(void)dealloc 100 | { 101 | // remove reference to dummyObject 102 | SpatialDatabaseInstances--; 103 | if (SpatialDatabaseInstances == 0) 104 | { 105 | NSLog(@"Terminating spatialite"); 106 | spatialite_cleanup_ex(spatialite_conn); 107 | } 108 | } 109 | 110 | @end 111 | 112 | -------------------------------------------------------------------------------- /SpatialDBKit/SpatialDatabaseQueue.h: -------------------------------------------------------------------------------- 1 | // 2 | // SpatialDatabaseQueue.h 3 | // SpatialDBKit 4 | // 5 | // Created by James Gregory on 21/08/14. 6 | // 7 | // * This is free software; you can redistribute and/or modify it under 8 | // the terms of the Mozilla Public License Version 1.1 9 | // 10 | // Alternatively, the contents of this file may be used under the terms of 11 | // either the GNU General Public License Version 2 or later (the "GPL"), or 12 | // the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 13 | // See the LICENSE file for more information. 14 | 15 | #import 16 | #import 17 | 18 | @interface SpatialDatabaseQueue : FMDatabaseQueue 19 | @end 20 | -------------------------------------------------------------------------------- /SpatialDBKit/SpatialDatabaseQueue.m: -------------------------------------------------------------------------------- 1 | // 2 | // SpatialDatabaseQueue.m 3 | // SpatialDBKit 4 | // 5 | // Created by James Gregory on 21/08/14. 6 | // 7 | // * This is free software; you can redistribute and/or modify it under 8 | // the terms of the Mozilla Public License Version 1.1 9 | // 10 | // Alternatively, the contents of this file may be used under the terms of 11 | // either the GNU General Public License Version 2 or later (the "GPL"), or 12 | // the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 13 | // See the LICENSE file for more information. 14 | 15 | #import "SpatialDatabaseQueue.h" 16 | #import "SpatialDatabase.h" 17 | 18 | @implementation SpatialDatabaseQueue 19 | 20 | + (Class)databaseClass 21 | { 22 | return [SpatialDatabase class]; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /SpatialDBKitExample/Assets/test-2.3.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andreacremaschi/SpatialDBKit/8cdeb00b590c74c46144f872044932d100956a28/SpatialDBKitExample/Assets/test-2.3.sqlite -------------------------------------------------------------------------------- /SpatialDBKitExample/Assets/test-network-2.3.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andreacremaschi/SpatialDBKit/8cdeb00b590c74c46144f872044932d100956a28/SpatialDBKitExample/Assets/test-network-2.3.sqlite -------------------------------------------------------------------------------- /SpatialDBKitExample/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '6.0' 3 | 4 | target 'SpatialDBKitExample' do 5 | pod 'SpatialDBKit', :path => '../' 6 | end 7 | 8 | target 'SpatialDBKitExampleTests' do 9 | 10 | end 11 | 12 | -------------------------------------------------------------------------------- /SpatialDBKitExample/SpatialDBKitExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 8D374D6A5B5F254B0DFDF053 /* libPods-SpatialDBKitExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 90C30FF1C2363E1D2452B4C1 /* libPods-SpatialDBKitExample.a */; }; 11 | CD28A11A1A307F370087B00D /* Assets in Resources */ = {isa = PBXBuildFile; fileRef = CD28A1191A307F370087B00D /* Assets */; }; 12 | CD60F7CA1A3074480008CE86 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD60F7C91A3074480008CE86 /* main.mm */; }; 13 | CD60F7CD1A3074480008CE86 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CD60F7CC1A3074480008CE86 /* AppDelegate.m */; }; 14 | CD60F7D01A3074480008CE86 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CD60F7CF1A3074480008CE86 /* ViewController.m */; }; 15 | CD60F7D31A3074480008CE86 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CD60F7D11A3074480008CE86 /* Main.storyboard */; }; 16 | CD60F7D51A3074480008CE86 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CD60F7D41A3074480008CE86 /* Images.xcassets */; }; 17 | CD60F7D81A3074480008CE86 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = CD60F7D61A3074480008CE86 /* LaunchScreen.xib */; }; 18 | CD60F7E41A3074480008CE86 /* SpatialDBKitExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CD60F7E31A3074480008CE86 /* SpatialDBKitExampleTests.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | CD60F7DE1A3074480008CE86 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = CD60F7BC1A3074480008CE86 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = CD60F7C31A3074480008CE86; 27 | remoteInfo = SpatialDBKitExample; 28 | }; 29 | /* End PBXContainerItemProxy section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 90C30FF1C2363E1D2452B4C1 /* libPods-SpatialDBKitExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SpatialDBKitExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | 95B43353F47D25573FE22E46 /* Pods-SpatialDBKitExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SpatialDBKitExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-SpatialDBKitExample/Pods-SpatialDBKitExample.release.xcconfig"; sourceTree = ""; }; 34 | CD28A1191A307F370087B00D /* Assets */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Assets; sourceTree = ""; }; 35 | CD60F7C41A3074480008CE86 /* SpatialDBKitExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SpatialDBKitExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | CD60F7C81A3074480008CE86 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 37 | CD60F7C91A3074480008CE86 /* main.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; 38 | CD60F7CB1A3074480008CE86 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 39 | CD60F7CC1A3074480008CE86 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 40 | CD60F7CE1A3074480008CE86 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 41 | CD60F7CF1A3074480008CE86 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 42 | CD60F7D21A3074480008CE86 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 43 | CD60F7D41A3074480008CE86 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 44 | CD60F7D71A3074480008CE86 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 45 | CD60F7DD1A3074480008CE86 /* SpatialDBKitExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SpatialDBKitExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | CD60F7E21A3074480008CE86 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | CD60F7E31A3074480008CE86 /* SpatialDBKitExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SpatialDBKitExampleTests.m; sourceTree = ""; }; 48 | D5E067962E12F61E22AD46CB /* Pods-SpatialDBKitExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SpatialDBKitExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SpatialDBKitExample/Pods-SpatialDBKitExample.debug.xcconfig"; sourceTree = ""; }; 49 | /* End PBXFileReference section */ 50 | 51 | /* Begin PBXFrameworksBuildPhase section */ 52 | CD60F7C11A3074480008CE86 /* Frameworks */ = { 53 | isa = PBXFrameworksBuildPhase; 54 | buildActionMask = 2147483647; 55 | files = ( 56 | 8D374D6A5B5F254B0DFDF053 /* libPods-SpatialDBKitExample.a in Frameworks */, 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | CD60F7DA1A3074480008CE86 /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | /* End PBXFrameworksBuildPhase section */ 68 | 69 | /* Begin PBXGroup section */ 70 | 3BEB9664AC3F8752D8BA3CBB /* Pods */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | D5E067962E12F61E22AD46CB /* Pods-SpatialDBKitExample.debug.xcconfig */, 74 | 95B43353F47D25573FE22E46 /* Pods-SpatialDBKitExample.release.xcconfig */, 75 | ); 76 | name = Pods; 77 | sourceTree = ""; 78 | }; 79 | CD60F7BB1A3074480008CE86 = { 80 | isa = PBXGroup; 81 | children = ( 82 | CD60F7C61A3074480008CE86 /* SpatialDBKitExample */, 83 | CD28A1191A307F370087B00D /* Assets */, 84 | CD60F7E01A3074480008CE86 /* SpatialDBKitExampleTests */, 85 | CD60F7C51A3074480008CE86 /* Products */, 86 | 3BEB9664AC3F8752D8BA3CBB /* Pods */, 87 | E55D08451EE9538271A4FE14 /* Frameworks */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | CD60F7C51A3074480008CE86 /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | CD60F7C41A3074480008CE86 /* SpatialDBKitExample.app */, 95 | CD60F7DD1A3074480008CE86 /* SpatialDBKitExampleTests.xctest */, 96 | ); 97 | name = Products; 98 | sourceTree = ""; 99 | }; 100 | CD60F7C61A3074480008CE86 /* SpatialDBKitExample */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | CD60F7CB1A3074480008CE86 /* AppDelegate.h */, 104 | CD60F7CC1A3074480008CE86 /* AppDelegate.m */, 105 | CD60F7CE1A3074480008CE86 /* ViewController.h */, 106 | CD60F7CF1A3074480008CE86 /* ViewController.m */, 107 | CD60F7D11A3074480008CE86 /* Main.storyboard */, 108 | CD60F7D41A3074480008CE86 /* Images.xcassets */, 109 | CD60F7D61A3074480008CE86 /* LaunchScreen.xib */, 110 | CD60F7C71A3074480008CE86 /* Supporting Files */, 111 | ); 112 | path = SpatialDBKitExample; 113 | sourceTree = ""; 114 | }; 115 | CD60F7C71A3074480008CE86 /* Supporting Files */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | CD60F7C81A3074480008CE86 /* Info.plist */, 119 | CD60F7C91A3074480008CE86 /* main.mm */, 120 | ); 121 | name = "Supporting Files"; 122 | sourceTree = ""; 123 | }; 124 | CD60F7E01A3074480008CE86 /* SpatialDBKitExampleTests */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | CD60F7E31A3074480008CE86 /* SpatialDBKitExampleTests.m */, 128 | CD60F7E11A3074480008CE86 /* Supporting Files */, 129 | ); 130 | path = SpatialDBKitExampleTests; 131 | sourceTree = ""; 132 | }; 133 | CD60F7E11A3074480008CE86 /* Supporting Files */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | CD60F7E21A3074480008CE86 /* Info.plist */, 137 | ); 138 | name = "Supporting Files"; 139 | sourceTree = ""; 140 | }; 141 | E55D08451EE9538271A4FE14 /* Frameworks */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 90C30FF1C2363E1D2452B4C1 /* libPods-SpatialDBKitExample.a */, 145 | ); 146 | name = Frameworks; 147 | sourceTree = ""; 148 | }; 149 | /* End PBXGroup section */ 150 | 151 | /* Begin PBXNativeTarget section */ 152 | CD60F7C31A3074480008CE86 /* SpatialDBKitExample */ = { 153 | isa = PBXNativeTarget; 154 | buildConfigurationList = CD60F7E71A3074480008CE86 /* Build configuration list for PBXNativeTarget "SpatialDBKitExample" */; 155 | buildPhases = ( 156 | C0B9128FF226C0FBC5DE49CE /* Check Pods Manifest.lock */, 157 | CD60F7C01A3074480008CE86 /* Sources */, 158 | CD60F7C11A3074480008CE86 /* Frameworks */, 159 | CD60F7C21A3074480008CE86 /* Resources */, 160 | DB4C4231C8BA2369B7CE7AC6 /* Copy Pods Resources */, 161 | ); 162 | buildRules = ( 163 | ); 164 | dependencies = ( 165 | ); 166 | name = SpatialDBKitExample; 167 | productName = SpatialDBKitExample; 168 | productReference = CD60F7C41A3074480008CE86 /* SpatialDBKitExample.app */; 169 | productType = "com.apple.product-type.application"; 170 | }; 171 | CD60F7DC1A3074480008CE86 /* SpatialDBKitExampleTests */ = { 172 | isa = PBXNativeTarget; 173 | buildConfigurationList = CD60F7EA1A3074480008CE86 /* Build configuration list for PBXNativeTarget "SpatialDBKitExampleTests" */; 174 | buildPhases = ( 175 | CD60F7D91A3074480008CE86 /* Sources */, 176 | CD60F7DA1A3074480008CE86 /* Frameworks */, 177 | CD60F7DB1A3074480008CE86 /* Resources */, 178 | ); 179 | buildRules = ( 180 | ); 181 | dependencies = ( 182 | CD60F7DF1A3074480008CE86 /* PBXTargetDependency */, 183 | ); 184 | name = SpatialDBKitExampleTests; 185 | productName = SpatialDBKitExampleTests; 186 | productReference = CD60F7DD1A3074480008CE86 /* SpatialDBKitExampleTests.xctest */; 187 | productType = "com.apple.product-type.bundle.unit-test"; 188 | }; 189 | /* End PBXNativeTarget section */ 190 | 191 | /* Begin PBXProject section */ 192 | CD60F7BC1A3074480008CE86 /* Project object */ = { 193 | isa = PBXProject; 194 | attributes = { 195 | LastUpgradeCheck = 0610; 196 | ORGANIZATIONNAME = acremaschi; 197 | TargetAttributes = { 198 | CD60F7C31A3074480008CE86 = { 199 | CreatedOnToolsVersion = 6.1; 200 | }; 201 | CD60F7DC1A3074480008CE86 = { 202 | CreatedOnToolsVersion = 6.1; 203 | TestTargetID = CD60F7C31A3074480008CE86; 204 | }; 205 | }; 206 | }; 207 | buildConfigurationList = CD60F7BF1A3074480008CE86 /* Build configuration list for PBXProject "SpatialDBKitExample" */; 208 | compatibilityVersion = "Xcode 3.2"; 209 | developmentRegion = English; 210 | hasScannedForEncodings = 0; 211 | knownRegions = ( 212 | en, 213 | Base, 214 | ); 215 | mainGroup = CD60F7BB1A3074480008CE86; 216 | productRefGroup = CD60F7C51A3074480008CE86 /* Products */; 217 | projectDirPath = ""; 218 | projectRoot = ""; 219 | targets = ( 220 | CD60F7C31A3074480008CE86 /* SpatialDBKitExample */, 221 | CD60F7DC1A3074480008CE86 /* SpatialDBKitExampleTests */, 222 | ); 223 | }; 224 | /* End PBXProject section */ 225 | 226 | /* Begin PBXResourcesBuildPhase section */ 227 | CD60F7C21A3074480008CE86 /* Resources */ = { 228 | isa = PBXResourcesBuildPhase; 229 | buildActionMask = 2147483647; 230 | files = ( 231 | CD60F7D31A3074480008CE86 /* Main.storyboard in Resources */, 232 | CD28A11A1A307F370087B00D /* Assets in Resources */, 233 | CD60F7D81A3074480008CE86 /* LaunchScreen.xib in Resources */, 234 | CD60F7D51A3074480008CE86 /* Images.xcassets in Resources */, 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | CD60F7DB1A3074480008CE86 /* Resources */ = { 239 | isa = PBXResourcesBuildPhase; 240 | buildActionMask = 2147483647; 241 | files = ( 242 | ); 243 | runOnlyForDeploymentPostprocessing = 0; 244 | }; 245 | /* End PBXResourcesBuildPhase section */ 246 | 247 | /* Begin PBXShellScriptBuildPhase section */ 248 | C0B9128FF226C0FBC5DE49CE /* Check Pods Manifest.lock */ = { 249 | isa = PBXShellScriptBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | ); 253 | inputPaths = ( 254 | ); 255 | name = "Check Pods Manifest.lock"; 256 | outputPaths = ( 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | shellPath = /bin/sh; 260 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 261 | showEnvVarsInLog = 0; 262 | }; 263 | DB4C4231C8BA2369B7CE7AC6 /* Copy Pods Resources */ = { 264 | isa = PBXShellScriptBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | ); 268 | inputPaths = ( 269 | ); 270 | name = "Copy Pods Resources"; 271 | outputPaths = ( 272 | ); 273 | runOnlyForDeploymentPostprocessing = 0; 274 | shellPath = /bin/sh; 275 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SpatialDBKitExample/Pods-SpatialDBKitExample-resources.sh\"\n"; 276 | showEnvVarsInLog = 0; 277 | }; 278 | /* End PBXShellScriptBuildPhase section */ 279 | 280 | /* Begin PBXSourcesBuildPhase section */ 281 | CD60F7C01A3074480008CE86 /* Sources */ = { 282 | isa = PBXSourcesBuildPhase; 283 | buildActionMask = 2147483647; 284 | files = ( 285 | CD60F7D01A3074480008CE86 /* ViewController.m in Sources */, 286 | CD60F7CD1A3074480008CE86 /* AppDelegate.m in Sources */, 287 | CD60F7CA1A3074480008CE86 /* main.mm in Sources */, 288 | ); 289 | runOnlyForDeploymentPostprocessing = 0; 290 | }; 291 | CD60F7D91A3074480008CE86 /* Sources */ = { 292 | isa = PBXSourcesBuildPhase; 293 | buildActionMask = 2147483647; 294 | files = ( 295 | CD60F7E41A3074480008CE86 /* SpatialDBKitExampleTests.m in Sources */, 296 | ); 297 | runOnlyForDeploymentPostprocessing = 0; 298 | }; 299 | /* End PBXSourcesBuildPhase section */ 300 | 301 | /* Begin PBXTargetDependency section */ 302 | CD60F7DF1A3074480008CE86 /* PBXTargetDependency */ = { 303 | isa = PBXTargetDependency; 304 | target = CD60F7C31A3074480008CE86 /* SpatialDBKitExample */; 305 | targetProxy = CD60F7DE1A3074480008CE86 /* PBXContainerItemProxy */; 306 | }; 307 | /* End PBXTargetDependency section */ 308 | 309 | /* Begin PBXVariantGroup section */ 310 | CD60F7D11A3074480008CE86 /* Main.storyboard */ = { 311 | isa = PBXVariantGroup; 312 | children = ( 313 | CD60F7D21A3074480008CE86 /* Base */, 314 | ); 315 | name = Main.storyboard; 316 | sourceTree = ""; 317 | }; 318 | CD60F7D61A3074480008CE86 /* LaunchScreen.xib */ = { 319 | isa = PBXVariantGroup; 320 | children = ( 321 | CD60F7D71A3074480008CE86 /* Base */, 322 | ); 323 | name = LaunchScreen.xib; 324 | sourceTree = ""; 325 | }; 326 | /* End PBXVariantGroup section */ 327 | 328 | /* Begin XCBuildConfiguration section */ 329 | CD60F7E51A3074480008CE86 /* Debug */ = { 330 | isa = XCBuildConfiguration; 331 | buildSettings = { 332 | ALWAYS_SEARCH_USER_PATHS = NO; 333 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 334 | CLANG_CXX_LIBRARY = "libc++"; 335 | CLANG_ENABLE_MODULES = YES; 336 | CLANG_ENABLE_OBJC_ARC = YES; 337 | CLANG_WARN_BOOL_CONVERSION = YES; 338 | CLANG_WARN_CONSTANT_CONVERSION = YES; 339 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 340 | CLANG_WARN_EMPTY_BODY = YES; 341 | CLANG_WARN_ENUM_CONVERSION = YES; 342 | CLANG_WARN_INT_CONVERSION = YES; 343 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 344 | CLANG_WARN_UNREACHABLE_CODE = YES; 345 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 346 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 347 | COPY_PHASE_STRIP = NO; 348 | ENABLE_STRICT_OBJC_MSGSEND = YES; 349 | GCC_C_LANGUAGE_STANDARD = gnu99; 350 | GCC_DYNAMIC_NO_PIC = NO; 351 | GCC_OPTIMIZATION_LEVEL = 0; 352 | GCC_PREPROCESSOR_DEFINITIONS = ( 353 | "DEBUG=1", 354 | "$(inherited)", 355 | ); 356 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 357 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 358 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 359 | GCC_WARN_UNDECLARED_SELECTOR = YES; 360 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 361 | GCC_WARN_UNUSED_FUNCTION = YES; 362 | GCC_WARN_UNUSED_VARIABLE = YES; 363 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 364 | MTL_ENABLE_DEBUG_INFO = YES; 365 | ONLY_ACTIVE_ARCH = YES; 366 | SDKROOT = iphoneos; 367 | TARGETED_DEVICE_FAMILY = "1,2"; 368 | }; 369 | name = Debug; 370 | }; 371 | CD60F7E61A3074480008CE86 /* Release */ = { 372 | isa = XCBuildConfiguration; 373 | buildSettings = { 374 | ALWAYS_SEARCH_USER_PATHS = NO; 375 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 376 | CLANG_CXX_LIBRARY = "libc++"; 377 | CLANG_ENABLE_MODULES = YES; 378 | CLANG_ENABLE_OBJC_ARC = YES; 379 | CLANG_WARN_BOOL_CONVERSION = YES; 380 | CLANG_WARN_CONSTANT_CONVERSION = YES; 381 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 382 | CLANG_WARN_EMPTY_BODY = YES; 383 | CLANG_WARN_ENUM_CONVERSION = YES; 384 | CLANG_WARN_INT_CONVERSION = YES; 385 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 386 | CLANG_WARN_UNREACHABLE_CODE = YES; 387 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 388 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 389 | COPY_PHASE_STRIP = YES; 390 | ENABLE_NS_ASSERTIONS = NO; 391 | ENABLE_STRICT_OBJC_MSGSEND = YES; 392 | GCC_C_LANGUAGE_STANDARD = gnu99; 393 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 394 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 395 | GCC_WARN_UNDECLARED_SELECTOR = YES; 396 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 397 | GCC_WARN_UNUSED_FUNCTION = YES; 398 | GCC_WARN_UNUSED_VARIABLE = YES; 399 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 400 | MTL_ENABLE_DEBUG_INFO = NO; 401 | SDKROOT = iphoneos; 402 | TARGETED_DEVICE_FAMILY = "1,2"; 403 | VALIDATE_PRODUCT = YES; 404 | }; 405 | name = Release; 406 | }; 407 | CD60F7E81A3074480008CE86 /* Debug */ = { 408 | isa = XCBuildConfiguration; 409 | baseConfigurationReference = D5E067962E12F61E22AD46CB /* Pods-SpatialDBKitExample.debug.xcconfig */; 410 | buildSettings = { 411 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 412 | INFOPLIST_FILE = SpatialDBKitExample/Info.plist; 413 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 414 | PRODUCT_NAME = "$(TARGET_NAME)"; 415 | }; 416 | name = Debug; 417 | }; 418 | CD60F7E91A3074480008CE86 /* Release */ = { 419 | isa = XCBuildConfiguration; 420 | baseConfigurationReference = 95B43353F47D25573FE22E46 /* Pods-SpatialDBKitExample.release.xcconfig */; 421 | buildSettings = { 422 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 423 | INFOPLIST_FILE = SpatialDBKitExample/Info.plist; 424 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 425 | PRODUCT_NAME = "$(TARGET_NAME)"; 426 | }; 427 | name = Release; 428 | }; 429 | CD60F7EB1A3074480008CE86 /* Debug */ = { 430 | isa = XCBuildConfiguration; 431 | buildSettings = { 432 | BUNDLE_LOADER = "$(TEST_HOST)"; 433 | FRAMEWORK_SEARCH_PATHS = ( 434 | "$(SDKROOT)/Developer/Library/Frameworks", 435 | "$(inherited)", 436 | ); 437 | GCC_PREPROCESSOR_DEFINITIONS = ( 438 | "DEBUG=1", 439 | "$(inherited)", 440 | ); 441 | INFOPLIST_FILE = SpatialDBKitExampleTests/Info.plist; 442 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SpatialDBKitExample.app/SpatialDBKitExample"; 445 | }; 446 | name = Debug; 447 | }; 448 | CD60F7EC1A3074480008CE86 /* Release */ = { 449 | isa = XCBuildConfiguration; 450 | buildSettings = { 451 | BUNDLE_LOADER = "$(TEST_HOST)"; 452 | FRAMEWORK_SEARCH_PATHS = ( 453 | "$(SDKROOT)/Developer/Library/Frameworks", 454 | "$(inherited)", 455 | ); 456 | INFOPLIST_FILE = SpatialDBKitExampleTests/Info.plist; 457 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SpatialDBKitExample.app/SpatialDBKitExample"; 460 | }; 461 | name = Release; 462 | }; 463 | /* End XCBuildConfiguration section */ 464 | 465 | /* Begin XCConfigurationList section */ 466 | CD60F7BF1A3074480008CE86 /* Build configuration list for PBXProject "SpatialDBKitExample" */ = { 467 | isa = XCConfigurationList; 468 | buildConfigurations = ( 469 | CD60F7E51A3074480008CE86 /* Debug */, 470 | CD60F7E61A3074480008CE86 /* Release */, 471 | ); 472 | defaultConfigurationIsVisible = 0; 473 | defaultConfigurationName = Release; 474 | }; 475 | CD60F7E71A3074480008CE86 /* Build configuration list for PBXNativeTarget "SpatialDBKitExample" */ = { 476 | isa = XCConfigurationList; 477 | buildConfigurations = ( 478 | CD60F7E81A3074480008CE86 /* Debug */, 479 | CD60F7E91A3074480008CE86 /* Release */, 480 | ); 481 | defaultConfigurationIsVisible = 0; 482 | defaultConfigurationName = Release; 483 | }; 484 | CD60F7EA1A3074480008CE86 /* Build configuration list for PBXNativeTarget "SpatialDBKitExampleTests" */ = { 485 | isa = XCConfigurationList; 486 | buildConfigurations = ( 487 | CD60F7EB1A3074480008CE86 /* Debug */, 488 | CD60F7EC1A3074480008CE86 /* Release */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | defaultConfigurationName = Release; 492 | }; 493 | /* End XCConfigurationList section */ 494 | }; 495 | rootObject = CD60F7BC1A3074480008CE86 /* Project object */; 496 | } 497 | -------------------------------------------------------------------------------- /SpatialDBKitExample/SpatialDBKitExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SpatialDBKitExample 4 | // 5 | // Created by Andrea Cremaschi on 04/12/14. 6 | // Copyright (c) 2014 acremaschi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /SpatialDBKitExample/SpatialDBKitExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SpatialDBKitExample 4 | // 5 | // Created by Andrea Cremaschi on 04/12/14. 6 | // Copyright (c) 2014 acremaschi. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import 12 | 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 21 | 22 | NSString *sqliteVersion = [SpatialDatabase sqliteLibVersion]; 23 | NSLog(@"sqlite version: %@", sqliteVersion); 24 | 25 | NSString *spatialiteVersion = [SpatialDatabase spatialiteLibVersion]; 26 | NSLog(@"spatialite version: %@", spatialiteVersion); 27 | 28 | // test spatialite AsText function -> ShapeKit object import 29 | SpatialDatabase *db = [SpatialDatabase databaseWithPath: [[NSBundle mainBundle] pathForResource:@"Assets/test-2.3" ofType:@"sqlite"]] ; 30 | [db open]; 31 | FMResultSet *rs = [db executeQuery:@"select AsText(geometry) AS text FROM Regions WHERE PK_UID = 106"]; 32 | while ([rs next]) 33 | { 34 | id object = [rs resultDictionary]; 35 | 36 | NSLog(@"%@", object); 37 | } 38 | 39 | // test spatialite fetch function -> ShapeKit WKB object import 40 | SpatialDatabase *db3 = [SpatialDatabase databaseWithPath: [[NSBundle mainBundle] pathForResource:@"Assets/test-2.3" ofType:@"sqlite"]] ; 41 | [db3 open]; 42 | FMResultSet *rs3 = [db executeQuery:@"select geometry FROM Regions WHERE PK_UID = 106"]; 43 | ShapeKitGeometry* geom = nil; 44 | while ([rs3 next]) 45 | { 46 | NSDictionary * object = [rs3 resultDictionary]; 47 | if ((!geom) && ([object objectForKey:@"geometry"])) 48 | geom=[object objectForKey:@"geometry"]; // get the route geom for future use 49 | 50 | NSLog(@"%@", object); 51 | } 52 | 53 | // test ShapeKit topology functions 54 | NSLog(@"Route boundary: %@", geom.boundary); 55 | NSLog(@"Route cascaded union : %@", [(ShapeKitMultiPolygon *)geom cascadedUnion]); 56 | 57 | // test VirtualNetwork module for Dijkstra-based routing 58 | SpatialDatabase *db2 = [SpatialDatabase databaseWithPath: [[NSBundle mainBundle] pathForResource:@"Assets/test-network-2.3" ofType:@"sqlite"]] ; 59 | [db2 open]; 60 | FMResultSet *rs2 = [db2 executeQuery:@"SELECT * AS WKT_geometry \ 61 | FROM Roads_net \ 62 | WHERE NodeFrom = 1 AND NodeTo = 512;"]; 63 | while ([rs2 next]) 64 | { 65 | id object = [rs2 resultDictionary]; 66 | 67 | NSLog(@"%@", object); 68 | } 69 | 70 | return YES; 71 | } 72 | 73 | - (void)applicationWillResignActive:(UIApplication *)application { 74 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 75 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 76 | } 77 | 78 | - (void)applicationDidEnterBackground:(UIApplication *)application { 79 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 80 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 81 | } 82 | 83 | - (void)applicationWillEnterForeground:(UIApplication *)application { 84 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 85 | } 86 | 87 | - (void)applicationDidBecomeActive:(UIApplication *)application { 88 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 89 | } 90 | 91 | - (void)applicationWillTerminate:(UIApplication *)application { 92 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 93 | } 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /SpatialDBKitExample/SpatialDBKitExample/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /SpatialDBKitExample/SpatialDBKitExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /SpatialDBKitExample/SpatialDBKitExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /SpatialDBKitExample/SpatialDBKitExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | it.acremaschi.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /SpatialDBKitExample/SpatialDBKitExample/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SpatialDBKitExample 4 | // 5 | // Created by Andrea Cremaschi on 04/12/14. 6 | // Copyright (c) 2014 acremaschi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /SpatialDBKitExample/SpatialDBKitExample/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // SpatialDBKitExample 4 | // 5 | // Created by Andrea Cremaschi on 04/12/14. 6 | // Copyright (c) 2014 acremaschi. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /SpatialDBKitExample/SpatialDBKitExample/main.mm: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SpatialDBKitExample 4 | // 5 | // Created by Andrea Cremaschi on 04/12/14. 6 | // Copyright (c) 2014 acremaschi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SpatialDBKitExample/SpatialDBKitExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | it.acremaschi.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /SpatialDBKitExample/SpatialDBKitExampleTests/SpatialDBKitExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // SpatialDBKitExampleTests.m 3 | // SpatialDBKitExampleTests 4 | // 5 | // Created by Andrea Cremaschi on 04/12/14. 6 | // Copyright (c) 2014 acremaschi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface SpatialDBKitExampleTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation SpatialDBKitExampleTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | --------------------------------------------------------------------------------