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
@@ -6,21 +6,11 @@ import java.util.Enumeration;
|
|
6
6
|
import java.util.Hashtable;
|
7
7
|
import java.util.Vector;
|
8
8
|
|
9
|
-
import org.json.me.RhoJSONArray;
|
10
|
-
import org.json.me.RhoJSONException;
|
11
|
-
import org.json.me.RhoJSONObject;
|
12
|
-
|
13
|
-
import j2me.lang.MathEx;
|
14
|
-
|
15
9
|
import com.rho.RhoClassFactory;
|
16
10
|
import com.rho.RhoEmptyLogger;
|
17
11
|
import com.rho.RhoLogger;
|
18
12
|
import com.rho.net.IHttpConnection;
|
19
|
-
import com.rho.net.URI;
|
20
|
-
|
21
|
-
import com.xruby.runtime.builtin.ObjectFactory;
|
22
13
|
|
23
|
-
import com.rho.rubyext.WebView;
|
24
14
|
import rhomobile.mapview.RhoMapField;
|
25
15
|
|
26
16
|
import net.rim.device.api.math.Fixed32;
|
@@ -38,10 +28,7 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
38
28
|
new RhoLogger("GoogleMapField");
|
39
29
|
|
40
30
|
// Configurable parameters
|
41
|
-
|
42
|
-
// Sensivity of annotations area (in pixels)
|
43
|
-
private static final int ANNOTATION_SENSIVITY_AREA_RADIUS = 8;
|
44
|
-
|
31
|
+
|
45
32
|
// Size of workers pool (threads which actually fetch data from Google)
|
46
33
|
private static final int WORKERS_POOL_SIZE = 1;
|
47
34
|
// Maximum time for task executing by worker
|
@@ -82,7 +69,6 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
82
69
|
// This is maximum absolute value of sine ( == sin(85*PI/180) ) allowed by Merkator projection
|
83
70
|
private static final double MAX_SIN = 0.99627207622;
|
84
71
|
|
85
|
-
private static final double LN2 = 0.693147180559945;
|
86
72
|
private static final double PI = Math.PI;
|
87
73
|
|
88
74
|
//===============================================================================
|
@@ -96,13 +82,6 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
96
82
|
private int width;
|
97
83
|
private int height;
|
98
84
|
private String maptype;
|
99
|
-
private Vector annotations;
|
100
|
-
|
101
|
-
private boolean needToCloseMap = false;
|
102
|
-
|
103
|
-
public boolean needToClose() {
|
104
|
-
return needToCloseMap;
|
105
|
-
}
|
106
85
|
|
107
86
|
private class CachedImage {
|
108
87
|
public EncodedImage image;
|
@@ -125,17 +104,31 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
125
104
|
};
|
126
105
|
|
127
106
|
private class ImageCache {
|
128
|
-
private Hashtable hash
|
129
|
-
private SimpleSortingVector cvec
|
130
|
-
private SimpleSortingVector tvec
|
107
|
+
private Hashtable hash;
|
108
|
+
private SimpleSortingVector cvec;
|
109
|
+
private SimpleSortingVector tvec;
|
131
110
|
|
132
111
|
public ImageCache() {
|
112
|
+
reinit();
|
113
|
+
}
|
114
|
+
|
115
|
+
private void reinit() {
|
116
|
+
hash = new Hashtable();
|
117
|
+
cvec = new SimpleSortingVector();
|
133
118
|
cvec.setSortComparator(new ByCoordinatesComparator());
|
134
119
|
cvec.setSort(true);
|
120
|
+
tvec = new SimpleSortingVector();
|
135
121
|
tvec.setSortComparator(new ByAccessTimeComparator());
|
136
122
|
tvec.setSort(true);
|
137
123
|
}
|
138
124
|
|
125
|
+
public ImageCache clone() {
|
126
|
+
ImageCache cloned = new ImageCache();
|
127
|
+
for (Enumeration e = hash.elements(); e.hasMoreElements();)
|
128
|
+
cloned.put((CachedImage)e.nextElement());
|
129
|
+
return cloned;
|
130
|
+
}
|
131
|
+
|
139
132
|
public Enumeration sortedByCoordinates() {
|
140
133
|
return cvec.elements();
|
141
134
|
}
|
@@ -160,13 +153,7 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
160
153
|
return;
|
161
154
|
|
162
155
|
SimpleSortingVector vec = tvec;
|
163
|
-
|
164
|
-
cvec = new SimpleSortingVector();
|
165
|
-
cvec.setSortComparator(new ByCoordinatesComparator());
|
166
|
-
cvec.setSort(true);
|
167
|
-
tvec = new SimpleSortingVector();
|
168
|
-
tvec.setSortComparator(new ByAccessTimeComparator());
|
169
|
-
tvec.setSort(true);
|
156
|
+
reinit();
|
170
157
|
|
171
158
|
Enumeration e = vec.elements();
|
172
159
|
while (e.hasMoreElements()) {
|
@@ -191,18 +178,16 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
191
178
|
public int width;
|
192
179
|
public int height;
|
193
180
|
public String maptype;
|
194
|
-
public Vector annotations;
|
195
181
|
public GoogleMapField mapField;
|
196
182
|
|
197
183
|
public MapFetchCommand(long lat, long lon, int z, int w, int h,
|
198
|
-
String m,
|
184
|
+
String m, GoogleMapField mf) {
|
199
185
|
latitude = lat;
|
200
186
|
longitude = lon;
|
201
187
|
zoom = z;
|
202
188
|
width = w;
|
203
189
|
height = h;
|
204
190
|
maptype = m;
|
205
|
-
annotations = a;
|
206
191
|
mapField = mf;
|
207
192
|
}
|
208
193
|
|
@@ -212,7 +197,7 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
212
197
|
MapFetchCommand cmd = (MapFetchCommand)c;
|
213
198
|
return latitude == cmd.latitude && longitude == cmd.longitude &&
|
214
199
|
zoom == cmd.zoom && width == cmd.width && maptype.equals(cmd.maptype) &&
|
215
|
-
|
200
|
+
mapField == cmd.mapField;
|
216
201
|
}
|
217
202
|
|
218
203
|
public String type() {
|
@@ -224,38 +209,6 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
224
209
|
}
|
225
210
|
}
|
226
211
|
|
227
|
-
private static class MapGeocodingCommand extends MapCommand {
|
228
|
-
|
229
|
-
public Annotation annotation;
|
230
|
-
public GoogleMapField mapField;
|
231
|
-
|
232
|
-
public MapGeocodingCommand(Annotation a, GoogleMapField mf) {
|
233
|
-
annotation = a;
|
234
|
-
mapField = mf;
|
235
|
-
}
|
236
|
-
|
237
|
-
public boolean equals(Object c) {
|
238
|
-
if (!(c instanceof MapGeocodingCommand))
|
239
|
-
return false;
|
240
|
-
MapGeocodingCommand cmd = (MapGeocodingCommand)c;
|
241
|
-
return annotation.equals(cmd.annotation);
|
242
|
-
}
|
243
|
-
|
244
|
-
public String type() {
|
245
|
-
return "geocoding";
|
246
|
-
}
|
247
|
-
|
248
|
-
public String description() {
|
249
|
-
if (annotation.street_address != null)
|
250
|
-
return "location:\"" + annotation.street_address + "\"";
|
251
|
-
else if (annotation.coordinates != null)
|
252
|
-
return "location:" + annotation.coordinates.latitude + "," +
|
253
|
-
annotation.coordinates.longitude;
|
254
|
-
else
|
255
|
-
return "location:null";
|
256
|
-
}
|
257
|
-
}
|
258
|
-
|
259
212
|
private static class MapThread extends Thread {
|
260
213
|
|
261
214
|
private static final String mapkey = "ABQIAAAA-X8Mm7F-7Nmz820lFEBHYxT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSfNPZbryNEPHF-5PQKi9c7Fbdf-A";
|
@@ -298,40 +251,57 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
298
251
|
interrupt();
|
299
252
|
}
|
300
253
|
|
301
|
-
private byte[] fetchData(String url) throws IOException
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
//conn.setRequestProperty("User-Agent", "Blackberry");
|
307
|
-
//conn.setRequestProperty("Accept", "*/*");
|
308
|
-
|
309
|
-
InputStream is = conn.openInputStream();
|
310
|
-
|
311
|
-
int code = conn.getResponseCode();
|
312
|
-
if (code/100 != 2)
|
313
|
-
throw new IOException("Google map respond with " + code + " " + conn.getResponseMessage());
|
314
|
-
|
315
|
-
int size = conn.getHeaderFieldInt("Content-Length", 0);
|
316
|
-
byte[] data = new byte[size];
|
317
|
-
if (size == 0)
|
318
|
-
size = 1073741824; // 1Gb :)
|
254
|
+
private byte[] fetchData(String url) throws IOException
|
255
|
+
{
|
256
|
+
IHttpConnection conn = null;
|
257
|
+
InputStream is = null;
|
319
258
|
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
259
|
+
try
|
260
|
+
{
|
261
|
+
conn = RhoClassFactory.getNetworkAccess().connect(url,false);
|
262
|
+
|
263
|
+
conn.setRequestMethod("GET");
|
264
|
+
|
265
|
+
//conn.setRequestProperty("User-Agent", "Blackberry");
|
266
|
+
//conn.setRequestProperty("Accept", "*/*");
|
267
|
+
|
268
|
+
is = conn.openInputStream();
|
269
|
+
|
270
|
+
int code = conn.getResponseCode();
|
271
|
+
if (code/100 != 2)
|
272
|
+
throw new IOException("Google map respond with " + code + " " + conn.getResponseMessage());
|
273
|
+
|
274
|
+
int size = conn.getHeaderFieldInt("Content-Length", 0);
|
275
|
+
byte[] data = new byte[size];
|
276
|
+
if (size == 0)
|
277
|
+
size = 1073741824; // 1Gb :)
|
278
|
+
|
279
|
+
byte[] buf = new byte[BLOCK_SIZE];
|
280
|
+
for (int offset = 0; offset < size;) {
|
281
|
+
int n = is.read(buf, 0, BLOCK_SIZE);
|
282
|
+
if (n <= 0)
|
283
|
+
break;
|
284
|
+
if (offset + n > data.length) {
|
285
|
+
byte[] newData = new byte[offset + n];
|
286
|
+
System.arraycopy(data, 0, newData, 0, data.length);
|
287
|
+
data = newData;
|
288
|
+
}
|
289
|
+
System.arraycopy(buf, 0, data, offset, n);
|
290
|
+
offset += n;
|
329
291
|
}
|
330
|
-
|
331
|
-
|
292
|
+
|
293
|
+
return data;
|
294
|
+
}finally
|
295
|
+
{
|
296
|
+
if ( is != null )
|
297
|
+
try{ is.close(); }catch(IOException e){}
|
298
|
+
|
299
|
+
if ( conn != null )
|
300
|
+
try{ conn.close(); }catch(IOException e){}
|
301
|
+
|
302
|
+
is = null;
|
303
|
+
conn = null;
|
332
304
|
}
|
333
|
-
|
334
|
-
return data;
|
335
305
|
}
|
336
306
|
|
337
307
|
private void processCommand(MapFetchCommand cmd) throws IOException {
|
@@ -352,22 +322,6 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
352
322
|
url.append("&format=png&sensor=false");
|
353
323
|
url.append("&mobile=" + (cmd.maptype.equals("roadmap") ? "true" : "false"));
|
354
324
|
url.append("&key=" + mapkey);
|
355
|
-
if (!cmd.annotations.isEmpty()) {
|
356
|
-
url.append("&markers=color:blue");
|
357
|
-
for (int i = 0, lim = cmd.annotations.size(); i < lim; ++i) {
|
358
|
-
Annotation ann = (Annotation)cmd.annotations.elementAt(i);
|
359
|
-
if (ann.coordinates != null) {
|
360
|
-
url.append('|');
|
361
|
-
url.append(ann.coordinates.latitude);
|
362
|
-
url.append(',');
|
363
|
-
url.append(ann.coordinates.longitude);
|
364
|
-
}
|
365
|
-
else if (ann.street_address != null) {
|
366
|
-
url.append('|');
|
367
|
-
url.append(URI.urlEncode(ann.street_address));
|
368
|
-
}
|
369
|
-
}
|
370
|
-
}
|
371
325
|
String finalUrl = url.toString();
|
372
326
|
|
373
327
|
byte[] data = fetchData(finalUrl);
|
@@ -378,66 +332,6 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
378
332
|
cmd.mapField.draw(cmd.latitude, cmd.longitude, cmd.zoom, img);
|
379
333
|
}
|
380
334
|
|
381
|
-
private void processCommand(MapGeocodingCommand cmd) throws IOException, RhoJSONException {
|
382
|
-
LOG.TRACE("Processing map geocoding command (thread #" + hashCode() + "): " + cmd.description());
|
383
|
-
|
384
|
-
if (cmd.annotation.street_address == null) {
|
385
|
-
LOG.ERROR("Can not make geocoding request: street address is null");
|
386
|
-
return;
|
387
|
-
}
|
388
|
-
|
389
|
-
StringBuffer url = new StringBuffer();
|
390
|
-
url.append("http://maps.google.com/maps/geo?");
|
391
|
-
url.append("q=" + URI.urlEncode(cmd.annotation.street_address));
|
392
|
-
url.append("&output=json&mobile=true&sensor=false");
|
393
|
-
url.append("&key=" + mapkey);
|
394
|
-
|
395
|
-
String finalUrl = url.toString();
|
396
|
-
|
397
|
-
byte[] data = fetchData(finalUrl);
|
398
|
-
String response = new String(data);
|
399
|
-
|
400
|
-
RhoJSONObject resp = new RhoJSONObject(response);
|
401
|
-
RhoJSONObject status = resp.getJSONObject("Status");
|
402
|
-
int statusCode = status.getInt("code");
|
403
|
-
if (statusCode/100 != 2) {
|
404
|
-
LOG.ERROR("Error received from geocoding service: " + statusCode);
|
405
|
-
return;
|
406
|
-
}
|
407
|
-
|
408
|
-
RhoJSONArray placemarks = resp.getJSONArray("Placemark");
|
409
|
-
if (placemarks.length() == 0) {
|
410
|
-
LOG.ERROR("Geocoding request return empty response");
|
411
|
-
return;
|
412
|
-
}
|
413
|
-
RhoJSONObject placemark = placemarks.getJSONObject(0);
|
414
|
-
RhoJSONObject point = placemark.getJSONObject("Point");
|
415
|
-
RhoJSONArray coordinates = point.getJSONArray("coordinates");
|
416
|
-
if (coordinates.length() < 2) {
|
417
|
-
LOG.ERROR("Geocoding response contains less than 2 coordinates");
|
418
|
-
return;
|
419
|
-
}
|
420
|
-
double longitude = coordinates.getDouble(0);
|
421
|
-
double latitude = coordinates.getDouble(1);
|
422
|
-
|
423
|
-
/*
|
424
|
-
// Parse response
|
425
|
-
Vector res = split(response, ",");
|
426
|
-
if (res.size() != 4) {
|
427
|
-
LOG.ERROR("Geocoding response parse error. Response: " + response);
|
428
|
-
return;
|
429
|
-
}
|
430
|
-
|
431
|
-
int statusCode = Integer.parseInt((String)res.elementAt(0));
|
432
|
-
int accuracy = Integer.parseInt((String)res.elementAt(1));
|
433
|
-
double latitude = Double.parseDouble((String)res.elementAt(2));
|
434
|
-
double longitude = Double.parseDouble((String)res.elementAt(3));
|
435
|
-
*/
|
436
|
-
|
437
|
-
LOG.TRACE("Geocoding request done, pass results back");
|
438
|
-
cmd.mapField.geocodingDone(cmd.annotation, latitude, longitude);
|
439
|
-
}
|
440
|
-
|
441
335
|
public void run() {
|
442
336
|
try {
|
443
337
|
while (active) {
|
@@ -459,8 +353,6 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
459
353
|
try {
|
460
354
|
if (cmd instanceof MapFetchCommand)
|
461
355
|
processCommand((MapFetchCommand)cmd);
|
462
|
-
else if (cmd instanceof MapGeocodingCommand)
|
463
|
-
processCommand((MapGeocodingCommand)cmd);
|
464
356
|
else
|
465
357
|
LOG.INFO("Received unknown command: " + cmd.type() + ", ignore it");
|
466
358
|
}
|
@@ -648,7 +540,7 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
648
540
|
if (img == null) {
|
649
541
|
if (curTime - CACHE_UPDATE_INTERVAL > lastFetchCommandSent) {
|
650
542
|
cmd = new MapFetchCommand(lat, lon, zoom,
|
651
|
-
rts, rts, maptype,
|
543
|
+
rts, rts, maptype, mapField);
|
652
544
|
CachedImage dummy = new CachedImage(null, lat, lon, zoom);
|
653
545
|
cache.put(dummy);
|
654
546
|
fetchCommandWasSent = true;
|
@@ -689,7 +581,6 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
689
581
|
if (tileSize + 2*ADDITIONAL_AREA_WIDTH > MAX_GOOGLE_TILE_SIZE)
|
690
582
|
tileSize = MAX_GOOGLE_TILE_SIZE - 2*ADDITIONAL_AREA_WIDTH;
|
691
583
|
maptype = "roadmap";
|
692
|
-
annotations = new Vector();
|
693
584
|
|
694
585
|
cacheUpdate = new CacheUpdate(this);
|
695
586
|
cacheUpdate.start();
|
@@ -744,7 +635,7 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
744
635
|
long top = -toCurrentZoom(latitude - img.latitude, zoom);
|
745
636
|
|
746
637
|
if (img.zoom != zoom) {
|
747
|
-
double x =
|
638
|
+
double x = MapTools.math_pow2d(img.zoom - zoom);
|
748
639
|
int factor = Fixed32.tenThouToFP((int)(x*10000));
|
749
640
|
img.image = img.image.scaleImage32(factor, factor);
|
750
641
|
img.bitmap = null;
|
@@ -772,17 +663,17 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
772
663
|
}
|
773
664
|
|
774
665
|
protected void paint(Graphics graphics) {
|
775
|
-
ImageCache imgCache = null;
|
776
|
-
synchronized (this) {
|
777
|
-
imgCache = cache;
|
778
|
-
}
|
779
|
-
|
780
666
|
// Draw background
|
781
667
|
for (int i = 1, lim = 2*Math.max(width, height); i < lim; i += 5) {
|
782
668
|
graphics.drawLine(0, i, i, 0);
|
783
669
|
}
|
784
|
-
|
670
|
+
|
785
671
|
// Draw map tiles
|
672
|
+
ImageCache imgCache;
|
673
|
+
synchronized (this) {
|
674
|
+
imgCache = cache.clone();
|
675
|
+
}
|
676
|
+
|
786
677
|
Enumeration e = imgCache.sortedByCoordinates();
|
787
678
|
while (e.hasMoreElements()) {
|
788
679
|
// Draw map
|
@@ -793,6 +684,7 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
793
684
|
paintImage(graphics, img);
|
794
685
|
}
|
795
686
|
|
687
|
+
/*
|
796
688
|
// Draw pointer at center
|
797
689
|
graphics.setColor(0x00000000); // Black
|
798
690
|
// Draw black cross
|
@@ -805,14 +697,7 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
805
697
|
int xRight = xCenter + delta;
|
806
698
|
graphics.drawLine(xCenter, yTop, xCenter, yBottom);
|
807
699
|
graphics.drawLine(xLeft, yCenter, xRight, yCenter);
|
808
|
-
|
809
|
-
Annotation a = getCurrentAnnotation();
|
810
|
-
if (a != null && a.url != null) {
|
811
|
-
// Annotation found, so draw pointer
|
812
|
-
//graphics.setColor(0x00FFFFFF); // White
|
813
|
-
for (delta = 3; delta <= 7; delta += 2)
|
814
|
-
graphics.drawEllipse(xCenter, yCenter, xCenter + delta, yCenter, xCenter, yCenter + delta, 0, 360);
|
815
|
-
}
|
700
|
+
*/
|
816
701
|
}
|
817
702
|
|
818
703
|
public void redraw() {
|
@@ -849,7 +734,7 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
849
734
|
public int compare (Object o1, Object o2) {
|
850
735
|
long l1 = ((CachedImage)o1).lastUsed;
|
851
736
|
long l2 = ((CachedImage)o2).lastUsed;
|
852
|
-
return l1 < l2 ? 1 : l1 > l2 ?
|
737
|
+
return l1 < l2 ? -1 : l1 > l2 ? 1 : 0;
|
853
738
|
}
|
854
739
|
|
855
740
|
};
|
@@ -919,185 +804,61 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
919
804
|
lastFetchCommandSent = 0;
|
920
805
|
}
|
921
806
|
|
922
|
-
public void addAnnotation(Annotation ann) {
|
923
|
-
if (ann.street_address == null && ann.coordinates == null)
|
924
|
-
return;
|
925
|
-
if (ann.coordinates != null) {
|
926
|
-
long nlat = degreesToPixelsY(ann.coordinates.latitude, MAX_ZOOM);
|
927
|
-
long nlon = degreesToPixelsX(ann.coordinates.longitude, MAX_ZOOM);
|
928
|
-
ann.normalized_coordinates = new Annotation.NormalizedCoordinates(nlat, nlon);
|
929
|
-
}
|
930
|
-
annotations.addElement(ann);
|
931
|
-
if (ann.coordinates == null)
|
932
|
-
fetchThreadPool.send(new MapGeocodingCommand(ann, this));
|
933
|
-
}
|
934
|
-
|
935
|
-
private void geocodingDone(Annotation ann, double lat, double lon) {
|
936
|
-
|
937
|
-
LOG.TRACE("Apply geocoding result: " + lat + "," + lon);
|
938
|
-
ann.coordinates = new Annotation.Coordinates(lat, lon);
|
939
|
-
long nlat = degreesToPixelsY(lat, MAX_ZOOM);
|
940
|
-
long nlon = degreesToPixelsX(lon, MAX_ZOOM);
|
941
|
-
ann.normalized_coordinates = new Annotation.NormalizedCoordinates(nlat, nlon);
|
942
|
-
if (ann.type.equals("center")) {
|
943
|
-
moveTo(lat, lon);
|
944
|
-
}
|
945
|
-
}
|
946
|
-
|
947
807
|
private static int calcZoom(double degrees, int pixels) {
|
948
808
|
double angleRatio = degrees*GOOGLE_TILE_SIZE/pixels;
|
949
809
|
|
950
810
|
double twoInZoomExp = 360/angleRatio;
|
951
|
-
int zoom = (int)math_log2(twoInZoomExp);
|
811
|
+
int zoom = (int)MapTools.math_log2(twoInZoomExp);
|
952
812
|
return zoom;
|
953
813
|
}
|
954
814
|
|
955
815
|
private static long toMaxZoom(long n, int zoom) {
|
956
|
-
return n == 0 ? 0 : n*(
|
816
|
+
return n == 0 ? 0 : n*MapTools.math_pow2(MAX_ZOOM - zoom);
|
957
817
|
}
|
958
818
|
|
959
819
|
private static long toCurrentZoom(long coord, int zoom) {
|
960
820
|
if (coord == 0) return 0;
|
961
|
-
long pow = (
|
821
|
+
long pow = MapTools.math_pow2(MAX_ZOOM - zoom);
|
962
822
|
return coord/pow;
|
963
823
|
}
|
964
824
|
|
965
825
|
private static long degreesToPixelsX(double n, int z) {
|
966
826
|
while (n < -180.0) n += 360.0;
|
967
827
|
while (n > 180.0) n -= 360.0;
|
968
|
-
double angleRatio =
|
828
|
+
double angleRatio = 360d/MapTools.math_pow2(z);
|
969
829
|
double val = (n + 180)*GOOGLE_TILE_SIZE/angleRatio;
|
970
830
|
return (long)val;
|
971
831
|
}
|
972
832
|
|
973
833
|
private static long degreesToPixelsY(double n, int z) {
|
974
834
|
// Google use Merkator projection so use it here
|
975
|
-
double sin_phi = math_sin(n*PI/180);
|
835
|
+
double sin_phi = MapTools.math_sin(n*PI/180);
|
976
836
|
// MAX_SIN - maximum value of sine allowed by Merkator projection
|
977
837
|
// (~85.0 degrees of north latitude)
|
978
838
|
if (sin_phi < -MAX_SIN) sin_phi = -MAX_SIN;
|
979
839
|
if (sin_phi > MAX_SIN) sin_phi = MAX_SIN;
|
980
840
|
|
981
|
-
double ath = math_atanh(sin_phi);
|
982
|
-
double val = GOOGLE_TILE_SIZE *
|
841
|
+
double ath = MapTools.math_atanh(sin_phi);
|
842
|
+
double val = GOOGLE_TILE_SIZE * MapTools.math_pow2(z) * (1 - ath/PI)/2;
|
983
843
|
return (long)val;
|
984
844
|
}
|
985
845
|
|
986
846
|
private static double pixelsToDegreesX(long n, int z) {
|
987
847
|
while (n < 0) n += MAX_LONGITUDE;
|
988
848
|
while (n > MAX_LONGITUDE) n -= MAX_LONGITUDE;
|
989
|
-
double angleRatio =
|
849
|
+
double angleRatio = 360d/MapTools.math_pow2(z);
|
990
850
|
double val = n*angleRatio/GOOGLE_TILE_SIZE - 180.0;
|
991
851
|
return val;
|
992
852
|
}
|
993
853
|
|
994
854
|
private static double pixelsToDegreesY(long n, int z) {
|
995
855
|
// Revert calculation of Merkator projection
|
996
|
-
double ath = PI - 2*PI*n/(GOOGLE_TILE_SIZE*
|
997
|
-
double th = math_tanh(ath);
|
998
|
-
double val = 180*math_asin(th)/PI;
|
856
|
+
double ath = PI - 2*PI*n/(GOOGLE_TILE_SIZE*MapTools.math_pow2(z));
|
857
|
+
double th = MapTools.math_tanh(ath);
|
858
|
+
double val = 180*MapTools.math_asin(th)/PI;
|
999
859
|
return val;
|
1000
860
|
}
|
1001
861
|
|
1002
|
-
private static Vector split(String s, String delimiter) {
|
1003
|
-
Vector res = new Vector();
|
1004
|
-
for (int start = 0, end = start;;) {
|
1005
|
-
end = s.indexOf(delimiter, start);
|
1006
|
-
if (end == -1) {
|
1007
|
-
res.addElement(s.substring(start));
|
1008
|
-
break;
|
1009
|
-
}
|
1010
|
-
else {
|
1011
|
-
res.addElement(s.substring(start, end));
|
1012
|
-
start = end + delimiter.length();
|
1013
|
-
}
|
1014
|
-
}
|
1015
|
-
|
1016
|
-
return res;
|
1017
|
-
}
|
1018
|
-
|
1019
|
-
private Annotation getCurrentAnnotation() {
|
1020
|
-
// return current annotation (point we are under now)
|
1021
|
-
Enumeration e = annotations.elements();
|
1022
|
-
while (e.hasMoreElements()) {
|
1023
|
-
Annotation a = (Annotation)e.nextElement();
|
1024
|
-
Annotation.NormalizedCoordinates coords = a.normalized_coordinates;
|
1025
|
-
if (coords == null)
|
1026
|
-
continue;
|
1027
|
-
|
1028
|
-
long deltaX = toCurrentZoom(longitude - coords.longitude, zoom);
|
1029
|
-
long deltaY = toCurrentZoom(latitude - coords.latitude, zoom);
|
1030
|
-
// Move area of sensitivity bit higher
|
1031
|
-
deltaY += ANNOTATION_SENSIVITY_AREA_RADIUS*3;
|
1032
|
-
|
1033
|
-
double distance = math_pow(math_pow(deltaX, 2) + math_pow(deltaY, 2), 0.5);
|
1034
|
-
if ((int)distance > ANNOTATION_SENSIVITY_AREA_RADIUS)
|
1035
|
-
continue;
|
1036
|
-
|
1037
|
-
return a;
|
1038
|
-
}
|
1039
|
-
return null;
|
1040
|
-
}
|
1041
|
-
|
1042
|
-
public boolean handleClick() {
|
1043
|
-
Annotation a = getCurrentAnnotation();
|
1044
|
-
if (a == null || a.url == null)
|
1045
|
-
return false;
|
1046
|
-
|
1047
|
-
needToCloseMap = true;
|
1048
|
-
WebView.navigate(a.url);
|
1049
|
-
return true;
|
1050
|
-
}
|
1051
|
-
|
1052
|
-
//================================================================
|
1053
|
-
// Mathematical functions
|
1054
|
-
|
1055
|
-
// Sine of the a
|
1056
|
-
private static double math_sin(double a) {
|
1057
|
-
return Math.sin(a);
|
1058
|
-
}
|
1059
|
-
|
1060
|
-
// Arc sine of the a
|
1061
|
-
private static double math_asin(double a) {
|
1062
|
-
//return MathUtilities.asin(a);
|
1063
|
-
return MathEx.asin(a);
|
1064
|
-
}
|
1065
|
-
|
1066
|
-
// Exponential (base E ~ 2.718281828) of a
|
1067
|
-
private static double math_exp(double a) {
|
1068
|
-
//return MathUtilities.exp(a);
|
1069
|
-
return MathEx.exp(a);
|
1070
|
-
}
|
1071
|
-
|
1072
|
-
// Natural logarithm (base E ~ 2.718281828) of a
|
1073
|
-
private static double math_ln(double a) {
|
1074
|
-
//return MathUtilities.log(a);
|
1075
|
-
return MathEx.log(a);
|
1076
|
-
}
|
1077
|
-
|
1078
|
-
// Binary logarithm (base 2) of a
|
1079
|
-
private static double math_log2(double a) {
|
1080
|
-
return math_ln(a)/LN2;
|
1081
|
-
}
|
1082
|
-
|
1083
|
-
// a raised to the power of b
|
1084
|
-
private static double math_pow(double a, double b) {
|
1085
|
-
//return MathUtilities.pow(a, b);
|
1086
|
-
return MathEx.pow(a, b);
|
1087
|
-
}
|
1088
|
-
|
1089
|
-
// Hyperbolic tangent of a
|
1090
|
-
private static double math_tanh(double a) {
|
1091
|
-
double epx = math_exp(a);
|
1092
|
-
double emx = math_exp(-a);
|
1093
|
-
return (epx - emx)/(epx + emx);
|
1094
|
-
}
|
1095
|
-
|
1096
|
-
// Hyperbolic arc tangent of a
|
1097
|
-
private static double math_atanh(double a) {
|
1098
|
-
return 0.5*math_ln((1 + a)/(1 - a));
|
1099
|
-
}
|
1100
|
-
|
1101
862
|
public double getCenterLatitude() {
|
1102
863
|
return pixelsToDegreesY(latitude, MAX_ZOOM);
|
1103
864
|
}
|
@@ -1106,4 +867,17 @@ public class GoogleMapField extends Field implements RhoMapField {
|
|
1106
867
|
return pixelsToDegreesX(longitude, MAX_ZOOM);
|
1107
868
|
}
|
1108
869
|
|
870
|
+
public long toScreenCoordinateX(double n) {
|
871
|
+
long v = degreesToPixelsX(n, zoom);
|
872
|
+
long center = toCurrentZoom(longitude, zoom);
|
873
|
+
long begin = center - width/2;
|
874
|
+
return v - begin;
|
875
|
+
}
|
876
|
+
|
877
|
+
public long toScreenCoordinateY(double n) {
|
878
|
+
long v = degreesToPixelsY(n, zoom);
|
879
|
+
long center = toCurrentZoom(latitude, zoom);
|
880
|
+
long begin = center - height/2;
|
881
|
+
return v - begin;
|
882
|
+
}
|
1109
883
|
}
|