rhodes 2.2.6 → 2.3.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +20 -0
- data/README.md +46 -0
- data/Rakefile +85 -80
- data/bin/rhodes +2 -2
- data/bin/rhogen +1 -1
- data/doc/application.txt +277 -0
- data/doc/bb-css.txt +209 -0
- data/doc/build.txt +785 -0
- data/doc/configuration.txt +236 -0
- data/doc/connect-to-web-services.txt +282 -0
- data/doc/contributing.txt +64 -0
- data/doc/css-framework.txt +144 -0
- data/doc/device-caps.txt +1152 -0
- data/doc/extensions.txt +528 -0
- data/doc/files.txt +4 -0
- data/doc/generator.txt +141 -0
- data/doc/install.txt +35 -0
- data/doc/introduction.txt +88 -0
- data/doc/rhom.txt +826 -0
- data/doc/standard-css.txt +392 -0
- data/doc/synchronization.txt +542 -0
- data/doc/test-log-debug.txt +148 -0
- data/doc/tutorial.txt +136 -0
- data/doc/ui.txt +766 -0
- data/installer/EnvVarUpdate.nsh +328 -0
- data/installer/README.html +81 -0
- data/installer/RHOSYNC-LICENSE.txt +675 -0
- data/installer/icon.ico +0 -0
- data/installer/instant-rhodes.nsi +427 -0
- data/lib/build/jake.rb +15 -1
- data/lib/extensions/barcode/ext/barcode/platform/android/jni/src/imageprovider.cpp +1 -1
- data/lib/extensions/barcode/ext/barcode/platform/bb/Barcode6.files +45 -0
- data/lib/extensions/barcode/ext/barcode/platform/bb/Rakefile +6 -0
- data/lib/extensions/barcode/ext/barcode/platform/bb/barcode6.jdp +92 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +7 -4
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Rakefile +2 -1
- data/lib/extensions/barcode/ext/barcode/platform/wm/src/wm_imageprovider.cpp +1 -1
- data/lib/extensions/digest-sha1/ext/build.bat +1 -0
- data/lib/extensions/digest-sha1/ext/digest-sha1.vcproj +335 -0
- data/lib/extensions/esri/ext/build +17 -0
- data/lib/extensions/esri/ext/build.bat +29 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewFactory.h +7 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewFactory.mm +58 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewFactoryRegister.mm +22 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewManager.h +21 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewManager.mm +32 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/InitESRI.c +5 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/MapViewControllerESRI.h +143 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/MapViewControllerESRI.m +919 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/ESRI.xcodeproj/project.pbxproj +320 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/ESRI_Prefix.pch +7 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Rakefile +76 -0
- data/lib/extensions/esri/ext.yml +3 -0
- data/lib/extensions/net-http/monitor.rb +265 -0
- data/lib/extensions/net-http/net/ftp.rb +981 -0
- data/lib/extensions/net-http/thread.rb +367 -0
- data/lib/extensions/rhocgi/cgi.rb +16 -0
- data/lib/extensions/rhospec/rhospec.rb +118 -0
- data/lib/framework/base64.rb +91 -0
- data/lib/framework/builtinME.rb +13 -10
- data/lib/framework/ostruct.rb +145 -0
- data/lib/framework/res/back_btn.wm.png +0 -0
- data/lib/framework/res/blue_pushpin.wm.png +0 -0
- data/lib/framework/res/blue_pushpin_small.wm.png +0 -0
- data/lib/framework/res/callout.wm.png +0 -0
- data/lib/framework/res/callout_link.wm.png +0 -0
- data/lib/framework/res/forward_btn.wm.png +0 -0
- data/lib/framework/res/home_btn.wm.png +0 -0
- data/lib/framework/res/options_btn.wm.png +0 -0
- data/lib/framework/res/refresh_btn.wm.png +0 -0
- data/lib/framework/rho/render.rb +5 -2
- data/lib/framework/rho/rho.rb +320 -50
- data/lib/framework/rho/rhoapplication.rb +48 -10
- data/lib/framework/rho/rhonativeviewmanager.rb +73 -0
- data/lib/framework/rho/rhosupport.rb +15 -1
- data/lib/framework/rho/rhotabbar.rb +29 -0
- data/lib/framework/rho/rhotoolbar.rb +17 -0
- data/lib/framework/rho/rhoutils.rb +22 -6
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rholang/rhomsg_de.rb +4 -3
- data/lib/framework/rholang/rhomsg_en.rb +1 -0
- data/lib/framework/rholang/rhomsg_es.rb +1 -0
- data/lib/framework/rholang/rhomsg_it.rb +1 -0
- data/lib/framework/rhom/rhom.rb +31 -10
- data/lib/framework/rhom/rhom_db_adapter.rb +33 -23
- data/lib/framework/rhom/rhom_object_factory.rb +465 -249
- data/lib/framework/rhom/rhom_source.rb +22 -7
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.xml +83 -20
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +5 -0
- data/platform/android/Rhodes/jni/include/rhodes/RhoClassFactory.h +2 -0
- data/platform/android/Rhodes/jni/include/rhodes/details/rhojava.inc +9 -5
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesAppOptions.h +53 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +46 -56
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_SplashScreen.h +10 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_mapview_MapView.h +93 -0
- data/platform/android/Rhodes/jni/include/rhodes/rhocryptimpl.h +38 -0
- data/platform/android/Rhodes/jni/include/rhodes.h +64 -8
- data/platform/android/Rhodes/jni/src/RhoClassFactory.cpp +6 -0
- data/platform/android/Rhodes/jni/src/alert.cpp +5 -11
- data/platform/android/Rhodes/jni/src/bluetooth.cpp +66 -29
- data/platform/android/Rhodes/jni/src/callbacks.cpp +24 -21
- data/platform/android/Rhodes/jni/src/camera.cpp +2 -6
- data/platform/android/Rhodes/jni/src/datetimepicker.cpp +13 -11
- data/platform/android/Rhodes/jni/src/event.cpp +9 -15
- data/platform/android/Rhodes/jni/src/fileapi.cpp +13 -27
- data/platform/android/Rhodes/jni/src/logconf.cpp +3 -3
- data/platform/android/Rhodes/jni/src/mapview.cpp +696 -16
- data/platform/android/Rhodes/jni/src/menu.cpp +3 -3
- data/platform/android/Rhodes/jni/src/nativebar.cpp +55 -4
- data/platform/android/Rhodes/jni/src/nativeview.cpp +33 -0
- data/platform/android/Rhodes/jni/src/phonebook.cpp +6 -11
- data/platform/android/Rhodes/jni/src/rhoconf.cpp +4 -4
- data/platform/android/Rhodes/jni/src/rhocryptimpl.cpp +87 -0
- data/platform/android/Rhodes/jni/src/rhodes.cpp +55 -34
- data/platform/android/Rhodes/jni/src/ringtones.cpp +2 -3
- data/platform/android/Rhodes/jni/src/signature.cpp +3 -5
- data/platform/android/Rhodes/jni/src/splashscreen.cpp +7 -0
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +17 -20
- data/platform/android/Rhodes/jni/src/webview.cpp +13 -12
- data/platform/android/Rhodes/res/drawable/callout.png +0 -0
- data/platform/android/Rhodes/res/drawable/callout_link.png +0 -0
- data/platform/android/Rhodes/res/drawable/signature_cancel.png +0 -0
- data/platform/android/Rhodes/res/drawable/signature_clear.png +0 -0
- data/platform/android/Rhodes/res/drawable/signature_ok.png +0 -0
- data/platform/android/Rhodes/res/layout/datetime.xml +4 -0
- data/platform/android/Rhodes/res/layout/signature.xml +24 -17
- data/platform/android/Rhodes/res/layout/status_bar_ongoing_event_progress_bar.xml +102 -0
- data/platform/android/Rhodes/res/values/strings.xml +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +6 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Base64.java +575 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +83 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +21 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +23 -15
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoCryptImpl.java +151 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMenu.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +372 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesAppOptions.java +11 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +58 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +705 -523
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RingtoneManager.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +167 -85
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Utils.java +36 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +4 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +33 -20
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/IRhoBluetoothManager.java +2 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManager.java +2 -24
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerNew.java +106 -36
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerOld.java +15 -58
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothSession.java +0 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/Camera.java +6 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/FileList.java +4 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +91 -27
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePicker.java +6 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePickerScreen.java +275 -42
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +1 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +120 -43
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +518 -28
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/AnnotationsOverlay.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java +434 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapTouch.java +20 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +296 -336
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MultiTouchHandler.java +111 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/OneTouchHandler.java +77 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/TouchHandler.java +10 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +0 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Contact.java +5 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorOld.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/ImageCapture.java +6 -11
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +6 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +0 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/ui/LogViewDialog.java +9 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +8 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientNew.java +5 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientOld.java +11 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsNew.java +3 -5
- data/platform/android/build/RhodesSRC_build.files +32 -23
- data/platform/android/build/android.rake +28 -11
- data/platform/android/build/androidcommon.rb +2 -0
- data/platform/android/build/librhocommon_build.files +9 -5
- data/platform/android/build/librhodes_build.files +1 -0
- data/platform/android/build/libruby_build.files +1 -0
- data/platform/bb/Hsqldb/Hsqldb.jdp +0 -2
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +10 -2
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +37 -5
- data/platform/bb/Hsqldb/src/org/hsqldb/Column.java +5 -5
- data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Function.java +73 -78
- data/platform/bb/Hsqldb/src/org/hsqldb/Library.java +288 -8
- data/platform/bb/RubyVM/RubyVM.jdp +3 -0
- data/platform/bb/RubyVM/src/com/rho/FilePath.java +13 -1
- data/platform/bb/RubyVM/src/com/rho/IRhoRubyHelper.java +2 -2
- data/platform/bb/RubyVM/src/com/rho/RhoAppAdapter.java +12 -0
- data/platform/bb/RubyVM/src/com/rho/RhoClassFactory.java +18 -1
- data/platform/bb/RubyVM/src/com/rho/RhoConf.java +128 -108
- data/platform/bb/RubyVM/src/com/rho/RhoLogConf.java +9 -10
- data/platform/bb/RubyVM/src/com/rho/RhoLogger.java +16 -1
- data/platform/bb/RubyVM/src/com/rho/RhoProfiler.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +20 -0
- data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +5 -2
- data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +65 -46
- data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +192 -50
- data/platform/bb/RubyVM/src/com/rho/db/DBAttrManager.java +8 -114
- data/platform/bb/RubyVM/src/com/rho/db/DBException.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/db/IDBCallback.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/db/IDBResult.java +5 -3
- data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +5 -1
- data/platform/bb/RubyVM/src/com/rho/file/FileAccessBB.java +109 -0
- data/platform/bb/RubyVM/src/com/rho/file/RhoFile.java +85 -0
- data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +12 -4
- data/platform/bb/RubyVM/src/com/rho/net/NetResponse.java +5 -0
- data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +37 -23
- data/platform/bb/RubyVM/src/com/rho/net/URI.java +84 -0
- data/platform/bb/RubyVM/src/com/rho/sync/ClientRegister.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +119 -61
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +61 -24
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +108 -54
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +121 -163
- data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyString_Methods.java +23 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyMutex.java +1 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyRange.java +3 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyRegexp.java +3 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyString.java +208 -25
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyTime.java +3 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RhoSupport.java +5 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyAPI.java +12 -5
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyID.java +1 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule.java +16 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule_Methods.java +5 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyValue.java +1 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/stdlib/RubyStringIO.java +4 -1
- data/platform/bb/{Hsqldb → RubyVM}/src/j2me/math/Number.java +33 -0
- data/platform/bb/build/RubyVM_build.files +3 -0
- data/platform/bb/build/bb.rake +140 -62
- data/platform/bb/build/hsqldb_build.files +0 -2
- data/platform/bb/build/rhodes_build.files +5 -0
- data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +43 -7
- data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +23 -2
- data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +5 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteCopyResult.java +143 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteResult.java +269 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteStorage.java +446 -0
- data/platform/bb/rhodes/platform/common/com/rho/BrowserAdapter5.java +3 -0
- data/platform/bb/rhodes/platform/common/com/rho/RhoMainScreen.java +12 -2
- data/platform/bb/rhodes/platform/common/com/rho/db/SqliteCopyResult.java +2 -0
- data/platform/bb/rhodes/platform/common/com/rho/db/SqliteResult.java +2 -0
- data/platform/bb/rhodes/platform/common/com/rho/db/SqliteStorage.java +2 -0
- data/platform/bb/rhodes/resources/mappin.png +0 -0
- data/platform/bb/rhodes/rhodes.jdp +3 -0
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +21 -18
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +150 -0
- data/platform/bb/rhodes/src/com/rho/IBrowserAdapter.java +1 -0
- data/platform/bb/rhodes/src/com/rho/RhoMainScreen.java +63 -4
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +6 -5
- data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +242 -2
- data/platform/bb/rhodes/src/com/rho/db/SqliteCopyResult.java +143 -0
- data/platform/bb/rhodes/src/com/rho/db/SqliteResult.java +269 -0
- data/platform/bb/rhodes/src/com/rho/db/SqliteStorage.java +446 -0
- data/platform/bb/rhodes/src/com/rho/file/Jsr75File.java +1 -1
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +71 -14
- data/platform/bb/rhodes/src/com/rho/net/bb/BBHttpConnection.java +4 -2
- data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +28 -12
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +100 -4
- data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +3 -2
- data/platform/bb/rhodes/src/com/rho/rubyext/XMLParser.java +1 -1
- data/platform/bb/rhodes/src/rhomobile/NativeBar.java +32 -0
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +9 -2
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +174 -41
- data/platform/bb/rhodes/src/rhomobile/datetime/DateTimePicker.java +52 -3
- data/platform/bb/rhodes/src/rhomobile/datetime/DateTimeScreen.java +33 -1
- data/platform/bb/rhodes/src/rhomobile/mapview/Annotation.java +2 -14
- data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapField.java +686 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapProvider.java +14 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/GeoCoding.java +13 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/GoogleGeoCoding.java +174 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/GoogleMapField.java +104 -330
- data/platform/bb/rhodes/src/rhomobile/mapview/MapTools.java +79 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/MapView.java +35 -12
- data/platform/bb/rhodes/src/rhomobile/mapview/MapViewParent.java +2 -1
- data/platform/bb/rhodes/src/rhomobile/mapview/MapViewScreen.java +336 -44
- data/platform/bb/rhodes/src/rhomobile/mapview/RhoMapField.java +3 -6
- data/platform/iphone/Classes/AppManager/AppManager.m +19 -4
- data/platform/iphone/Classes/DateTime.h +4 -0
- data/platform/iphone/Classes/DateTime.m +1 -1
- data/platform/iphone/Classes/DateTimePicker.m +8 -1
- data/platform/iphone/Classes/DateTimePickerDelegate.m +7 -1
- data/platform/iphone/Classes/Event/Event.m +2 -2
- data/platform/iphone/Classes/MapView/MapViewController.h +4 -1
- data/platform/iphone/Classes/MapView/MapViewController.m +6 -46
- data/platform/iphone/Classes/MapView/MapViewManager.h +26 -0
- data/platform/iphone/Classes/MapView/MapViewManager.m +172 -0
- data/platform/iphone/Classes/NativeBar.h +34 -0
- data/platform/iphone/Classes/NativeBar.m +131 -26
- data/platform/iphone/Classes/NativeView/NVDelegate.h +26 -0
- data/platform/iphone/Classes/NativeView/NVDelegate.m +40 -0
- data/platform/iphone/Classes/NativeView/NVViewController.h +24 -0
- data/platform/iphone/Classes/NativeView/NVViewController.m +90 -0
- data/platform/iphone/Classes/NativeView/RhoNativeViewManager.mm +449 -0
- data/platform/iphone/Classes/{RhoNativeViewManagerOC.h → NativeView/RhoNativeViewManagerOC.h} +15 -0
- data/platform/iphone/Classes/RhoAlert.m +3 -3
- data/platform/iphone/Classes/RhoMainView.h +3 -0
- data/platform/iphone/Classes/Rhodes.h +6 -2
- data/platform/iphone/Classes/Rhodes.m +47 -79
- data/platform/iphone/Classes/Signature/SignatureViewController.m +1 -0
- data/platform/iphone/Classes/SimpleMainView.h +18 -1
- data/platform/iphone/Classes/SimpleMainView.m +180 -35
- data/platform/iphone/Classes/SplitView/LeftViewController.h +1 -1
- data/platform/iphone/Classes/SplitView/LeftViewController.m +13 -7
- data/platform/iphone/Classes/SplitView/RightViewController.h +1 -1
- data/platform/iphone/Classes/SplitView/RightViewController.m +26 -11
- data/platform/iphone/Classes/SplitView/SplittedMainView.h +1 -6
- data/platform/iphone/Classes/SplitView/SplittedMainView.m +14 -52
- data/platform/iphone/Classes/TabbedMainView.h +25 -3
- data/platform/iphone/Classes/TabbedMainView.m +340 -14
- data/platform/iphone/ESRI/BluePushpin.png +0 -0
- data/platform/iphone/ESRI/BluePushpin@2x.png +0 -0
- data/platform/iphone/ESRI/esri.png +0 -0
- data/platform/iphone/ESRI/esri@2x.png +0 -0
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +26 -3
- data/platform/iphone/rbuild/iphone.rake +100 -4
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +12 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +116 -12
- data/platform/shared/SyncClient/SyncClient.cpp +29 -3
- data/platform/shared/SyncClient/SyncClient.h +2 -1
- data/platform/shared/common/IRhoClassFactory.h +3 -0
- data/platform/shared/common/IRhoCrypt.h +16 -0
- data/platform/shared/common/IRhoThreadImpl.h +1 -0
- data/platform/shared/common/RhoAppAdapter.h +2 -0
- data/platform/shared/common/RhoConf.cpp +97 -46
- data/platform/shared/common/RhoConf.h +14 -13
- data/platform/shared/common/RhoFile.cpp +10 -0
- data/platform/shared/common/RhoFile.h +1 -0
- data/platform/shared/common/RhoMath.cpp +43 -0
- data/platform/shared/common/RhoMath.h +27 -0
- data/platform/shared/common/RhoNativeViewManager.h +27 -1
- data/platform/shared/common/RhoPort.h +11 -0
- data/platform/shared/common/RhoStd.h +5 -0
- data/platform/shared/common/RhoThread.cpp +1 -1
- data/platform/shared/common/RhoThread.h +1 -1
- data/platform/shared/common/RhodesApp.cpp +381 -139
- data/platform/shared/common/RhodesApp.h +24 -10
- data/platform/shared/common/RhodesAppBase.cpp +72 -1
- data/platform/shared/common/RhodesAppBase.h +5 -1
- data/platform/shared/common/SplashScreen.h +4 -4
- data/platform/shared/common/ThreadQueue.cpp +44 -17
- data/platform/shared/common/ThreadQueue.h +4 -0
- data/platform/shared/common/app_build_configs.c +0 -1
- data/platform/shared/common/iphone/RhoClassfactory.h +6 -0
- data/platform/shared/common/iphone/RhoCryptImpl.h +47 -0
- data/platform/shared/common/iphone/RhoCryptImpl.mm +286 -0
- data/platform/shared/common/map/ESRIMapEngine.cpp +921 -0
- data/platform/shared/common/map/ESRIMapEngine.h +255 -0
- data/platform/shared/common/map/GoogleMapEngine.cpp +160 -0
- data/platform/shared/common/map/GoogleMapEngine.h +52 -0
- data/platform/shared/common/map/MapEngine.cpp +304 -0
- data/platform/shared/common/map/MapEngine.h +214 -0
- data/platform/shared/db/DBAdapter.cpp +147 -18
- data/platform/shared/db/DBAdapter.h +38 -12
- data/platform/shared/db/DBAttrManager.cpp +4 -3
- data/platform/shared/db/DBAttrManager.h +7 -7
- data/platform/shared/db/res/db/syncdb.triggers +0 -5
- data/platform/shared/db/res/db/syncdb_java.triggers +21 -0
- data/platform/shared/json/JSONIterator.cpp +11 -1
- data/platform/shared/json/JSONIterator.h +1 -0
- data/platform/shared/logging/RhoLogConf.cpp +29 -12
- data/platform/shared/net/CURLNetRequest.cpp +80 -25
- data/platform/shared/net/CURLNetRequest.h +6 -2
- data/platform/shared/net/HttpServer.cpp +12 -6
- data/platform/shared/net/HttpServer.h +2 -1
- data/platform/shared/net/INetRequest.h +1 -0
- data/platform/shared/ruby/ext/alert/alert.i +5 -0
- data/platform/shared/ruby/ext/alert/alert_wrap.c +439 -108
- data/platform/shared/ruby/ext/datetimepicker/datetimepicker.i +42 -0
- data/platform/shared/ruby/ext/datetimepicker/datetimepicker_wrap.c +521 -120
- data/platform/shared/ruby/ext/nativebar/nativebar.i +16 -0
- data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +623 -128
- data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager.i +18 -0
- data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager_wrap.c +2321 -0
- data/platform/shared/ruby/ext/rho/extensions.c +0 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +53 -0
- data/platform/shared/ruby/ext/rho/rhoruby.h +6 -0
- data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +6 -3
- data/platform/shared/ruby/ext/syncengine/syncengine.i +9 -1
- data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +61 -0
- data/platform/shared/ruby/ext/system/system.i +4 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +33 -5
- data/platform/shared/rubyext/RhoAppAdapter.cpp +11 -1
- data/platform/shared/rubyext/System.cpp +9 -0
- data/platform/shared/rubyext/WebView.h +1 -0
- data/platform/shared/sqlite/crypto.c +907 -0
- data/platform/shared/sqlite/sqlite3.c +6 -0
- data/platform/shared/sync/SyncEngine.cpp +49 -19
- data/platform/shared/sync/SyncEngine.h +0 -1
- data/platform/shared/sync/SyncNotify.cpp +14 -5
- data/platform/shared/sync/SyncNotify.h +2 -2
- data/platform/shared/sync/SyncSource.cpp +79 -33
- data/platform/shared/sync/SyncSource.h +1 -0
- data/platform/shared/sync/SyncThread.cpp +26 -11
- data/platform/shared/xruby/src/com/xruby/compiler/codedom/StringExpression.java +4 -2
- data/platform/wm/RhoLib/RhoLib.vcproj +108 -72
- data/platform/wm/build/wm.rake +6 -0
- data/platform/wm/rhodes/Alert.cpp +4 -3
- data/platform/wm/rhodes/Alert.h +1 -1
- data/platform/wm/rhodes/DateTimePicker.cpp +30 -3
- data/platform/wm/rhodes/DateTimePicker.h +9 -1
- data/platform/wm/rhodes/MainWindow.cpp +121 -61
- data/platform/wm/rhodes/MainWindow.h +29 -4
- data/platform/wm/rhodes/MapView/Graphics.cpp +547 -0
- data/platform/wm/rhodes/MapView/Graphics.h +136 -0
- data/platform/wm/rhodes/MapView/MapViewManager.cpp +391 -0
- data/platform/wm/rhodes/MapView/MapViewManager.h +158 -0
- data/platform/wm/rhodes/RhoCryptImpl.cpp +248 -0
- data/platform/wm/rhodes/RhoCryptImpl.h +51 -0
- data/platform/wm/rhodes/RhoNativeViewManager.cpp +208 -0
- data/platform/wm/rhodes/Rhodes.cpp +94 -102
- data/platform/wm/rhodes/Rhodes.rc +27 -0
- data/platform/wm/rhodes/SyncStatusDlg.cpp +1 -0
- data/platform/wm/rhodes/SyncStatusDlg.h +2 -1
- data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +7 -4
- data/platform/wm/rhodes/camera/Camera.cpp +36 -15
- data/platform/wm/rhodes/camera/Camera.h +0 -4
- data/platform/wm/rhodes/resource.h +10 -2
- data/platform/wm/rhodes/rho/common/RhoClassFactory.cpp +7 -0
- data/platform/wm/rhodes/rho/common/RhoClassFactory.h +1 -0
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +10 -2
- data/platform/wm/rhodes/rho/net/NetRequestImpl.h +10 -0
- data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +513 -0
- data/platform/wm/rhodes/rho/rubyext/NativeToolbar.h +74 -0
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +22 -10
- data/platform/wm/rhodes/rho/rubyext/WebView.cpp +5 -0
- data/platform/wm/rhodes/rhodes.vcproj +38 -2
- data/platform/wm/rhodes/stdafx.h +2 -1
- data/platform/wm/rubylib/rubylib.vcproj +12 -0
- data/rakefile.rb +85 -80
- data/res/build-tools/iphonesim/Source/iPhoneSimulator.m +14 -3
- data/res/build-tools/iphonesim/build/Release/iphonesim +0 -0
- data/res/build-tools/iphonesim/iphonesim.xcodeproj/project.pbxproj +2 -0
- data/res/build-tools/xruby-0.3.3.jar +0 -0
- data/res/generators/templates/application/app/application.rb +2 -2
- data/res/generators/templates/application/app/helpers/application_helper.rb +1 -1
- data/res/generators/templates/application/public/css/android.css +1 -0
- data/res/generators/templates/application/public/jqtouch/jquery.1.3.2.min.js +1 -1
- data/res/generators/templates/application/rhoconfig.txt +66 -14
- data/rhodes.gemspec +3 -3
- data/spec/framework_spec/app/spec/core/file/expand_path_spec.rb +7 -3
- data/spec/framework_spec/build.yml +1 -1
- data/spec/phone_spec/Rakefile +1 -0
- data/spec/phone_spec/app/Account/account.rb +2 -0
- data/spec/phone_spec/app/Account_s/account_s.rb +7 -0
- data/spec/phone_spec/app/spec/{fixtures → array/fixtures}/classes.rb +0 -0
- data/spec/phone_spec/app/spec/{array_pack_spec.rb → array/pack_spec.rb} +2 -1
- data/spec/phone_spec/app/spec/bulksync_spec.rb +1 -0
- data/spec/phone_spec/app/spec/contacts_spec.rb +2 -0
- data/spec/phone_spec/app/spec/rho_spec.rb +34 -233
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +396 -87
- data/spec/phone_spec/app/spec/string/element_set_spec.rb +251 -0
- data/spec/phone_spec/app/spec/string/end_with_spec.rb +49 -0
- data/spec/phone_spec/app/spec/string/fixtures/classes.rb +27 -0
- data/spec/phone_spec/app/spec/{lstrip_spec.rb → string/lstrip_spec.rb} +0 -0
- data/spec/phone_spec/app/spec/string/replace_spec.rb +52 -0
- data/spec/phone_spec/app/spec/{rstrip_spec.rb → string/rstrip_spec.rb} +0 -0
- data/spec/phone_spec/app/spec/string/slice_spec.rb +473 -0
- data/spec/phone_spec/app/spec/string/split_spec.rb +302 -0
- data/spec/phone_spec/app/spec/string/start_with_spec.rb +48 -0
- data/spec/phone_spec/app/spec/{strip_spec.rb → string/strip_spec.rb} +0 -0
- data/spec/phone_spec/app/spec/syncengine_spec.rb +30 -1
- data/spec/phone_spec/app/spec_runner.rb +15 -7
- data/spec/phone_spec/build.yml +2 -2
- metadata +154 -25
- data/README.textile +0 -45
- data/platform/android/Rhodes/AndroidManifest.full.xml +0 -62
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/Manifest.java +0 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoActivity.java +0 -20
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +0 -193
- data/platform/bb/Hsqldb/src/com/rho/file/FileAccessBB.java +0 -25
- data/platform/bb/RubyVM/src/com/rho/AppBuildConfig.java +0 -22
- data/platform/bb/RubyVM/src/com/rho/Capabilities.java +0 -6
- data/platform/bb/RubyVM/src/com/rho/Extensions.java +0 -11
- data/platform/iphone/Classes/RhoNativeViewManager.mm +0 -226
@@ -0,0 +1,919 @@
|
|
1
|
+
//
|
2
|
+
// Created by DmitryS .
|
3
|
+
// Copyright 2011 rhomobile, inc. All rights reserved.
|
4
|
+
//
|
5
|
+
|
6
|
+
#ifdef __IPHONE_3_0
|
7
|
+
|
8
|
+
//#import "MapAnnotation.h"
|
9
|
+
#import "MapViewControllerESRI.h"
|
10
|
+
//#import "Rhodes.h"
|
11
|
+
//#import "RhoMainView.h"
|
12
|
+
|
13
|
+
#import "logging/RhoLog.h"
|
14
|
+
#import "rhoruby.h"
|
15
|
+
#import "common/RhoConf.h"
|
16
|
+
|
17
|
+
#import "rubyext/WebView.h"
|
18
|
+
|
19
|
+
|
20
|
+
#import "MapViewManager.h"
|
21
|
+
#import "ESRIViewManager.h"
|
22
|
+
|
23
|
+
#undef DEFAULT_LOGCATEGORY
|
24
|
+
#define DEFAULT_LOGCATEGORY "MapViewESRI"
|
25
|
+
|
26
|
+
static MapViewControllerESRI *mc = nil;
|
27
|
+
|
28
|
+
static NSString *kGeoLocatorURL = kESRI_geo_locator_URL;
|
29
|
+
|
30
|
+
static NSMutableArray* geocode_requests = nil;
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
@interface MapEngine_ESRI : NSObject <RhoMapViewProvider>
|
40
|
+
{
|
41
|
+
}
|
42
|
+
|
43
|
+
- (void)createMap:(rho_param*)params;
|
44
|
+
- (void)closeMap;
|
45
|
+
- (BOOL)isStarted;
|
46
|
+
- (double)centerLatitude;
|
47
|
+
- (double)centerLongitude;
|
48
|
+
|
49
|
+
@end
|
50
|
+
|
51
|
+
@implementation MapEngine_ESRI
|
52
|
+
|
53
|
+
- (void)createMap:(rho_param*)params {
|
54
|
+
[MapViewControllerESRI createMap:params];
|
55
|
+
}
|
56
|
+
|
57
|
+
- (void)closeMap {
|
58
|
+
[MapViewControllerESRI closeMap];
|
59
|
+
}
|
60
|
+
|
61
|
+
- (BOOL)isStarted {
|
62
|
+
return [MapViewControllerESRI isStarted];
|
63
|
+
}
|
64
|
+
|
65
|
+
- (double)centerLatitude {
|
66
|
+
return [MapViewControllerESRI centerLatitude];
|
67
|
+
}
|
68
|
+
|
69
|
+
- (double)centerLongitude {
|
70
|
+
return [MapViewControllerESRI centerLongitude];
|
71
|
+
}
|
72
|
+
|
73
|
+
@end
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
@interface RhoESRIGeoLocatorItem : NSObject <AGSLocatorDelegate> {
|
80
|
+
NSString* query_adress;
|
81
|
+
AGSLocator* locator;
|
82
|
+
}
|
83
|
+
@property (nonatomic,retain) NSString* query_adress;
|
84
|
+
@property (nonatomic,retain) AGSLocator* locator;
|
85
|
+
|
86
|
+
-(id)initWithAdress:(NSString*)adress;
|
87
|
+
-(void)start;
|
88
|
+
-(void)locator:(AGSLocator *)locator operation:(NSOperation *)op didFindLocationsForAddress:(NSArray *)candidates;
|
89
|
+
-(void)locator:(AGSLocator *)locator operation:(NSOperation *)op didFailLocationsForAddress:(NSError *)error;
|
90
|
+
-(void)onFounded:(double)longitude latitude:(double)latitude;
|
91
|
+
|
92
|
+
@end
|
93
|
+
|
94
|
+
|
95
|
+
@interface RhoESRIGeoLocatorItemAnnotation : RhoESRIGeoLocatorItem {
|
96
|
+
MapViewControllerESRI* map;
|
97
|
+
NSString* title;
|
98
|
+
NSString* subtitle;
|
99
|
+
NSString* url;
|
100
|
+
|
101
|
+
}
|
102
|
+
@property (nonatomic,assign) MapViewControllerESRI* map;
|
103
|
+
@property (nonatomic,retain) NSString* title;
|
104
|
+
@property (nonatomic,retain) NSString* subtitle;
|
105
|
+
@property (nonatomic,retain) NSString* url;
|
106
|
+
|
107
|
+
-(id)init:(MapViewControllerESRI*)map adress:(NSString*)adress title:(NSString*)title subtitle:(NSString*)subtitle url:(NSString*)url;
|
108
|
+
-(void)onFounded:(double)longitude latitude:(double)latitude;
|
109
|
+
|
110
|
+
@end
|
111
|
+
|
112
|
+
|
113
|
+
@interface RhoESRIGeoLocatorItemMapCenter : RhoESRIGeoLocatorItem {
|
114
|
+
MapViewControllerESRI* map;
|
115
|
+
double radius;
|
116
|
+
|
117
|
+
}
|
118
|
+
@property (nonatomic,assign) MapViewControllerESRI* map;
|
119
|
+
@property (nonatomic,assign) double radius;
|
120
|
+
|
121
|
+
-(id)init:(MapViewControllerESRI*)map adress:(NSString*)adress radius:(double)radius;
|
122
|
+
-(void)onFounded:(double)longitude latitude:(double)latitude;
|
123
|
+
|
124
|
+
@end
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
@implementation RhoESRIGeoLocatorItem
|
132
|
+
|
133
|
+
@synthesize query_adress, locator;
|
134
|
+
|
135
|
+
-(id)initWithAdress:(NSString*)adress {
|
136
|
+
self = [super init];
|
137
|
+
self.query_adress = adress;
|
138
|
+
if (geocode_requests != nil) {
|
139
|
+
//[geocode_requests addObject:self];
|
140
|
+
}
|
141
|
+
return self;
|
142
|
+
}
|
143
|
+
|
144
|
+
-(void)start {
|
145
|
+
self.locator = [AGSLocator locatorWithURL:[NSURL URLWithString:kGeoLocatorURL]];
|
146
|
+
self.locator.delegate = self;
|
147
|
+
|
148
|
+
NSArray *outFields = [NSArray arrayWithObjects:@"Score",
|
149
|
+
@"Latitude",
|
150
|
+
@"Longitude",
|
151
|
+
nil];
|
152
|
+
|
153
|
+
//Create the address dictionary with the contents of the search bar
|
154
|
+
NSDictionary *addresses = [NSDictionary dictionaryWithObjectsAndKeys:self.query_adress, @"PlaceName", nil];
|
155
|
+
|
156
|
+
//now request the location from the locator for our address
|
157
|
+
[self.locator locationsForAddress:addresses returnFields:outFields];
|
158
|
+
}
|
159
|
+
|
160
|
+
-(void)locator:(AGSLocator *)locator operation:(NSOperation *)op didFindLocationsForAddress:(NSArray *)candidates {
|
161
|
+
if ((candidates != nil) && ([candidates count] > 0))
|
162
|
+
{
|
163
|
+
//loop through all candidates/results and add to graphics layer
|
164
|
+
for (int i=0; i<[candidates count]; i++)
|
165
|
+
{
|
166
|
+
AGSAddressCandidate *addressCandidate = (AGSAddressCandidate *)[candidates objectAtIndex:i];
|
167
|
+
|
168
|
+
//get the location from the candidate
|
169
|
+
AGSPoint *pt = addressCandidate.location;
|
170
|
+
[self onFounded:pt.x latitude:pt.y];
|
171
|
+
|
172
|
+
//[geocode_requests removeObject:self];
|
173
|
+
return;
|
174
|
+
}
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
-(void)locator:(AGSLocator *)locator operation:(NSOperation *)op didFailLocationsForAddress:(NSError *)error {
|
179
|
+
//[geocode_requests removeObject:self];
|
180
|
+
}
|
181
|
+
|
182
|
+
-(void)onFounded:(double)longitude latitude:(double)latitude {
|
183
|
+
}
|
184
|
+
|
185
|
+
- (void)dealloc {
|
186
|
+
[self.locator release];
|
187
|
+
[super dealloc];
|
188
|
+
}
|
189
|
+
|
190
|
+
|
191
|
+
@end
|
192
|
+
|
193
|
+
|
194
|
+
@implementation RhoESRIGeoLocatorItemAnnotation
|
195
|
+
|
196
|
+
@synthesize map, title, subtitle, url;
|
197
|
+
|
198
|
+
-(id)init:(MapViewControllerESRI*)map adress:(NSString*)adress title:(NSString*)title subtitle:(NSString*)subtitle url:(NSString*)url {
|
199
|
+
self = [super initWithAdress:adress];
|
200
|
+
self.map = map;
|
201
|
+
self.title = title;
|
202
|
+
self.subtitle = subtitle;
|
203
|
+
self.url = url;
|
204
|
+
[self start];
|
205
|
+
return self;
|
206
|
+
}
|
207
|
+
|
208
|
+
-(void)onFounded:(double)longitude latitude:(double)latitude {
|
209
|
+
[self.map addAnnotation:latitude longitude:longitude streetAdress:self.query_adress title:self.title subtitle:self.subtitle url:self.url];
|
210
|
+
}
|
211
|
+
|
212
|
+
|
213
|
+
@end
|
214
|
+
|
215
|
+
|
216
|
+
@implementation RhoESRIGeoLocatorItemMapCenter
|
217
|
+
|
218
|
+
@synthesize map, radius;
|
219
|
+
|
220
|
+
-(id)init:(MapViewControllerESRI*)map adress:(NSString*)adress radius:(double)radius {
|
221
|
+
[super initWithAdress:adress];
|
222
|
+
self.map = map;
|
223
|
+
self.radius = radius;
|
224
|
+
[self start];
|
225
|
+
return self;
|
226
|
+
}
|
227
|
+
|
228
|
+
-(void)onFounded:(double)longitude latitude:(double)latitude {
|
229
|
+
AGSSpatialReference *sr = [AGSSpatialReference spatialReferenceWithWKID:4326];
|
230
|
+
double xmin, ymin, xmax, ymax;
|
231
|
+
xmin = longitude - self.radius;
|
232
|
+
ymin = latitude - self.radius;
|
233
|
+
xmax = longitude + self.radius;
|
234
|
+
ymax = latitude + self.radius;
|
235
|
+
// zoom to region
|
236
|
+
AGSEnvelope *env = [AGSEnvelope envelopeWithXmin:xmin ymin:ymin xmax:xmax ymax:ymax spatialReference:sr];
|
237
|
+
env = (AGSEnvelope*)AGSGeometryGeographicToWebMercator(env);
|
238
|
+
[self.map.mapView zoomToEnvelope:env animated:YES];
|
239
|
+
}
|
240
|
+
|
241
|
+
@end
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
@interface RhoCreateMapTaskESRI : NSObject {}
|
250
|
+
|
251
|
+
+ (void) run;
|
252
|
+
|
253
|
+
@end
|
254
|
+
|
255
|
+
@implementation RhoCreateMapTaskESRI
|
256
|
+
|
257
|
+
static RhoCreateMapTaskESRI* instance_create = nil;
|
258
|
+
|
259
|
+
-(void)runCommand:(NSValue*)value {
|
260
|
+
if (mc) {
|
261
|
+
[mc close];
|
262
|
+
mc = nil;
|
263
|
+
}
|
264
|
+
MapViewControllerESRI* map = [[MapViewControllerESRI alloc] initWithParams:[value pointerValue]];
|
265
|
+
mc = map;
|
266
|
+
[ESRIViewManager openView];
|
267
|
+
|
268
|
+
}
|
269
|
+
|
270
|
+
+(void) run:(NSValue*)value {
|
271
|
+
if (instance_create == nil) {
|
272
|
+
instance_create = [[RhoCreateMapTaskESRI alloc] init];
|
273
|
+
}
|
274
|
+
[instance_create performSelectorOnMainThread:@selector(runCommand:) withObject:value waitUntilDone:NO];
|
275
|
+
}
|
276
|
+
|
277
|
+
@end
|
278
|
+
|
279
|
+
@interface RhoCloseMapTaskESRI : NSObject
|
280
|
+
+ (void)run;
|
281
|
+
@end
|
282
|
+
|
283
|
+
@implementation RhoCloseMapTaskESRI
|
284
|
+
|
285
|
+
static RhoCloseMapTaskESRI* instance_close = nil;
|
286
|
+
|
287
|
+
- (void)runCommand:(NSValue*)value {
|
288
|
+
if (mc) {
|
289
|
+
[mc close];
|
290
|
+
mc = nil;
|
291
|
+
}
|
292
|
+
}
|
293
|
+
+ (void)run {
|
294
|
+
if (instance_close == nil) {
|
295
|
+
instance_close = [[RhoCloseMapTaskESRI alloc] init];
|
296
|
+
}
|
297
|
+
[instance_close performSelectorOnMainThread:@selector(runCommand:) withObject:nil waitUntilDone:NO];
|
298
|
+
}
|
299
|
+
|
300
|
+
@end
|
301
|
+
|
302
|
+
@implementation MapViewControllerESRI
|
303
|
+
|
304
|
+
@synthesize savedMainView;
|
305
|
+
|
306
|
+
@synthesize mapView = _mapView;
|
307
|
+
@synthesize dynamicLayer = _dynamicLayer, dynamicLayerView = _dynamicLayerView;
|
308
|
+
|
309
|
+
@synthesize graphicsLayer = _graphicsLayer;
|
310
|
+
//@synthesize locator = _locator;
|
311
|
+
@synthesize calloutTemplate = _calloutTemplate;
|
312
|
+
|
313
|
+
@synthesize params_value, region_center, region_radius, esriLogo, esri_standard_map_url, esri_satellite_map_url;
|
314
|
+
|
315
|
+
|
316
|
+
- (id)initWithParams:(rho_param*)params {
|
317
|
+
geocode_requests = [NSMutableArray arrayWithCapacity:10];
|
318
|
+
|
319
|
+
[self init];
|
320
|
+
|
321
|
+
mapType = ESRI_MapType_RoadMap;
|
322
|
+
zoomEnabled = TRUE;
|
323
|
+
scrollEnabled = TRUE;
|
324
|
+
showsUserLocation = TRUE;
|
325
|
+
region_set = FALSE;
|
326
|
+
params_value = NULL;
|
327
|
+
|
328
|
+
esri_standard_map_url = kESRI_standart_map_URL;
|
329
|
+
esri_satellite_map_url = kESRI_satellite_map_URL;
|
330
|
+
|
331
|
+
{
|
332
|
+
char* std_map = rho_conf_getString("esri_map_url_roadmap");
|
333
|
+
if (std_map) {
|
334
|
+
esri_standard_map_url = [[NSString stringWithUTF8String:std_map] stringByAppendingString:@"MapServer"];
|
335
|
+
}
|
336
|
+
char* sat_map = rho_conf_getString("esri_map_url_satellite");
|
337
|
+
if (sat_map) {
|
338
|
+
esri_satellite_map_url = [[NSString stringWithUTF8String:std_map] stringByAppendingString:@"MapServer"];
|
339
|
+
}
|
340
|
+
}
|
341
|
+
|
342
|
+
self.calloutTemplate = [[AGSCalloutTemplate alloc]init];
|
343
|
+
|
344
|
+
if (params && params->type == RHO_PARAM_HASH) {
|
345
|
+
rho_param *st = NULL;
|
346
|
+
rho_param *ann = NULL;
|
347
|
+
for (int i = 0, lim = params->v.hash->size; i < lim; ++i) {
|
348
|
+
char *name = params->v.hash->name[i];
|
349
|
+
rho_param *value = params->v.hash->value[i];
|
350
|
+
if (strcasecmp(name, "settings") == 0)
|
351
|
+
st = value;
|
352
|
+
else if (strcasecmp(name, "annotations") == 0)
|
353
|
+
ann = value;
|
354
|
+
}
|
355
|
+
if (st)
|
356
|
+
[self setSettings:st];
|
357
|
+
params_value = params;//[self setAnnotations:ann];
|
358
|
+
}
|
359
|
+
//rho_param_free(params);
|
360
|
+
return self;
|
361
|
+
}
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
+ (void)createMap:(rho_param *)params {
|
367
|
+
|
368
|
+
[RhoCreateMapTaskESRI run:[NSValue valueWithPointer:params]];
|
369
|
+
|
370
|
+
//id runnable = [RhoCreateMapTaskESRI class];
|
371
|
+
//id arg = [NSValue valueWithPointer:params];
|
372
|
+
//[Rhodes performOnUiThread:runnable arg:arg wait:NO];
|
373
|
+
}
|
374
|
+
|
375
|
+
+ (void)closeMap {
|
376
|
+
[RhoCloseMapTaskESRI run];
|
377
|
+
//id runnable = [RhoCloseMapTaskESRI class];
|
378
|
+
//[Rhodes performOnUiThread:runnable wait:NO];
|
379
|
+
}
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
- (void)close {
|
384
|
+
//[self dismissModalViewControllerAnimated:YES];
|
385
|
+
|
386
|
+
[ESRIViewManager closeView];
|
387
|
+
|
388
|
+
}
|
389
|
+
|
390
|
+
- (void)setSettings:(rho_param*)p {
|
391
|
+
if (!p || p->type != RHO_PARAM_HASH)
|
392
|
+
return;
|
393
|
+
|
394
|
+
for (int i = 0, lim = p->v.hash->size; i < lim; ++i) {
|
395
|
+
char *name = p->v.hash->name[i];
|
396
|
+
rho_param *value = p->v.hash->value[i];
|
397
|
+
if (!name || !value)
|
398
|
+
continue;
|
399
|
+
|
400
|
+
if (strcasecmp(name, "map_type") == 0) {
|
401
|
+
if (value->type != RHO_PARAM_STRING)
|
402
|
+
continue;
|
403
|
+
char *map_type = value->v.string;
|
404
|
+
if (strcasecmp(map_type, "standard") == 0 || strcasecmp(map_type, "roadmap") == 0)
|
405
|
+
mapType = ESRI_MapType_RoadMap;
|
406
|
+
else if (strcasecmp(map_type, "satellite") == 0)
|
407
|
+
mapType = ESRI_MapType_Satellite;
|
408
|
+
else if (strcasecmp(map_type, "hybrid") == 0)
|
409
|
+
mapType = ESRI_MapType_Hybrid;
|
410
|
+
else {
|
411
|
+
RAWLOG_ERROR1("Unknown map type: %s", map_type);
|
412
|
+
continue;
|
413
|
+
}
|
414
|
+
}
|
415
|
+
else if (strcasecmp(name, "region") == 0) {
|
416
|
+
if (value->type == RHO_PARAM_ARRAY) {
|
417
|
+
if (value->v.array->size != 4)
|
418
|
+
continue;
|
419
|
+
|
420
|
+
rho_param *lat = value->v.array->value[0];
|
421
|
+
rho_param *lon = value->v.array->value[1];
|
422
|
+
rho_param *latSpan = value->v.array->value[2];
|
423
|
+
rho_param *lonSpan = value->v.array->value[3];
|
424
|
+
|
425
|
+
double location_latitude = lat->type == RHO_PARAM_STRING ? strtod(lat->v.string, NULL) : 0;
|
426
|
+
double location_longitude = lon->type == RHO_PARAM_STRING ? strtod(lon->v.string, NULL) : 0;
|
427
|
+
double span_latitudeDelta = latSpan->type == RHO_PARAM_STRING ? strtod(latSpan->v.string, NULL) : 0;
|
428
|
+
double span_longitudeDelta = lonSpan->type == RHO_PARAM_STRING ? strtod(lonSpan->v.string, NULL) : 0;
|
429
|
+
|
430
|
+
region_latitude_min = location_latitude - span_latitudeDelta;
|
431
|
+
region_latitude_max = location_latitude + span_latitudeDelta;
|
432
|
+
region_longitude_min = location_longitude - span_longitudeDelta;
|
433
|
+
region_longitude_max = location_longitude + span_longitudeDelta;
|
434
|
+
|
435
|
+
region_set = TRUE;
|
436
|
+
}
|
437
|
+
else if (value->type == RHO_PARAM_HASH) {
|
438
|
+
char *center = NULL;
|
439
|
+
char *radius = NULL;
|
440
|
+
|
441
|
+
for (int j = 0, limm = value->v.hash->size; j < limm; ++j) {
|
442
|
+
char *rname = value->v.hash->name[j];
|
443
|
+
rho_param *rvalue = value->v.hash->value[j];
|
444
|
+
if (strcasecmp(rname, "center") == 0) {
|
445
|
+
if (rvalue->type != RHO_PARAM_STRING) {
|
446
|
+
RAWLOG_ERROR("Wrong type of 'center', should be String");
|
447
|
+
continue;
|
448
|
+
}
|
449
|
+
center = rvalue->v.string;
|
450
|
+
}
|
451
|
+
else if (strcasecmp(rname, "radius") == 0) {
|
452
|
+
if (rvalue->type != RHO_PARAM_STRING) {
|
453
|
+
RAWLOG_ERROR("Wrong type of 'radius', should be String");
|
454
|
+
continue;
|
455
|
+
}
|
456
|
+
radius = rvalue->v.string;
|
457
|
+
}
|
458
|
+
}
|
459
|
+
|
460
|
+
if (!center || !radius)
|
461
|
+
continue;
|
462
|
+
|
463
|
+
region_center = [NSString stringWithUTF8String:center];
|
464
|
+
region_radius = strtod(radius, NULL);
|
465
|
+
}
|
466
|
+
}
|
467
|
+
else if (strcasecmp(name, "zoom_enabled") == 0) {
|
468
|
+
if (value->type != RHO_PARAM_STRING)
|
469
|
+
continue;
|
470
|
+
zoomEnabled = strcasecmp(value->v.string, "true") == 0;
|
471
|
+
}
|
472
|
+
else if (strcasecmp(name, "scroll_enabled") == 0) {
|
473
|
+
if (value->type != RHO_PARAM_STRING)
|
474
|
+
continue;
|
475
|
+
scrollEnabled = strcasecmp(value->v.string, "true") == 0;
|
476
|
+
}
|
477
|
+
else if (strcasecmp(name, "shows_user_location") == 0) {
|
478
|
+
if (value->type != RHO_PARAM_STRING)
|
479
|
+
continue;
|
480
|
+
showsUserLocation = strcasecmp(value->v.string, "true") == 0;
|
481
|
+
}
|
482
|
+
}
|
483
|
+
}
|
484
|
+
|
485
|
+
- (void)setAnnotations:(rho_param*)p {
|
486
|
+
///*
|
487
|
+
int size = 1;
|
488
|
+
if (p && p->type == RHO_PARAM_ARRAY)
|
489
|
+
size += p->v.array->size;
|
490
|
+
NSMutableArray *annotations = [NSMutableArray arrayWithCapacity:size];
|
491
|
+
//if (region_center) {
|
492
|
+
// MapAnnotation *annObj = [[MapAnnotation alloc] init];
|
493
|
+
// annObj.type = @"center";
|
494
|
+
// annObj.address = region_center;
|
495
|
+
// CLLocationCoordinate2D c;
|
496
|
+
// c.latitude = c.longitude = 10000;
|
497
|
+
// annObj.coordinate = c;
|
498
|
+
// [annotations addObject:annObj];
|
499
|
+
// [annObj release];
|
500
|
+
//}
|
501
|
+
if (p && p->type == RHO_PARAM_ARRAY) {
|
502
|
+
for (int i = 0, lim = p->v.array->size; i < lim; ++i) {
|
503
|
+
rho_param *ann = p->v.array->value[i];
|
504
|
+
if (ann->type != RHO_PARAM_HASH)
|
505
|
+
continue;
|
506
|
+
|
507
|
+
//CLLocationCoordinate2D coord;
|
508
|
+
double coord_latitude = 10000;
|
509
|
+
double coord_longitude = 10000;
|
510
|
+
|
511
|
+
NSString *address = nil;
|
512
|
+
NSString *title = nil;
|
513
|
+
NSString *subtitle = nil;
|
514
|
+
NSString *url = nil;
|
515
|
+
|
516
|
+
for (int j = 0, limm = ann->v.hash->size; j < limm; ++j) {
|
517
|
+
char *name = ann->v.hash->name[j];
|
518
|
+
rho_param *value = ann->v.hash->value[j];
|
519
|
+
if (!name || !value)
|
520
|
+
continue;
|
521
|
+
if (value->type != RHO_PARAM_STRING)
|
522
|
+
continue;
|
523
|
+
char *v = value->v.string;
|
524
|
+
|
525
|
+
if (strcasecmp(name, "latitude") == 0) {
|
526
|
+
coord_latitude = strtod(v, NULL);
|
527
|
+
}
|
528
|
+
else if (strcasecmp(name, "longitude") == 0) {
|
529
|
+
coord_longitude = strtod(v, NULL);
|
530
|
+
}
|
531
|
+
else if (strcasecmp(name, "street_address") == 0) {
|
532
|
+
address = [NSString stringWithUTF8String:v];
|
533
|
+
}
|
534
|
+
else if (strcasecmp(name, "title") == 0) {
|
535
|
+
title = [NSString stringWithUTF8String:v];
|
536
|
+
}
|
537
|
+
else if (strcasecmp(name, "subtitle") == 0) {
|
538
|
+
subtitle = [NSString stringWithUTF8String:v];
|
539
|
+
}
|
540
|
+
else if (strcasecmp(name, "url") == 0) {
|
541
|
+
url = [NSString stringWithUTF8String:v];
|
542
|
+
}
|
543
|
+
}
|
544
|
+
|
545
|
+
if ((coord_latitude < 10000) && (coord_longitude < 10000)) {
|
546
|
+
[self addAnnotation:coord_latitude longitude:coord_longitude streetAdress:address title:title subtitle:subtitle url:url];
|
547
|
+
}
|
548
|
+
else {
|
549
|
+
if (address != nil) {
|
550
|
+
[[RhoESRIGeoLocatorItemAnnotation alloc] init:self adress:address title:title subtitle:subtitle url:url];
|
551
|
+
}
|
552
|
+
}
|
553
|
+
|
554
|
+
}
|
555
|
+
}
|
556
|
+
}
|
557
|
+
|
558
|
+
- (void)loadView {
|
559
|
+
//CGRect rootViewBounds = [[[Rhodes sharedInstance] mainView] view].frame;
|
560
|
+
CGRect rootViewBounds = CGRectMake(0, 20, 200, 200);
|
561
|
+
UIView* mv = [[UIView alloc] initWithFrame:rootViewBounds];
|
562
|
+
mv.autoresizesSubviews = YES;
|
563
|
+
self.view = mv;
|
564
|
+
[mv release];
|
565
|
+
|
566
|
+
}
|
567
|
+
|
568
|
+
|
569
|
+
+(UIView*)getCurrentView {
|
570
|
+
if (mc != nil) {
|
571
|
+
return mc.view;
|
572
|
+
}
|
573
|
+
return nil;
|
574
|
+
}
|
575
|
+
|
576
|
+
|
577
|
+
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
578
|
+
return YES;
|
579
|
+
}
|
580
|
+
|
581
|
+
- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
|
582
|
+
{
|
583
|
+
//[self.mapView removeMapLayerWithName:@"Graphics Layer"];
|
584
|
+
//[self.mapView addMapLayer:self.graphicsLayer withName:@"Graphics Layer"];
|
585
|
+
//[self.view layoutSubviews];
|
586
|
+
//[self.graphicsLayer dataChanged];
|
587
|
+
}
|
588
|
+
|
589
|
+
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
|
590
|
+
- (void)viewDidLoad {
|
591
|
+
[super viewDidLoad];
|
592
|
+
|
593
|
+
self.view.opaque = YES;
|
594
|
+
self.view.backgroundColor = [UIColor blackColor];
|
595
|
+
|
596
|
+
//Initialize the toolbar
|
597
|
+
toolbar = [[UIToolbar alloc] init];
|
598
|
+
toolbar.barStyle = UIBarStyleBlack;
|
599
|
+
UIBarButtonItem *closeButton = [[UIBarButtonItem alloc]
|
600
|
+
initWithTitle:@"Close" style:UIBarButtonItemStyleBordered
|
601
|
+
target:self action:@selector(close_clicked:)];
|
602
|
+
[toolbar setItems:[NSArray arrayWithObjects:closeButton,nil]];
|
603
|
+
|
604
|
+
|
605
|
+
toolbar.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin |
|
606
|
+
UIViewAutoresizingFlexibleWidth;
|
607
|
+
toolbar.autoresizesSubviews = YES;
|
608
|
+
[toolbar sizeToFit];
|
609
|
+
|
610
|
+
CGFloat toolbarHeight = [toolbar frame].size.height;
|
611
|
+
// hack for do not reduce height of toolbar in Landscape mode
|
612
|
+
if (toolbarHeight < 44) {
|
613
|
+
toolbarHeight = 44;
|
614
|
+
}
|
615
|
+
|
616
|
+
//RhoMainView* rw = [[Rhodes sharedInstance] mainView];
|
617
|
+
|
618
|
+
CGRect rootViewBounds = CGRectMake(0, 20, 200, 200);//[[[Rhodes sharedInstance] mainView] view].frame;//bounds;
|
619
|
+
|
620
|
+
self.view.frame = rootViewBounds;
|
621
|
+
|
622
|
+
CGFloat rootViewHeight = rootViewBounds.size.height;
|
623
|
+
//CGFloat rootViewHeight = CGRectGetHeight(rootViewBounds);
|
624
|
+
CGFloat rootViewWidth = CGRectGetWidth(rootViewBounds);
|
625
|
+
CGRect rectArea = CGRectMake(0, rootViewHeight - toolbarHeight, rootViewWidth, toolbarHeight);
|
626
|
+
toolbar.frame = rectArea;
|
627
|
+
|
628
|
+
|
629
|
+
[self.view addSubview:toolbar];
|
630
|
+
[closeButton release];
|
631
|
+
|
632
|
+
CGRect rectMapArea = CGRectMake(0, 0, rootViewWidth, rootViewHeight - toolbarHeight);
|
633
|
+
|
634
|
+
AGSMapView* content = [[AGSMapView alloc] initWithFrame:rectMapArea];
|
635
|
+
|
636
|
+
self.mapView = content;
|
637
|
+
self.mapView.frame = rectMapArea;
|
638
|
+
self.mapView.autoresizesSubviews = YES;
|
639
|
+
self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
640
|
+
[content release];
|
641
|
+
|
642
|
+
|
643
|
+
/*Geocoder Stuff*/
|
644
|
+
//[ggeoCoder start];
|
645
|
+
|
646
|
+
[self.view insertSubview:self.mapView atIndex:0];
|
647
|
+
|
648
|
+
|
649
|
+
// set the delegate for the map view
|
650
|
+
self.mapView.mapViewDelegate = self;
|
651
|
+
|
652
|
+
|
653
|
+
|
654
|
+
NSURL* baseURL = [NSURL URLWithString:kESRI_standart_map_URL];
|
655
|
+
//create an instance of a tiled map service layer
|
656
|
+
if (mapType == ESRI_MapType_RoadMap) {
|
657
|
+
baseURL = [NSURL URLWithString:kESRI_standart_map_URL];
|
658
|
+
}
|
659
|
+
else if (mapType == ESRI_MapType_Satellite) {
|
660
|
+
baseURL = [NSURL URLWithString:kESRI_satellite_map_URL];
|
661
|
+
}
|
662
|
+
else if (mapType == ESRI_MapType_Hybrid) {
|
663
|
+
baseURL = [NSURL URLWithString:kESRI_satellite_map_URL];
|
664
|
+
}
|
665
|
+
AGSTiledMapServiceLayer *tiledLayer = [[AGSTiledMapServiceLayer alloc] initWithURL:baseURL];
|
666
|
+
|
667
|
+
//Add it to the map view
|
668
|
+
UIView<AGSLayerView>* lyr = [self.mapView addMapLayer:tiledLayer withName:@"Tiled Layer"];
|
669
|
+
|
670
|
+
//release to avoid memory leaks
|
671
|
+
[tiledLayer release];
|
672
|
+
|
673
|
+
// Setting these two properties lets the map draw while still performing a zoom/pan
|
674
|
+
lyr.drawDuringPanning = scrollEnabled;
|
675
|
+
lyr.drawDuringZooming = zoomEnabled;
|
676
|
+
|
677
|
+
|
678
|
+
//if (mapType == ESRI_MapType_Hybrid) {
|
679
|
+
if (0) {
|
680
|
+
//create an instance of a dynmaic map layer
|
681
|
+
self.dynamicLayer = [[[AGSDynamicMapServiceLayer alloc] initWithURL:[NSURL URLWithString:kESRI_standart_map_URL]] autorelease];
|
682
|
+
|
683
|
+
//set visible layers
|
684
|
+
self.dynamicLayer.visibleLayers = [NSArray arrayWithObjects:[NSNumber numberWithInt:2], nil];
|
685
|
+
|
686
|
+
//name the layer. This is the name that is displayed if there was a property page, tocs, etc...
|
687
|
+
self.dynamicLayerView = [self.mapView addMapLayer:self.dynamicLayer withName:@"Dynamic Layer"];
|
688
|
+
|
689
|
+
//set transparency
|
690
|
+
self.dynamicLayerView.alpha = 1.0;
|
691
|
+
}
|
692
|
+
|
693
|
+
|
694
|
+
//create the graphics layer that the geocoding result
|
695
|
+
//will be stored in and add it to the map
|
696
|
+
self.graphicsLayer = [AGSGraphicsLayer graphicsLayer];
|
697
|
+
[self.mapView addMapLayer:self.graphicsLayer withName:@"Graphics Layer"];
|
698
|
+
|
699
|
+
|
700
|
+
|
701
|
+
AGSSpatialReference *sr = [AGSSpatialReference spatialReferenceWithWKID:4326];
|
702
|
+
double xmin, ymin, xmax, ymax;
|
703
|
+
if (region_set) {
|
704
|
+
xmin = region_longitude_min;
|
705
|
+
ymin = region_latitude_min;
|
706
|
+
xmax = region_longitude_max;
|
707
|
+
ymax = region_latitude_max;
|
708
|
+
|
709
|
+
// zoom to region
|
710
|
+
AGSEnvelope *env = [AGSEnvelope envelopeWithXmin:xmin ymin:ymin xmax:xmax ymax:ymax spatialReference:sr];
|
711
|
+
|
712
|
+
env = (AGSEnvelope*)AGSGeometryGeographicToWebMercator(env);
|
713
|
+
|
714
|
+
//AGSEnvelope *env = [AGSEnvelope envelopeWithXmin:xmin ymin:ymin xmax:xmax ymax:ymax spatialReference:self.mapView.spatialReference];
|
715
|
+
|
716
|
+
[self.mapView zoomToEnvelope:env animated:YES];
|
717
|
+
}
|
718
|
+
else if (region_center != nil){
|
719
|
+
[[RhoESRIGeoLocatorItemMapCenter alloc] init:self adress:region_center radius:self.region_radius];
|
720
|
+
}
|
721
|
+
|
722
|
+
|
723
|
+
|
724
|
+
if (params_value && params_value->type == RHO_PARAM_HASH) {
|
725
|
+
rho_param *ann = NULL;
|
726
|
+
for (int i = 0, lim = params_value->v.hash->size; i < lim; ++i) {
|
727
|
+
char *name = params_value->v.hash->name[i];
|
728
|
+
rho_param *value = params_value->v.hash->value[i];
|
729
|
+
if (strcasecmp(name, "annotations") == 0)
|
730
|
+
ann = value;
|
731
|
+
}
|
732
|
+
if (ann != NULL) {
|
733
|
+
[self setAnnotations:ann];
|
734
|
+
}
|
735
|
+
rho_param_free(params_value);
|
736
|
+
}
|
737
|
+
|
738
|
+
// ESRI logo
|
739
|
+
// http://resources.arcgis.com/content/attribution
|
740
|
+
//
|
741
|
+
UIImage* logoimg = [UIImage imageNamed:@"esri.png"];
|
742
|
+
self.esriLogo = [[UIImageView alloc] initWithImage:logoimg];
|
743
|
+
|
744
|
+
CGSize size = [logoimg size];
|
745
|
+
|
746
|
+
CGRect fr = self.mapView.frame;
|
747
|
+
|
748
|
+
CGRect logo_fr;
|
749
|
+
logo_fr.origin.x = 0;
|
750
|
+
logo_fr.origin.y = fr.size.height - size.height;
|
751
|
+
logo_fr.size.width = size.width;
|
752
|
+
logo_fr.size.height = size.height;
|
753
|
+
self.esriLogo.frame = logo_fr;
|
754
|
+
self.esriLogo.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
|
755
|
+
[self.view addSubview:esriLogo];
|
756
|
+
|
757
|
+
}
|
758
|
+
|
759
|
+
|
760
|
+
- (void)didReceiveMemoryWarning {
|
761
|
+
// Releases the view if it doesn't have a superview.
|
762
|
+
[super didReceiveMemoryWarning];
|
763
|
+
|
764
|
+
// Release any cached data, images, etc that aren't in use.
|
765
|
+
}
|
766
|
+
|
767
|
+
- (void)viewDidUnload {
|
768
|
+
// Release any retained subviews of the main view.
|
769
|
+
// e.g. self.myOutlet = nil;
|
770
|
+
}
|
771
|
+
|
772
|
+
|
773
|
+
- (void)dealloc {
|
774
|
+
self.mapView = nil;
|
775
|
+
self.dynamicLayer = nil;
|
776
|
+
self.dynamicLayerView = nil;
|
777
|
+
|
778
|
+
self.graphicsLayer = nil;
|
779
|
+
//self.locator = nil;
|
780
|
+
self.calloutTemplate = nil;
|
781
|
+
|
782
|
+
geocode_requests = nil;
|
783
|
+
|
784
|
+
[super dealloc];
|
785
|
+
}
|
786
|
+
|
787
|
+
|
788
|
+
#pragma mark AGSMapViewDelegate methods
|
789
|
+
|
790
|
+
-(void) mapViewDidLoad:(AGSMapView*)mapView {
|
791
|
+
|
792
|
+
// comment to disable the GPS on start up
|
793
|
+
if (showsUserLocation) {
|
794
|
+
[self.mapView.gps start];
|
795
|
+
}
|
796
|
+
}
|
797
|
+
|
798
|
+
- (void)mapView:(AGSMapView *) mapView didClickAtPoint:(CGPoint) screen mapPoint:(AGSPoint *) mappoint graphics:(NSDictionary *) graphics {
|
799
|
+
// on click on map
|
800
|
+
}
|
801
|
+
|
802
|
+
|
803
|
+
#pragma mark -
|
804
|
+
#pragma mark AGSMapViewDelegate
|
805
|
+
|
806
|
+
- (void)mapView:(AGSMapView *) mapView didClickCalloutAccessoryButtonForGraphic:(AGSGraphic *) graphic
|
807
|
+
{
|
808
|
+
NSDictionary* dict = graphic.attributes;
|
809
|
+
NSString* url = [dict objectForKey:@"URL"];
|
810
|
+
NSLog(@"Callout tapped... Url = %@\n", url);
|
811
|
+
//id<RhoMainView> mainView = [[Rhodes sharedInstance] mainView];
|
812
|
+
//[mainView navigateRedirect:url tab:[mainView activeTab]];
|
813
|
+
if ([url length] > 0) {
|
814
|
+
rho_webview_navigate([url UTF8String], 0);
|
815
|
+
[self close];
|
816
|
+
}
|
817
|
+
}
|
818
|
+
|
819
|
+
|
820
|
+
|
821
|
+
-(void)addAnnotation:(double)latitude longitude:(double)longitude
|
822
|
+
streetAdress:(NSString*)streetAdress
|
823
|
+
title:(NSString*)title
|
824
|
+
subtitle:(NSString*)subtitle
|
825
|
+
url:(NSString*)url
|
826
|
+
{
|
827
|
+
AGSPictureMarkerSymbol *marker = [AGSPictureMarkerSymbol pictureMarkerSymbolWithImageNamed:@"BluePushpin.png"];
|
828
|
+
marker.xoffset = 9;
|
829
|
+
marker.yoffset = -16;
|
830
|
+
marker.hotspot = CGPointMake(-9, -11);
|
831
|
+
|
832
|
+
|
833
|
+
AGSSpatialReference *sr = [AGSSpatialReference spatialReferenceWithWKID:4326];
|
834
|
+
AGSPoint *point = [[AGSPoint alloc] initWithX:longitude y:latitude spatialReference:sr];
|
835
|
+
|
836
|
+
point = (AGSPoint*)AGSGeometryGeographicToWebMercator(point);
|
837
|
+
|
838
|
+
//set the text and detail text based on 'Name' and 'Descr' fields in the attributes
|
839
|
+
self.calloutTemplate.titleTemplate = @"${Name}";
|
840
|
+
self.calloutTemplate.detailTemplate = @"${Descr}";
|
841
|
+
|
842
|
+
//title - @"Name",
|
843
|
+
//street adress - @"Match_addr",
|
844
|
+
//subtitle - @"Descr",
|
845
|
+
//latitude - @"Latitude"
|
846
|
+
//longitude - @"Longitude"
|
847
|
+
//url - @"URL"
|
848
|
+
|
849
|
+
|
850
|
+
NSMutableDictionary* attributes = [NSMutableDictionary dictionaryWithCapacity:6];
|
851
|
+
if (title != nil)
|
852
|
+
[attributes setObject:title forKey:@"Name"];
|
853
|
+
|
854
|
+
if (subtitle != nil)
|
855
|
+
[attributes setObject:subtitle forKey:@"Descr"];
|
856
|
+
|
857
|
+
if (streetAdress != nil)
|
858
|
+
[attributes setObject:streetAdress forKey:@"Match_addr"];
|
859
|
+
|
860
|
+
if (url != nil)
|
861
|
+
[attributes setObject:url forKey:@"URL"];
|
862
|
+
|
863
|
+
//create the graphic
|
864
|
+
AGSGraphic *graphic = [[AGSGraphic alloc] initWithGeometry: point
|
865
|
+
symbol:marker
|
866
|
+
attributes:attributes
|
867
|
+
infoTemplateDelegate:self.calloutTemplate];
|
868
|
+
|
869
|
+
|
870
|
+
//add the graphic to the graphics layer
|
871
|
+
[self.graphicsLayer addGraphic:graphic];
|
872
|
+
|
873
|
+
//[graphic release];
|
874
|
+
//[attributes release];
|
875
|
+
|
876
|
+
self.mapView.callout.width = 250;
|
877
|
+
//[self.mapView showCalloutAtPoint:(AGSPoint*)graphic.geometry forGraphic:graphic animated:YES];
|
878
|
+
|
879
|
+
|
880
|
+
[self.graphicsLayer dataChanged];
|
881
|
+
|
882
|
+
}
|
883
|
+
|
884
|
+
|
885
|
+
|
886
|
+
|
887
|
+
|
888
|
+
- (void) close_clicked:(id)sender {
|
889
|
+
[self close];
|
890
|
+
//mc = nil;
|
891
|
+
}
|
892
|
+
|
893
|
+
|
894
|
+
+ (BOOL)isStarted {
|
895
|
+
return mc != nil;
|
896
|
+
}
|
897
|
+
|
898
|
+
|
899
|
+
+ (double)centerLatitude {
|
900
|
+
AGSPoint* p = (AGSPoint*)AGSGeometryWebMercatorToGeographic(mc.mapView.envelope.center);
|
901
|
+
return p.y;
|
902
|
+
}
|
903
|
+
|
904
|
+
+ (double)centerLongitude {
|
905
|
+
AGSPoint* p = (AGSPoint*)AGSGeometryWebMercatorToGeographic(mc.mapView.envelope.center);
|
906
|
+
return p.x;
|
907
|
+
}
|
908
|
+
|
909
|
+
|
910
|
+
|
911
|
+
|
912
|
+
@end
|
913
|
+
|
914
|
+
#endif
|
915
|
+
|
916
|
+
|
917
|
+
void register_ESRI_mapViewProvider() {
|
918
|
+
[RhoMapViewProvidersManager registerMapViewProvider:@"ESRI" provider:[[MapEngine_ESRI alloc] init]];
|
919
|
+
}
|