├── OfflineTilesProof.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── scottdavis.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ └── scottdavis.xcuserdatad │ ├── xcdebugger │ └── Breakpoints.xcbkptlist │ └── xcschemes │ ├── OfflineTilesProof.xcscheme │ └── xcschememanagement.plist ├── OfflineTilesProof ├── Classes │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── MainViewController.h │ ├── MainViewController.m │ └── MainViewController.xib ├── Cordova.plist ├── NSData+Base64.h ├── NSData+Base64.m ├── OfflineTilesProof-Info.plist ├── OfflineTilesProof-Prefix.pch ├── Plugins │ └── README ├── Resources │ ├── Capture.bundle │ │ ├── controls_bg.png │ │ ├── controls_bg@2x.png │ │ ├── controls_bg~ipad.png │ │ ├── microphone.png │ │ ├── microphone@2x.png │ │ ├── microphone~ipad.png │ │ ├── record_button.png │ │ ├── record_button@2x.png │ │ ├── record_button~ipad.png │ │ ├── recording_bg.png │ │ ├── recording_bg@2x.png │ │ ├── recording_bg~ipad.png │ │ ├── stop_button.png │ │ ├── stop_button@2x.png │ │ └── stop_button~ipad.png │ ├── de.lproj │ │ └── Localizable.strings │ ├── en.lproj │ │ └── Localizable.strings │ ├── es.lproj │ │ └── Localizable.strings │ ├── icons │ │ ├── icon-72.png │ │ ├── icon.png │ │ └── icon@2x.png │ ├── road-trip.sqlite3 │ ├── se.lproj │ │ └── Localizable.strings │ └── splash │ │ ├── Default.png │ │ └── Default@2x.png ├── SQLitePlugin.h ├── SQLitePlugin.m ├── en.lproj │ └── InfoPlist.strings ├── main.m └── verify.sh └── www ├── cordova-1.5.0.js ├── css └── core.css ├── index.html ├── js ├── TileLayer.MBTiles.js ├── core.js └── sqlite_plugin.js └── libs ├── images ├── layers.png ├── marker-shadow.png ├── marker.png ├── popup-close.png ├── zoom-in.png └── zoom-out.png ├── leaflet.css └── leaflet.js /OfflineTilesProof.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 36169491152BDA18007ECED4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 36169490152BDA18007ECED4 /* Foundation.framework */; }; 11 | 36169493152BDA18007ECED4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 36169492152BDA18007ECED4 /* UIKit.framework */; }; 12 | 36169495152BDA18007ECED4 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 36169494152BDA18007ECED4 /* CoreGraphics.framework */; }; 13 | 36169497152BDA18007ECED4 /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 36169496152BDA18007ECED4 /* AddressBook.framework */; }; 14 | 36169499152BDA18007ECED4 /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 36169498152BDA18007ECED4 /* AddressBookUI.framework */; }; 15 | 3616949B152BDA18007ECED4 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3616949A152BDA18007ECED4 /* AudioToolbox.framework */; }; 16 | 3616949D152BDA18007ECED4 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3616949C152BDA18007ECED4 /* AVFoundation.framework */; }; 17 | 3616949F152BDA18007ECED4 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3616949E152BDA18007ECED4 /* CoreLocation.framework */; }; 18 | 361694A1152BDA18007ECED4 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 361694A0152BDA18007ECED4 /* MediaPlayer.framework */; }; 19 | 361694A3152BDA18007ECED4 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 361694A2152BDA18007ECED4 /* QuartzCore.framework */; }; 20 | 361694A5152BDA18007ECED4 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 361694A4152BDA18007ECED4 /* SystemConfiguration.framework */; }; 21 | 361694A7152BDA18007ECED4 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 361694A6152BDA18007ECED4 /* MobileCoreServices.framework */; }; 22 | 361694A9152BDA18007ECED4 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 361694A8152BDA18007ECED4 /* CoreMedia.framework */; }; 23 | 361694AF152BDA18007ECED4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 361694AD152BDA18007ECED4 /* InfoPlist.strings */; }; 24 | 361694B1152BDA18007ECED4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 361694B0152BDA18007ECED4 /* main.m */; }; 25 | 361694B4152BDA18007ECED4 /* Cordova.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 361694B3152BDA18007ECED4 /* Cordova.framework */; }; 26 | 361694B9152BDA18007ECED4 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 361694B7152BDA18007ECED4 /* Localizable.strings */; }; 27 | 361694BD152BDA18007ECED4 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 361694BB152BDA18007ECED4 /* Localizable.strings */; }; 28 | 361694C1152BDA18007ECED4 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 361694BF152BDA18007ECED4 /* Localizable.strings */; }; 29 | 361694C5152BDA18007ECED4 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 361694C3152BDA18007ECED4 /* Localizable.strings */; }; 30 | 361694C8152BDA18007ECED4 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 361694C7152BDA18007ECED4 /* icon.png */; }; 31 | 361694CA152BDA18007ECED4 /* icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 361694C9152BDA18007ECED4 /* icon@2x.png */; }; 32 | 361694CC152BDA18007ECED4 /* icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 361694CB152BDA18007ECED4 /* icon-72.png */; }; 33 | 361694CF152BDA18007ECED4 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 361694CE152BDA18007ECED4 /* Default.png */; }; 34 | 361694D1152BDA18007ECED4 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 361694D0152BDA18007ECED4 /* Default@2x.png */; }; 35 | 361694D3152BDA18007ECED4 /* Capture.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 361694D2152BDA18007ECED4 /* Capture.bundle */; }; 36 | 361694D5152BDA18007ECED4 /* Cordova.plist in Resources */ = {isa = PBXBuildFile; fileRef = 361694D4152BDA18007ECED4 /* Cordova.plist */; }; 37 | 361694D9152BDA18007ECED4 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 361694D8152BDA18007ECED4 /* AppDelegate.m */; }; 38 | 361694DC152BDA18007ECED4 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 361694DB152BDA18007ECED4 /* MainViewController.m */; }; 39 | 361694DE152BDA18007ECED4 /* MainViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 361694DD152BDA18007ECED4 /* MainViewController.xib */; }; 40 | 361694E2152BDA18007ECED4 /* verify.sh in Resources */ = {isa = PBXBuildFile; fileRef = 361694E1152BDA18007ECED4 /* verify.sh */; }; 41 | 361694E9152BDABB007ECED4 /* www in Resources */ = {isa = PBXBuildFile; fileRef = 361694E8152BDABB007ECED4 /* www */; }; 42 | 362BEB9D15300DA8003729E9 /* NSData+Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 362BEB9C15300DA8003729E9 /* NSData+Base64.m */; }; 43 | 36519D83152BFE4300AD09A8 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 36519D82152BFE4300AD09A8 /* libsqlite3.dylib */; }; 44 | 36519D87152BFE9700AD09A8 /* SQLitePlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 36519D86152BFE9700AD09A8 /* SQLitePlugin.m */; }; 45 | /* End PBXBuildFile section */ 46 | 47 | /* Begin PBXFileReference section */ 48 | 3616948C152BDA18007ECED4 /* OfflineTilesProof.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OfflineTilesProof.app; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 36169490152BDA18007ECED4 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 50 | 36169492152BDA18007ECED4 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 51 | 36169494152BDA18007ECED4 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 52 | 36169496152BDA18007ECED4 /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; }; 53 | 36169498152BDA18007ECED4 /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; }; 54 | 3616949A152BDA18007ECED4 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 55 | 3616949C152BDA18007ECED4 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 56 | 3616949E152BDA18007ECED4 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; 57 | 361694A0152BDA18007ECED4 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; }; 58 | 361694A2152BDA18007ECED4 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 59 | 361694A4152BDA18007ECED4 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 60 | 361694A6152BDA18007ECED4 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; 61 | 361694A8152BDA18007ECED4 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 62 | 361694AC152BDA18007ECED4 /* OfflineTilesProof-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "OfflineTilesProof-Info.plist"; sourceTree = ""; }; 63 | 361694AE152BDA18007ECED4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 64 | 361694B0152BDA18007ECED4 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 65 | 361694B2152BDA18007ECED4 /* OfflineTilesProof-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "OfflineTilesProof-Prefix.pch"; sourceTree = ""; }; 66 | 361694B3152BDA18007ECED4 /* Cordova.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cordova.framework; path = /Users/Shared/Cordova/Frameworks/Cordova.framework; sourceTree = ""; }; 67 | 361694B8152BDA18007ECED4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Resources/en.lproj/Localizable.strings; sourceTree = ""; }; 68 | 361694BC152BDA18007ECED4 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = Resources/es.lproj/Localizable.strings; sourceTree = ""; }; 69 | 361694C0152BDA18007ECED4 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = Resources/de.lproj/Localizable.strings; sourceTree = ""; }; 70 | 361694C4152BDA18007ECED4 /* se */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = se; path = Resources/se.lproj/Localizable.strings; sourceTree = ""; }; 71 | 361694C7152BDA18007ECED4 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = icon.png; path = Resources/icons/icon.png; sourceTree = ""; }; 72 | 361694C9152BDA18007ECED4 /* icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "icon@2x.png"; path = "Resources/icons/icon@2x.png"; sourceTree = ""; }; 73 | 361694CB152BDA18007ECED4 /* icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "icon-72.png"; path = "Resources/icons/icon-72.png"; sourceTree = ""; }; 74 | 361694CE152BDA18007ECED4 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = Resources/splash/Default.png; sourceTree = ""; }; 75 | 361694D0152BDA18007ECED4 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default@2x.png"; path = "Resources/splash/Default@2x.png"; sourceTree = ""; }; 76 | 361694D2152BDA18007ECED4 /* Capture.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = Capture.bundle; path = Resources/Capture.bundle; sourceTree = ""; }; 77 | 361694D4152BDA18007ECED4 /* Cordova.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Cordova.plist; sourceTree = ""; }; 78 | 361694D7152BDA18007ECED4 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Classes/AppDelegate.h; sourceTree = ""; }; 79 | 361694D8152BDA18007ECED4 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Classes/AppDelegate.m; sourceTree = ""; }; 80 | 361694DA152BDA18007ECED4 /* MainViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MainViewController.h; path = Classes/MainViewController.h; sourceTree = ""; }; 81 | 361694DB152BDA18007ECED4 /* MainViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = MainViewController.m; path = Classes/MainViewController.m; sourceTree = ""; }; 82 | 361694DD152BDA18007ECED4 /* MainViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MainViewController.xib; path = Classes/MainViewController.xib; sourceTree = ""; }; 83 | 361694E0152BDA18007ECED4 /* README */ = {isa = PBXFileReference; lastKnownFileType = text; name = README; path = Plugins/README; sourceTree = ""; }; 84 | 361694E1152BDA18007ECED4 /* verify.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = verify.sh; sourceTree = ""; }; 85 | 361694E8152BDABB007ECED4 /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; path = www; sourceTree = ""; }; 86 | 362BEB9C15300DA8003729E9 /* NSData+Base64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+Base64.m"; sourceTree = ""; }; 87 | 362BEB9E15300DE2003729E9 /* NSData+Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+Base64.h"; sourceTree = ""; }; 88 | 36519D82152BFE4300AD09A8 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; }; 89 | 36519D85152BFE9700AD09A8 /* SQLitePlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLitePlugin.h; sourceTree = ""; }; 90 | 36519D86152BFE9700AD09A8 /* SQLitePlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SQLitePlugin.m; sourceTree = ""; }; 91 | /* End PBXFileReference section */ 92 | 93 | /* Begin PBXFrameworksBuildPhase section */ 94 | 36169486152BDA18007ECED4 /* Frameworks */ = { 95 | isa = PBXFrameworksBuildPhase; 96 | buildActionMask = 2147483647; 97 | files = ( 98 | 36519D83152BFE4300AD09A8 /* libsqlite3.dylib in Frameworks */, 99 | 36169491152BDA18007ECED4 /* Foundation.framework in Frameworks */, 100 | 36169493152BDA18007ECED4 /* UIKit.framework in Frameworks */, 101 | 36169495152BDA18007ECED4 /* CoreGraphics.framework in Frameworks */, 102 | 36169497152BDA18007ECED4 /* AddressBook.framework in Frameworks */, 103 | 36169499152BDA18007ECED4 /* AddressBookUI.framework in Frameworks */, 104 | 3616949B152BDA18007ECED4 /* AudioToolbox.framework in Frameworks */, 105 | 3616949D152BDA18007ECED4 /* AVFoundation.framework in Frameworks */, 106 | 3616949F152BDA18007ECED4 /* CoreLocation.framework in Frameworks */, 107 | 361694A1152BDA18007ECED4 /* MediaPlayer.framework in Frameworks */, 108 | 361694A3152BDA18007ECED4 /* QuartzCore.framework in Frameworks */, 109 | 361694A5152BDA18007ECED4 /* SystemConfiguration.framework in Frameworks */, 110 | 361694A7152BDA18007ECED4 /* MobileCoreServices.framework in Frameworks */, 111 | 361694A9152BDA18007ECED4 /* CoreMedia.framework in Frameworks */, 112 | 361694B4152BDA18007ECED4 /* Cordova.framework in Frameworks */, 113 | ); 114 | runOnlyForDeploymentPostprocessing = 0; 115 | }; 116 | 36169489152BDA18007ECED4 /* Frameworks */ = { 117 | isa = PBXFrameworksBuildPhase; 118 | buildActionMask = 2147483647; 119 | files = ( 120 | ); 121 | runOnlyForDeploymentPostprocessing = 0; 122 | }; 123 | /* End PBXFrameworksBuildPhase section */ 124 | 125 | /* Begin PBXGroup section */ 126 | 3616947E152BDA18007ECED4 = { 127 | isa = PBXGroup; 128 | children = ( 129 | 36519D82152BFE4300AD09A8 /* libsqlite3.dylib */, 130 | 361694E8152BDABB007ECED4 /* www */, 131 | 361694AA152BDA18007ECED4 /* OfflineTilesProof */, 132 | 3616948F152BDA18007ECED4 /* Frameworks */, 133 | 3616948D152BDA18007ECED4 /* Products */, 134 | ); 135 | sourceTree = ""; 136 | }; 137 | 3616948D152BDA18007ECED4 /* Products */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 3616948C152BDA18007ECED4 /* OfflineTilesProof.app */, 141 | ); 142 | name = Products; 143 | sourceTree = ""; 144 | }; 145 | 3616948F152BDA18007ECED4 /* Frameworks */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | 36169490152BDA18007ECED4 /* Foundation.framework */, 149 | 36169492152BDA18007ECED4 /* UIKit.framework */, 150 | 36169494152BDA18007ECED4 /* CoreGraphics.framework */, 151 | 36169496152BDA18007ECED4 /* AddressBook.framework */, 152 | 36169498152BDA18007ECED4 /* AddressBookUI.framework */, 153 | 3616949A152BDA18007ECED4 /* AudioToolbox.framework */, 154 | 3616949C152BDA18007ECED4 /* AVFoundation.framework */, 155 | 3616949E152BDA18007ECED4 /* CoreLocation.framework */, 156 | 361694A0152BDA18007ECED4 /* MediaPlayer.framework */, 157 | 361694A2152BDA18007ECED4 /* QuartzCore.framework */, 158 | 361694A4152BDA18007ECED4 /* SystemConfiguration.framework */, 159 | 361694A6152BDA18007ECED4 /* MobileCoreServices.framework */, 160 | 361694A8152BDA18007ECED4 /* CoreMedia.framework */, 161 | ); 162 | name = Frameworks; 163 | sourceTree = ""; 164 | }; 165 | 361694AA152BDA18007ECED4 /* OfflineTilesProof */ = { 166 | isa = PBXGroup; 167 | children = ( 168 | 361694B3152BDA18007ECED4 /* Cordova.framework */, 169 | 361694B5152BDA18007ECED4 /* Resources */, 170 | 361694D6152BDA18007ECED4 /* Classes */, 171 | 361694DF152BDA18007ECED4 /* Plugins */, 172 | 361694AB152BDA18007ECED4 /* Supporting Files */, 173 | ); 174 | path = OfflineTilesProof; 175 | sourceTree = ""; 176 | }; 177 | 361694AB152BDA18007ECED4 /* Supporting Files */ = { 178 | isa = PBXGroup; 179 | children = ( 180 | 361694AC152BDA18007ECED4 /* OfflineTilesProof-Info.plist */, 181 | 361694AD152BDA18007ECED4 /* InfoPlist.strings */, 182 | 361694B0152BDA18007ECED4 /* main.m */, 183 | 361694B2152BDA18007ECED4 /* OfflineTilesProof-Prefix.pch */, 184 | 361694D4152BDA18007ECED4 /* Cordova.plist */, 185 | 361694DD152BDA18007ECED4 /* MainViewController.xib */, 186 | 361694E1152BDA18007ECED4 /* verify.sh */, 187 | ); 188 | name = "Supporting Files"; 189 | sourceTree = ""; 190 | }; 191 | 361694B5152BDA18007ECED4 /* Resources */ = { 192 | isa = PBXGroup; 193 | children = ( 194 | 361694D2152BDA18007ECED4 /* Capture.bundle */, 195 | 361694B6152BDA18007ECED4 /* en.lproj */, 196 | 361694BA152BDA18007ECED4 /* es.lproj */, 197 | 361694BE152BDA18007ECED4 /* de.lproj */, 198 | 361694C2152BDA18007ECED4 /* se.lproj */, 199 | 361694C6152BDA18007ECED4 /* icons */, 200 | 361694CD152BDA18007ECED4 /* splash */, 201 | ); 202 | name = Resources; 203 | sourceTree = ""; 204 | }; 205 | 361694B6152BDA18007ECED4 /* en.lproj */ = { 206 | isa = PBXGroup; 207 | children = ( 208 | 361694B7152BDA18007ECED4 /* Localizable.strings */, 209 | ); 210 | name = en.lproj; 211 | sourceTree = ""; 212 | }; 213 | 361694BA152BDA18007ECED4 /* es.lproj */ = { 214 | isa = PBXGroup; 215 | children = ( 216 | 361694BB152BDA18007ECED4 /* Localizable.strings */, 217 | ); 218 | name = es.lproj; 219 | sourceTree = ""; 220 | }; 221 | 361694BE152BDA18007ECED4 /* de.lproj */ = { 222 | isa = PBXGroup; 223 | children = ( 224 | 361694BF152BDA18007ECED4 /* Localizable.strings */, 225 | ); 226 | name = de.lproj; 227 | sourceTree = ""; 228 | }; 229 | 361694C2152BDA18007ECED4 /* se.lproj */ = { 230 | isa = PBXGroup; 231 | children = ( 232 | 361694C3152BDA18007ECED4 /* Localizable.strings */, 233 | ); 234 | name = se.lproj; 235 | sourceTree = ""; 236 | }; 237 | 361694C6152BDA18007ECED4 /* icons */ = { 238 | isa = PBXGroup; 239 | children = ( 240 | 361694C7152BDA18007ECED4 /* icon.png */, 241 | 361694C9152BDA18007ECED4 /* icon@2x.png */, 242 | 361694CB152BDA18007ECED4 /* icon-72.png */, 243 | ); 244 | name = icons; 245 | sourceTree = ""; 246 | }; 247 | 361694CD152BDA18007ECED4 /* splash */ = { 248 | isa = PBXGroup; 249 | children = ( 250 | 361694CE152BDA18007ECED4 /* Default.png */, 251 | 361694D0152BDA18007ECED4 /* Default@2x.png */, 252 | ); 253 | name = splash; 254 | sourceTree = ""; 255 | }; 256 | 361694D6152BDA18007ECED4 /* Classes */ = { 257 | isa = PBXGroup; 258 | children = ( 259 | 361694D7152BDA18007ECED4 /* AppDelegate.h */, 260 | 361694D8152BDA18007ECED4 /* AppDelegate.m */, 261 | 361694DA152BDA18007ECED4 /* MainViewController.h */, 262 | 361694DB152BDA18007ECED4 /* MainViewController.m */, 263 | ); 264 | name = Classes; 265 | sourceTree = ""; 266 | }; 267 | 361694DF152BDA18007ECED4 /* Plugins */ = { 268 | isa = PBXGroup; 269 | children = ( 270 | 36519D85152BFE9700AD09A8 /* SQLitePlugin.h */, 271 | 36519D86152BFE9700AD09A8 /* SQLitePlugin.m */, 272 | 361694E0152BDA18007ECED4 /* README */, 273 | 362BEB9C15300DA8003729E9 /* NSData+Base64.m */, 274 | 362BEB9E15300DE2003729E9 /* NSData+Base64.h */, 275 | ); 276 | name = Plugins; 277 | sourceTree = ""; 278 | }; 279 | /* End PBXGroup section */ 280 | 281 | /* Begin PBXNativeTarget section */ 282 | 3616948B152BDA18007ECED4 /* OfflineTilesProof */ = { 283 | isa = PBXNativeTarget; 284 | buildConfigurationList = 361694E5152BDA18007ECED4 /* Build configuration list for PBXNativeTarget "OfflineTilesProof" */; 285 | buildPhases = ( 286 | 36169485152BDA18007ECED4 /* Sources */, 287 | 36169486152BDA18007ECED4 /* Frameworks */, 288 | 36169487152BDA18007ECED4 /* Resources */, 289 | 36169488152BDA18007ECED4 /* Sources */, 290 | 36169489152BDA18007ECED4 /* Frameworks */, 291 | 3616948A152BDA18007ECED4 /* ShellScript */, 292 | ); 293 | buildRules = ( 294 | ); 295 | dependencies = ( 296 | ); 297 | name = OfflineTilesProof; 298 | productName = OfflineTilesProof; 299 | productReference = 3616948C152BDA18007ECED4 /* OfflineTilesProof.app */; 300 | productType = "com.apple.product-type.application"; 301 | }; 302 | /* End PBXNativeTarget section */ 303 | 304 | /* Begin PBXProject section */ 305 | 36169480152BDA18007ECED4 /* Project object */ = { 306 | isa = PBXProject; 307 | attributes = { 308 | LastUpgradeCheck = 0430; 309 | ORGANIZATIONNAME = "Sandy City Public Works"; 310 | }; 311 | buildConfigurationList = 36169483152BDA18007ECED4 /* Build configuration list for PBXProject "OfflineTilesProof" */; 312 | compatibilityVersion = "Xcode 3.2"; 313 | developmentRegion = English; 314 | hasScannedForEncodings = 0; 315 | knownRegions = ( 316 | en, 317 | es, 318 | de, 319 | se, 320 | ); 321 | mainGroup = 3616947E152BDA18007ECED4; 322 | productRefGroup = 3616948D152BDA18007ECED4 /* Products */; 323 | projectDirPath = ""; 324 | projectRoot = ""; 325 | targets = ( 326 | 3616948B152BDA18007ECED4 /* OfflineTilesProof */, 327 | ); 328 | }; 329 | /* End PBXProject section */ 330 | 331 | /* Begin PBXResourcesBuildPhase section */ 332 | 36169487152BDA18007ECED4 /* Resources */ = { 333 | isa = PBXResourcesBuildPhase; 334 | buildActionMask = 2147483647; 335 | files = ( 336 | 361694AF152BDA18007ECED4 /* InfoPlist.strings in Resources */, 337 | 361694B9152BDA18007ECED4 /* Localizable.strings in Resources */, 338 | 361694BD152BDA18007ECED4 /* Localizable.strings in Resources */, 339 | 361694C1152BDA18007ECED4 /* Localizable.strings in Resources */, 340 | 361694C5152BDA18007ECED4 /* Localizable.strings in Resources */, 341 | 361694C8152BDA18007ECED4 /* icon.png in Resources */, 342 | 361694CA152BDA18007ECED4 /* icon@2x.png in Resources */, 343 | 361694CC152BDA18007ECED4 /* icon-72.png in Resources */, 344 | 361694CF152BDA18007ECED4 /* Default.png in Resources */, 345 | 361694D1152BDA18007ECED4 /* Default@2x.png in Resources */, 346 | 361694D3152BDA18007ECED4 /* Capture.bundle in Resources */, 347 | 361694D5152BDA18007ECED4 /* Cordova.plist in Resources */, 348 | 361694DE152BDA18007ECED4 /* MainViewController.xib in Resources */, 349 | 361694E2152BDA18007ECED4 /* verify.sh in Resources */, 350 | 361694E9152BDABB007ECED4 /* www in Resources */, 351 | ); 352 | runOnlyForDeploymentPostprocessing = 0; 353 | }; 354 | /* End PBXResourcesBuildPhase section */ 355 | 356 | /* Begin PBXShellScriptBuildPhase section */ 357 | 3616948A152BDA18007ECED4 /* ShellScript */ = { 358 | isa = PBXShellScriptBuildPhase; 359 | buildActionMask = 2147483647; 360 | files = ( 361 | ); 362 | inputPaths = ( 363 | ); 364 | outputPaths = ( 365 | ); 366 | runOnlyForDeploymentPostprocessing = 0; 367 | shellPath = /bin/bash; 368 | shellScript = "\n\t\t\t\t\t\t\t\tchmod 755 $PROJECT_DIR/$PROJECT_NAME/verify.sh\n\t\t\t\t\t\t\t\t$PROJECT_DIR/$PROJECT_NAME/verify.sh\n\t\t\t\t\t"; 369 | }; 370 | /* End PBXShellScriptBuildPhase section */ 371 | 372 | /* Begin PBXSourcesBuildPhase section */ 373 | 36169485152BDA18007ECED4 /* Sources */ = { 374 | isa = PBXSourcesBuildPhase; 375 | buildActionMask = 2147483647; 376 | files = ( 377 | 361694B1152BDA18007ECED4 /* main.m in Sources */, 378 | 361694D9152BDA18007ECED4 /* AppDelegate.m in Sources */, 379 | 361694DC152BDA18007ECED4 /* MainViewController.m in Sources */, 380 | 36519D87152BFE9700AD09A8 /* SQLitePlugin.m in Sources */, 381 | 362BEB9D15300DA8003729E9 /* NSData+Base64.m in Sources */, 382 | ); 383 | runOnlyForDeploymentPostprocessing = 0; 384 | }; 385 | 36169488152BDA18007ECED4 /* Sources */ = { 386 | isa = PBXSourcesBuildPhase; 387 | buildActionMask = 2147483647; 388 | files = ( 389 | ); 390 | runOnlyForDeploymentPostprocessing = 0; 391 | }; 392 | /* End PBXSourcesBuildPhase section */ 393 | 394 | /* Begin PBXVariantGroup section */ 395 | 361694AD152BDA18007ECED4 /* InfoPlist.strings */ = { 396 | isa = PBXVariantGroup; 397 | children = ( 398 | 361694AE152BDA18007ECED4 /* en */, 399 | ); 400 | name = InfoPlist.strings; 401 | sourceTree = ""; 402 | }; 403 | 361694B7152BDA18007ECED4 /* Localizable.strings */ = { 404 | isa = PBXVariantGroup; 405 | children = ( 406 | 361694B8152BDA18007ECED4 /* en */, 407 | ); 408 | name = Localizable.strings; 409 | sourceTree = ""; 410 | }; 411 | 361694BB152BDA18007ECED4 /* Localizable.strings */ = { 412 | isa = PBXVariantGroup; 413 | children = ( 414 | 361694BC152BDA18007ECED4 /* es */, 415 | ); 416 | name = Localizable.strings; 417 | sourceTree = ""; 418 | }; 419 | 361694BF152BDA18007ECED4 /* Localizable.strings */ = { 420 | isa = PBXVariantGroup; 421 | children = ( 422 | 361694C0152BDA18007ECED4 /* de */, 423 | ); 424 | name = Localizable.strings; 425 | sourceTree = ""; 426 | }; 427 | 361694C3152BDA18007ECED4 /* Localizable.strings */ = { 428 | isa = PBXVariantGroup; 429 | children = ( 430 | 361694C4152BDA18007ECED4 /* se */, 431 | ); 432 | name = Localizable.strings; 433 | sourceTree = ""; 434 | }; 435 | /* End PBXVariantGroup section */ 436 | 437 | /* Begin XCBuildConfiguration section */ 438 | 361694E3152BDA18007ECED4 /* Debug */ = { 439 | isa = XCBuildConfiguration; 440 | buildSettings = { 441 | ALWAYS_SEARCH_USER_PATHS = NO; 442 | ARCHS = ( 443 | armv6, 444 | armv7, 445 | ); 446 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 447 | COPY_PHASE_STRIP = NO; 448 | GCC_C_LANGUAGE_STANDARD = gnu99; 449 | GCC_DYNAMIC_NO_PIC = NO; 450 | GCC_OPTIMIZATION_LEVEL = 0; 451 | GCC_PREPROCESSOR_DEFINITIONS = ( 452 | "DEBUG=1", 453 | "$(inherited)", 454 | ); 455 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 456 | GCC_THUMB_SUPPORT = NO; 457 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 458 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 459 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 460 | GCC_WARN_UNUSED_VARIABLE = YES; 461 | IPHONEOS_DEPLOYMENT_TARGET = 4.0; 462 | SDKROOT = iphoneos; 463 | }; 464 | name = Debug; 465 | }; 466 | 361694E4152BDA18007ECED4 /* Release */ = { 467 | isa = XCBuildConfiguration; 468 | buildSettings = { 469 | ALWAYS_SEARCH_USER_PATHS = NO; 470 | ARCHS = ( 471 | armv6, 472 | armv7, 473 | ); 474 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 475 | COPY_PHASE_STRIP = YES; 476 | GCC_C_LANGUAGE_STANDARD = gnu99; 477 | GCC_THUMB_SUPPORT = NO; 478 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 479 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 480 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 481 | GCC_WARN_UNUSED_VARIABLE = YES; 482 | IPHONEOS_DEPLOYMENT_TARGET = 4.0; 483 | SDKROOT = iphoneos; 484 | VALIDATE_PRODUCT = YES; 485 | }; 486 | name = Release; 487 | }; 488 | 361694E6152BDA18007ECED4 /* Debug */ = { 489 | isa = XCBuildConfiguration; 490 | buildSettings = { 491 | ALWAYS_SEARCH_USER_PATHS = YES; 492 | COPY_PHASE_STRIP = NO; 493 | FRAMEWORK_SEARCH_PATHS = /Users/Shared/Cordova/Frameworks; 494 | GCC_DYNAMIC_NO_PIC = NO; 495 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 496 | GCC_PREFIX_HEADER = "OfflineTilesProof/OfflineTilesProof-Prefix.pch"; 497 | GCC_PREPROCESSOR_DEFINITIONS = ( 498 | "DEBUG=1,", 499 | "CORDOVA_FRAMEWORK=1", 500 | ); 501 | GCC_THUMB_SUPPORT = NO; 502 | INFOPLIST_FILE = "OfflineTilesProof/OfflineTilesProof-Info.plist"; 503 | OTHER_LDFLAGS = ( 504 | "-weak_framework", 505 | UIKit, 506 | "-weak_framework", 507 | AVFoundation, 508 | "-weak_framework", 509 | CoreMedia, 510 | "-weak_library", 511 | /usr/lib/libSystem.B.dylib, 512 | ); 513 | PRODUCT_NAME = "$(TARGET_NAME)"; 514 | TARGETED_DEVICE_FAMILY = "1,2"; 515 | WRAPPER_EXTENSION = app; 516 | }; 517 | name = Debug; 518 | }; 519 | 361694E7152BDA18007ECED4 /* Release */ = { 520 | isa = XCBuildConfiguration; 521 | buildSettings = { 522 | ALWAYS_SEARCH_USER_PATHS = YES; 523 | COPY_PHASE_STRIP = YES; 524 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 525 | FRAMEWORK_SEARCH_PATHS = /Users/Shared/Cordova/Frameworks; 526 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 527 | GCC_PREFIX_HEADER = "OfflineTilesProof/OfflineTilesProof-Prefix.pch"; 528 | GCC_PREPROCESSOR_DEFINITIONS = ( 529 | "NDEBUG=1,", 530 | "CORDOVA_FRAMEWORK=1", 531 | ); 532 | GCC_THUMB_SUPPORT = NO; 533 | INFOPLIST_FILE = "OfflineTilesProof/OfflineTilesProof-Info.plist"; 534 | OTHER_LDFLAGS = ( 535 | "-weak_framework", 536 | UIKit, 537 | "-weak_framework", 538 | AVFoundation, 539 | "-weak_framework", 540 | CoreMedia, 541 | "-weak_library", 542 | /usr/lib/libSystem.B.dylib, 543 | ); 544 | PRODUCT_NAME = "$(TARGET_NAME)"; 545 | TARGETED_DEVICE_FAMILY = "1,2"; 546 | VALIDATE_PRODUCT = YES; 547 | WRAPPER_EXTENSION = app; 548 | }; 549 | name = Release; 550 | }; 551 | /* End XCBuildConfiguration section */ 552 | 553 | /* Begin XCConfigurationList section */ 554 | 36169483152BDA18007ECED4 /* Build configuration list for PBXProject "OfflineTilesProof" */ = { 555 | isa = XCConfigurationList; 556 | buildConfigurations = ( 557 | 361694E3152BDA18007ECED4 /* Debug */, 558 | 361694E4152BDA18007ECED4 /* Release */, 559 | ); 560 | defaultConfigurationIsVisible = 0; 561 | defaultConfigurationName = Release; 562 | }; 563 | 361694E5152BDA18007ECED4 /* Build configuration list for PBXNativeTarget "OfflineTilesProof" */ = { 564 | isa = XCConfigurationList; 565 | buildConfigurations = ( 566 | 361694E6152BDA18007ECED4 /* Debug */, 567 | 361694E7152BDA18007ECED4 /* Release */, 568 | ); 569 | defaultConfigurationIsVisible = 0; 570 | defaultConfigurationName = Release; 571 | }; 572 | /* End XCConfigurationList section */ 573 | }; 574 | rootObject = 36169480152BDA18007ECED4 /* Project object */; 575 | } 576 | -------------------------------------------------------------------------------- /OfflineTilesProof.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OfflineTilesProof.xcodeproj/project.xcworkspace/xcuserdata/scottdavis.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof.xcodeproj/project.xcworkspace/xcuserdata/scottdavis.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /OfflineTilesProof.xcodeproj/project.xcworkspace/xcuserdata/scottdavis.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /OfflineTilesProof.xcodeproj/xcuserdata/scottdavis.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /OfflineTilesProof.xcodeproj/xcuserdata/scottdavis.xcuserdatad/xcschemes/OfflineTilesProof.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 50 | 51 | 57 | 58 | 59 | 60 | 61 | 62 | 68 | 69 | 75 | 76 | 77 | 78 | 80 | 81 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /OfflineTilesProof.xcodeproj/xcuserdata/scottdavis.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OfflineTilesProof.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 3616948B152BDA18007ECED4 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /OfflineTilesProof/Classes/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | // 21 | // AppDelegate.h 22 | // OfflineTilesProof 23 | // 24 | // Created by Scott Davis on 4/3/12. 25 | // Copyright Sandy City Public Works 2012. All rights reserved. 26 | // 27 | 28 | #import 29 | 30 | #ifdef CORDOVA_FRAMEWORK 31 | #import 32 | #else 33 | #import "CDVViewController.h" 34 | #endif 35 | 36 | 37 | @interface AppDelegate : NSObject < UIApplicationDelegate, UIWebViewDelegate, CDVCommandDelegate > { 38 | 39 | NSString* invokeString; 40 | } 41 | 42 | // invoke string is passed to your app on launch, this is only valid if you 43 | // edit FooBar.plist to add a protocol 44 | // a simple tutorial can be found here : 45 | // http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html 46 | 47 | @property (nonatomic, copy) NSString* invokeString; 48 | @property (nonatomic, retain) IBOutlet UIWindow* window; 49 | @property (nonatomic, retain) IBOutlet CDVViewController* viewController; 50 | 51 | @end 52 | 53 | -------------------------------------------------------------------------------- /OfflineTilesProof/Classes/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | // 21 | // AppDelegate.m 22 | // OfflineTilesProof 23 | // 24 | // Created by Scott Davis on 4/3/12. 25 | // Copyright Sandy City Public Works 2012. All rights reserved. 26 | // 27 | 28 | #import "AppDelegate.h" 29 | #import "MainViewController.h" 30 | 31 | #ifdef CORDOVA_FRAMEWORK 32 | #import 33 | #import 34 | #else 35 | #import "CDVPlugin.h" 36 | #import "CDVURLProtocol.h" 37 | #endif 38 | 39 | 40 | @implementation AppDelegate 41 | 42 | @synthesize invokeString, window, viewController; 43 | 44 | - (id) init 45 | { 46 | /** If you need to do any extra app-specific initialization, you can do it here 47 | * -jm 48 | **/ 49 | NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; 50 | [cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; 51 | 52 | [CDVURLProtocol registerPGHttpURLProtocol]; 53 | 54 | return [super init]; 55 | } 56 | 57 | #pragma UIApplicationDelegate implementation 58 | 59 | /** 60 | * This is main kick off after the app inits, the views and Settings are setup here. (preferred - iOS4 and up) 61 | */ 62 | - (BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions 63 | { 64 | NSURL* url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey]; 65 | if (url && [url isKindOfClass:[NSURL class]]) { 66 | self.invokeString = [url absoluteString]; 67 | NSLog(@"OfflineTilesProof launchOptions = %@", url); 68 | } 69 | 70 | CGRect screenBounds = [[UIScreen mainScreen] bounds]; 71 | self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease]; 72 | self.window.autoresizesSubviews = YES; 73 | 74 | CGRect viewBounds = [[UIScreen mainScreen] applicationFrame]; 75 | 76 | self.viewController = [[[MainViewController alloc] init] autorelease]; 77 | self.viewController.useSplashScreen = YES; 78 | self.viewController.wwwFolderName = @"www"; 79 | self.viewController.startPage = @"index.html"; 80 | self.viewController.view.frame = viewBounds; 81 | 82 | // over-ride delegates 83 | self.viewController.webView.delegate = self; 84 | self.viewController.commandDelegate = self; 85 | 86 | // check whether the current orientation is supported: if it is, keep it, rather than forcing a rotation 87 | BOOL forceStartupRotation = YES; 88 | UIDeviceOrientation curDevOrientation = [[UIDevice currentDevice] orientation]; 89 | 90 | if (UIDeviceOrientationUnknown == curDevOrientation) { 91 | // UIDevice isn't firing orientation notifications yet… go look at the status bar 92 | curDevOrientation = (UIDeviceOrientation)[[UIApplication sharedApplication] statusBarOrientation]; 93 | } 94 | 95 | if (UIDeviceOrientationIsValidInterfaceOrientation(curDevOrientation)) { 96 | for (NSNumber *orient in self.viewController.supportedOrientations) { 97 | if ([orient intValue] == curDevOrientation) { 98 | forceStartupRotation = NO; 99 | break; 100 | } 101 | } 102 | } 103 | 104 | if (forceStartupRotation) { 105 | NSLog(@"supportedOrientations: %@", self.viewController.supportedOrientations); 106 | // The first item in the supportedOrientations array is the start orientation (guaranteed to be at least Portrait) 107 | UIInterfaceOrientation newOrient = [[self.viewController.supportedOrientations objectAtIndex:0] intValue]; 108 | NSLog(@"AppDelegate forcing status bar to: %d from: %d", newOrient, curDevOrientation); 109 | [[UIApplication sharedApplication] setStatusBarOrientation:newOrient]; 110 | } 111 | 112 | [self.window addSubview:self.viewController.view]; 113 | [self.window makeKeyAndVisible]; 114 | 115 | return YES; 116 | } 117 | 118 | // this happens while we are running ( in the background, or from within our own app ) 119 | // only valid if FooBar.plist specifies a protocol to handle 120 | - (BOOL) application:(UIApplication*)application handleOpenURL:(NSURL*)url 121 | { 122 | if (!url) { 123 | return NO; 124 | } 125 | 126 | // calls into javascript global function 'handleOpenURL' 127 | NSString* jsString = [NSString stringWithFormat:@"handleOpenURL(\"%@\");", url]; 128 | [self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString]; 129 | 130 | // all plugins will get the notification, and their handlers will be called 131 | [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]]; 132 | 133 | return YES; 134 | } 135 | 136 | #pragma PGCommandDelegate implementation 137 | 138 | - (id) getCommandInstance:(NSString*)className 139 | { 140 | return [self.viewController getCommandInstance:className]; 141 | } 142 | 143 | - (BOOL) execute:(CDVInvokedUrlCommand*)command 144 | { 145 | return [self.viewController execute:command]; 146 | } 147 | 148 | - (NSString*) pathForResource:(NSString*)resourcepath; 149 | { 150 | return [self.viewController pathForResource:resourcepath]; 151 | } 152 | 153 | #pragma UIWebDelegate implementation 154 | 155 | - (void) webViewDidFinishLoad:(UIWebView*) theWebView 156 | { 157 | // only valid if FooBar.plist specifies a protocol to handle 158 | if (self.invokeString) 159 | { 160 | // this is passed before the deviceready event is fired, so you can access it in js when you receive deviceready 161 | NSString* jsString = [NSString stringWithFormat:@"var invokeString = \"%@\";", self.invokeString]; 162 | [theWebView stringByEvaluatingJavaScriptFromString:jsString]; 163 | } 164 | 165 | // Black base color for background matches the native apps 166 | theWebView.backgroundColor = [UIColor blackColor]; 167 | 168 | return [self.viewController webViewDidFinishLoad:theWebView]; 169 | } 170 | 171 | - (void) webViewDidStartLoad:(UIWebView*)theWebView 172 | { 173 | return [self.viewController webViewDidStartLoad:theWebView]; 174 | } 175 | 176 | - (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error 177 | { 178 | return [self.viewController webView:theWebView didFailLoadWithError:error]; 179 | } 180 | 181 | - (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType 182 | { 183 | return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType]; 184 | } 185 | 186 | - (void) dealloc 187 | { 188 | [super dealloc]; 189 | } 190 | 191 | @end 192 | -------------------------------------------------------------------------------- /OfflineTilesProof/Classes/MainViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | // 21 | // MainViewController.h 22 | // OfflineTilesProof 23 | // 24 | // Created by Scott Davis on 4/3/12. 25 | // Copyright Sandy City Public Works 2012. All rights reserved. 26 | // 27 | 28 | #ifdef CORDOVA_FRAMEWORK 29 | #import 30 | #else 31 | #import "CDVViewController.h" 32 | #endif 33 | 34 | @interface MainViewController : CDVViewController 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /OfflineTilesProof/Classes/MainViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | // 21 | // MainViewController.h 22 | // OfflineTilesProof 23 | // 24 | // Created by Scott Davis on 4/3/12. 25 | // Copyright Sandy City Public Works 2012. All rights reserved. 26 | // 27 | 28 | #import "MainViewController.h" 29 | 30 | @implementation MainViewController 31 | 32 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 33 | { 34 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 35 | if (self) { 36 | // Custom initialization 37 | } 38 | return self; 39 | } 40 | 41 | - (void)didReceiveMemoryWarning 42 | { 43 | // Releases the view if it doesn't have a superview. 44 | [super didReceiveMemoryWarning]; 45 | 46 | // Release any cached data, images, etc that aren't in use. 47 | } 48 | 49 | #pragma mark - View lifecycle 50 | 51 | - (void)viewDidLoad 52 | { 53 | [super viewDidLoad]; 54 | // Do any additional setup after loading the view from its nib. 55 | } 56 | 57 | - (void)viewDidUnload 58 | { 59 | [super viewDidUnload]; 60 | // Release any retained subviews of the main view. 61 | // e.g. self.myOutlet = nil; 62 | } 63 | 64 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 65 | { 66 | // Return YES for supported orientations 67 | return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation]; 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /OfflineTilesProof/Classes/MainViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1280 5 | 11C25 6 | 1919 7 | 1138.11 8 | 566.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 916 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | 17 | 18 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 19 | 20 | 21 | PluginDependencyRecalculationVersion 22 | 23 | 24 | 25 | 26 | IBFilesOwner 27 | IBCocoaTouchFramework 28 | 29 | 30 | IBFirstResponder 31 | IBCocoaTouchFramework 32 | 33 | 34 | 35 | 274 36 | {{0, 20}, {320, 460}} 37 | 38 | 39 | 40 | 3 41 | MQA 42 | 43 | 2 44 | 45 | 46 | 47 | IBCocoaTouchFramework 48 | 49 | 50 | 51 | 52 | 53 | 54 | view 55 | 56 | 57 | 58 | 3 59 | 60 | 61 | 62 | 63 | 64 | 0 65 | 66 | 67 | 68 | 69 | 70 | 1 71 | 72 | 73 | 74 | 75 | -1 76 | 77 | 78 | File's Owner 79 | 80 | 81 | -2 82 | 83 | 84 | 85 | 86 | 87 | 88 | MainViewController 89 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 90 | UIResponder 91 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 92 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 93 | 94 | 95 | 96 | 97 | 98 | 3 99 | 100 | 101 | 102 | 103 | MainViewController 104 | UIViewController 105 | 106 | IBProjectSource 107 | ./Classes/MainViewController.h 108 | 109 | 110 | 111 | 112 | 0 113 | IBCocoaTouchFramework 114 | YES 115 | 3 116 | 916 117 | 118 | 119 | -------------------------------------------------------------------------------- /OfflineTilesProof/Cordova.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIWebViewBounce 6 | 7 | TopActivityIndicator 8 | gray 9 | EnableLocation 10 | 11 | EnableViewportScale 12 | 13 | AutoHideSplashScreen 14 | 15 | ShowSplashScreenSpinner 16 | 17 | MediaPlaybackRequiresUserAction 18 | 19 | AllowInlineMediaPlayback 20 | 21 | OpenAllWhitelistURLsInWebView 22 | 23 | ExternalHosts 24 | 25 | * 26 | 27 | Plugins 28 | 29 | SQLitePlugin 30 | SQLitePlugin 31 | org.apache.cordova.accelerometer 32 | CDVAccelerometer 33 | org.apache.cordova.camera 34 | CDVCamera 35 | org.apache.cordova.connection 36 | CDVConnection 37 | org.apache.cordova.contacts 38 | CDVContacts 39 | org.apache.cordova.debugconsole 40 | CDVDebugConsole 41 | org.apache.cordova.file 42 | CDVFile 43 | org.apache.cordova.filetransfer 44 | CDVFileTransfer 45 | org.apache.cordova.geolocation 46 | CDVLocation 47 | org.apache.cordova.notification 48 | CDVNotification 49 | org.apache.cordova.media 50 | CDVSound 51 | org.apache.cordova.mediacapture 52 | CDVCapture 53 | org.apache.cordova.splashscreen 54 | CDVSplashScreen 55 | org.apache.cordova.battery 56 | CDVBattery 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /OfflineTilesProof/NSData+Base64.h: -------------------------------------------------------------------------------- 1 | // got from: https://github.com/mattgemmell/MGTwitterEngine#readme 2 | 3 | // 4 | // NSData+Base64.m 5 | // 6 | // Derived from http://colloquy.info/project/browser/trunk/NSDataAdditions.h?rev=1576 7 | // Created by khammond on Mon Oct 29 2001. 8 | // Formatted by Timothy Hatcher on Sun Jul 4 2004. 9 | // Copyright (c) 2001 Kyle Hammond. All rights reserved. 10 | // Original development by Dave Winer. 11 | // 12 | 13 | //#import "MGTwitterEngineGlobalHeader.h" 14 | 15 | @interface NSData (Base64) 16 | 17 | /*! @function +dataWithBase64EncodedString: 18 | @discussion This method returns an autoreleased NSData object. The NSData object is initialized with the 19 | contents of the Base 64 encoded string. This is a convenience method. 20 | @param inBase64String An NSString object that contains only Base 64 encoded data. 21 | @result The NSData object. */ 22 | + (NSData *) dataWithBase64EncodedString:(NSString *) string; 23 | 24 | /*! @function -initWithBase64EncodedString: 25 | @discussion The NSData object is initialized with the contents of the Base 64 encoded string. 26 | This method returns self as a convenience. 27 | @param inBase64String An NSString object that contains only Base 64 encoded data. 28 | @result This method returns self. */ 29 | - (id) initWithBase64EncodedString:(NSString *) string; 30 | 31 | /*! @function -base64EncodingWithLineLength: 32 | @discussion This method returns a Base 64 encoded string representation of the data object. 33 | @param inLineLength A value of zero means no line breaks. This is crunched to a multiple of 4 (the next 34 | one greater than inLineLength). 35 | @result The base 64 encoded data. */ 36 | - (NSString *) base64EncodingWithLineLength:(unsigned int) lineLength; 37 | 38 | @end -------------------------------------------------------------------------------- /OfflineTilesProof/NSData+Base64.m: -------------------------------------------------------------------------------- 1 | // got from: https://github.com/mattgemmell/MGTwitterEngine#readme 2 | 3 | // 4 | // NSData+Base64.m 5 | // 6 | // Derived from http://colloquy.info/project/browser/trunk/NSDataAdditions.h?rev=1576 7 | // Created by khammond on Mon Oct 29 2001. 8 | // Formatted by Timothy Hatcher on Sun Jul 4 2004. 9 | // Copyright (c) 2001 Kyle Hammond. All rights reserved. 10 | // Original development by Dave Winer. 11 | // 12 | 13 | #import "NSData+Base64.h" 14 | 15 | //#import 16 | 17 | static char encodingTable[64] = { 18 | 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', 19 | 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', 20 | 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', 21 | 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' }; 22 | 23 | @implementation NSData (Base64) 24 | 25 | + (NSData *) dataWithBase64EncodedString:(NSString *) string { 26 | NSData *result = [[NSData alloc] initWithBase64EncodedString:string]; 27 | return [result autorelease]; 28 | } 29 | 30 | - (id) initWithBase64EncodedString:(NSString *) string { 31 | NSMutableData *mutableData = nil; 32 | 33 | if( string ) { 34 | unsigned long ixtext = 0; 35 | unsigned long lentext = 0; 36 | unsigned char ch = 0; 37 | unsigned char inbuf[3], outbuf[4]; 38 | short i = 0, ixinbuf = 0; 39 | BOOL flignore = NO; 40 | BOOL flendtext = NO; 41 | NSData *base64Data = nil; 42 | const unsigned char *base64Bytes = nil; 43 | 44 | // Convert the string to ASCII data. 45 | base64Data = [string dataUsingEncoding:NSASCIIStringEncoding]; 46 | base64Bytes = [base64Data bytes]; 47 | mutableData = [NSMutableData dataWithCapacity:[base64Data length]]; 48 | lentext = [base64Data length]; 49 | 50 | while( YES ) { 51 | if( ixtext >= lentext ) break; 52 | ch = base64Bytes[ixtext++]; 53 | flignore = NO; 54 | 55 | if( ( ch >= 'A' ) && ( ch <= 'Z' ) ) ch = ch - 'A'; 56 | else if( ( ch >= 'a' ) && ( ch <= 'z' ) ) ch = ch - 'a' + 26; 57 | else if( ( ch >= '0' ) && ( ch <= '9' ) ) ch = ch - '0' + 52; 58 | else if( ch == '+' ) ch = 62; 59 | else if( ch == '=' ) flendtext = YES; 60 | else if( ch == '/' ) ch = 63; 61 | else flignore = YES; 62 | 63 | if( ! flignore ) { 64 | short ctcharsinbuf = 3; 65 | BOOL flbreak = NO; 66 | 67 | if( flendtext ) { 68 | if( ! ixinbuf ) break; 69 | if( ( ixinbuf == 1 ) || ( ixinbuf == 2 ) ) ctcharsinbuf = 1; 70 | else ctcharsinbuf = 2; 71 | ixinbuf = 3; 72 | flbreak = YES; 73 | } 74 | 75 | inbuf [ixinbuf++] = ch; 76 | 77 | if( ixinbuf == 4 ) { 78 | ixinbuf = 0; 79 | outbuf [0] = ( inbuf[0] << 2 ) | ( ( inbuf[1] & 0x30) >> 4 ); 80 | outbuf [1] = ( ( inbuf[1] & 0x0F ) << 4 ) | ( ( inbuf[2] & 0x3C ) >> 2 ); 81 | outbuf [2] = ( ( inbuf[2] & 0x03 ) << 6 ) | ( inbuf[3] & 0x3F ); 82 | 83 | for( i = 0; i < ctcharsinbuf; i++ ) 84 | [mutableData appendBytes:&outbuf[i] length:1]; 85 | } 86 | 87 | if( flbreak ) break; 88 | } 89 | } 90 | } 91 | 92 | self = [self initWithData:mutableData]; 93 | return self; 94 | } 95 | 96 | - (NSString *) base64EncodingWithLineLength:(unsigned int) lineLength { 97 | const unsigned char *bytes = [self bytes]; 98 | NSMutableString *result = [NSMutableString stringWithCapacity:[self length]]; 99 | unsigned long ixtext = 0; 100 | unsigned long lentext = [self length]; 101 | long ctremaining = 0; 102 | unsigned char inbuf[3], outbuf[4]; 103 | short i = 0; 104 | unsigned int charsonline = 0; 105 | short ctcopy = 0; 106 | unsigned long ix = 0; 107 | 108 | while( YES ) { 109 | ctremaining = lentext - ixtext; 110 | if( ctremaining <= 0 ) break; 111 | 112 | for( i = 0; i < 3; i++ ) { 113 | ix = ixtext + i; 114 | if( ix < lentext ) inbuf[i] = bytes[ix]; 115 | else inbuf [i] = 0; 116 | } 117 | 118 | outbuf [0] = (inbuf [0] & 0xFC) >> 2; 119 | outbuf [1] = ((inbuf [0] & 0x03) << 4) | ((inbuf [1] & 0xF0) >> 4); 120 | outbuf [2] = ((inbuf [1] & 0x0F) << 2) | ((inbuf [2] & 0xC0) >> 6); 121 | outbuf [3] = inbuf [2] & 0x3F; 122 | ctcopy = 4; 123 | 124 | switch( ctremaining ) { 125 | case 1: 126 | ctcopy = 2; 127 | break; 128 | case 2: 129 | ctcopy = 3; 130 | break; 131 | } 132 | 133 | for( i = 0; i < ctcopy; i++ ) 134 | [result appendFormat:@"%c", encodingTable[outbuf[i]]]; 135 | 136 | for( i = ctcopy; i < 4; i++ ) 137 | [result appendFormat:@"%c",'=']; 138 | 139 | ixtext += 3; 140 | charsonline += 4; 141 | 142 | if( lineLength > 0 ) { 143 | if (charsonline >= lineLength) { 144 | charsonline = 0; 145 | [result appendString:@"\n"]; 146 | } 147 | } 148 | } 149 | 150 | return result; 151 | } 152 | 153 | @end -------------------------------------------------------------------------------- /OfflineTilesProof/OfflineTilesProof-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIconFiles 6 | 7 | icon.png 8 | icon@2x.png 9 | icon-72.png 10 | 11 | UISupportedInterfaceOrientations~ipad 12 | 13 | UIInterfaceOrientationPortrait 14 | UIInterfaceOrientationLandscapeLeft 15 | UIInterfaceOrientationPortraitUpsideDown 16 | UIInterfaceOrientationLandscapeRight 17 | 18 | UISupportedInterfaceOrientations 19 | 20 | UIInterfaceOrientationPortrait 21 | 22 | CFBundleDevelopmentRegion 23 | English 24 | CFBundleDisplayName 25 | ${PRODUCT_NAME} 26 | CFBundleExecutable 27 | ${EXECUTABLE_NAME} 28 | CFBundleIconFile 29 | icon.png 30 | CFBundleIdentifier 31 | com.GeospatialScott.OfflineTilesProof 32 | CFBundleInfoDictionaryVersion 33 | 6.0 34 | CFBundleName 35 | ${PRODUCT_NAME} 36 | CFBundlePackageType 37 | APPL 38 | CFBundleSignature 39 | ???? 40 | CFBundleVersion 41 | 1.0 42 | LSRequiresIPhoneOS 43 | 44 | NSMainNibFile 45 | 46 | NSMainNibFile~ipad 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /OfflineTilesProof/OfflineTilesProof-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'OfflineTilesProof' target in the 'OfflineTilesProof' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /OfflineTilesProof/Plugins/README: -------------------------------------------------------------------------------- 1 | Put the .h and .m files of your plugin here. The .js files of your plugin belong in the www folder. -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/Capture.bundle/controls_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/Capture.bundle/controls_bg.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/Capture.bundle/controls_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/Capture.bundle/controls_bg@2x.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/Capture.bundle/controls_bg~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/Capture.bundle/controls_bg~ipad.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/Capture.bundle/microphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/Capture.bundle/microphone.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/Capture.bundle/microphone@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/Capture.bundle/microphone@2x.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/Capture.bundle/microphone~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/Capture.bundle/microphone~ipad.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/Capture.bundle/record_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/Capture.bundle/record_button.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/Capture.bundle/record_button@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/Capture.bundle/record_button@2x.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/Capture.bundle/record_button~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/Capture.bundle/record_button~ipad.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/Capture.bundle/recording_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/Capture.bundle/recording_bg.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/Capture.bundle/recording_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/Capture.bundle/recording_bg@2x.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/Capture.bundle/recording_bg~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/Capture.bundle/recording_bg~ipad.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/Capture.bundle/stop_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/Capture.bundle/stop_button.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/Capture.bundle/stop_button@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/Capture.bundle/stop_button@2x.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/Capture.bundle/stop_button~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/Capture.bundle/stop_button~ipad.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/de.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | 21 | // accessibility label for recording button 22 | "toggle audio recording" = "starten/beenden der Tonaufnahme"; 23 | // notification spoken by VoiceOver when timed recording finishes 24 | "timed recording complete" = "programmierte Aufnahme beendet"; 25 | // accessibility hint for display of recorded elapsed time 26 | "recorded time in minutes and seconds" = "aufgenommene Zeit in Minuten und Sekunden"; -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | // accessibility label for recording button 21 | "toggle audio recording" = "toggle audio recording"; 22 | // notification spoken by VoiceOver when timed recording finishes 23 | "timed recording complete" = "timed recording complete"; 24 | // accessibility hint for display of recorded elapsed time 25 | "recorded time in minutes and seconds" = "recorded time in minutes and seconds"; -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/es.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | // accessibility label for recording button 21 | "toggle audio recording" = "grabación de audio cambiar"; 22 | // notification spoken by VoiceOver when timed recording finishes 23 | "timed recording complete" = "tiempo de grabación completo"; 24 | // accessibility hint for display of recorded elapsed time 25 | "recorded time in minutes and seconds" = "tiempo registrado en minutos y segundos"; -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/icons/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/icons/icon-72.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/icons/icon.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/icons/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/icons/icon@2x.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/road-trip.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/road-trip.sqlite3 -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/se.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | 21 | // accessibility label for recording button 22 | "toggle audio recording" = "börja/avsluta inspelning"; 23 | // notification spoken by VoiceOver when timed recording finishes 24 | "timed recording complete" = "inspelning har avslutad"; 25 | // accessibility hint for display of recorded elapsed time 26 | "recorded time in minutes and seconds" = "inspelad tid in minuter och sekund"; -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/splash/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/splash/Default.png -------------------------------------------------------------------------------- /OfflineTilesProof/Resources/splash/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/OfflineTilesProof/Resources/splash/Default@2x.png -------------------------------------------------------------------------------- /OfflineTilesProof/SQLitePlugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Davide Bertola 3 | * 4 | * Authors: 5 | * Davide Bertola 6 | * Joe Noon 7 | * 8 | * This library is available under the terms of the MIT License (2008). 9 | * See http://opensource.org/licenses/alphabetical for full text. 10 | */ 11 | 12 | #import 13 | #import "sqlite3.h" 14 | 15 | #ifdef CORDOVA_FRAMEWORK 16 | #import 17 | #import 18 | #import 19 | #else 20 | #import "CDVPlugin.h" 21 | #import "JSON.h" 22 | #import "File.h" 23 | #endif 24 | 25 | #import "AppDelegate.h" 26 | 27 | @interface SQLitePlugin : CDVPlugin { 28 | NSMutableDictionary *openDBs; 29 | } 30 | 31 | @property (nonatomic, copy) NSMutableDictionary *openDBs; 32 | @property (nonatomic, retain) NSString *appDocsPath; 33 | 34 | -(void) open:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; 35 | -(void) backgroundExecuteSqlBatch:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; 36 | -(void) backgroundExecuteSql:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; 37 | -(void) executeSqlBatch:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; 38 | -(void) executeSql:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; 39 | -(void) _executeSqlBatch:(NSMutableDictionary*)options; 40 | -(void) _executeSql:(NSMutableDictionary*)options; 41 | -(void) close: (NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; 42 | -(void) respond: (id)cb withString:(NSString *)str withType:(NSString *)type; 43 | -(id) getDBPath:(id)dbFile; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /OfflineTilesProof/SQLitePlugin.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Davide Bertola 3 | * 4 | * Authors: 5 | * Davide Bertola 6 | * Joe Noon 7 | * 8 | * This library is available under the terms of the MIT License (2008). 9 | * See http://opensource.org/licenses/alphabetical for full text. 10 | */ 11 | 12 | 13 | #import "SQLitePlugin.h" 14 | #import "NSData+Base64.m" 15 | #import "NSData+Base64.h" 16 | 17 | @implementation SQLitePlugin 18 | 19 | @synthesize openDBs; 20 | @synthesize appDocsPath; 21 | 22 | -(CDVPlugin*) initWithWebView:(UIWebView*)theWebView 23 | { 24 | self = (SQLitePlugin*)[super initWithWebView:theWebView]; 25 | if (self) { 26 | openDBs = [NSMutableDictionary dictionaryWithCapacity:0]; 27 | [openDBs retain]; 28 | 29 | CDVFile* pgFile = [[self appDelegate] getCommandInstance: @"org.apache.cordova.file"]; 30 | NSString *docs = [pgFile appDocsPath]; 31 | [self setAppDocsPath:docs]; 32 | 33 | } 34 | return self; 35 | } 36 | 37 | -(void) respond: (id)cb withString:(NSString *)str withType:(NSString *)type { 38 | if (cb != NULL) { 39 | NSString* jsString = [NSString stringWithFormat:@"SQLitePlugin.handleCallback('%@', '%@', %@);", cb, type, str ]; 40 | [self writeJavascript:jsString]; 41 | } 42 | } 43 | 44 | -(id) getDBPath:(id)dbFile { 45 | if (dbFile == NULL) { 46 | return NULL; 47 | } 48 | NSString *dbPath = [NSString stringWithFormat:@"%@/%@", appDocsPath, dbFile]; 49 | return dbPath; 50 | } 51 | 52 | -(void) open: (NSMutableArray*)arguments withDict:(NSMutableDictionary*)options 53 | { 54 | NSString *callback = [options objectForKey:@"callback"]; 55 | NSString *dbPath = [self getDBPath:[options objectForKey:@"path"]]; 56 | 57 | if (dbPath == NULL) { 58 | [self respond:callback withString:@"{ message: 'You must specify database path' }" withType:@"error"]; 59 | return; 60 | } 61 | 62 | sqlite3 *db; 63 | const char *path = [dbPath UTF8String]; 64 | 65 | if (sqlite3_open(path, &db) != SQLITE_OK) { 66 | [self respond:callback withString:@"{ message: 'Unable to open DB' }" withType:@"error"]; 67 | return; 68 | } 69 | 70 | NSValue *dbPointer = [NSValue valueWithPointer:db]; 71 | [openDBs setObject:dbPointer forKey: dbPath]; 72 | [self respond:callback withString: @"{ message: 'Database opened' }" withType:@"success"]; 73 | } 74 | 75 | -(void) backgroundExecuteSqlBatch: (NSMutableArray*)arguments withDict:(NSMutableDictionary*)options 76 | { 77 | [self performSelector:@selector(_executeSqlBatch:) withObject:options afterDelay:0.001]; 78 | } 79 | 80 | -(void) backgroundExecuteSql: (NSMutableArray*)arguments withDict:(NSMutableDictionary*)options 81 | { 82 | [self performSelector:@selector(_executeSql:) withObject:options afterDelay:0.001]; 83 | } 84 | 85 | -(void) _executeSqlBatch:(NSMutableDictionary*)options 86 | { 87 | [self executeSqlBatch:NULL withDict:options]; 88 | } 89 | 90 | -(void) _executeSql:(NSMutableDictionary*)options 91 | { 92 | [self executeSql:NULL withDict:options]; 93 | } 94 | 95 | -(void) executeSqlBatch: (NSMutableArray*)arguments withDict:(NSMutableDictionary*)options 96 | { 97 | NSMutableArray *executes = [options objectForKey:@"executes"]; 98 | for (NSMutableDictionary *dict in executes) { 99 | [self executeSql:NULL withDict:dict]; 100 | } 101 | } 102 | 103 | -(void) executeSql: (NSMutableArray*)arguments withDict:(NSMutableDictionary*)options 104 | { 105 | NSString *callback = [options objectForKey:@"callback"]; 106 | NSString *dbPath = [self getDBPath:[options objectForKey:@"path"]]; 107 | NSMutableArray *query_parts = [options objectForKey:@"query"]; 108 | NSString *query = [query_parts objectAtIndex:0]; 109 | 110 | if (dbPath == NULL) { 111 | [self respond:callback withString:@"{ message: 'You must specify database path' }" withType:@"error"]; 112 | return; 113 | } 114 | if (query == NULL) { 115 | [self respond:callback withString:@"{ message: 'You must specify a query to execute' }" withType:@"error"]; 116 | return; 117 | } 118 | 119 | NSValue *dbPointer = [openDBs objectForKey:dbPath]; 120 | if (dbPointer == NULL) { 121 | [self respond:callback withString:@"{ message: 'No such database, you must open it first' }" withType:@"error"]; 122 | return; 123 | } 124 | sqlite3 *db = [dbPointer pointerValue]; 125 | 126 | const char *sql_stmt = [query UTF8String]; 127 | char *errMsg = NULL; 128 | sqlite3_stmt *statement; 129 | int result, i, column_type, count; 130 | int previousRowsAffected, nowRowsAffected, diffRowsAffected; 131 | long long previousInsertId, nowInsertId; 132 | BOOL keepGoing = YES; 133 | BOOL hasInsertId; 134 | NSMutableDictionary *resultSet = [NSMutableDictionary dictionaryWithCapacity:0]; 135 | NSMutableArray *resultRows = [NSMutableArray arrayWithCapacity:0]; 136 | NSMutableDictionary *entry; 137 | NSObject *columnValue; 138 | NSString *columnName; 139 | NSString *bindval; 140 | NSObject *insertId; 141 | NSObject *rowsAffected; 142 | NSData *nsData; 143 | 144 | hasInsertId = NO; 145 | previousRowsAffected = sqlite3_total_changes(db); 146 | previousInsertId = sqlite3_last_insert_rowid(db); 147 | 148 | if (sqlite3_prepare_v2(db, sql_stmt, -1, &statement, NULL) != SQLITE_OK) { 149 | errMsg = (char *) sqlite3_errmsg (db); 150 | keepGoing = NO; 151 | } else { 152 | for (int b = 1; b < query_parts.count; b++) { 153 | bindval = [NSString stringWithFormat:@"%@", [query_parts objectAtIndex:b]]; 154 | sqlite3_bind_text(statement, b, [bindval UTF8String], -1, SQLITE_TRANSIENT); 155 | } 156 | } 157 | 158 | while (keepGoing) { 159 | result = sqlite3_step (statement); 160 | switch (result) { 161 | 162 | case SQLITE_ROW: 163 | i = 0; 164 | entry = [NSMutableDictionary dictionaryWithCapacity:0]; 165 | count = sqlite3_column_count(statement); 166 | 167 | while (i < count) { 168 | column_type = sqlite3_column_type(statement, i); 169 | switch (column_type) { 170 | case SQLITE_INTEGER: 171 | columnValue = [NSNumber numberWithDouble: sqlite3_column_double(statement, i)]; 172 | columnName = [NSString stringWithFormat:@"%s", sqlite3_column_name(statement, i)]; 173 | [entry setObject:columnValue forKey:columnName]; 174 | break; 175 | case SQLITE_TEXT: 176 | columnValue = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, i)]; 177 | columnName = [NSString stringWithFormat:@"%s", sqlite3_column_name(statement, i)]; 178 | [entry setObject:columnValue forKey:columnName]; 179 | break; 180 | case SQLITE_BLOB: 181 | nsData = [[NSData alloc] initWithBytes:sqlite3_column_blob(statement, i) length:sqlite3_column_bytes(statement, i)]; 182 | columnValue = [nsData base64EncodingWithLineLength:0]; 183 | columnName = [NSString stringWithFormat:@"%s", sqlite3_column_name(statement, i)]; 184 | [entry setObject:columnValue forKey:columnName]; 185 | break; 186 | case SQLITE_FLOAT: 187 | columnValue = [NSNumber numberWithFloat: sqlite3_column_double(statement, i)]; 188 | columnName = [NSString stringWithFormat:@"%s", sqlite3_column_name(statement, i)]; 189 | [entry setObject:columnValue forKey:columnName]; 190 | break; 191 | case SQLITE_NULL: 192 | break; 193 | } 194 | i++; 195 | 196 | } 197 | [resultRows addObject:entry]; 198 | break; 199 | 200 | case SQLITE_DONE: 201 | nowRowsAffected = sqlite3_total_changes(db); 202 | diffRowsAffected = nowRowsAffected - previousRowsAffected; 203 | rowsAffected = [NSNumber numberWithInt:diffRowsAffected]; 204 | nowInsertId = sqlite3_last_insert_rowid(db); 205 | if (previousInsertId != nowInsertId) { 206 | hasInsertId = YES; 207 | insertId = [NSNumber numberWithLongLong:sqlite3_last_insert_rowid(db)]; 208 | } 209 | keepGoing = NO; 210 | break; 211 | 212 | default: 213 | errMsg = "SQL statement error"; 214 | keepGoing = NO; 215 | } 216 | } 217 | 218 | sqlite3_finalize (statement); 219 | 220 | if (errMsg != NULL) { 221 | [self respond:callback withString:[NSString stringWithFormat:@"{ message: 'SQL statement error : %s' }", errMsg] withType:@"error"]; 222 | } else { 223 | [resultSet setObject:resultRows forKey:@"rows"]; 224 | [resultSet setObject:rowsAffected forKey:@"rowsAffected"]; 225 | if (hasInsertId) { 226 | [resultSet setObject:insertId forKey:@"insertId"]; 227 | } 228 | [self respond:callback withString:[resultSet JSONString] withType:@"success"]; 229 | } 230 | } 231 | 232 | -(void) close: (NSMutableArray*)arguments withDict:(NSMutableDictionary*)options 233 | { 234 | NSString *callback = [options objectForKey:@"callback"]; 235 | NSString *dbPath = [self getDBPath:[options objectForKey:@"path"]]; 236 | if (dbPath == NULL) { 237 | [self respond:callback withString:@"{ message: 'You must specify database path' }" withType:@"error"]; 238 | return; 239 | } 240 | 241 | NSValue *val = [openDBs objectForKey:dbPath]; 242 | sqlite3 *db = [val pointerValue]; 243 | if (db == NULL) { 244 | [self respond:callback withString: @"{ message: 'Specified db was not open' }" withType:@"error"]; 245 | } 246 | sqlite3_close (db); 247 | [self respond:callback withString: @"{ message: 'db closed' }" withType:@"success"]; 248 | } 249 | 250 | -(void)dealloc 251 | { 252 | int i; 253 | NSArray *keys = [openDBs allKeys]; 254 | NSValue *pointer; 255 | NSString *key; 256 | sqlite3 *db; 257 | 258 | /* close db the user forgot */ 259 | for (i=0; i<[keys count]; i++) { 260 | key = [keys objectAtIndex:i]; 261 | pointer = [openDBs objectForKey:key]; 262 | db = [pointer pointerValue]; 263 | sqlite3_close (db); 264 | } 265 | 266 | [openDBs release]; 267 | [appDocsPath release]; 268 | [super dealloc]; 269 | } 270 | 271 | @end 272 | -------------------------------------------------------------------------------- /OfflineTilesProof/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /OfflineTilesProof/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | // 20 | // main.m 21 | // OfflineTilesProof 22 | // 23 | // Created by Scott Davis on 4/3/12. 24 | // Copyright Sandy City Public Works 2012. All rights reserved. 25 | // 26 | 27 | #import 28 | 29 | int main(int argc, char *argv[]) { 30 | 31 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 32 | int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate"); 33 | [pool release]; 34 | return retVal; 35 | } 36 | -------------------------------------------------------------------------------- /OfflineTilesProof/verify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | if [ ! -d "$PROJECT_DIR/www" ] ; then 5 | cp -R /Users/Shared/Cordova/Frameworks/Cordova.framework/www "$PROJECT_DIR" 6 | fi 7 | # detect www folder reference in project, if missing, print warning 8 | grep "{isa = PBXFileReference; lastKnownFileType = folder; path = www; sourceTree = \"\"; };" "$PROJECT_DIR/$PROJECT_NAME.xcodeproj/project.pbxproj" 9 | rc=$? 10 | if [ $rc != 0 ] ; then 11 | echo -e "warning: Missing - Add $PROJECT_DIR/www as a folder reference in your project. Just drag and drop the folder into your project, into the Project Navigator of Xcode 4. Make sure you select the second radio-button: 'Create folder references for any added folders' (which will create a blue folder)" 1>&2 12 | fi -------------------------------------------------------------------------------- /www/css/core.css: -------------------------------------------------------------------------------- 1 | body, #map { 2 | width: 100%; 3 | height: 100%; 4 | } 5 | #map { 6 | position: absolute; 7 | top: 0; 8 | left: 0; 9 | } -------------------------------------------------------------------------------- /www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Offline Maps Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /www/js/TileLayer.MBTiles.js: -------------------------------------------------------------------------------- 1 | // inspired by: https://github.com/coomsie/topomap.co.nz/blob/master/Resources/leaflet/TileLayer.DB.js 2 | L.TileLayer.MBTiles = L.TileLayer.extend({ 3 | //db: SQLitePlugin 4 | mbTilesDB: null, 5 | 6 | initialize: function(url, options, db) { 7 | this.mbTilesDB = db; 8 | 9 | L.Util.setOptions(this, options); 10 | }, 11 | getTileUrl: function (tilePoint, zoom, tile) { 12 | var z = this._getOffsetZoom(zoom); 13 | var x = tilePoint.x; 14 | var y = tilePoint.y; 15 | var base64Prefix = 'data:image/gif;base64,'; 16 | 17 | this.mbTilesDB.executeSql("SELECT tile_data FROM images INNER JOIN map ON images.tile_id = map.tile_id WHERE zoom_level = ? AND tile_column = ? AND tile_row = ?", [z, x, y], function (res) { 18 | tile.src = base64Prefix + res.rows[0].tile_data; 19 | }, function (er) { 20 | console.log('error with executeSql', er); 21 | }); 22 | }, 23 | _loadTile: function (tile, tilePoint, zoom) { 24 | tile._layer = this; 25 | tile.onload = this._tileOnLoad; 26 | tile.onerror = this._tileOnError; 27 | this.getTileUrl(tilePoint, zoom, tile); 28 | } 29 | }); -------------------------------------------------------------------------------- /www/js/core.js: -------------------------------------------------------------------------------- 1 | function onBodyLoad() { 2 | document.addEventListener("deviceready", go, false); 3 | } 4 | 5 | var localFileName; // the filename of the local mbtiles file 6 | var remoteFile; // the url of the remote mbtiles file to be downloaded 7 | var msg; // the span to show messages 8 | 9 | localFileName = 'test.mbtiles'; 10 | remoteFile = 'http://dl.dropbox.com/u/14814828/OSMBrightSLValley.mbtiles'; 11 | 12 | function go() { 13 | var fs; // file system object 14 | var ft; // TileTransfer object 15 | 16 | msg = document.getElementById('message'); 17 | 18 | console.log('requesting file system...'); 19 | window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) { 20 | console.log('file system retrieved.'); 21 | fs = fileSystem; 22 | 23 | // check to see if files already exists 24 | var file = fs.root.getFile(localFileName, {create: false}, function () { 25 | // file exists 26 | console.log('exists'); 27 | 28 | msg.innerHTML = 'File already exists on device. Building map...'; 29 | 30 | buildMap(); 31 | }, function () { 32 | // file does not exist 33 | console.log('does not exist'); 34 | 35 | msg.innerHTML = 'Downloading file (~14mbs)...'; 36 | 37 | console.log('downloading sqlite file...'); 38 | ft = new FileTransfer(); 39 | ft.download(remoteFile, fs.root.fullPath + '/' + localFileName, function (entry) { 40 | console.log('download complete: ' + entry.fullPath); 41 | 42 | buildMap(); 43 | 44 | }, function (error) { 45 | console.log('error with download', error); 46 | }); 47 | }); 48 | }); 49 | } 50 | 51 | function buildMap() { 52 | var db = new SQLitePlugin(localFileName); 53 | 54 | document.body.removeChild(msg); 55 | 56 | var map = new L.Map('map', { 57 | center: new L.LatLng(40.6681, -111.9364), 58 | zoom: 11 59 | }); 60 | 61 | var lyr = new L.TileLayer.MBTiles('', {maxZoom: 14, scheme: 'tms'}, db); 62 | 63 | map.addLayer(lyr); 64 | } -------------------------------------------------------------------------------- /www/js/sqlite_plugin.js: -------------------------------------------------------------------------------- 1 | var SQLitePlugin = function() { 2 | var callbacks, cbref, counter, getOptions, root; 3 | root = this; 4 | callbacks = {}; 5 | counter = 0; 6 | cbref = function(hash) { 7 | var f; 8 | f = "cb" + (counter += 1); 9 | callbacks[f] = hash; 10 | return f; 11 | }; 12 | getOptions = function(opts, success, error) { 13 | var cb, has_cbs; 14 | cb = {}; 15 | has_cbs = false; 16 | if (typeof success === "function") { 17 | has_cbs = true; 18 | cb.success = success; 19 | } 20 | if (typeof error === "function") { 21 | has_cbs = true; 22 | cb.error = error; 23 | } 24 | if (has_cbs) { 25 | opts.callback = cbref(cb); 26 | } 27 | return opts; 28 | }; 29 | root.SQLitePlugin = (function() { 30 | SQLitePlugin.prototype.openDBs = {}; 31 | function SQLitePlugin(dbPath, openSuccess, openError) { 32 | this.dbPath = dbPath; 33 | this.openSuccess = openSuccess; 34 | this.openError = openError; 35 | if (!dbPath) { 36 | throw new Error("Cannot create a SQLitePlugin instance without a dbPath"); 37 | } 38 | this.openSuccess || (this.openSuccess = function() { 39 | console.log("DB opened: " + dbPath); 40 | }); 41 | this.openError || (this.openError = function(e) { 42 | console.log(e.message); 43 | }); 44 | this.open(this.openSuccess, this.openError); 45 | } 46 | SQLitePlugin.handleCallback = function(ref, type, obj) { 47 | var _ref; 48 | if ((_ref = callbacks[ref]) != null) { 49 | if (typeof _ref[type] === "function") { 50 | _ref[type](obj); 51 | } 52 | } 53 | callbacks[ref] = null; 54 | delete callbacks[ref]; 55 | }; 56 | SQLitePlugin.prototype.executeSql = function(sql, params, success, error) { 57 | var opts; 58 | if (!sql) { 59 | throw new Error("Cannot executeSql without a query"); 60 | } 61 | opts = getOptions({ 62 | query: [sql].concat(params || []), 63 | path: this.dbPath 64 | }, success, error); 65 | Cordova.exec("SQLitePlugin.backgroundExecuteSql", opts); 66 | }; 67 | SQLitePlugin.prototype.transaction = function(fn, success, error) { 68 | var t; 69 | t = new root.SQLitePluginTransaction(this.dbPath); 70 | fn(t); 71 | return t.complete(success, error); 72 | }; 73 | SQLitePlugin.prototype.open = function(success, error) { 74 | var opts; 75 | if (!(this.dbPath in this.openDBs)) { 76 | this.openDBs[this.dbPath] = true; 77 | opts = getOptions({ 78 | path: this.dbPath 79 | }, success, error); 80 | Cordova.exec("SQLitePlugin.open", opts); 81 | } 82 | }; 83 | SQLitePlugin.prototype.close = function(success, error) { 84 | var opts; 85 | if (this.dbPath in this.openDBs) { 86 | delete this.openDBs[this.dbPath]; 87 | opts = getOptions({ 88 | path: this.dbPath 89 | }, success, error); 90 | Cordova.exec("SQLitePlugin.close", opts); 91 | } 92 | }; 93 | return SQLitePlugin; 94 | })(); 95 | root.SQLitePluginTransaction = (function() { 96 | function SQLitePluginTransaction(dbPath) { 97 | this.dbPath = dbPath; 98 | this.executes = []; 99 | } 100 | SQLitePluginTransaction.prototype.executeSql = function(sql, params, success, error) { 101 | this.executes.push(getOptions({ 102 | query: [sql].concat(params || []), 103 | path: this.dbPath 104 | }, success, error)); 105 | }; 106 | SQLitePluginTransaction.prototype.complete = function(success, error) { 107 | var begin_opts, commit_opts, executes, opts; 108 | if (this.__completed) { 109 | throw new Error("Transaction already run"); 110 | } 111 | this.__completed = true; 112 | begin_opts = getOptions({ 113 | query: ["BEGIN;"], 114 | path: this.dbPath 115 | }); 116 | commit_opts = getOptions({ 117 | query: ["COMMIT;"], 118 | path: this.dbPath 119 | }, success, error); 120 | executes = [begin_opts].concat(this.executes).concat([commit_opts]); 121 | opts = { 122 | executes: executes 123 | }; 124 | Cordova.exec("SQLitePlugin.backgroundExecuteSqlBatch", opts); 125 | this.executes = []; 126 | }; 127 | return SQLitePluginTransaction; 128 | })(); 129 | }; 130 | //.call(this); 131 | 132 | /** 133 | * Install function 134 | 135 | SQLitePlugin.install = function() 136 | { 137 | if ( !window.plugins ) { 138 | window.plugins = {}; 139 | } 140 | if ( !window.plugins.sqlite ) { 141 | window.plugins.sqlite = new SQLitePlugin(); 142 | } 143 | }; 144 | */ 145 | /** 146 | * Add to PhoneGap constructor 147 | */ 148 | 149 | Cordova.addConstructor(SQLitePlugin); 150 | 151 | -------------------------------------------------------------------------------- /www/libs/images/layers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/www/libs/images/layers.png -------------------------------------------------------------------------------- /www/libs/images/marker-shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/www/libs/images/marker-shadow.png -------------------------------------------------------------------------------- /www/libs/images/marker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/www/libs/images/marker.png -------------------------------------------------------------------------------- /www/libs/images/popup-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/www/libs/images/popup-close.png -------------------------------------------------------------------------------- /www/libs/images/zoom-in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/www/libs/images/zoom-in.png -------------------------------------------------------------------------------- /www/libs/images/zoom-out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdavis/OfflineMbTiles/86985157d753e487018f9b99bcafed4f07d3791e/www/libs/images/zoom-out.png -------------------------------------------------------------------------------- /www/libs/leaflet.css: -------------------------------------------------------------------------------- 1 | /* required styles */ 2 | 3 | .leaflet-map-pane, 4 | .leaflet-tile, 5 | .leaflet-marker-icon, 6 | .leaflet-marker-shadow, 7 | .leaflet-tile-pane, 8 | .leaflet-overlay-pane, 9 | .leaflet-shadow-pane, 10 | .leaflet-marker-pane, 11 | .leaflet-popup-pane, 12 | .leaflet-overlay-pane svg, 13 | .leaflet-zoom-box, 14 | .leaflet-image-layer { /* TODO optimize classes */ 15 | position: absolute; 16 | } 17 | .leaflet-container { 18 | overflow: hidden; 19 | } 20 | .leaflet-tile-pane, .leaflet-container { 21 | -webkit-transform: translate3d(0,0,0); 22 | } 23 | .leaflet-tile, 24 | .leaflet-marker-icon, 25 | .leaflet-marker-shadow { 26 | -moz-user-select: none; 27 | -webkit-user-select: none; 28 | user-select: none; 29 | } 30 | .leaflet-marker-icon, 31 | .leaflet-marker-shadow { 32 | display: block; 33 | } 34 | .leaflet-clickable { 35 | cursor: pointer; 36 | } 37 | .leaflet-container img { 38 | max-width: none !important; 39 | } 40 | 41 | .leaflet-tile-pane { z-index: 2; } 42 | 43 | .leaflet-objects-pane { z-index: 3; } 44 | .leaflet-overlay-pane { z-index: 4; } 45 | .leaflet-shadow-pane { z-index: 5; } 46 | .leaflet-marker-pane { z-index: 6; } 47 | .leaflet-popup-pane { z-index: 7; } 48 | 49 | .leaflet-zoom-box { 50 | width: 0; 51 | height: 0; 52 | } 53 | 54 | .leaflet-tile { 55 | visibility: hidden; 56 | } 57 | .leaflet-tile-loaded { 58 | visibility: inherit; 59 | } 60 | 61 | a.leaflet-active { 62 | outline: 2px solid orange; 63 | } 64 | 65 | 66 | /* Leaflet controls */ 67 | 68 | .leaflet-control { 69 | position: relative; 70 | z-index: 7; 71 | } 72 | .leaflet-top, 73 | .leaflet-bottom { 74 | position: absolute; 75 | } 76 | .leaflet-top { 77 | top: 0; 78 | } 79 | .leaflet-right { 80 | right: 0; 81 | } 82 | .leaflet-bottom { 83 | bottom: 0; 84 | } 85 | .leaflet-left { 86 | left: 0; 87 | } 88 | .leaflet-control { 89 | float: left; 90 | clear: both; 91 | } 92 | .leaflet-right .leaflet-control { 93 | float: right; 94 | } 95 | .leaflet-top .leaflet-control { 96 | margin-top: 10px; 97 | } 98 | .leaflet-bottom .leaflet-control { 99 | margin-bottom: 10px; 100 | } 101 | .leaflet-left .leaflet-control { 102 | margin-left: 10px; 103 | } 104 | .leaflet-right .leaflet-control { 105 | margin-right: 10px; 106 | } 107 | 108 | .leaflet-control-zoom, .leaflet-control-layers { 109 | -moz-border-radius: 7px; 110 | -webkit-border-radius: 7px; 111 | border-radius: 7px; 112 | } 113 | .leaflet-control-zoom { 114 | padding: 5px; 115 | background: rgba(0, 0, 0, 0.25); 116 | } 117 | .leaflet-control-zoom a { 118 | background-color: rgba(255, 255, 255, 0.75); 119 | } 120 | .leaflet-control-zoom a, .leaflet-control-layers a { 121 | background-position: 50% 50%; 122 | background-repeat: no-repeat; 123 | display: block; 124 | } 125 | .leaflet-control-zoom a { 126 | -moz-border-radius: 4px; 127 | -webkit-border-radius: 4px; 128 | border-radius: 4px; 129 | width: 19px; 130 | height: 19px; 131 | } 132 | .leaflet-control-zoom a:hover { 133 | background-color: #fff; 134 | } 135 | .leaflet-big-buttons .leaflet-control-zoom a { 136 | width: 27px; 137 | height: 27px; 138 | } 139 | .leaflet-control-zoom-in { 140 | background-image: url(images/zoom-in.png); 141 | margin-bottom: 5px; 142 | } 143 | .leaflet-control-zoom-out { 144 | background-image: url(images/zoom-out.png); 145 | } 146 | 147 | .leaflet-control-layers { 148 | -moz-box-shadow: 0 0 7px #999; 149 | -webkit-box-shadow: 0 0 7px #999; 150 | box-shadow: 0 0 7px #999; 151 | 152 | background: #f8f8f9; 153 | } 154 | .leaflet-control-layers a { 155 | background-image: url(images/layers.png); 156 | width: 36px; 157 | height: 36px; 158 | } 159 | .leaflet-big-buttons .leaflet-control-layers a { 160 | width: 44px; 161 | height: 44px; 162 | } 163 | .leaflet-control-layers .leaflet-control-layers-list, 164 | .leaflet-control-layers-expanded .leaflet-control-layers-toggle { 165 | display: none; 166 | } 167 | .leaflet-control-layers-expanded .leaflet-control-layers-list { 168 | display: block; 169 | position: relative; 170 | } 171 | .leaflet-control-layers-expanded { 172 | padding: 6px 10px 6px 6px; 173 | font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif; 174 | color: #333; 175 | background: #fff; 176 | } 177 | .leaflet-control-layers input { 178 | margin-top: 2px; 179 | position: relative; 180 | top: 1px; 181 | } 182 | .leaflet-control-layers label { 183 | display: block; 184 | } 185 | .leaflet-control-layers-separator { 186 | height: 0; 187 | border-top: 1px solid #ddd; 188 | margin: 5px -10px 5px -6px; 189 | } 190 | 191 | .leaflet-container .leaflet-control-attribution { 192 | margin: 0; 193 | padding: 0 5px; 194 | 195 | font: 11px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif; 196 | color: #333; 197 | 198 | background-color: rgba(255, 255, 255, 0.7); 199 | 200 | -moz-box-shadow: 0 0 7px #ccc; 201 | -webkit-box-shadow: 0 0 7px #ccc; 202 | box-shadow: 0 0 7px #ccc; 203 | } 204 | 205 | 206 | /* Fade animations */ 207 | 208 | .leaflet-fade-anim .leaflet-tile { 209 | opacity: 0; 210 | 211 | -webkit-transition: opacity 0.2s linear; 212 | -moz-transition: opacity 0.2s linear; 213 | -o-transition: opacity 0.2s linear; 214 | transition: opacity 0.2s linear; 215 | } 216 | .leaflet-fade-anim .leaflet-tile-loaded { 217 | opacity: 1; 218 | } 219 | 220 | .leaflet-fade-anim .leaflet-popup { 221 | opacity: 0; 222 | 223 | -webkit-transition: opacity 0.2s linear; 224 | -moz-transition: opacity 0.2s linear; 225 | -o-transition: opacity 0.2s linear; 226 | transition: opacity 0.2s linear; 227 | } 228 | .leaflet-fade-anim .leaflet-map-pane .leaflet-popup { 229 | opacity: 1; 230 | } 231 | 232 | .leaflet-zoom-anim .leaflet-tile { 233 | -webkit-transition: none; 234 | -moz-transition: none; 235 | -o-transition: none; 236 | transition: none; 237 | } 238 | 239 | .leaflet-zoom-anim .leaflet-objects-pane { 240 | visibility: hidden; 241 | } 242 | 243 | 244 | /* Popup layout */ 245 | 246 | .leaflet-popup { 247 | position: absolute; 248 | text-align: center; 249 | -webkit-transform: translate3d(0,0,0); 250 | } 251 | .leaflet-popup-content-wrapper { 252 | padding: 1px; 253 | text-align: left; 254 | } 255 | .leaflet-popup-content { 256 | margin: 19px; 257 | } 258 | .leaflet-popup-tip-container { 259 | margin: 0 auto; 260 | width: 40px; 261 | height: 16px; 262 | position: relative; 263 | overflow: hidden; 264 | } 265 | .leaflet-popup-tip { 266 | width: 15px; 267 | height: 15px; 268 | padding: 1px; 269 | 270 | margin: -8px auto 0; 271 | 272 | -moz-transform: rotate(45deg); 273 | -webkit-transform: rotate(45deg); 274 | -ms-transform: rotate(45deg); 275 | -o-transform: rotate(45deg); 276 | transform: rotate(45deg); 277 | } 278 | .leaflet-popup-close-button { 279 | position: absolute; 280 | top: 9px; 281 | right: 9px; 282 | 283 | width: 10px; 284 | height: 10px; 285 | 286 | overflow: hidden; 287 | } 288 | .leaflet-popup-content p { 289 | margin: 18px 0; 290 | } 291 | 292 | 293 | /* Visual appearance */ 294 | 295 | .leaflet-container { 296 | background: #ddd; 297 | } 298 | .leaflet-container a { 299 | color: #0078A8; 300 | } 301 | .leaflet-zoom-box { 302 | border: 2px dotted #05f; 303 | background: white; 304 | opacity: 0.5; 305 | } 306 | .leaflet-popup-content-wrapper, .leaflet-popup-tip { 307 | background: white; 308 | 309 | box-shadow: 0 1px 10px #888; 310 | -moz-box-shadow: 0 1px 10px #888; 311 | -webkit-box-shadow: 0 1px 14px #999; 312 | } 313 | .leaflet-popup-content-wrapper { 314 | -moz-border-radius: 20px; 315 | -webkit-border-radius: 20px; 316 | border-radius: 20px; 317 | } 318 | .leaflet-popup-content { 319 | font: 12px/1.4 "Helvetica Neue", Arial, Helvetica, sans-serif; 320 | } 321 | .leaflet-popup-close-button { 322 | background: white url(images/popup-close.png); 323 | } 324 | -------------------------------------------------------------------------------- /www/libs/leaflet.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010-2011, CloudMade, Vladimir Agafonkin 3 | Leaflet is a modern open-source JavaScript library for interactive maps. 4 | http://leaflet.cloudmade.com 5 | */ 6 | (function(a){a.L={VERSION:"0.3",ROOT_URL:a.L_ROOT_URL||function(){var a=document.getElementsByTagName("script"),b=/\/?leaflet[\-\._]?([\w\-\._]*)\.js\??/,c,d,e,f;for(c=0,d=a.length;c0},removeEventListener:function(a,b,c){if(!this.hasEventListeners(a))return this;for(var d=0,e=this._leaflet_events,f=e[a].length;d=this.min.x&&c.x<=this.max.x&&b.y>=this.min.y&&c.y<=this.max.y},intersects:function(a){var b=this.min,c=this.max,d=a.min,e=a.max,f=e.x>=b.x&&d.x<=c.x,g=e.y>=b.y&&d.y<=c.y;return f&&g}}),L.Transformation=L.Class.extend({initialize:function(a,b,c,d){this._a=a,this._b=b,this._c=c,this._d=d},transform:function(a,b){return this._transform(a.clone(),b)},_transform:function(a,b){return b=b||1,a.x=b*(this._a*a.x+this._b),a.y=b*(this._c*a.y+this._d),a},untransform:function(a,b){return b=b||1,new L.Point((a.x/b-this._b)/this._a,(a.y/b-this._d)/this._c)}}),L.DomUtil={get:function(a){return typeof a=="string"?document.getElementById(a):a},getStyle:function(a,b){var c=a.style[b];!c&&a.currentStyle&&(c=a.currentStyle[b]);if(!c||c==="auto"){var d=document.defaultView.getComputedStyle(a,null);c=d?d[b]:null}return c==="auto"?null:c},getViewportOffset:function(a){var b=0,c=0,d=a,e=document.body;do{b+=d.offsetTop||0,c+=d.offsetLeft||0;if(d.offsetParent===e&&L.DomUtil.getStyle(d,"position")==="absolute")break;d=d.offsetParent}while(d);d=a;do{if(d===e)break;b-=d.scrollTop||0,c-=d.scrollLeft||0,d=d.parentNode}while(d);return new L.Point(c,b)},create:function(a,b,c){var d=document.createElement(a);return d.className=b,c&&c.appendChild(d),d},disableTextSelection:function(){document.selection&&document.selection.empty&&document.selection.empty(),this._onselectstart||(this._onselectstart=document.onselectstart,document.onselectstart=L.Util.falseFn)},enableTextSelection:function(){document.onselectstart=this._onselectstart,this._onselectstart=null},hasClass:function(a,b){return a.className.length>0&&RegExp("(^|\\s)"+b+"(\\s|$)").test(a.className)},addClass:function(a,b){L.DomUtil.hasClass(a,b)||(a.className+=(a.className?" ":"")+b)},removeClass:function(a,b){a.className=a.className.replace(/(\S+)\s*/g,function(a,c){return c===b?"":a}).replace(/^\s+/,"")},setOpacity:function(a,b){L.Browser.ie?a.style.filter="alpha(opacity="+Math.round(b*100)+")":a.style.opacity=b},testProp:function(a){var b=document.documentElement.style;for(var c=0;c=b.lat&&e.lat<=c.lat&&d.lng>=b.lng&&e.lng<=c.lng},intersects:function(a){var b=this._southWest,c=this._northEast,d=a.getSouthWest(),e=a.getNorthEast(),f=e.lat>=b.lat&&d.lat<=c.lat,g=e.lng>=b.lng&&d.lng<=c.lng;return f&&g},toBBoxString:function(){var a=this._southWest,b=this._northEast;return[a.lng,a.lat,b.lng,b.lat].join(",")}}),L.Projection={},L.Projection.SphericalMercator={MAX_LATITUDE:85.0511287798,project:function(a){var b=L.LatLng.DEG_TO_RAD,c=this.MAX_LATITUDE,d=Math.max(Math.min(c,a.lat),-c),e=a.lng*b,f=d*b;return f=Math.log(Math.tan(Math.PI/4+f/2)),new L.Point(e,f)},unproject:function(a,b){var c=L.LatLng.RAD_TO_DEG,d=a.x*c,e=(2*Math.atan(Math.exp(a.y))-Math.PI/2)*c;return new L.LatLng(e,d,b)}},L.Projection.LonLat={project:function(a){return new L.Point(a.lng,a.lat)},unproject:function(a,b){return new L.LatLng(a.y,a.x,b)}},L.CRS={latLngToPoint:function(a,b){var c=this.projection.project(a);return this.transformation._transform(c,b)},pointToLatLng:function(a,b,c){var d=this.transformation.untransform(a,b);return this.projection.unproject(d,c)},project:function(a){return this.projection.project(a)}},L.CRS.EPSG3857=L.Util.extend({},L.CRS,{code:"EPSG:3857",projection:L.Projection.SphericalMercator,transformation:new L.Transformation(.5/Math.PI,.5,-0.5/Math.PI,.5),project:function(a){var b=this.projection.project(a),c=6378137;return b.multiplyBy(c)}}),L.CRS.EPSG900913=L.Util.extend({},L.CRS.EPSG3857,{code:"EPSG:900913"}),L.CRS.EPSG4326=L.Util.extend({},L.CRS,{code:"EPSG:4326",projection:L.Projection.LonLat,transformation:new L.Transformation(1/360,.5,-1/360,.5)}),L.Map=L.Class.extend({includes:L.Mixin.Events,options:{crs:L.CRS.EPSG3857||L.CRS.EPSG4326,scale:function(a){return 256*Math.pow(2,a)},center:null,zoom:null,layers:[],dragging:!0,touchZoom:L.Browser.touch&&!L.Browser.android,scrollWheelZoom:!L.Browser.touch,doubleClickZoom:!0,boxZoom:!0,zoomControl:!0,attributionControl:!0,fadeAnimation:L.DomUtil.TRANSITION&&!L.Browser.android,zoomAnimation:L.DomUtil.TRANSITION&&!L.Browser.android&&!L.Browser.mobileOpera,trackResize:!0,closePopupOnClick:!0,worldCopyJump:!0},initialize:function(a,b){L.Util.setOptions(this,b),this._container=L.DomUtil.get(a);if(this._container._leaflet)throw Error("Map container is already initialized.");this._container._leaflet=!0,this._initLayout(),L.DomEvent&&(this._initEvents(),L.Handler&&this._initInteraction(),L.Control&&this._initControls()),this.options.maxBounds&&this.setMaxBounds(this.options.maxBounds);var c=this.options.center,d=this.options.zoom;c!==null&&d!==null&&this.setView(c,d,!0);var e=this.options.layers;e=e instanceof Array?e:[e],this._tileLayersNum=0,this._initLayers(e)},setView:function(a,b){return this._resetView(a,this._limitZoom(b)),this},setZoom:function(a){return this.setView(this.getCenter(),a)},zoomIn:function(){return this.setZoom(this._zoom+1)},zoomOut:function(){return this.setZoom(this._zoom-1)},fitBounds:function(a){var b=this.getBoundsZoom(a);return this.setView(a.getCenter(),b)},fitWorld:function(){var a=new L.LatLng(-60,-170),b=new L.LatLng(85,179);return this.fitBounds(new L.LatLngBounds(a,b))},panTo:function(a){return this.setView(a,this._zoom)},panBy:function(a){return this.fire("movestart"),this._rawPanBy(a),this.fire("move"),this.fire("moveend"),this},setMaxBounds:function(a){this.options.maxBounds=a;if(!a)return this._boundsMinZoom=null,this;var b=this.getBoundsZoom(a,!0);return this._boundsMinZoom=b,this._loaded&&(this._zoomf.x&&(g=f.x-d.x),c.y>e.y&&(h=e.y-c.y),c.xl&&--m>0)o=h*Math.sin(j),n=Math.PI/2-2*Math.atan(i*Math.pow((1-o)/(1+o),.5*h))-j,j+=n;return new L.LatLng(j*c,f,b)}},L.CRS.EPSG3395=L.Util.extend({},L.CRS,{code:"EPSG:3395",projection:L.Projection.Mercator,transformation:function(){var a=L.Projection.Mercator,b=a.R_MAJOR,c=a.R_MINOR;return new L.Transformation(.5/(Math.PI*b),.5,-0.5/(Math.PI*c),.5)}()}),L.TileLayer=L.Class.extend({includes:L.Mixin.Events,options:{minZoom:0,maxZoom:18,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",opacity:1,scheme:"xyz",continuousWorld:!1,noWrap:!1,zoomOffset:0,zoomReverse:!1,unloadInvisibleTiles:L.Browser.mobile,updateWhenIdle:L.Browser.mobile,reuseTiles:!1},initialize:function(a,b,c){L.Util.setOptions(this,b),this._url=a,this._urlParams=c,typeof this.options.subdomains=="string"&&(this.options.subdomains=this.options.subdomains.split(""))},onAdd:function(a,b){this._map=a,this._insertAtTheBottom=b,this._initContainer(),this._createTileProto(),a.on("viewreset",this._resetCallback,this),this.options.updateWhenIdle?a.on("moveend",this._update,this):(this._limitedUpdate=L.Util.limitExecByInterval(this._update,150,this),a.on("move",this._limitedUpdate,this)),this._reset(),this._update()},onRemove:function(a){this._map.getPanes().tilePane.removeChild(this._container),this._container=null,this._map.off("viewreset",this._resetCallback,this),this.options.updateWhenIdle?this._map.off("moveend",this._update,this):this._map.off("move",this._limitedUpdate,this)},getAttribution:function(){return this.options.attribution},setOpacity:function(a){this.options.opacity=a,this._setOpacity(a);if(L.Browser.webkit)for(var b in this._tiles)this._tiles.hasOwnProperty(b)&&(this._tiles[b].style.webkitTransform+=" translate(0,0)")},_setOpacity:function(a){a<1&&L.DomUtil.setOpacity(this._container,a)},_initContainer:function(){var a=this._map.getPanes().tilePane,b=a.firstChild;if(!this._container||a.empty)this._container=L.DomUtil.create("div","leaflet-layer"),this._insertAtTheBottom&&b?a.insertBefore(this._container,b):a.appendChild(this._container),this._setOpacity(this.options.opacity)},_resetCallback:function(a){this._reset(a.hard)},_reset:function(a){var b;for(b in this._tiles)this._tiles.hasOwnProperty(b)&&this.fire("tileunload",{tile:this._tiles[b]});this._tiles={},this.options.reuseTiles&&(this._unusedTiles=[]),a&&this._container&&(this._container.innerHTML=""),this._initContainer()},_update:function(){var a=this._map.getPixelBounds(),b=this._map.getZoom(),c=this.options.tileSize;if(b>this.options.maxZoom||ba.max.x||da.max.y)f=this._tiles[e],this.fire("tileunload",{tile:f,url:f.src}),f.parentNode===this._container&&this._container.removeChild(f),this.options.reuseTiles&&this._unusedTiles.push(this._tiles[e]),f.src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=",delete this._tiles[e]}},_addTile:function(a,b){var c=this._getTilePos(a),d=this._map.getZoom(),e=a.x+":"+a.y,f=Math.pow(2,this._getOffsetZoom(d));if(!this.options.continuousWorld){if(!this.options.noWrap)a.x=(a.x%f+f)%f;else if(a.x<0||a.x>=f){this._tilesToLoad--;return}if(a.y<0||a.y>=f){this._tilesToLoad--;return}}var g=this._getTile();L.DomUtil.setPosition(g,c),this._tiles[e]=g,this.options.scheme==="tms"&&(a.y=f-a.y-1),this._loadTile(g,a,d),b.appendChild(g)},_getOffsetZoom:function(a){return a=this.options.zoomReverse?this.options.maxZoom-a:a,a+this.options.zoomOffset},_getTilePos:function(a){var b=this._map.getPixelOrigin(),c=this.options.tileSize;return a.multiplyBy(c).subtract(b)},getTileUrl:function(a,b){var c=this.options.subdomains,d=this.options.subdomains[(a.x+a.y)%c.length];return L.Util.template(this._url,L.Util.extend({s:d,z:this._getOffsetZoom(b),x:a.x,y:a.y},this._urlParams))},_createTileProto:function(){this._tileImg=L.DomUtil.create("img","leaflet-tile"),this._tileImg.galleryimg="no";var a=this.options.tileSize;this._tileImg.style.width=a+"px",this._tileImg.style.height=a+"px"},_getTile:function(){if(this.options.reuseTiles&&this._unusedTiles.length>0){var a=this._unusedTiles.pop();return this._resetTile(a),a}return this._createTile()},_resetTile:function(a){},_createTile:function(){var a=this._tileImg.cloneNode(!1);return a.onselectstart=a.onmousemove=L.Util.falseFn,a},_loadTile:function(a,b,c){a._layer=this,a.onload=this._tileOnLoad,a.onerror=this._tileOnError,a.src=this.getTileUrl(b,c)},_tileOnLoad:function(a){var b=this._layer;this.className+=" leaflet-tile-loaded",b.fire("tileload",{tile:this,url:this.src}),b._tilesToLoad--,b._tilesToLoad||b.fire("load")},_tileOnError:function(a){var b=this._layer;b.fire("tileerror",{tile:this,url:this.src});var c=b.options.errorTileUrl;c&&(this.src=c)}}),L.TileLayer.WMS=L.TileLayer.extend({defaultWmsParams:{service:"WMS",request:"GetMap",version:"1.1.1",layers:"",styles:"",format:"image/jpeg",transparent:!1},initialize:function(a,b){this._url=a,this.wmsParams=L.Util.extend({},this.defaultWmsParams),this.wmsParams.width=this.wmsParams.height=this.options.tileSize;for(var c in b)this.options.hasOwnProperty(c)||(this.wmsParams[c]=b[c]);L.Util.setOptions(this,b)},onAdd:function(a){var b=parseFloat(this.wmsParams.version)<1.3?"srs":"crs";this.wmsParams[b]=a.options.crs.code,L.TileLayer.prototype.onAdd.call(this,a)},getTileUrl:function(a,b){var c=this.options.tileSize,d=a.multiplyBy(c),e=d.add(new L.Point(c,c)),f=this._map.unproject(d,this._zoom,!0),g=this._map.unproject(e,this._zoom,!0),h=this._map.options.crs.project(f),i=this._map.options.crs.project(g),j=[h.x,i.y,i.x,h.y].join(",");return this._url+L.Util.getParamString(this.wmsParams)+"&bbox="+j}}),L.TileLayer.Canvas=L.TileLayer.extend({options:{async:!1},initialize:function(a){L.Util.setOptions(this,a)},redraw:function(){for(var a in this._tiles){var b=this._tiles[a];this._redrawTile(b)}},_redrawTile:function(a){this.drawTile(a,a._tilePoint,a._zoom)},_createTileProto:function(){this._canvasProto=L.DomUtil.create("canvas","leaflet-tile");var a=this.options.tileSize;this._canvasProto.width=a,this._canvasProto.height=a},_createTile:function(){var a=this._canvasProto.cloneNode(!1);return a.onselectstart=a.onmousemove=L.Util.falseFn,a},_loadTile:function(a,b,c){a._layer=this,a._tilePoint=b,a._zoom=c,this.drawTile(a,b,c),this.options.async||this.tileDrawn(a)},drawTile:function(a,b,c){},tileDrawn:function(a){this._tileOnLoad.call(a)}}),L.ImageOverlay=L.Class.extend({includes:L.Mixin.Events,initialize:function(a,b){this._url=a,this._bounds=b},onAdd:function(a){this._map=a,this._image||this._initImage(),a.getPanes().overlayPane.appendChild(this._image),a.on("viewreset",this._reset,this),this._reset()},onRemove:function(a){a.getPanes().overlayPane.removeChild(this._image),a.off("viewreset",this._reset,this)},_initImage:function(){this._image=L.DomUtil.create("img","leaflet-image-layer"),this._image.style.visibility="hidden",L.Util.extend(this._image,{galleryimg:"no",onselectstart:L.Util.falseFn,onmousemove:L.Util.falseFn,onload:L.Util.bind(this._onImageLoad,this),src:this._url})},_reset:function(){var a=this._map.latLngToLayerPoint(this._bounds.getNorthWest()),b=this._map.latLngToLayerPoint(this._bounds.getSouthEast()),c=b.subtract(a);L.DomUtil.setPosition(this._image,a),this._image.style.width=c.x+"px",this._image.style.height=c.y+"px"},_onImageLoad:function(){this._image.style.visibility="",this.fire("load")}}),L.Icon=L.Class.extend({iconUrl:L.ROOT_URL+"images/marker.png",shadowUrl:L.ROOT_URL+"images/marker-shadow.png",iconSize:new L.Point(25,41),shadowSize:new L.Point(41,41),iconAnchor:new L.Point(13,41),popupAnchor:new L.Point(0,-33),initialize:function(a){a&&(this.iconUrl=a)},createIcon:function(){return this._createIcon("icon")},createShadow:function(){return this._createIcon("shadow")},_createIcon:function(a){var b=this[a+"Size"],c=this[a+"Url"];if(!c&&a==="shadow")return null;var d;return c?d=this._createImg(c):d=this._createDiv(),d.className="leaflet-marker-"+a,d.style.marginLeft=-this.iconAnchor.x+"px",d.style.marginTop=-this.iconAnchor.y+"px",b&&(d.style.width=b.x+"px",d.style.height=b.y+"px"),d},_createImg:function(a){var b;return L.Browser.ie6?(b=document.createElement("div"),b.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+a+'")'):(b=document.createElement("img"),b.src=a),b},_createDiv:function(){return document.createElement("div")}}),L.Marker=L.Class.extend({includes:L.Mixin.Events,options:{icon:new L.Icon,title:"",clickable:!0,draggable:!1,zIndexOffset:0},initialize:function(a,b){L.Util.setOptions(this,b),this._latlng=a},onAdd:function(a){this._map=a,this._initIcon(),a.on("viewreset",this._reset,this),this._reset()},onRemove:function(a){this._removeIcon(),this.closePopup&&this.closePopup(),this._map=null,a.off("viewreset",this._reset,this)},getLatLng:function(){return this._latlng},setLatLng:function(a){this._latlng=a,this._icon&&(this._reset(),this._popup&&this._popup.setLatLng(this._latlng))},setZIndexOffset:function(a){this.options.zIndexOffset=a,this._icon&&this._reset()},setIcon:function(a){this._map&&this._removeIcon(),this.options.icon=a,this._map&&(this._initIcon(),this._reset())},_initIcon:function(){this._icon||(this._icon=this.options.icon.createIcon(),this.options.title&&(this._icon.title=this.options.title),this._initInteraction()),this._shadow||(this._shadow=this.options.icon.createShadow()),this._map._panes.markerPane.appendChild(this._icon),this._shadow&&this._map._panes.shadowPane.appendChild(this._shadow)},_removeIcon:function(){this._map._panes.markerPane.removeChild(this._icon),this._shadow&&this._map._panes.shadowPane.removeChild(this._shadow),this._icon=this._shadow=null},_reset:function(){var a=this._map.latLngToLayerPoint(this._latlng).round();L.DomUtil.setPosition(this._icon,a),this._shadow&&L.DomUtil.setPosition(this._shadow,a),this._icon.style.zIndex=a.y+this.options.zIndexOffset},_initInteraction:function(){if(this.options.clickable){this._icon.className+=" leaflet-clickable",L.DomEvent.addListener(this._icon,"click",this._onMouseClick,this);var a=["dblclick","mousedown","mouseover","mouseout"];for(var b=0;bthis.options.maxWidth?this.options.maxWidth:af.x&&(d.x=c.x+this._containerWidth-f.x+e.x),c.y<0&&(d.y=c.y-e.y),c.y+a>f.y&&(d.y=c.y+a-f.y+e.y),(d.x||d.y)&&this._map.panBy(d)},_onCloseButtonClick:function(a){this._close(),L.DomEvent.stop(a)}}),L.Marker.include({openPopup:function(){return this._popup.setLatLng(this._latlng),this._map&&this._map.openPopup(this._popup),this},closePopup:function(){return this._popup&&this._popup._close(),this},bindPopup:function(a,b){return b=L.Util.extend({offset:this.options.icon.popupAnchor},b),this._popup||this.on("click",this.openPopup,this),this._popup=new L.Popup(b,this),this._popup.setContent(a),this},unbindPopup:function(){return this._popup&&(this._popup=null,this.off("click",this.openPopup)),this}}),L.Map.include({openPopup:function(a){return this.closePopup(),this._popup=a,this.addLayer(a),this.fire("popupopen",{popup:this._popup}),this},closePopup:function(){return this._popup&&(this.removeLayer(this._popup),this.fire("popupclose",{popup:this._popup}),this._popup=null),this}}),L.LayerGroup=L.Class.extend({initialize:function(a){this._layers={};if(a)for(var b=0,c=a.length;b')}}catch(a){return function(a){return document.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}()},_initPath:function(){this._container=L.Path._createElement("shape"),this._container.className+=" leaflet-vml-shape"+(this.options.clickable?" leaflet-clickable":""),this._container.coordsize="1 1",this._path=L.Path._createElement("path"),this._container.appendChild(this._path),this._map._pathRoot.appendChild(this._container)},_initStyle:function(){this.options.stroke?(this._stroke=L.Path._createElement("stroke"),this._stroke.endcap="round",this._container.appendChild(this._stroke)):this._container.stroked=!1,this.options.fill?(this._container.filled=!0,this._fill=L.Path._createElement("fill"),this._container.appendChild(this._fill)):this._container.filled=!1,this._updateStyle()},_updateStyle:function(){this.options.stroke&&(this._stroke.weight=this.options.weight+"px",this._stroke.color=this.options.color,this._stroke.opacity=this.options.opacity),this.options.fill&&(this._fill.color=this.options.fillColor||this.options.color,this._fill.opacity=this.options.fillOpacity)},_updatePath:function(){this._container.style.display="none",this._path.v=this.getPathString()+" ",this._container.style.display=""}}),L.Map.include(L.Browser.svg||!L.Browser.vml?{}:{_initPathRoot:function(){this._pathRoot||(this._pathRoot=document.createElement("div"),this._pathRoot.className="leaflet-vml-container",this._panes.overlayPane.appendChild(this._pathRoot),this.on("moveend",this._updatePathViewport),this._updatePathViewport())}}),L.Browser.canvas=function(){return!!document.createElement("canvas").getContext}(),L.Path=L.Path.SVG&&!window.L_PREFER_CANVAS||!L.Browser.canvas?L.Path:L.Path.extend({statics:{CANVAS:!0,SVG:!1},options:{updateOnMoveEnd:!0},_initElements:function(){this._map._initPathRoot(),this._ctx=this._map._canvasCtx},_updateStyle:function(){this.options.stroke&&(this._ctx.lineWidth=this.options.weight,this._ctx.strokeStyle=this.options.color),this.options.fill&&(this._ctx.fillStyle=this.options.fillColor||this.options.color)},_drawPath:function(){var a,b,c,d,e,f;this._ctx.beginPath();for(a=0,c=this._parts.length;af&&(g=h,f=i);f>c&&(b[g]=1,this._simplifyDPStep(a,b,c,d,g),this._simplifyDPStep(a,b,c,g,e))},_reducePoints:function(a,b){var c=[a[0]];for(var d=1,e=0,f=a.length;db&&(c.push(a[d]),e=d);return eb.max.x&&(c|=2),a.yb.max.y&&(c|=8),c},_sqDist:function(a,b){var c=b.x-a.x,d=b.y-a.y;return c*c+d*d},_sqClosestPointOnSegment:function(a,b,c,d){var e=b.x,f=b.y,g=c.x-e,h=c.y-f,i=g*g+h*h,j;return i>0&&(j=((a.x-e)*g+(a.y-f)*h)/i,j>1?(e=c.x,f=c.y):j>0&&(e+=g*j,f+=h*j)),g=a.x-e,h=a.y-f,d?g*g+h*h:new L.Point(e,f)}},L.Polyline=L.Path.extend({initialize:function(a,b){L.Path.prototype.initialize.call(this,b),this._latlngs=a},options:{smoothFactor:1,noClip:!1,updateOnMoveEnd:!0},projectLatlngs:function(){this._originalPoints=[];for(var a=0,b=this._latlngs.length;aa.max.x||c.y-b>a.max.y||c.x+ba.y!=e.y>a.y&&a.x<(e.x-d.x)*(a.y-d.y)/(e.y-d.y)+d.x&&(b=!b)}return b}}:{}),L.Circle.include(L.Path.CANVAS?{_drawPath:function(){var a=this._point;this._ctx.beginPath(),this._ctx.arc(a.x,a.y,this._radius,0,Math.PI*2)},_containsPoint:function(a){var b=this._point,c=this.options.stroke?this.options.weight/2:0;return a.distanceTo(b)<=this._radius+c}}:{}),L.GeoJSON=L.FeatureGroup.extend({initialize:function(a,b){L.Util.setOptions(this,b),this._geojson=a,this._layers={},a&&this.addGeoJSON(a)},addGeoJSON:function(a){if(a.features){for(var b=0,c=a.features.length;b1)return;var b=a.touches&&a.touches.length===1?a.touches[0]:a,c=b.target;L.DomEvent.preventDefault(a),L.Browser.touch&&c.tagName.toLowerCase()==="a"&&(c.className+=" leaflet-active"),this._moved=!1;if(this._moving)return;L.Browser.touch||(L.DomUtil.disableTextSelection(),this._setMovingCursor()),this._startPos=this._newPos=L.DomUtil.getPosition(this._element),this._startPoint=new L.Point(b.clientX,b.clientY),L.DomEvent.addListener(document,L.Draggable.MOVE,this._onMove,this),L.DomEvent.addListener(document,L.Draggable.END,this._onUp,this)},_onMove:function(a){if(a.touches&&a.touches.length>1)return;L.DomEvent.preventDefault(a);var b=a.touches&&a.touches.length===1?a.touches[0]:a;this._moved||(this.fire("dragstart"),this._moved=!0),this._moving=!0;var c=new L.Point(b.clientX,b.clientY);this._newPos=this._startPos.add(c).subtract(this._startPoint),L.Util.requestAnimFrame(this._updatePosition,this,!0,this._dragStartTarget)},_updatePosition:function(){this.fire("predrag"),L.DomUtil.setPosition(this._element,this._newPos),this.fire("drag")},_onUp:function(a){if(a.changedTouches){var b=a.changedTouches[0],c=b.target,d=this._newPos&&this._newPos.distanceTo(this._startPos)||0;c.tagName.toLowerCase()==="a"&&(c.className=c.className.replace(" leaflet-active","")),d0&&c<=f,d=b}function l(a){e&&(g.type="dblclick",b(g),d=null)}var d,e=!1,f=250,g,h="_leaflet_",i="touchstart",j="touchend";a[h+i+c]=k,a[h+j+c]=l,a.addEventListener(i,k,!1),a.addEventListener(j,l,!1)},removeDoubleTapListener:function(a,b){var c="_leaflet_";a.removeEventListener(a,a[c+"touchstart"+b],!1),a.removeEventListener(a,a[c+"touchend"+b],!1)}}),L.Map.TouchZoom=L.Handler.extend({addHooks:function(){L.DomEvent.addListener(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){L.DomEvent.removeListener(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(a){if(!a.touches||a.touches.length!==2||this._map._animatingZoom)return;var b=this._map.mouseEventToLayerPoint(a.touches[0]),c=this._map.mouseEventToLayerPoint(a.touches[1]),d=this._map.containerPointToLayerPoint(this._map.getSize().divideBy(2));this._startCenter=b.add(c).divideBy(2,!0),this._startDist=b.distanceTo(c),this._moved=!1,this._zooming=!0,this._centerOffset=d.subtract(this._startCenter),L.DomEvent.addListener(document,"touchmove",this._onTouchMove,this),L.DomEvent.addListener(document,"touchend",this._onTouchEnd,this),L.DomEvent.preventDefault(a)},_onTouchMove:function(a){if(!a.touches||a.touches.length!==2)return;this._moved||(this._map._mapPane.className+=" leaflet-zoom-anim",this._map.fire("zoomstart").fire("movestart")._prepareTileBg(),this._moved=!0);var b=this._map.mouseEventToLayerPoint(a.touches[0]),c=this._map.mouseEventToLayerPoint(a.touches[1]);this._scale=b.distanceTo(c)/this._startDist,this._delta=b.add(c).divideBy(2,!0).subtract(this._startCenter),this._map._tileBg.style.webkitTransform=[L.DomUtil.getTranslateString(this._delta),L.DomUtil.getScaleString(this._scale,this._startCenter)].join(" "),L.DomEvent.preventDefault(a)},_onTouchEnd:function(a){if(!this._moved||!this._zooming)return;this._zooming=!1;var b=this._map.getZoom(),c=Math.log(this._scale)/Math.LN2,d=c>0?Math.ceil(c):Math.floor(c),e=this._map._limitZoom(b+d),f=e-b,g=this._centerOffset.subtract(this._delta).divideBy(this._scale),h=this._map.getPixelOrigin().add(this._startCenter).add(g),i=this._map.unproject(h);L.DomEvent.removeListener(document,"touchmove",this._onTouchMove),L.DomEvent.removeListener(document,"touchend",this._onTouchEnd);var j=Math.pow(2,f);this._map._runAnimation(i,e,j/this._scale,this._startCenter.add(g))}}),L.Map.BoxZoom=L.Handler.extend({initialize:function(a){this._map=a,this._container=a._container,this._pane=a._panes.overlayPane},addHooks:function(){L.DomEvent.addListener(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){L.DomEvent.removeListener(this._container,"mousedown",this._onMouseDown)},_onMouseDown:function(a){if(!a.shiftKey||a.which!==1&&a.button!==1)return!1;L.DomUtil.disableTextSelection(),this._startLayerPoint=this._map.mouseEventToLayerPoint(a),this._box=L.DomUtil.create("div","leaflet-zoom-box",this._pane),L.DomUtil.setPosition(this._box,this._startLayerPoint),this._container.style.cursor="crosshair",L.DomEvent.addListener(document,"mousemove",this._onMouseMove,this),L.DomEvent.addListener(document,"mouseup",this._onMouseUp,this),L.DomEvent.preventDefault(a)},_onMouseMove:function(a){var b=this._map.mouseEventToLayerPoint(a),c=b.x-this._startLayerPoint.x,d=b.y-this._startLayerPoint.y,e=Math.min(b.x,this._startLayerPoint.x),f=Math.min(b.y,this._startLayerPoint.y),g=new L.Point(e,f);L.DomUtil.setPosition(this._box,g),this._box.style.width=Math.abs(c)-4+"px",this._box.style.height=Math.abs(d)-4+"px"},_onMouseUp:function(a){this._pane.removeChild(this._box),this._container.style.cursor="",L.DomUtil.enableTextSelection(),L.DomEvent.removeListener(document,"mousemove",this._onMouseMove),L.DomEvent.removeListener(document,"mouseup",this._onMouseUp);var b=this._map.mouseEventToLayerPoint(a),c=new L.LatLngBounds(this._map.layerPointToLatLng(this._startLayerPoint),this._map.layerPointToLatLng(b));this._map.fitBounds(c)}}),L.Handler.MarkerDrag=L.Handler.extend({initialize:function(a){this._marker=a},addHooks:function(){var a=this._marker._icon;this._draggable||(this._draggable=new L.Draggable(a,a),this._draggable.on("dragstart",this._onDragStart,this).on("drag",this._onDrag,this).on("dragend",this._onDragEnd,this)),this._draggable.enable()},removeHooks:function(){this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},_onDragStart:function(a){this._marker.closePopup().fire("movestart").fire("dragstart")},_onDrag:function(a){var b=L.DomUtil.getPosition(this._marker._icon);this._marker._shadow&&L.DomUtil.setPosition(this._marker._shadow,b),this._marker._latlng=this._marker._map.layerPointToLatLng(b),this._marker.fire("move").fire("drag")},_onDragEnd:function(){this._marker.fire("moveend").fire("dragend")}}),L.Control={},L.Control.Position={TOP_LEFT:"topLeft",TOP_RIGHT:"topRight",BOTTOM_LEFT:"bottomLeft",BOTTOM_RIGHT:"bottomRight"},L.Map.include({addControl:function(a){a.onAdd(this);var b=a.getPosition(),c=this._controlCorners[b],d=a.getContainer();return L.DomUtil.addClass(d,"leaflet-control"),b.indexOf("bottom")!==-1?c.insertBefore(d,c.firstChild):c.appendChild(d),this},removeControl:function(a){var b=a.getPosition(),c=this._controlCorners[b],d=a.getContainer();return c.removeChild(d),a.onRemove&&a.onRemove(this),this},_initControlPos:function(){var a=this._controlCorners={},b="leaflet-",c=b+"top",d=b+"bottom",e=b+"left",f=b+"right",g=L.DomUtil.create("div",b+"control-container",this._container);L.Browser.touch&&(g.className+=" "+b+"big-buttons"),a.topLeft=L.DomUtil.create("div",c+" "+e,g),a.topRight=L.DomUtil.create("div",c+" "+f,g),a.bottomLeft=L.DomUtil.create("div",d+" "+e,g),a.bottomRight=L.DomUtil.create("div",d+" "+f,g)}}),L.Control.Zoom=L.Class.extend({onAdd:function(a){this._map=a,this._container=L.DomUtil.create("div","leaflet-control-zoom"),this._zoomInButton=this._createButton("Zoom in","leaflet-control-zoom-in",this._map.zoomIn,this._map),this._zoomOutButton=this._createButton("Zoom out","leaflet-control-zoom-out",this._map.zoomOut,this._map),this._container.appendChild(this._zoomInButton),this._container.appendChild(this._zoomOutButton)},getContainer:function(){return this._container},getPosition:function(){return L.Control.Position.TOP_LEFT},_createButton:function(a,b,c,d){var e=document.createElement("a");return e.href="#",e.title=a,e.className=b,L.Browser.touch||L.DomEvent.disableClickPropagation(e),L.DomEvent.addListener(e,"click",L.DomEvent.preventDefault),L.DomEvent.addListener(e,"click",c,d),e}}),L.Control.Attribution=L.Class.extend({initialize:function(a){this._prefix=a||'Powered by Leaflet',this._attributions={}},onAdd:function(a){this._container=L.DomUtil.create("div","leaflet-control-attribution"),L.DomEvent.disableClickPropagation(this._container),this._map=a,this._update()},getPosition:function(){return L.Control.Position.BOTTOM_RIGHT},getContainer:function(){return this._container},setPrefix:function(a){this._prefix=a,this._update()},addAttribution:function(a){if(!a)return;this._attributions[a]||(this._attributions[a]=0),this._attributions[a]++,this._update()},removeAttribution:function(a){if(!a)return;this._attributions[a]--,this._update()},_update:function(){if(!this._map)return;var a=[];for(var b in this._attributions)this._attributions.hasOwnProperty(b)&&a.push(b);var c=[];this._prefix&&c.push(this._prefix),a.length&&c.push(a.join(", ")),this._container.innerHTML=c.join(" — ")}}),L.Control.Layers=L.Class.extend({options:{collapsed:!0},initialize:function(a,b,c){L.Util.setOptions(this,c),this._layers={};for(var d in a)a.hasOwnProperty(d)&&this._addLayer(a[d],d);for(d in b)b.hasOwnProperty(d)&&this._addLayer(b[d],d,!0)},onAdd:function(a){this._map=a,this._initLayout(),this._update()},getContainer:function(){return this._container},getPosition:function(){return L.Control.Position.TOP_RIGHT},addBaseLayer:function(a,b){return this._addLayer(a,b),this._update(),this},addOverlay:function(a,b){return this._addLayer(a,b,!0),this._update(),this},removeLayer:function(a){var b=L.Util.stamp(a);return delete this._layers[b],this._update(),this},_initLayout:function(){this._container=L.DomUtil.create("div","leaflet-control-layers"),L.Browser.touch||L.DomEvent.disableClickPropagation(this._container),this._form=L.DomUtil.create("form","leaflet-control-layers-list");if(this.options.collapsed){L.DomEvent.addListener(this._container,"mouseover",this._expand,this),L.DomEvent.addListener(this._container,"mouseout",this._collapse,this);var a=this._layersLink=L.DomUtil.create("a","leaflet-control-layers-toggle");a.href="#",a.title="Layers",L.Browser.touch?L.DomEvent.addListener(a,"click",this._expand,this):L.DomEvent.addListener(a,"focus",this._expand,this),this._map.on("movestart",this._collapse,this),this._container.appendChild(a)}else this._expand();this._baseLayersList=L.DomUtil.create("div","leaflet-control-layers-base",this._form),this._separator=L.DomUtil.create("div","leaflet-control-layers-separator",this._form),this._overlaysList=L.DomUtil.create("div","leaflet-control-layers-overlays",this._form),this._container.appendChild(this._form)},_addLayer:function(a,b,c){var d=L.Util.stamp(a);this._layers[d]={layer:a,name:b,overlay:c}},_update:function(){if(!this._container)return;this._baseLayersList.innerHTML="",this._overlaysList.innerHTML="";var a=!1,b=!1;for(var c in this._layers)if(this._layers.hasOwnProperty(c)){var d=this._layers[c];this._addItem(d),b=b||d.overlay,a=a||!d.overlay}this._separator.style.display=b&&a?"":"none"},_addItem:function(a,b){var c=document.createElement("label"),d=document.createElement("input");a.overlay||(d.name="leaflet-base-layers"),d.type=a.overlay?"checkbox":"radio",d.checked=this._map.hasLayer(a.layer),d.layerId=L.Util.stamp(a.layer),L.DomEvent.addListener(d,"click",this._onInputClick,this);var e=document.createTextNode(" "+a.name);c.appendChild(d),c.appendChild(e);var f=a.overlay?this._overlaysList:this._baseLayersList;f.appendChild(c)},_onInputClick:function(){var a,b,c,d=this._form.getElementsByTagName("input"),e=d.length;for(a=0;a