├── .cordova ├── .eslintignore ├── .jshintrc ├── images ├── map.png ├── poly.png ├── circle.png ├── encode.png ├── marker.png ├── polygon.png ├── touch.png ├── geocoder.png ├── icon-ios.png ├── polyline.png ├── spherical.png ├── browser_demo.gif ├── icon-android.png ├── kmloverlay.png ├── streetview.png ├── tileoverlay.png ├── documentations.png ├── groundoverlay.png ├── htmlInfoWindow.png ├── markercluster.png ├── development_mode.png ├── locationService.png ├── modern_browsers.png └── api_key_restrictions.png ├── src ├── android │ ├── frameworks │ │ ├── tbxml-android.aar │ │ ├── tbxml-android.gradle │ │ └── pgm-custom.gradle │ ├── res │ │ ├── drawable │ │ │ ├── dummy_my_location_button.png │ │ │ └── dummy_mylocation_button_shadow.xml │ │ ├── layout │ │ │ └── dummy_infowindow.xml │ │ ├── values-ja │ │ │ └── pgm_strings.xml │ │ ├── values-ar │ │ │ └── pgm_strings.xml │ │ ├── values-nl │ │ │ └── pgm_strings.xml │ │ ├── values-hi │ │ │ └── pgm_strings.xml │ │ ├── values-uk │ │ │ └── pgm_strings.xml │ │ ├── values-vi │ │ │ └── pgm_strings.xml │ │ ├── values-in │ │ │ └── pgm_strings.xml │ │ ├── values-ru │ │ │ └── pgm_strings.xml │ │ ├── values │ │ │ └── pgm_strings.xml │ │ ├── values-nb │ │ │ └── pgm_strings.xml │ │ ├── values-pt-rPT │ │ │ └── pgm_strings.xml │ │ ├── values-pl │ │ │ └── pgm_strings.xml │ │ ├── values-da │ │ │ └── pgm_strings.xml │ │ ├── values-es │ │ │ └── pgm_strings.xml │ │ ├── values-de │ │ │ └── pgm_strings.xml │ │ └── values-fr │ │ │ └── pgm_strings.xml │ └── plugin │ │ └── google │ │ └── maps │ │ ├── AsyncLoadImageInterface.java │ │ ├── PluginAsyncInterface.java │ │ ├── BitmapCache.java │ │ ├── IPluginView.java │ │ ├── MyPluginInterface.java │ │ ├── ObjectCache.java │ │ └── PluginEnvironment.java ├── ios │ ├── GoogleMaps │ │ ├── MFGoogleMapAdditions │ │ │ ├── README.md │ │ │ ├── GMSCoordinateBounds+Geometry.h │ │ │ ├── LICENSE │ │ │ └── GMSCoordinateBounds+Geometry.m │ │ ├── IPluginView.h │ │ ├── MyPluginScrollView.h │ │ ├── IPluginProtocol.h │ │ ├── PluginEnvironment.h │ │ ├── PluginGeocoder.h │ │ ├── UIImageCache.h │ │ ├── PluginObjects.h │ │ ├── PluginLocationService.h │ │ ├── PluginKmlOverlay.h │ │ ├── PluginMapViewController.h │ │ ├── PluginCircle.h │ │ ├── GMSCoordinateBounds+Geometry.h │ │ ├── PluginTileOverlay.h │ │ ├── PluginMarkerCluster.h │ │ ├── PluginPolyline.h │ │ ├── CordovaGoogleMaps.h │ │ ├── PluginTileProvider.h │ │ ├── PluginObjects.m │ │ ├── PluginStreetViewPanorama.h │ │ ├── PluginGroundOverlay.h │ │ ├── PluginViewController.h │ │ ├── PluginPolygon.h │ │ ├── MyPluginLayer.h │ │ ├── MyPluginScrollView.m │ │ ├── UIImageCache.m │ │ ├── PluginViewController.m │ │ ├── PluginMap.h │ │ ├── PluginMarker.h │ │ ├── PluginStreetViewPanoramaController.h │ │ ├── PluginUtil.h │ │ ├── GMSCoordinateBounds+Geometry.m │ │ └── PluginEnvironment.m │ ├── strings │ │ ├── pgm_Localizable_ja.json │ │ ├── pgm_Localizable_en.json │ │ ├── pgm_Localizable_ar.json │ │ ├── pgm_Localizable_in.json │ │ ├── pgm_Localizable_hi.json │ │ ├── pgm_Localizable_nb.json │ │ ├── pgm_Localizable_uk.json │ │ ├── pgm_Localizable_nl.json │ │ ├── pgm_Localizable_pl.json │ │ ├── pgm_Localizable_ru.json │ │ ├── pgm_Localizable_vi.json │ │ ├── pgm_Localizable_da.json │ │ ├── pgm_Localizable_de.json │ │ ├── pgm_Localizable_es.json │ │ ├── pgm_Localizable_pt-BR.json │ │ └── pgm_Localizable_fr.json │ └── check_sdk_version.js └── browser │ ├── __test__ │ └── PluginMap.spec.js │ ├── PluginEnvironment.js │ └── PluginLocationService.js ├── jest.config.js ├── www ├── MapTypeId.js ├── Location.js ├── CameraPosition.js ├── Environment.js ├── event.js ├── LatLng.js ├── plugin-loader-for-browser.js ├── VisibleRegion.js ├── InlineWorker.js ├── encoding.js ├── __test__ │ ├── __snapshots__ │ │ └── Geocoder.spec.js.snap │ └── Geocoder.spec.js ├── poly.js ├── Cluster.js ├── Overlay.js ├── TileOverlay.js ├── LocationService.js ├── LatLngBounds.js ├── geomodel.js ├── Geocoder.js └── GroundOverlay.js ├── .jsbeautifyrc ├── tests ├── tests.js ├── package.json ├── plugin.xml └── travis.sh ├── pull_request_template.md ├── jsdoc.json ├── .gitignore ├── jest-cordova-resolver.js ├── .github ├── ISSUE_TEMPLATE │ ├── feature_request.md │ ├── private-support.md │ └── question-or-bug-report.md └── ISSUE_TEMPLATE.md ├── .eslintrc.js ├── package.json └── .travis.yml /.cordova: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | www/Promise.js 2 | *.spec.js -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "esversion": 5 3 | } 4 | -------------------------------------------------------------------------------- /images/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/map.png -------------------------------------------------------------------------------- /images/poly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/poly.png -------------------------------------------------------------------------------- /images/circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/circle.png -------------------------------------------------------------------------------- /images/encode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/encode.png -------------------------------------------------------------------------------- /images/marker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/marker.png -------------------------------------------------------------------------------- /images/polygon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/polygon.png -------------------------------------------------------------------------------- /images/touch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/touch.png -------------------------------------------------------------------------------- /images/geocoder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/geocoder.png -------------------------------------------------------------------------------- /images/icon-ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/icon-ios.png -------------------------------------------------------------------------------- /images/polyline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/polyline.png -------------------------------------------------------------------------------- /images/spherical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/spherical.png -------------------------------------------------------------------------------- /images/browser_demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/browser_demo.gif -------------------------------------------------------------------------------- /images/icon-android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/icon-android.png -------------------------------------------------------------------------------- /images/kmloverlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/kmloverlay.png -------------------------------------------------------------------------------- /images/streetview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/streetview.png -------------------------------------------------------------------------------- /images/tileoverlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/tileoverlay.png -------------------------------------------------------------------------------- /images/documentations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/documentations.png -------------------------------------------------------------------------------- /images/groundoverlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/groundoverlay.png -------------------------------------------------------------------------------- /images/htmlInfoWindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/htmlInfoWindow.png -------------------------------------------------------------------------------- /images/markercluster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/markercluster.png -------------------------------------------------------------------------------- /images/development_mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/development_mode.png -------------------------------------------------------------------------------- /images/locationService.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/locationService.png -------------------------------------------------------------------------------- /images/modern_browsers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/modern_browsers.png -------------------------------------------------------------------------------- /images/api_key_restrictions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/images/api_key_restrictions.png -------------------------------------------------------------------------------- /src/android/frameworks/tbxml-android.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/src/android/frameworks/tbxml-android.aar -------------------------------------------------------------------------------- /src/android/res/drawable/dummy_my_location_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapsplugin/cordova-plugin-googlemaps/HEAD/src/android/res/drawable/dummy_my_location_button.png -------------------------------------------------------------------------------- /src/android/plugin/google/maps/AsyncLoadImageInterface.java: -------------------------------------------------------------------------------- 1 | package plugin.google.maps; 2 | 3 | public interface AsyncLoadImageInterface { 4 | public void onPostExecute(AsyncLoadImage.AsyncLoadImageResult result) ; 5 | } 6 | -------------------------------------------------------------------------------- /src/android/plugin/google/maps/PluginAsyncInterface.java: -------------------------------------------------------------------------------- 1 | package plugin.google.maps; 2 | 3 | public interface PluginAsyncInterface { 4 | public void onPostExecute(Object object); 5 | public void onError(String errorMsg); 6 | } 7 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | moduleNameMapper: { 3 | '^cordova/(.*)$': '/node_modules/cordova-js/src/common/$1', 4 | }, 5 | resolver: './jest-cordova-resolver.js', 6 | globals: { 7 | cordova: {}, 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /www/MapTypeId.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'NORMAL': 'MAP_TYPE_NORMAL', 3 | 'ROADMAP': 'MAP_TYPE_NORMAL', 4 | 'SATELLITE': 'MAP_TYPE_SATELLITE', 5 | 'HYBRID': 'MAP_TYPE_HYBRID', 6 | 'TERRAIN': 'MAP_TYPE_TERRAIN', 7 | 'NONE': 'MAP_TYPE_NONE' 8 | }; 9 | -------------------------------------------------------------------------------- /.jsbeautifyrc: -------------------------------------------------------------------------------- 1 | { 2 | "js": { 3 | "indent_size": 2, 4 | "indent_char": " ", 5 | "indent_level": 0, 6 | "indent_with_tabs": false, 7 | "preserve_newlines": true, 8 | "max_preserve_newlines": 2, 9 | "jslint_happy": true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/MFGoogleMapAdditions/README.md: -------------------------------------------------------------------------------- 1 | # MFGoogleMapAdditions 2 | 3 | A couple of helpful categories for the Google Maps SDK. 4 | 5 | 6 | ## Installation 7 | 8 | Simply add the `GMSCoordinateBounds+Geometry.h` to your project 9 | 10 | 11 | Enjoy. 12 | -------------------------------------------------------------------------------- /tests/tests.js: -------------------------------------------------------------------------------- 1 | exports.defineAutoTests = function () { 2 | 3 | describe('FirebaseCore (plugin.firebase.app)', function () { 4 | 5 | it('plugin.firebase.app should exist', function () { 6 | expect(plugin.firebase.app).toBeDefined(); 7 | }); 8 | 9 | }); 10 | 11 | }; 12 | -------------------------------------------------------------------------------- /pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Pull request guide 2 | 3 | Thank you for considering to improve this cordova-plugin-googlemaps. 4 | 5 | When you create a pull request, please make it to **multiple_maps** branch instead of master branch. 6 | 7 | Because **the multiple_maps branch is edge version**. 8 | 9 | Thank you for your understanding. 10 | -------------------------------------------------------------------------------- /tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-plugin-googlemaps-tests", 3 | "version": "0.0.3-dev", 4 | "description": "", 5 | "cordova": { 6 | "id": "cordova-plugin-googlemaps-tests", 7 | "platforms": [] 8 | }, 9 | "keywords": [ 10 | "ecosystem:cordova" 11 | ], 12 | "author": "", 13 | "license": "Apache 2.0" 14 | } 15 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/IPluginView.h: -------------------------------------------------------------------------------- 1 | // 2 | // IPluginView 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @protocol IPluginView 12 | - (void)attachToWebView:(CDVInvokedUrlCommand*)command; 13 | - (void)detachFromWebView:(CDVInvokedUrlCommand*)command; 14 | @end 15 | -------------------------------------------------------------------------------- /src/android/res/layout/dummy_infowindow.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/MyPluginScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyPluginScrollView.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface MyPluginScrollView : UIScrollView 12 | 13 | @property (nonatomic) NSMutableDictionary *mapCtrls; 14 | @property (nonatomic) NSMutableDictionary *HTMLNodes; 15 | - (void)attachView:(UIView *)view depth:(NSInteger)depth; 16 | - (void)detachView:(UIView *)view; 17 | @end 18 | -------------------------------------------------------------------------------- /tests/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | Cordova Geolocation Plugin Tests 8 | Apache 2.0 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/android/frameworks/tbxml-android.gradle: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven { url 'https://maven.google.com' } 3 | mavenCentral() 4 | jcenter() 5 | def libsDirPath = System.getProperty("user.dir") 6 | flatDir{ 7 | dirs 'src/main/libs', 'libs', "${libsDirPath}/libs" 8 | } 9 | } 10 | 11 | dependencies { 12 | implementation(name:'tbxml-android', ext:'aar') 13 | } 14 | 15 | android { 16 | compileSdkVersion 26 17 | 18 | packagingOptions { 19 | exclude 'README' 20 | exclude 'LICENSE' 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/IPluginProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // IPluginProtocol.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import 10 | #import 11 | #import "PluginViewController.h" 12 | 13 | @protocol IPluginProtocol 14 | //- (void)onHookedPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId; 15 | - (void)pluginUnload; 16 | - (void)setPluginViewController: (PluginViewController*)viewCtrl; 17 | @end 18 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginEnvironment.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginEnvironment.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import 10 | #import "CordovaGoogleMaps.h" 11 | 12 | @interface PluginEnvironment : CDVPlugin 13 | 14 | - (void)isAvailable:(CDVInvokedUrlCommand*)command; 15 | - (void)setBackGroundColor:(CDVInvokedUrlCommand*)command; 16 | - (void)getLicenseInfo:(CDVInvokedUrlCommand*)command; 17 | - (void)setEnv:(CDVInvokedUrlCommand*)command; 18 | @end 19 | -------------------------------------------------------------------------------- /jsdoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tags": { 3 | "allowUnknownTags": false 4 | }, 5 | "source": { 6 | "include": "www", 7 | "includePattern": ".js$", 8 | "excludePattern": "(node_modules/|docs|__test__)" 9 | }, 10 | "opts": { 11 | "template": "node_modules/docdash/", 12 | "encoding": "utf8", 13 | "destination": "docs/", 14 | "recurse": true, 15 | "verbose": true 16 | }, 17 | "templates": { 18 | "cleverLinks": false, 19 | "monospaceLinks": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/browser/__test__/PluginMap.spec.js: -------------------------------------------------------------------------------- 1 | const PluginMap = require('../PluginMap'); 2 | 3 | describe('PluginMap', () => { 4 | it('should exist', () => { 5 | expect(PluginMap).toBeDefined(); 6 | }); 7 | 8 | describe('toDataURL', () => { 9 | afterEach(() => { 10 | document.body.innerHTML = ''; 11 | }); 12 | 13 | it('should exist', () => { 14 | var mapId = 'map'; 15 | document.body.innerHTML = '
'; 16 | expect(new PluginMap(mapId, {}).toDataURL).toBeDefined(); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginGeocoder.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginGeocoder.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Katsumata Masashi. 6 | // 7 | // 8 | 9 | #import "CordovaGoogleMaps.h" 10 | #import "PluginUtil.h" 11 | #import 12 | 13 | @interface PluginGeocoder : CDVPlugin 14 | @property (nonatomic, strong) NSDictionary *codeForCountryDictionary; 15 | @property (nonatomic, strong) NSOperationQueue *executeQueue; 16 | - (void)geocode:(CDVInvokedUrlCommand*)command; 17 | - (NSArray *)geocoder_callback:(NSArray *)placemarks error:(NSError *)error; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/UIImageCache.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImageCache 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | #ifndef UIImageCache_h 9 | #define UIImageCache_h 10 | 11 | #import 12 | 13 | @interface UIImageCache : NSObject 14 | 15 | + (UIImageCache*)sharedInstance; 16 | @property (nonatomic) NSMutableDictionary* iconCacheKeys; 17 | 18 | // set 19 | - (void)cacheImage:(UIImage*)image forKey:(NSString*)key; 20 | // get 21 | - (UIImage*)getCachedImageForKey:(NSString*)key; 22 | // remove 23 | - (void)removeCachedImageForKey:(NSString*)key; 24 | // remove all 25 | - (void)removeAllCachedImages; 26 | @end 27 | 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginObjects.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginObjects 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | #ifndef PluginObjects_h 9 | #define PluginObjects_h 10 | 11 | #import 12 | 13 | @interface PluginObjects : NSObject 14 | 15 | @property (atomic, strong) NSMutableDictionary *objects; 16 | 17 | // set 18 | - (void)setObject:(id)objId forKey:(NSString*)key; 19 | 20 | // get 21 | - (id)objectForKey:(NSString*)key; 22 | 23 | // remove 24 | - (void)removeObjectForKey:(NSString*)key; 25 | 26 | // remove all 27 | - (void)removeAllObjects; 28 | 29 | // return all keys 30 | - (NSArray*)allKeys; 31 | 32 | @end 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginLocationService.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginLocationService.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import 10 | #import 11 | #import "PluginUtil.h" 12 | 13 | @interface PluginLocationService : CDVPlugin 14 | 15 | @property (nonatomic, strong) NSMutableDictionary *lastResult; 16 | @property (nonatomic, strong) CLLocation *lastLocation; 17 | @property (nonatomic, strong) CLLocationManager *locationManager; 18 | @property (nonatomic, strong) NSMutableArray *locationCommandQueue; 19 | - (void)getMyLocation:(CDVInvokedUrlCommand*)command; 20 | - (void)hasPermission:(CDVInvokedUrlCommand*)command; 21 | @end 22 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_ja.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "閉じる", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "APIキー エラー", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "\"GOOGLE_MAPS_IOS_API_KEY\"変数が設定されていません", 5 | "APP_NAME_ERROR_TITLE" : "config.xmlの変更が必要です", 6 | "APP_NAME_ERROR_MESSAGE" : "CFBundleExecutableに英数字以外の文字が含まれていると\nGoogle Maps SDK for iOSがクラッシュします。\n詳しくはCordovaGoogleMaps.mファイルのコメントを\nお読みください。", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "位置情報が有効になっていません", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "この端末の位置情報が無効になっています。\"設定 > プライバシー > 位置情報サービス\"を有効にしてください", 9 | "LOCATION_IS_DENIED_MESSAGE" : "位置情報サービスの利用が拒否されました", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : "現在位置を取得できませんでした", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : "位置情報サービスの利用が拒否されました" 12 | } 13 | -------------------------------------------------------------------------------- /src/android/plugin/google/maps/BitmapCache.java: -------------------------------------------------------------------------------- 1 | package plugin.google.maps; 2 | 3 | import android.graphics.Bitmap; 4 | import android.util.LruCache; 5 | 6 | public class BitmapCache extends LruCache { 7 | 8 | public BitmapCache(int maxSize) { 9 | super(maxSize); 10 | } 11 | 12 | @Override 13 | protected int sizeOf(String key, Bitmap bitmap) { 14 | // The cache size will be measured in kilobytes rather than 15 | // number of items. 16 | return bitmap.getByteCount() / 1024; 17 | } 18 | 19 | @Override 20 | protected void entryRemoved(boolean evicted, String key, Bitmap oldBitmap, Bitmap newBitmap) { 21 | if (!oldBitmap.isRecycled()) { 22 | oldBitmap.recycle(); 23 | oldBitmap = null; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.ap_ 3 | 4 | # files for the dex VM 5 | *.dex 6 | 7 | # Java class files 8 | *.class 9 | 10 | # generated files 11 | bin/ 12 | gen/ 13 | 14 | # Local configuration file (sdk path, etc) 15 | local.properties 16 | 17 | # Eclipse project files 18 | .settings/ 19 | 20 | # Google Maps iOS SDK directory 21 | GoogleMaps-iOS-SDK/ 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Intellij project files 27 | *.iml 28 | *.ipr 29 | *.iws 30 | .idea/ 31 | build/ 32 | 33 | # platform assets 34 | platforms/android/assets/www/* 35 | platforms/ios/www/* 36 | 37 | config.xml 38 | .DS_Store 39 | ant-build/ 40 | ant-gen/ 41 | plugins/ 42 | platforms/ 43 | hooks/ 44 | 45 | out/ 46 | node_modules/ 47 | package-lock.json 48 | -------------------------------------------------------------------------------- /www/Location.js: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Location Class 3 | *****************************************************************************/ 4 | var LatLng = require('./LatLng'); 5 | var Location = function(params) { 6 | var self = this; 7 | self.latLng = params.latLng || new LatLng(params.lat || 0, params.lng || 0); 8 | self.elapsedRealtimeNanos = params.elapsedRealtimeNanos; 9 | self.time = params.time; 10 | self.accuracy = params.accuracy || null; 11 | self.bearing = params.bearing || null; 12 | self.altitude = params.altitude || null; 13 | self.speed = params.speed || null; 14 | self.provider = params.provider; 15 | self.hashCode = params.hashCode; 16 | }; 17 | 18 | module.exports = Location; 19 | -------------------------------------------------------------------------------- /jest-cordova-resolver.js: -------------------------------------------------------------------------------- 1 | var Resolver = require('jest-resolve'); 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | 5 | var pluginModuleRegex = /^cordova-plugin-googlemaps\.(.*)/; 6 | var pathBrowser = './src/browser'; 7 | var pathWww = './www'; 8 | 9 | module.exports = function(moduleId, options) { 10 | if (pluginModuleRegex.test(moduleId)) { 11 | var fileName = moduleId.match(pluginModuleRegex)[1] + '.js'; 12 | if (fs.existsSync(path.resolve(pathBrowser, fileName))) { 13 | return path.resolve(pathBrowser, fileName); 14 | } 15 | if (fs.existsSync(path.resolve(pathWww, fileName))) { 16 | return path.resolve(pathWww, fileName); 17 | } 18 | 19 | throw new Error(moduleId + 'could not be located'); 20 | } 21 | return Resolver.findNodeModule(moduleId, options); 22 | }; 23 | -------------------------------------------------------------------------------- /src/android/plugin/google/maps/IPluginView.java: -------------------------------------------------------------------------------- 1 | package plugin.google.maps; 2 | 3 | import android.view.View; 4 | import android.view.ViewGroup; 5 | 6 | import org.apache.cordova.CallbackContext; 7 | import org.json.JSONArray; 8 | 9 | public interface IPluginView { 10 | boolean getVisible(); 11 | boolean getClickable(); 12 | String getDivId(); 13 | String getOverlayId(); 14 | ViewGroup getView(); 15 | int getViewDepth(); 16 | void onDestroy(); 17 | void onStart(); 18 | void onStop(); 19 | void onPause(boolean multitasking); 20 | void onResume(boolean multitasking); 21 | void remove(JSONArray args, final CallbackContext callbackContext); 22 | void attachToWebView(JSONArray args, final CallbackContext callbackContext); 23 | void detachFromWebView(JSONArray args, final CallbackContext callbackContext); 24 | } 25 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginKmlOverlay.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginKmlOverlay.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Katsumata Masashi. 6 | // 7 | // 8 | 9 | #import "CordovaGoogleMaps.h" 10 | #import "IPluginProtocol.h" 11 | #import "PluginUtil.h" 12 | #import "TBXML.h" 13 | #import "IPluginProtocol.h" 14 | 15 | @interface PluginKmlOverlay : CDVPlugin 16 | 17 | @property (nonatomic) BOOL initialized; 18 | @property (nonatomic, strong) PluginMapViewController* mapCtrl; 19 | - (void)create:(CDVInvokedUrlCommand*)command; 20 | @end 21 | 22 | @interface KmlParseClass : NSObject 23 | @property (nonatomic) NSMutableDictionary *styleHolder; 24 | @property (nonatomic) NSMutableDictionary *schemaHolder; 25 | 26 | -(NSMutableDictionary *)parseXml:(TBXML *)tbxml rootElement:(TBXMLElement *)rootElement; 27 | @end 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this plugin 4 | 5 | --- 6 | 7 | 17 | 18 | **Please tell us your new feature idea** 19 | 20 | **Why do you need it?** 21 | 22 | **How helps other people?** 23 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginMapViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginMapViewController.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | #import "PluginUtil.h" 13 | #import "IPluginProtocol.h" 14 | #import "PluginObjects.h" 15 | #import "PluginViewController.h" 16 | #import 17 | 18 | @interface PluginMapViewController : PluginViewController 19 | 20 | @property (nonatomic) GMSMarker* activeMarker; 21 | @property (nonatomic) GMSMapView* map; 22 | 23 | - (BOOL)didTapMyLocationButtonForMapView:(GMSMapView *)mapView; 24 | - (void)didChangeActiveBuilding: (GMSIndoorBuilding *)building; 25 | - (void)didChangeActiveLevel: (GMSIndoorLevel *)level; 26 | @end 27 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "env": { 3 | "browser": true, 4 | "node": true 5 | }, 6 | "extends": "eslint:recommended", 7 | "parserOptions": { 8 | "ecmaVersion": 5 9 | }, 10 | "rules": { 11 | "indent": [ 12 | "error", 13 | 2 14 | ], 15 | "linebreak-style": [ 16 | "error", 17 | "unix" 18 | ], 19 | "quotes": [ 20 | "error", 21 | "single" 22 | ], 23 | "semi": [ 24 | "error", 25 | "always" 26 | ], 27 | "no-console": 0 28 | }, 29 | "globals": { 30 | "require": false, 31 | "Symbol": false, 32 | "window": false, 33 | "cordova": false, 34 | "Promise": false, 35 | "module": false, 36 | "angular": false, 37 | "firebase": false, 38 | "exports": false, 39 | "google": false, 40 | "plugin": false 41 | } 42 | }; 43 | -------------------------------------------------------------------------------- /src/android/plugin/google/maps/MyPluginInterface.java: -------------------------------------------------------------------------------- 1 | package plugin.google.maps; 2 | 3 | import org.apache.cordova.CallbackContext; 4 | import org.apache.cordova.CordovaArgs; 5 | import org.apache.cordova.CordovaInterface; 6 | import org.apache.cordova.CordovaWebView; 7 | import org.json.JSONArray; 8 | import org.json.JSONException; 9 | 10 | public interface MyPluginInterface { 11 | public void initialize(CordovaInterface cordova, CordovaWebView webView); 12 | public void setPluginMap(PluginMap pluginMap); 13 | public boolean execute(String action, String rawArgs, CallbackContext callbackContext) throws JSONException; 14 | public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException; 15 | public boolean execute(String action, CordovaArgs args, CallbackContext callbackContext) throws JSONException; 16 | } 17 | -------------------------------------------------------------------------------- /www/CameraPosition.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * @name CameraPosition 3 | * @class This class represents new camera position 4 | * @property {LatLng} target The location where you want to show 5 | * @property {Number} [tilt] View angle 6 | * @property {Number} [zoom] Zoom level 7 | * @property {Number} [bearing] Map orientation 8 | * @property {Number} [duration] The duration of animation 9 | *******************************************************************************/ 10 | var CameraPosition = function(params) { 11 | var self = this; 12 | self.zoom = params.zoom; 13 | self.tilt = params.tilt; 14 | self.target = params.target; 15 | self.bearing = params.bearing; 16 | self.hashCode = params.hashCode; 17 | self.duration = params.duration; 18 | }; 19 | 20 | module.exports = CameraPosition; 21 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginCircle.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginCircle.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import "CordovaGoogleMaps.h" 10 | #import "IPluginProtocol.h" 11 | 12 | @interface PluginCircle : CDVPlugin 13 | @property (nonatomic, strong) PluginMapViewController* mapCtrl; 14 | @property (nonatomic) BOOL initialized; 15 | 16 | - (void)create:(CDVInvokedUrlCommand*)command; 17 | - (void)setCenter:(CDVInvokedUrlCommand*)command; 18 | - (void)setFillColor:(CDVInvokedUrlCommand*)command; 19 | - (void)setStrokeColor:(CDVInvokedUrlCommand*)command; 20 | - (void)setStrokeWidth:(CDVInvokedUrlCommand*)command; 21 | - (void)setRadius:(CDVInvokedUrlCommand*)command; 22 | - (void)setZIndex:(CDVInvokedUrlCommand*)command; 23 | - (void)setVisible:(CDVInvokedUrlCommand*)command; 24 | - (void)remove:(CDVInvokedUrlCommand*)command; 25 | @end 26 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/GMSCoordinateBounds+Geometry.h: -------------------------------------------------------------------------------- 1 | // 2 | // GMSCoordinateBounds+Geometry.h 3 | // 4 | // Created by Marius Feldmann on 8/12/14. 5 | // Copyright (c) 2014 Marius Feldmann. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface GMSCoordinateBounds (MFAdditions) 11 | 12 | /** The North-West corner of these bounds. */ 13 | - (CLLocationCoordinate2D)southEast; 14 | 15 | /** The South-East corner of these bounds. */ 16 | - (CLLocationCoordinate2D)northWest; 17 | 18 | /** The center coordinate of these bounds. */ 19 | - (CLLocationCoordinate2D)center; 20 | 21 | /** Return the path of the rect. */ 22 | - (GMSPath *)path; 23 | 24 | /** 25 | * Returns an NSArray of GMSCoordinateBounds 26 | * Divides the current rectangular bounding box 27 | * into |numberOfRects| smaller boxes. 28 | */ 29 | - (NSArray *)divideIntoNumberOfBoxes:(NSInteger)numberOfBoxesl; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /src/browser/PluginEnvironment.js: -------------------------------------------------------------------------------- 1 | 2 | var envOptions = {}; 3 | 4 | module.exports = { 5 | 'isAvailable': function(onSuccess) { 6 | onSuccess(); 7 | }, 8 | 'setBackGroundColor': function(onSuccess) { 9 | // stub 10 | onSuccess(); 11 | }, 12 | 'getLicenseInfo': function(onSuccess) { 13 | // stub 14 | onSuccess('cordova-plugin-googlemaps for browser does not need to display any open source lincenses. But for iOS, you still need to display the lincense.'); 15 | }, 16 | 'setEnv': function(onSuccess, onError, args) { 17 | var options = args[0]; 18 | var keys = Object.keys(options); 19 | keys.forEach(function(key) { 20 | envOptions[key] = options[key]; 21 | }); 22 | onSuccess(); 23 | }, 24 | '_getEnv': function() { 25 | // internal method 26 | return envOptions; 27 | } 28 | }; 29 | 30 | 31 | require('cordova/exec/proxy').add('PluginEnvironment', module.exports); 32 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/MFGoogleMapAdditions/GMSCoordinateBounds+Geometry.h: -------------------------------------------------------------------------------- 1 | // 2 | // GMSCoordinateBounds+Geometry.h 3 | // 4 | // Created by Marius Feldmann on 8/12/14. 5 | // Copyright (c) 2014 Marius Feldmann. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface GMSCoordinateBounds (MFAdditions) 11 | 12 | /** The North-West corner of these bounds. */ 13 | - (CLLocationCoordinate2D)southEast; 14 | 15 | /** The South-East corner of these bounds. */ 16 | - (CLLocationCoordinate2D)northWest; 17 | 18 | /** The center coordinate of these bounds. */ 19 | - (CLLocationCoordinate2D)center; 20 | 21 | /** Return the path of the rect. */ 22 | - (GMSPath *)path; 23 | 24 | /** 25 | * Returns an NSArray of GMSCoordinateBounds 26 | * Divides the current rectangular bounding box 27 | * into |numberOfRects| smaller boxes. 28 | */ 29 | - (NSArray *)divideIntoNumberOfBoxes:(NSInteger)numberOfBoxesl; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_en.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "CLOSE", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "API key error", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "The variable \"GOOGLE_MAPS_IOS_API_KEY\" is not registered.", 5 | "APP_NAME_ERROR_TITLE" : "You need to change the config.xml file", 6 | "APP_NAME_ERROR_MESSAGE" : "Google Maps SDK for iOS crashes if CFBundleExecutable contains non-English characters.\nMore details, Check out the comment in the CordovaGoogleMaps.m file.", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "Location Service is not available", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "This app needs to access your location. Please turn on \"Settings > Privacy > Location Services\"", 9 | "LOCATION_IS_DENIED_MESSAGE" : "This app has rejected to use Location Services.", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : "Cannot get your location.", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : "Location service is rejected by user." 12 | } 13 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_ar.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "إغلاق", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "خطأ في مفتاح الأ بي إي (API)", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "ليس هنالك أي قيمة للمتغير \"GOOGLE_MAPS_IOS_API_KEY\" ", 5 | "APP_NAME_ERROR_TITLE" : "يجب عليك تغيير ملف config.xml", 6 | "APP_NAME_ERROR_MESSAGE" : "CordovaGoogleMaps.m لمزيد من المعلومات ، انظر التعليق في \n. عندما تكون الأحرف غير الإنجليزية قيد الاستخدام Google Maps SDK في CFBundleExecutable في حالة تعطل", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "خدمة تحديد المواقع غير متوفرة", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "Settings> Privacy> Location Services يحتاج هذا التطبيق إلى تحديد موقعك. يرجى تشغيله من إعدادات الهاتف ", 9 | "LOCATION_IS_DENIED_MESSAGE" : ". رفض هذا التطبيق إستعمال خدمة تحديد المواقع", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : ". موقعك غير متاح", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : ". رفض المستخدم خدمة تحديد المواقع" 12 | } 13 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginTileOverlay.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginTileOverlay.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import "CordovaGoogleMaps.h" 10 | #import "IPluginProtocol.h" 11 | #import "PluginTileProvider.h" 12 | 13 | @interface PluginTileOverlay : CDVPlugin 14 | @property (nonatomic, strong) PluginMapViewController* mapCtrl; 15 | @property (nonatomic) NSOperationQueue *executeQueue; 16 | @property (nonatomic, strong) NSCache* imgCache; 17 | @property (nonatomic) BOOL initialized; 18 | 19 | -(void)create:(CDVInvokedUrlCommand*)command; 20 | -(void)setVisible:(CDVInvokedUrlCommand *)command; 21 | -(void)remove:(CDVInvokedUrlCommand *)command; 22 | -(void)setZIndex:(CDVInvokedUrlCommand *)command; 23 | -(void)setFadeIn:(CDVInvokedUrlCommand *)command; 24 | -(void)setOpacity:(CDVInvokedUrlCommand *)command; 25 | -(void)onGetTileUrlFromJS:(CDVInvokedUrlCommand *)command; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_in.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "TUTUP", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "API key Anda Salah", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "variable \"GOOGLE_MAPS_IOS_API_KEY\" tidak terdaftar.", 5 | "APP_NAME_ERROR_TITLE" : "anda perlu merubah file config.xml ", 6 | "APP_NAME_ERROR_MESSAGE" : "Google Maps SDK untuk iOS cras jika CFBundleExecutable ber isi karakter non English.\nLebih detail, silahkan lihat komentar dalam file CordovaGoogleMaps.m", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "tidak terdapat Service Lokasi", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "Applikasi ini membutuhkan akses lokasi anda. Silahkan aktifkan \"Pengaturan > Privaci > Lokasi\"", 9 | "LOCATION_IS_DENIED_MESSAGE" : "Applikasi ini tidak dapat menggunakan service Lokasi.", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : "Tidak dapat menemukan lokasi anda.", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : "Service lokasi ditolak oleh Pengguna." 12 | } 13 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_hi.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "बंद", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "एपीआई कुंजी त्रुटि", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "चर \"GOOGLE_MAPS_IOS_API_KEY\" पंजीकृत (रजिस्टर) नहीं हुआ.", 5 | "APP_NAME_ERROR_TITLE" : "आपको config.xml फ़ाइल को बदलना होगा", 6 | "APP_NAME_ERROR_MESSAGE" : "अगर CFBundleExecutable मे गैर-अंग्रेज़ी वर्णों होने पर गूगल मैप्स एसडीके (Google Maps SDK) क्रैश हो जाता है.\nऔर जानकारी के लिए CordovaGoogleMaps.m मे टिप्पणी को देखें.", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "स्थान सेवा उपलब्ध नहीं है", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "इस एप को आप के स्थान की ज़रुरत है. कृपया \"Settings > Privacy > Location Services\" से चालू करें", 9 | "LOCATION_IS_DENIED_MESSAGE" : "इस एप ने स्थान सेवा को उपयोग करना अस्वीकार कर दिया है.", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : "आपका स्थान उपलब्ध नही है.", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : "उपयोगकर्ता ने स्थान सेवा अस्वीकार कर दिया है." 12 | } 13 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_nb.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "Lukk", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "API-nøkkel feil", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "Variabelen \"GOOGLE_MAPS_IOS_API_KEY\" er ikke registrert.", 5 | "APP_NAME_ERROR_TITLE" : "Du må endre config.xml filen", 6 | "APP_NAME_ERROR_MESSAGE" : "Google Maps SDK til iOS ødelegges hvis CFBundleExecutable inneholder ikke-engelske simboler.\nFlere detaljer, Skjekk ut kommentar i CordovaGoogleMaps.m filen.", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "Stedtjenester er ikke tilgjengelig", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "Denne applikasjon trenger tilghengelighet til din lokasjon. Vennlighst slå på \"Innstellinger > Personvern > Stedtjenester\"", 9 | "LOCATION_IS_DENIED_MESSAGE" : "Denne applikasjon avviser bruk av Stedtjenester.", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : "Kan ikke få din lokasjon.", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : "Stedtjenester ble avvist av brukeren." 12 | } 13 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_uk.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "ЗАКРИТИ", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "Невірний API ключ", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "Змінна \"GOOGLE_MAPS_IOS_API_KEY\" не зареєстрована.", 5 | "APP_NAME_ERROR_TITLE" : "Вам потрібно змінити файл config.xml", 6 | "APP_NAME_ERROR_MESSAGE" : "Google Maps SDK for iOS не працюватиме, якщо CFBundleExecutable міститиме неанглійські слова.\nБільш дутально, в коментарях до файлу CordovaGoogleMaps.m.", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "Сервіс пошуку розташування недоступний", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "Цей пристрій повинен отримати Ваше місцезнаходження. Будь ласка перейдіть \"Settings > Privacy > Location Services\"", 9 | "LOCATION_IS_DENIED_MESSAGE" : "Сервіс пошуку місцезнаходження відхилений.", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : "Невдається отримати Ваше місцерозташування.", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : "Сервіс пошуку місцезнаходження відхилений користувачем." 12 | } 13 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_nl.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "SLUITEN", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "API key fout", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "De variabele \"GOOGLE_MAPS_IOS_API_KEY\" is niet geregistreerd.", 5 | "APP_NAME_ERROR_TITLE" : "Je moet het config.xml bestand aanpassen.", 6 | "APP_NAME_ERROR_MESSAGE" : "Google Maps SDK for iOS faalt indien CFBundleExecutable niet-Engelse karakters bevat.\nVoor meer informatie bekijk het commentaar in het CordovaGoogleMaps.m bestand.", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "De locatievoorziening is niet beschikbaar", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "Deze app wil jouw locatie kunnen bepalen. Zet dit aan via \"Instellingen > Privacy > Locatievoorzieningen\"", 9 | "LOCATION_IS_DENIED_MESSAGE" : "Deze app heeft de locatievoorziening afgewezen.", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : "Kan je locatie niet bepalen.", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : "De locatievoorziening is afgewezen door de gebruiker." 12 | } 13 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_pl.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "ZAMKNIJ", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "Błąd klucza API", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "Zmienna \"GOOGLE_MAPS_IOS_API_KEY\" nie została zarejestrowana.", 5 | "APP_NAME_ERROR_TITLE" : "Proszę zmienić plik config.xml", 6 | "APP_NAME_ERROR_MESSAGE" : "Google Maps SDK dla iOS powoduje błędy, jeżeli CFBundleExecutable zawiera nie angielskie znaki.\nWięcej szczegółów dostępnych w komentarzu w pliku CordovaGoogleMaps.m.", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "Usługi lokalizacji są niedostępne", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "Aplikacja wymaga dostępu do usług lokalizacji. Proszę włączyć \"Ustawienia > Prywatność > Usługi lokalizacji\"", 9 | "LOCATION_IS_DENIED_MESSAGE" : "Aplikacja nie posiada zezwolenia na używanie usług lokalizacji.", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : "Nie można określić położenia.", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : "Usługi lokalizacji zostały odrzucone przez użytkownika." 12 | } 13 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginMarkerCluster.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginMarkerCluster.h 3 | // cordova-googlemaps-plugin 4 | // 5 | // Created by masashi. 6 | // 7 | // 8 | 9 | #import "CordovaGoogleMaps.h" 10 | #import "IPluginProtocol.h" 11 | #import "PluginUtil.h" 12 | #import "PluginMarker.h" 13 | 14 | @interface PluginMarkerCluster : PluginMarker 15 | @property (atomic, strong) NSMutableDictionary *debugFlags; 16 | @property (atomic, strong) NSMutableDictionary *pluginMarkers; 17 | @property (atomic, strong) NSMutableDictionary *waitCntManager; 18 | @property (atomic, strong) NSMutableDictionary *allResults; 19 | @property (atomic, strong) NSMutableArray *deleteMarkers; 20 | @property (atomic, strong) dispatch_semaphore_t semaphore; 21 | @property (atomic, strong) dispatch_semaphore_t deleteThreadLock; 22 | @property (nonatomic) BOOL stopFlag; 23 | 24 | - (void)create:(CDVInvokedUrlCommand*)command; 25 | - (void)redrawClusters:(CDVInvokedUrlCommand*)command; 26 | - (void)remove:(CDVInvokedUrlCommand*)command; 27 | @end 28 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_ru.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "ЗАКРЫТЬ", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "Неверный API ключ.", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "Переменная \"GOOGLE_MAPS_IOS_API_KEY\" не зарегистрирована.", 5 | "APP_NAME_ERROR_TITLE" : "Вам нужно изменить файл config.xml", 6 | "APP_NAME_ERROR_MESSAGE" : "Google Maps SDK for iOS не работает, если CFBundleExecutable содержит неанглийские символы.\nБолее подробно, в коментариях к файлу CordovaGoogleMaps.m.", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "Определение местоположения недоступно.", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "Это приложение должно получить доступ к вашему местоположению. Пожалуйста, перейдите \"Settings > Privacy > Location Services\"", 9 | "LOCATION_IS_DENIED_MESSAGE" : "Приложение отклонило запрос на получение местоположения.", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : "Не удается получить Ваше местоположение.", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : "Определение местоположения отклонено пользователем." 12 | } 13 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_vi.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "ĐÓNG", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "Lỗi API Key", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "\"GOOGLE_MAPS_IOS_API_KEY\" chưa được đăng ký.", 5 | "APP_NAME_ERROR_TITLE" : "Bạn cần cập nhật file config.xml.", 6 | "APP_NAME_ERROR_MESSAGE" : "Google Maps SDK cho iOS sẽ lỗi nếu CFBundleExecutable có chứa các ký tự không phải ký tự tiếng Anh..\nVui lòng kiểm tra bình luận trong file CordovaGoogleMaps.m để có thông tin.", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "Dịch vụ xác định vị trí không được hỗ trợ", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "Ứng dụng cần xác định vị trí của bạn. Vui lòng bật \"Cấu hình > Quyền riêng tư > Dịch vụ vị trí\"", 9 | "LOCATION_IS_DENIED_MESSAGE" : "Ứng dụng không được cấp quyền sử dụng dịch vụ xác định vị trí.", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : "Ứng dụng không thể xác định vị trí của bạn.", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : "Người dùng không cho phép sử dụng dịch vụ xác định vị trí." 12 | } 13 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_da.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "LUK", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "Fejl med API-nøgle", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "Proszę zastąpić \"GOOGLE_MAPS_IOS_API_KEY\" w pliku config.xml własnym kluczem API!", 5 | "APP_NAME_ERROR_TITLE" : "Vær sød at ændre config.xml filen", 6 | "APP_NAME_ERROR_MESSAGE" : "Google Maps IOS SDK forårsager fejl, hvis CFBundleExecutable indeholder ikke-engelske tegn.\n Flere detaljer er tilgængelige i kommentaren i filen CordovaGoogleMaps.m.", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "Placeringstjenester er ikke tilgængelige", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "Applikationen kræver adgang til lokationstjenester. Aktivér \"Indstillinger > Privatliv > Placeringstjenester\"", 9 | "LOCATION_IS_DENIED_MESSAGE" : "Applikationen er ikke autoriseret til at bruge lokationstjenester.", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : "Placeringen kan ikke bestemmes.", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : "Placeringstjenester blev afvist af brugeren." 12 | } 13 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_de.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "SCHLIESSEN", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "API Key Fehler", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "Die Variable \"GOOGLE_MAPS_IOS_API_KEY\" ist nicht definiert.", 5 | "APP_NAME_ERROR_TITLE" : "Du musst die config.xml Datei ändern.", 6 | "APP_NAME_ERROR_MESSAGE" : "Die Google Maps SDK für iOS stürzt ab, wenn CFBundleExecutable non-Latin Zeichen enthält.\nFür weitere Informationen bitte die CordovaGoogleMaps.m Datei anschauen.", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "Lokalisierung ist nicht verfügbar.", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "Diese App benötigt Zugriff auf deinen Standort. Bitte aktiviere diese unter \"Einstellungen > Datenschutz > Lokalisierung\"", 9 | "LOCATION_IS_DENIED_MESSAGE" : "Dieser App wurde der Zugriff auf die Lokalisierung verweigert.", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : "Standort konnte nicht bestimmt werden.", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : "Standortbestimmung wurde durch den Benutzer verweigert." 12 | } 13 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_es.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "CERRAR", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "Error en API key", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "La variable \"GOOGLE_MAPS_IOS_API_KEY\" no está registrada.", 5 | "APP_NAME_ERROR_TITLE" : "Necesitas cambiar el archivo config.xml", 6 | "APP_NAME_ERROR_MESSAGE" : "El SDK de Google Maps para iOS se detiene si CFBundleExecutable contiene caracteres que no pertenecen al inglés. Revisa el comentario en el archivo CordovaGoogleMaps.m", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "El Servicio de Localización no se encuentra disponible", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "Esta aplicación necesita acceso a tu localización. Por favor enciéndelo en \"Configuración > Privacidad > Localización\"", 9 | "LOCATION_IS_DENIED_MESSAGE" : "Esta aplicación ha rechazado el uso de los Servicios de Localización.", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : "No se puede obtener la ubicación.", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : "Servicio de localización rechazado por el usuario." 12 | } 13 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_pt-BR.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "FECHAR", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "Erro de chave de API", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "A variável \"GOOGLE_MAPS_IOS_API_KEY\" não foi registrada.", 5 | "APP_NAME_ERROR_TITLE" : "Você precisa alterar o arquivo config.xml", 6 | "APP_NAME_ERROR_MESSAGE" : "O Google Maps SDK para iOS falha se o campo CFBundleExecutable conter caracteres não-inglês.\nPara maiores detalhes, cheque o comentário no arquivo CordovaGoogleMaps.m", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "O serviço de localização não esta disponível", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "Esse aplicativo precisa acessar sua localização. Por favor ative em \"Ajustes > Privacidade > Serviços de Localização\"", 9 | "LOCATION_IS_DENIED_MESSAGE" : "O aplicativo foi rejeitado para usar os Serviços de Localização.", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : "Não foi possível obter sua localização.", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : "O serviço de localização foi rejeitado pelo usuário." 12 | } 13 | -------------------------------------------------------------------------------- /src/android/plugin/google/maps/ObjectCache.java: -------------------------------------------------------------------------------- 1 | package plugin.google.maps; 2 | 3 | import android.util.LruCache; 4 | 5 | import java.util.HashSet; 6 | 7 | public class ObjectCache { 8 | public final HashSet keys = new HashSet(); 9 | private LruCache objects = new LruCache(1024 * 1024 * 10); 10 | 11 | public boolean containsKey(String key) { 12 | return keys.contains(key); 13 | } 14 | 15 | public void put(String key, Object object) { 16 | keys.add(key); 17 | objects.put(key, object); 18 | } 19 | 20 | public Object remove(String key) { 21 | keys.remove(key); 22 | return objects.remove(key); 23 | } 24 | 25 | public Object get(String key) { 26 | return objects.get(key); 27 | } 28 | 29 | public int size() { 30 | return objects.size(); 31 | } 32 | 33 | 34 | public void clear() { 35 | for (String key : keys) { 36 | objects.remove(key); 37 | } 38 | keys.clear(); 39 | } 40 | 41 | public void destroy() { 42 | objects.evictAll(); 43 | } 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginPolyline.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginPolyline.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import "CordovaGoogleMaps.h" 10 | #import "IPluginProtocol.h" 11 | 12 | @interface PluginPolyline : CDVPlugin 13 | @property (nonatomic, strong) PluginMapViewController* mapCtrl; 14 | @property (nonatomic) BOOL initialized; 15 | 16 | - (void)create:(CDVInvokedUrlCommand*)command; 17 | - (void)setStrokeColor:(CDVInvokedUrlCommand*)command; 18 | - (void)setStrokeWidth:(CDVInvokedUrlCommand*)command; 19 | - (void)setPoints:(CDVInvokedUrlCommand*)command; 20 | - (void)removePointAt:(CDVInvokedUrlCommand*)command; 21 | - (void)setPointAt:(CDVInvokedUrlCommand*)command; 22 | - (void)insertPointAt:(CDVInvokedUrlCommand*)command; 23 | - (void)setZIndex:(CDVInvokedUrlCommand*)command; 24 | - (void)setVisible:(CDVInvokedUrlCommand*)command; 25 | - (void)setClickable:(CDVInvokedUrlCommand*)command; 26 | - (void)remove:(CDVInvokedUrlCommand*)command; 27 | - (void)setGeodesic:(CDVInvokedUrlCommand*)command; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /src/ios/strings/pgm_Localizable_fr.json: -------------------------------------------------------------------------------- 1 | { 2 | "CLOSE_BUTTON" : "FERMER", 3 | "APIKEY_IS_UNDEFINED_TITLE" : "Erreur liée à la clé API", 4 | "APIKEY_IS_UNDEFINED_MESSAGE" : "Variable \"GOOGLE_MAPS_IOS_API_KEY\" non enregistrée.", 5 | "APP_NAME_ERROR_TITLE" : "Vous devez modifier le fichier config.xml", 6 | "APP_NAME_ERROR_MESSAGE" : "Google Maps SDK pour iOS crash si CFBundleExecutable contient des caractères non-Anglais.\nPour plus de détails, veuillez consulter le commentaire dans le fichier CordovaGoogleMaps.m.", 7 | "LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "Service de localisation non disponible", 8 | "LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "Cette application nécessite un accès à votre localisation. Veuillez activer le service de localisation dans \"Réglages > Confidentialité > Service de localisation\"", 9 | "LOCATION_IS_DENIED_MESSAGE" : "Cette application a rejeté le service de localisation.", 10 | "CAN_NOT_GET_LOCATION_MESSAGE" : "Votre localisation est introuvable.", 11 | "LOCATION_REJECTED_BY_USER_MESSAGE" : "Le service de localisation a été rejeté par cet utilisateur." 12 | } 13 | -------------------------------------------------------------------------------- /tests/travis.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -o nounset 3 | set -o errexit 4 | 5 | # run tests appropriate for platform 6 | #if [[ "${CORDOVA_PLATFORM}" == "browser" ]]; then 7 | # npm run test:browser 8 | #fi 9 | if [[ "${CORDOVA_PLATFORM}" == "ios" ]]; then 10 | sudo gem install cocoapods 11 | npm install -g ios-sim ios-deploy 12 | npm run test:ios 13 | fi 14 | echo "CORDOVA_PLATFORM=${CORDOVA_PLATFORM}" 15 | echo "TRAVIS_OS_NAME=${TRAVIS_OS_NAME}" 16 | 17 | if [[ "${CORDOVA_PLATFORM}" == "android" ]]; then 18 | echo "y" | sdkmanager "platforms;android-${ANDROID_API}"; > /dev/null; 19 | echo "y" | android update sdk -a --no-ui --filter android-${ANDROID_API} > /dev/null 20 | echo "y" | android update sdk -a --no-ui --filter sys-img-armeabi-v7a-android-${ANDROID_API} > /dev/null 21 | echo no | android create avd --force -n test -t android-${ANDROID_API} --abi armeabi-v7a > /dev/null 22 | emulator -avd test -no-skin -no-window & 23 | android-wait-for-emulator 24 | adb shell input keyevent 82 & 25 | adb wait-for-device get-serialno 26 | npm run test:android 27 | fi 28 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/CordovaGoogleMaps.h: -------------------------------------------------------------------------------- 1 | // 2 | // CordovaGoogleMaps.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import 10 | #import 11 | #import "PluginMapViewController.h" 12 | #import "PluginStreetViewPanoramaController.h" 13 | #import "PluginUtil.h" 14 | #import "PluginMap.h" 15 | #import "PluginStreetViewPanorama.h" 16 | #import "MyPluginLayer.h" 17 | #import "IPluginProtocol.h" 18 | #import "IPluginView.h" 19 | 20 | @interface CordovaGoogleMaps : CDVPlugin 21 | 22 | @property (nonatomic) MyPluginLayer *pluginLayer; 23 | @property (nonatomic) NSMutableDictionary *viewPlugins; 24 | @property (nonatomic) NSOperationQueue *executeQueue; 25 | 26 | - (void)getMap:(CDVInvokedUrlCommand*)command; 27 | - (void)getPanorama:(CDVInvokedUrlCommand*)command; 28 | - (void)clearHtmlElements:(CDVInvokedUrlCommand *)command; 29 | - (void)putHtmlElements:(CDVInvokedUrlCommand *)command; 30 | - (void)removeMap:(CDVInvokedUrlCommand *)command; 31 | - (void)pause:(CDVInvokedUrlCommand *)command; 32 | - (void)resume:(CDVInvokedUrlCommand *)command; 33 | @end 34 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginTileProvider.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginTileProvider.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import "CordovaGoogleMaps.h" 10 | 11 | @interface PluginTileProvider : GMSTileLayer 12 | @property (nonatomic) NSString *tileUrlFormat; 13 | @property (nonatomic) NSString *wwwPath; 14 | @property (nonatomic) UIView *webView; 15 | @property (nonatomic) NSString *mapId; 16 | @property (nonatomic) NSString *pluginId; 17 | @property (nonatomic) NSMutableDictionary *tileUrlMap; 18 | @property (nonatomic) BOOL isDebug; 19 | @property (nonatomic, strong) NSCache* imgCache; 20 | @property (nonatomic) NSOperationQueue *executeQueue; 21 | @property (nonatomic) dispatch_semaphore_t semaphore; 22 | - (id)initWithOptions:(NSDictionary *) options webView:(UIView *)webView; 23 | - (void)requestTileForX:(NSUInteger)x y:(NSUInteger)y zoom:(NSUInteger)zoom receiver:(id)receiver; 24 | - (void)onGetTileUrlFromJS:(NSString *)urlKey tileUrl:(NSString *)tileUrl; 25 | - (void)downloadImageWithX:(NSUInteger)x y:(NSUInteger)y zoom:(NSUInteger)zoom url:(NSURL *)url receiver: (id) receiver; 26 | @end 27 | -------------------------------------------------------------------------------- /www/Environment.js: -------------------------------------------------------------------------------- 1 | var common = require('./Common'); 2 | 3 | /***************************************************************************** 4 | * Config Class 5 | *****************************************************************************/ 6 | var Environment = {}; 7 | 8 | Environment.setBackgroundColor = function (color) { 9 | cordova.exec(null, null, 'PluginEnvironment', 'setBackGroundColor', [common.HTMLColor2RGBA(color)]); 10 | }; 11 | 12 | Environment.isAvailable = function (callback) { 13 | cordova.exec(function () { 14 | if (typeof callback === 'function') { 15 | callback(true); 16 | } 17 | }, function (message) { 18 | if (typeof callback === 'function') { 19 | callback(false, message); 20 | } 21 | }, 'PluginEnvironment', 'isAvailable', ['']); 22 | }; 23 | 24 | Environment.getLicenseInfo = function (callback) { 25 | cordova.exec(function (txt) { 26 | callback(txt); 27 | }, null, 'PluginEnvironment', 'getLicenseInfo', []); 28 | }; 29 | 30 | Environment.setEnv = function (options) { 31 | if (options) { 32 | cordova.exec(null, null, 'PluginEnvironment', 'setEnv', [options]); 33 | } 34 | }; 35 | 36 | module.exports = Environment; 37 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/MFGoogleMapAdditions/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) {{{year}}} {{{fullname}}} 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginObjects.m: -------------------------------------------------------------------------------- 1 | // 2 | // PluginObjects 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | #import "PluginObjects.h" 9 | 10 | 11 | @implementation PluginObjects 12 | 13 | static NSObject *_lock; 14 | 15 | - (instancetype)init { 16 | self = [super init]; 17 | static dispatch_once_t onceToken; 18 | dispatch_once(&onceToken, ^{ 19 | _lock = [NSObject alloc]; 20 | }); 21 | self.objects = [NSMutableDictionary dictionary]; 22 | return self; 23 | } 24 | 25 | - (void)setObject:(id)objId forKey:(NSString*)key { 26 | @synchronized(_lock) { 27 | [self.objects setObject:objId forKey:key]; 28 | } 29 | } 30 | 31 | - (id)objectForKey:(NSString*)key { 32 | @synchronized(_lock) { 33 | return [self.objects objectForKey:key]; 34 | } 35 | } 36 | - (void)removeObjectForKey:(NSString*)key { 37 | @synchronized(_lock) { 38 | [self.objects removeObjectForKey:key]; 39 | } 40 | } 41 | 42 | - (void)removeAllObjects { 43 | @synchronized(_lock) { 44 | [self.objects removeAllObjects]; 45 | } 46 | } 47 | 48 | - (NSArray*)allKeys { 49 | @synchronized(_lock) { 50 | return [self.objects allKeys]; 51 | } 52 | } 53 | 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginStreetViewPanorama.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginStreetViewPanorama.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import "CordovaGoogleMaps.h" 10 | #import "IPluginProtocol.h" 11 | #import "IPluginView.h" 12 | #import "PluginStreetViewPanoramaController.h" 13 | 14 | @interface PluginStreetViewPanorama : CDVPlugin 15 | @property (nonatomic, strong) PluginStreetViewPanoramaController* panoramaCtrl; 16 | @property (nonatomic) BOOL isRemoved; 17 | @property (nonatomic) BOOL initialized; 18 | 19 | - (void)getPanorama:(CDVInvokedUrlCommand*)command; 20 | - (void)attachToWebView:(CDVInvokedUrlCommand*)command; 21 | - (void)detachFromWebView:(CDVInvokedUrlCommand*)command; 22 | - (void)setPov:(CDVInvokedUrlCommand*)command; 23 | - (void)setPosition:(CDVInvokedUrlCommand*)command; 24 | - (void)setPanningGesturesEnabled:(CDVInvokedUrlCommand*)command; 25 | - (void)setZoomGesturesEnabled:(CDVInvokedUrlCommand*)command; 26 | - (void)setNavigationEnabled:(CDVInvokedUrlCommand*)command; 27 | - (void)setStreetNamesEnabled:(CDVInvokedUrlCommand*)command; 28 | - (void)setVisible:(CDVInvokedUrlCommand*)command; 29 | - (void)remove:(CDVInvokedUrlCommand*)command; 30 | @end 31 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginGroundOverlay.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginGroundOverlay.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Katsumata Masashi. 6 | // 7 | // 8 | 9 | #import "CordovaGoogleMaps.h" 10 | #import "IPluginProtocol.h" 11 | #import "PluginUtil.h" 12 | 13 | @interface PluginGroundOverlay : CDVPlugin 14 | //@property (nonatomic, strong) NSCache* imgCache; 15 | @property (nonatomic) BOOL initialized; 16 | 17 | @property (nonatomic, strong) PluginMapViewController* mapCtrl; 18 | - (void)create:(CDVInvokedUrlCommand*)command; 19 | - (void)remove:(CDVInvokedUrlCommand *)command; 20 | - (void)setClickable:(CDVInvokedUrlCommand*)command; 21 | - (void)setVisible:(CDVInvokedUrlCommand*)command; 22 | - (void)setImage:(CDVInvokedUrlCommand*)command; 23 | - (void)setBounds:(CDVInvokedUrlCommand*)command; 24 | - (void)setOpacity:(CDVInvokedUrlCommand*)command; 25 | - (void)setBearing:(CDVInvokedUrlCommand*)command; 26 | - (void)setZIndex:(CDVInvokedUrlCommand *)command; 27 | - (void)_setImage:(GMSGroundOverlay *)layer urlStr:(NSString *)urlStr completionHandler:(void (^)(BOOL succeeded))completionHandler; 28 | - (void)downloadImageWithURL:(NSURL *)url completionBlock:(void (^)(BOOL succeeded, UIImage *image))completionBlock; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginViewController.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | #import "PluginUtil.h" 13 | #import "IPluginProtocol.h" 14 | #import "PluginObjects.h" 15 | #import 16 | 17 | @interface PluginViewController : UIViewController 18 | 19 | @property (nonatomic, strong) UIView* webView; 20 | @property (nonatomic) NSMutableDictionary* plugins; 21 | @property (nonatomic) BOOL attached; 22 | @property (nonatomic) BOOL isFullScreen; 23 | @property (nonatomic) BOOL isDragging; 24 | @property (nonatomic) CGRect screenSize; 25 | @property (nonatomic) CGFloat screenScale; 26 | @property (nonatomic) BOOL debuggable; 27 | @property (nonatomic) NSString *overlayId; 28 | @property (nonatomic) BOOL clickable; 29 | @property (nonatomic) BOOL isRenderedAtOnce; 30 | @property (nonatomic, readwrite, strong) NSString *divId; 31 | @property (nonatomic, strong) PluginObjects *objects; 32 | @property (atomic, strong) NSOperationQueue *executeQueue; 33 | @property (nonatomic) NSInteger viewDepth; 34 | 35 | - (id)initWithOptions:(NSDictionary *) options; 36 | - (void)execJS: (NSString *)jsString; 37 | @end 38 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginPolygon.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginPolygon.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import "CordovaGoogleMaps.h" 10 | #import "IPluginProtocol.h" 11 | @interface PluginPolygon : CDVPlugin 12 | @property (nonatomic, strong) PluginMapViewController* mapCtrl; 13 | @property (nonatomic) BOOL initialized; 14 | 15 | - (void)create:(CDVInvokedUrlCommand*)command; 16 | - (void)setFillColor:(CDVInvokedUrlCommand*)command; 17 | - (void)setStrokeColor:(CDVInvokedUrlCommand*)command; 18 | - (void)setStrokeWidth:(CDVInvokedUrlCommand*)command; 19 | - (void)removePointAt:(CDVInvokedUrlCommand*)command; 20 | - (void)setPointAt:(CDVInvokedUrlCommand*)command; 21 | - (void)setPoints:(CDVInvokedUrlCommand*)command; 22 | - (void)insertPointAt:(CDVInvokedUrlCommand*)command; 23 | - (void)setPointOfHoleAt:(CDVInvokedUrlCommand*)command; 24 | - (void)removePointOfHoleAt:(CDVInvokedUrlCommand*)command; 25 | - (void)insertPointOfHoleAt:(CDVInvokedUrlCommand*)command; 26 | - (void)setHoles:(CDVInvokedUrlCommand*)command; 27 | - (void)setZIndex:(CDVInvokedUrlCommand*)command; 28 | - (void)setClickable:(CDVInvokedUrlCommand*)command; 29 | - (void)setVisible:(CDVInvokedUrlCommand*)command; 30 | - (void)remove:(CDVInvokedUrlCommand*)command; 31 | - (void)setGeodesic:(CDVInvokedUrlCommand*)command; 32 | @end 33 | -------------------------------------------------------------------------------- /www/event.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | MAP_READY: 'map_ready', 3 | MAP_CLICK: 'map_click', 4 | MAP_LONG_CLICK: 'map_long_click', 5 | POI_CLICK: 'poi_click', 6 | MY_LOCATION_CLICK: 'my_location_click', 7 | MY_LOCATION_BUTTON_CLICK: 'my_location_button_click', 8 | INDOOR_BUILDING_FOCUSED: 'indoor_building_focused', 9 | INDOOR_LEVEL_ACTIVATED: 'indoor_level_activated', 10 | CAMERA_MOVE_START: 'camera_move_start', 11 | CAMERA_MOVE: 'camera_move', 12 | CAMERA_MOVE_END: 'camera_move_end', 13 | OVERLAY_CLICK: 'overlay_click', 14 | POLYGON_CLICK: 'polygon_click', 15 | POLYLINE_CLICK: 'polyline_click', 16 | CIRCLE_CLICK: 'circle_click', 17 | GROUND_OVERLAY_CLICK: 'groundoverlay_click', 18 | INFO_CLICK: 'info_click', 19 | INFO_LONG_CLICK: 'info_long_click', 20 | INFO_CLOSE: 'info_close', 21 | INFO_OPEN: 'info_open', 22 | MARKER_CLICK: 'marker_click', 23 | MARKER_DRAG: 'marker_drag', 24 | MARKER_DRAG_START: 'marker_drag_start', 25 | MARKER_DRAG_END: 'marker_drag_end', 26 | MAP_DRAG: 'map_drag', 27 | MAP_DRAG_START: 'map_drag_start', 28 | MAP_DRAG_END: 'map_drag_end', 29 | KML_CLICK: 'kml_click', 30 | FUSION_TABLE_CLICK: 'fusion_table_click', 31 | PANORAMA_READY: 'panorama_ready', 32 | PANORAMA_CAMERA_CHANGE: 'panorama_camera_change', 33 | PANORAMA_LOCATION_CHANGE: 'panorama_location_change', 34 | PANORAMA_CLICK: 'panorama_click' 35 | }; 36 | -------------------------------------------------------------------------------- /www/LatLng.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * @name LatLng 3 | * @class This class represents new camera position 4 | * @param {Number} latitude 5 | * @param {Number} longitude 6 | ******************************************************************************/ 7 | function LatLng(latitude, longitude) { 8 | var self = this; 9 | /** 10 | * @property {Number} latitude 11 | */ 12 | self.lat = parseFloat(latitude || 0, 10); 13 | 14 | /** 15 | * @property {Number} longitude 16 | */ 17 | self.lng = parseFloat(longitude || 0, 10); 18 | } 19 | 20 | LatLng.prototype = { 21 | /** 22 | * Comparison function. 23 | * @method 24 | * @return {Boolean} 25 | */ 26 | equals: function(other) { 27 | other = other || {}; 28 | return other.lat === this.lat && 29 | other.lng === this.lng; 30 | }, 31 | 32 | /** 33 | * @method 34 | * @return {String} latitude,lontitude 35 | */ 36 | toString: function() { 37 | return '{"lat": ' + this.lat + ', "lng": ' + this.lng + '}'; 38 | }, 39 | 40 | /** 41 | * @method 42 | * @param {Number} 43 | * @return {String} latitude,lontitude 44 | */ 45 | toUrlValue: function(precision) { 46 | precision = precision || 6; 47 | return '{"lat": ' + this.lat.toFixed(precision) + ', "lng": ' + this.lng.toFixed(precision) + '}'; 48 | } 49 | }; 50 | 51 | module.exports = LatLng; 52 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/private-support.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Private support 3 | about: How to request private support? 4 | 5 | --- 6 | 7 | This plugin is open source project, thus you can use this plugin as free! 8 | 9 | In order to share the issue knowledges with other people, we would like to ask you to make converstations in open issue threads as much as possible. 10 | 11 | However some people, some companies do not allow to do that, because of their NDAs or privacy policies. 12 | 13 | Yes, we understand thier situations. 14 | 15 | In that case, choose **"private support"**. 16 | If you choose "**private support**", we will make a private chat room for you, then we can discuss your issues. 17 | We don't discover your code or your application screen captures into public spaces. 18 | 19 | ### Fee 20 | 21 | You can choose one of following options: 22 | 23 | - only one time, ask only one issue. 24 | Please donate $15 USD. 25 | 26 | - 1 month private support, up to 10 issues. 27 | Please donate $100 USD. 28 | 29 | - one year private support, no cap. 30 | Please donate $1,000 USD. 31 | 32 | 33 | 34 | ### How to apply it? 35 | 36 | Please make an issue with this template, then donate the fee amount. 37 | 38 | https://github.com/mapsplugin/cordova-plugin-googlemaps#please-support-this-plugin-activity 39 | 40 | You don't need to discover your information at this issue thread. 41 | After donation, we will contact the email address which is used for paypal payment. 42 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/MyPluginLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyPluginLayer.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import 10 | #import "PluginMapViewController.h" 11 | #import "MyPluginScrollView.h" 12 | 13 | @interface CGDOMRect : NSObject 14 | @property CGFloat left; 15 | @property CGFloat right; 16 | @property CGFloat top; 17 | @property CGFloat bottom; 18 | @end 19 | 20 | @interface OverflowCSS : NSObject 21 | @property BOOL cropX; 22 | @property BOOL cropY; 23 | @property CGRect rect; 24 | @end 25 | 26 | @interface MyPluginLayer : UIView 27 | 28 | @property (nonatomic) UIView *webView; 29 | @property (nonatomic) MyPluginScrollView *pluginScrollView; 30 | @property (atomic) NSTimer *redrawTimer; 31 | @property (nonatomic) BOOL isSuspended; 32 | @property (nonatomic) NSOperationQueue *executeQueue; 33 | @property (atomic, strong) NSObject *_lockObject; 34 | @property (atomic, strong) NSMutableDictionary *CACHE_FIND_DOM; 35 | 36 | - (id)initWithWebView:(UIView *)webView; 37 | - (void)resizeTask:(NSTimer *)timer; 38 | - (void)clearHTMLElements; 39 | - (void)putHTMLElements:(NSDictionary *)elementsDic; 40 | - (void)addPluginOverlay:(PluginViewController *)pluginViewCtrl; 41 | - (void)removePluginOverlay:(PluginViewController *)pluginViewCtrl; 42 | - (void)updateViewPosition:(PluginViewController *)pluginViewCtrl; 43 | - (void)startRedrawTimer; 44 | - (void)stopRedrawTimer; 45 | @end 46 | -------------------------------------------------------------------------------- /src/ios/check_sdk_version.js: -------------------------------------------------------------------------------- 1 | module.exports = function (ctx) { 2 | 3 | var PluginInfoProvider = require('cordova-common').PluginInfoProvider; 4 | 5 | var path = require('path'); 6 | 7 | var projectRoot = ctx.opts.projectRoot; 8 | return (new Promise(function (resolve, reject) { 9 | 10 | var pluginsDir = path.join(projectRoot, 'plugins'); 11 | var pluginInfoProvider = new PluginInfoProvider(); 12 | var plugins = pluginInfoProvider.getAllWithinSearchPath(pluginsDir); 13 | var pluginInfo; 14 | var needToUninstall = false; 15 | for (var i = 0; i < plugins.length; i++) { 16 | pluginInfo = plugins[i]; 17 | if (pluginInfo.id === 'com.googlemaps.ios') { 18 | needToUninstall = true; 19 | break; 20 | } 21 | } 22 | 23 | if (needToUninstall) { 24 | console.info('--[cordova-plugin-googlemaps]------------------------'); 25 | console.info('From version 2.4.5, the cordova-plugin-googlemaps uses CocoaPod.'); 26 | console.info('No longer necessary com.googlemaps.ios plugin.'); 27 | console.info('Automatic uninstalling com.googlemaps.ios plugin...'); 28 | console.info('-----------------------------------------------------'); 29 | 30 | var exec = require('child_process').exec; 31 | exec('cordova plugin rm com.googlemaps.ios 2>&1', function (err, stdout) { 32 | if (err) { 33 | reject(err); 34 | } else { 35 | console.log(stdout); 36 | exec('npm uninstall cordova-plugin-googlemaps-sdk --save 2>&1', function () { 37 | resolve(); 38 | }); 39 | } 40 | }); 41 | } else { 42 | resolve(); 43 | } 44 | })); 45 | 46 | }; 47 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/MyPluginScrollView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyPluginScrollView.m 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import "MyPluginScrollView.h" 10 | 11 | @implementation MyPluginScrollView 12 | 13 | 14 | - (id)initWithFrame:(CGRect)aRect 15 | { 16 | self = [super initWithFrame:aRect]; 17 | // Avoid the white bar that appears at the top of the map with iPhone iOS 11 18 | // See problem description here: https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/1909 19 | // 20 | // https://github.com/vidinoti/cordova-plugin-googlemaps/commit/0894072be260223f4ee833e422adf011af9740dd 21 | if (@available(iOS 11, *)) { 22 | self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; 23 | } 24 | self.HTMLNodes = [[NSMutableDictionary alloc] init]; 25 | self.mapCtrls = [[NSMutableDictionary alloc] init]; 26 | return self; 27 | } 28 | 29 | - (void)attachView:(UIView *)view depth:(NSInteger)depth { 30 | NSArray *subviews = [self subviews]; 31 | UIView *subview; 32 | NSInteger tag; 33 | int viewCnt = (int)[subviews count]; 34 | int index = viewCnt; 35 | for (int i = 0; i < viewCnt; i++) { 36 | subview = [subviews objectAtIndex: i]; 37 | tag = subview.tag; 38 | if (tag == 0) { 39 | continue; 40 | } 41 | if (tag > depth) { 42 | index = i; 43 | break; 44 | } 45 | } 46 | 47 | [self insertSubview:view atIndex:index]; 48 | } 49 | - (void)detachView:(UIView *)view { 50 | [view removeFromSuperview]; 51 | 52 | } 53 | 54 | - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { 55 | return [super hitTest:point withEvent:event]; 56 | } 57 | @end 58 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-plugin-googlemaps", 3 | "version": "2.7.1", 4 | "description": "Google Maps native SDK for Android and iOS, and Google Maps JavaScript API v3 for browser.", 5 | "cordova": { 6 | "id": "cordova-plugin-googlemaps", 7 | "platforms": [ 8 | "android", 9 | "ios", 10 | "browser" 11 | ] 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/mapsplugin/cordova-plugin-googlemaps.git" 16 | }, 17 | "keywords": [ 18 | "google", 19 | "maps", 20 | "geo", 21 | "google maps", 22 | "ecosystem:cordova", 23 | "cordova-android", 24 | "cordova-ios", 25 | "cordova-browser" 26 | ], 27 | "engines": [ 28 | { 29 | "name": "cordova-android", 30 | "version": ">=5.1.0" 31 | }, 32 | { 33 | "name": "cordova-ios", 34 | "version": ">=5.1.1" 35 | }, 36 | { 37 | "name": "apple-xcode", 38 | "version": ">=10.0.0" 39 | }, 40 | { 41 | "name": "apple-ios", 42 | "version": ">=10.0.0" 43 | } 44 | ], 45 | "scripts": { 46 | "test": "jest && npm run eslint", 47 | "jest": "jest", 48 | "test:watch": "jest --watch", 49 | "eslint": "node node_modules/eslint/bin/eslint www src" 50 | }, 51 | "author": "Masashi Katsumata, Hirbod Mirjavadi", 52 | "license": "Apache-2.0", 53 | "bugs": { 54 | "url": "https://github.com/mapsplugin/cordova-plugin-googlemaps/issues" 55 | }, 56 | "homepage": "https://github.com/mapsplugin/cordova-plugin-googlemaps", 57 | "devDependencies": { 58 | "cordova-js": "^4.2.4", 59 | "eslint": "^5.7.0", 60 | "jest": "^23.6.0" 61 | }, 62 | "dependencies": { 63 | "cordova-common": "^3.1.0" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/UIImageCache.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImageCache 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | #import "UIImageCache.h" 9 | 10 | static UIImageCache *sharedInstance; 11 | 12 | @interface UIImageCache () 13 | @property (nonatomic, strong) NSCache *imageCache; 14 | @end 15 | 16 | @implementation UIImageCache 17 | 18 | + (UIImageCache*)sharedInstance { 19 | static dispatch_once_t onceToken; 20 | dispatch_once(&onceToken, ^{ 21 | sharedInstance = [[UIImageCache alloc] init]; 22 | sharedInstance.imageCache = [[NSCache alloc] init]; 23 | sharedInstance.imageCache.totalCostLimit = 3 * 1024 * 1024 * 1024; // 3MB = Cache for image 24 | sharedInstance.iconCacheKeys = [[NSMutableDictionary alloc] init]; 25 | }); 26 | return sharedInstance; 27 | } 28 | - (instancetype)init { 29 | self = [super init]; 30 | /* 31 | if (self && self.imageCache == nil) { 32 | self.imageCache = [[NSCache alloc] init]; 33 | self.imageCache.totalCostLimit = 3 * 1024 * 1024 * 1024; // 3MB = Cache for image 34 | self.iconCacheKeys = [NSMutableDictionary dictionary]; 35 | }*/ 36 | return self; 37 | } 38 | 39 | - (void)cacheImage:(UIImage*)image forKey:(NSString*)key { 40 | NSData *imgData = UIImagePNGRepresentation(image); 41 | [self.imageCache setObject:image forKey:key cost:[imgData length]]; 42 | imgData = nil; 43 | } 44 | 45 | - (UIImage*)getCachedImageForKey:(NSString*)key { 46 | return [self.imageCache objectForKey:key]; 47 | } 48 | - (void)removeCachedImageForKey:(NSString*)key { 49 | [self.imageCache removeObjectForKey:key]; 50 | } 51 | 52 | - (void)removeAllCachedImages { 53 | [self.imageCache removeAllObjects]; 54 | } 55 | 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /www/plugin-loader-for-browser.js: -------------------------------------------------------------------------------- 1 | var event = require('cordova-plugin-googlemaps.event'), 2 | BaseClass = require('cordova-plugin-googlemaps.BaseClass'), 3 | BaseArrayClass = require('cordova-plugin-googlemaps.BaseArrayClass'), 4 | execCmd = require('cordova-plugin-googlemaps.commandQueueExecutor'), 5 | cordovaGoogleMaps = new(require('cordova-plugin-googlemaps.js_CordovaGoogleMaps'))(execCmd); 6 | 7 | module.exports = { 8 | event: event, 9 | Animation: { 10 | BOUNCE: 'BOUNCE', 11 | DROP: 'DROP' 12 | }, 13 | BaseClass: BaseClass, 14 | BaseArrayClass: BaseArrayClass, 15 | Map: { 16 | getMap: cordovaGoogleMaps.getMap.bind(cordovaGoogleMaps) 17 | }, 18 | StreetView: { 19 | getPanorama: cordovaGoogleMaps.getPanorama.bind(cordovaGoogleMaps), 20 | Source: { 21 | DEFAULT: 'DEFAULT', 22 | OUTDOOR: 'OUTDOOR' 23 | } 24 | }, 25 | HtmlInfoWindow: require('cordova-plugin-googlemaps.HtmlInfoWindow'), 26 | LatLng: require('cordova-plugin-googlemaps.LatLng'), 27 | LatLngBounds: require('cordova-plugin-googlemaps.LatLngBounds'), 28 | MapTypeId: require('cordova-plugin-googlemaps.MapTypeId'), 29 | environment: require('cordova-plugin-googlemaps.Environment'), 30 | Geocoder: require('cordova-plugin-googlemaps.Geocoder')(execCmd), 31 | LocationService: require('cordova-plugin-googlemaps.LocationService')(execCmd), 32 | geometry: { 33 | encoding: require('cordova-plugin-googlemaps.encoding'), 34 | spherical: require('cordova-plugin-googlemaps.spherical'), 35 | poly: require('cordova-plugin-googlemaps.poly') 36 | } 37 | }; 38 | 39 | cordova.addConstructor(function () { 40 | if (!window.Cordova) { 41 | window.Cordova = cordova; 42 | } 43 | window.plugin = window.plugin || {}; 44 | window.plugin.google = window.plugin.google || {}; 45 | window.plugin.google.maps = window.plugin.google.maps || module.exports; 46 | }); 47 | -------------------------------------------------------------------------------- /src/browser/PluginLocationService.js: -------------------------------------------------------------------------------- 1 | 2 | var LOCATION_ERROR = { 3 | '1': 'service_denied', 4 | '2': 'not_available', 5 | '3': 'timeout' 6 | }; 7 | 8 | module.exports = { 9 | 'hasPermission': function(onSuccess, onError) { 10 | if (navigator.permissions) { 11 | navigator.permissions.query({'name': 'geolocation'}) 12 | .then(function(permission) { 13 | onSuccess(permission.state === 'granted' ? 1 : 0); 14 | }) 15 | .catch(onError); 16 | } else { 17 | onError('Browser does not support this feature.'); 18 | } 19 | }, 20 | 'getMyLocation': function(onSuccess, onError) { 21 | 22 | if (navigator.geolocation) { 23 | navigator.geolocation.getCurrentPosition(function(position) { 24 | onSuccess({ 25 | 'latLng': { 26 | 'lat': position.coords.latitude, 27 | 'lng': position.coords.longitude 28 | }, 29 | 'elapsedRealtimeNanos': 0, 30 | 'time': position.timestamp, 31 | 'accuracy': position.coords.accuracy, 32 | 'altitude': position.coords.altitude, 33 | 'speed': position.coords.speed, 34 | 'bearing': position.coords.heading, 35 | 'provider': 'geolocationapi', 36 | 'hashCode': 'dummy', 37 | 'status': true 38 | }); 39 | }, function(error) { 40 | onError({ 41 | 'status': false, 42 | 'error_code': LOCATION_ERROR[error.code], 43 | 'error_message': error.message 44 | }); 45 | }, { 46 | 'enableHighAccuracy': true 47 | }); 48 | } else { 49 | onError({ 50 | 'status': false, 51 | 'error_code': 'not_available', 52 | 'error_message': 'Since this device does not have any location provider, this app can not detect your location.' 53 | }); 54 | } 55 | } 56 | }; 57 | 58 | 59 | require('cordova/exec/proxy').add('PluginLocationService', module.exports); 60 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // PluginStreetViewPanoramaController.m 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import "PluginStreetViewPanoramaController.h" 10 | #if CORDOVA_VERSION_MIN_REQUIRED < __CORDOVA_4_0_0 11 | #import 12 | #endif 13 | 14 | 15 | @implementation PluginViewController 16 | 17 | - (id)initWithOptions:(NSDictionary *) options { 18 | self = [super init]; 19 | self.plugins = [NSMutableDictionary dictionary]; 20 | self.isFullScreen = NO; 21 | self.screenSize = [[UIScreen mainScreen] bounds]; 22 | self.screenScale = [[UIScreen mainScreen] scale]; 23 | self.clickable = YES; 24 | self.isRenderedAtOnce = NO; 25 | self.divId = nil; 26 | self.objects = [[PluginObjects alloc] init]; 27 | self.executeQueue = [NSOperationQueue new]; 28 | self.executeQueue.maxConcurrentOperationCount = 10; 29 | 30 | return self; 31 | } 32 | 33 | - (void)viewDidLoad 34 | { 35 | [super viewDidLoad]; 36 | 37 | } 38 | 39 | 40 | - (void)didReceiveMemoryWarning 41 | { 42 | [super didReceiveMemoryWarning]; 43 | } 44 | 45 | - (int)getVideDepth { 46 | return (int)self.viewDepth; 47 | } 48 | 49 | - (void)execJS: (NSString *)jsString { 50 | // Insert setTimeout() in order to prevent the GDC and webView deadlock 51 | // ( you can not click the ok button of Alert() ) 52 | // https://stackoverflow.com/a/23833841/697856 53 | jsString = [NSString stringWithFormat:@"setTimeout(function(){%@}, 0);", jsString]; 54 | 55 | if ([self.webView respondsToSelector:@selector(stringByEvaluatingJavaScriptFromString:)]) { 56 | [self.webView performSelector:@selector(stringByEvaluatingJavaScriptFromString:) withObject:jsString]; 57 | } else if ([self.webView respondsToSelector:@selector(evaluateJavaScript:completionHandler:)]) { 58 | [self.webView performSelector:@selector(evaluateJavaScript:completionHandler:) withObject:jsString withObject:nil]; 59 | } 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginMap.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginMap.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import "CordovaGoogleMaps.h" 10 | #import "IPluginProtocol.h" 11 | #import "IPluginView.h" 12 | 13 | @interface PluginMap : CDVPlugin 14 | @property (nonatomic, strong) PluginMapViewController* mapCtrl; 15 | @property (nonatomic) BOOL isRemoved; 16 | @property (nonatomic) BOOL initialized; 17 | 18 | - (void)clear:(CDVInvokedUrlCommand*)command; 19 | - (void)setClickable:(CDVInvokedUrlCommand*)command; 20 | - (void)setVisible:(CDVInvokedUrlCommand*)command; 21 | - (void)setCameraTilt:(CDVInvokedUrlCommand*)command; 22 | - (void)setCameraTarget:(CDVInvokedUrlCommand*)command; 23 | - (void)setCameraBearing:(CDVInvokedUrlCommand *)command; 24 | - (void)setCameraZoom:(CDVInvokedUrlCommand*)command; 25 | - (void)setDiv:(CDVInvokedUrlCommand *)command; 26 | - (void)setMapTypeId:(CDVInvokedUrlCommand*)command; 27 | - (void)animateCamera:(CDVInvokedUrlCommand*)command; 28 | - (void)loadPlugin:(CDVInvokedUrlCommand*)command; 29 | - (void)getMap:(CDVInvokedUrlCommand*)command; 30 | - (void)moveCamera:(CDVInvokedUrlCommand*)command; 31 | - (void)setMyLocationEnabled:(CDVInvokedUrlCommand*)command; 32 | - (void)setIndoorEnabled:(CDVInvokedUrlCommand*)command; 33 | - (void)setTrafficEnabled:(CDVInvokedUrlCommand*)command; 34 | - (void)setCompassEnabled:(CDVInvokedUrlCommand*)command; 35 | - (void)attachToWebView:(CDVInvokedUrlCommand*)command; 36 | - (void)detachFromWebView:(CDVInvokedUrlCommand*)command; 37 | - (void)toDataURL:(CDVInvokedUrlCommand*)command; 38 | - (void)setOptions:(CDVInvokedUrlCommand*)command; 39 | - (void)setAllGesturesEnabled:(CDVInvokedUrlCommand*)command; 40 | - (void)setPadding:(CDVInvokedUrlCommand*)command; 41 | - (void)panBy:(CDVInvokedUrlCommand*)command; 42 | - (void)getFocusedBuilding:(CDVInvokedUrlCommand*)command; 43 | - (void)setActiveMarkerId:(CDVInvokedUrlCommand*)command; 44 | - (void)stopAnimation:(CDVInvokedUrlCommand*)command; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /src/android/res/values-ja/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 閉じる 4 | config.xmlファイル内の\'GOOGLE_MAPS_ANDROID_API_KEY\'をあなたのAPIキーに置き換えてください 5 | この端末ではGoogle Maps Android API v2が利用できません。 6 | アプリケーションの設定が間違えています。このエラーは修復不可能かつ重大な失敗なものです。開発者は端末ログを確認してください。 7 | Google Play Servicesの内部エラーが発生しました。おそらくもう一度試みていただければ解決します。 8 | ログインしているGoogleアカウントが不正です。再度ログインして試してみてください。 9 | このアプリケーションの使用がユーザーに認められていません。このエラーは修復不可能かつ重大な失敗なものです。 10 | ネットワークエラーが発生しました。おそらくもう一度試みていただければ解決します。 11 | この端末にインストールされているGoogle Play Servicesが無効になっています。Google Play Servicesを有効にしてください。 12 | この端末にインストールされているGoogle Play Servicesでは認証ができません。Google Play Storeから最新版のGoogle Play Servicesをインストールしてください。 13 | この端末にGoogle Play Servicesがインストールされていません。Google Play Storeから最新版のGoogle Play Servicesをインストールしてください。 14 | この端末にインストールされているGoogle Play Servicesが古過ぎです。Google Play Storeから最新版のGoogle Play Servicesをインストールしてください。 15 | Google Maps Android API v2を使用しようと試みましたが、あなたがGoogleアカウントにログインしていません。Googleアカウントにログインしてから再度試してみてください。 16 | 利用できる位置情報を取得できる方法(GPSなど)がないため、この端末の位置情報が取得できませんでした。 17 | 位置情報サービス(GPSなど)が無効になっています。 18 | 位置情報サービス(GPSなど)の利用がユーザーにより拒否されました。 19 | この端末の位置情報が取得できませんでした。もう一度試してみてください。 20 | 21 | -------------------------------------------------------------------------------- /www/VisibleRegion.js: -------------------------------------------------------------------------------- 1 | var utils = require('cordova/utils'), 2 | LatLngBounds = require('./LatLngBounds'); 3 | 4 | /***************************************************************************** 5 | * VisibleRegion Class 6 | *****************************************************************************/ 7 | var VisibleRegion = function(southwest, northeast, farLeft, farRight, nearLeft, nearRight) { 8 | Object.defineProperty(this, 'type', { 9 | value: 'VisibleRegion', 10 | writable: false 11 | }); 12 | this.southwest = southwest; 13 | this.northeast = northeast; 14 | this.farLeft = farLeft; 15 | this.farRight = farRight; 16 | this.nearLeft = nearLeft; 17 | this.nearRight = nearRight; 18 | }; 19 | 20 | utils.extend(VisibleRegion, LatLngBounds); 21 | 22 | delete VisibleRegion.prototype.extend; 23 | delete VisibleRegion.prototype.getCenter; 24 | 25 | VisibleRegion.prototype.contains = function(latLng) { 26 | if (!latLng || !('lat' in latLng) || !('lng' in latLng)) { 27 | return false; 28 | } 29 | var y = latLng.lat, 30 | x = latLng.lng; 31 | 32 | var y90 = y + 90; 33 | var south = this.southwest.lat, 34 | north = this.northeast.lat, 35 | west = this.southwest.lng, 36 | east = this.northeast.lng; 37 | var south90 = south + 90, 38 | north90 = north + 90; 39 | 40 | var containX = false, 41 | containY = false; 42 | 43 | if (east >= 0 && west >= east) { 44 | if (x <= 0 && x >= -180) { 45 | containX = true; 46 | } else { 47 | containX = (west <= x && x <= east); 48 | } 49 | } else if (west <= 0 && east <= west) { 50 | containX = (west <= x && x <= east); 51 | if (x >= 0 && x <= 180) { 52 | containX = true; 53 | } else { 54 | containX = (x <= 0 && x <= west || x <= east && x>= -180); 55 | } 56 | } else { 57 | return LatLngBounds.prototype.contains.call(this, latLng); 58 | } 59 | 60 | containY = (south90 <= y90 && y90 <= north90) || //#a 61 | (south >= 0 && north <= 0 && ((south <= y && y <= 90) || (y >= -90 && y<= north))); // #d 62 | 63 | return containX && containY; 64 | }; 65 | 66 | module.exports = VisibleRegion; 67 | -------------------------------------------------------------------------------- /www/InlineWorker.js: -------------------------------------------------------------------------------- 1 | // InlineWorker 2 | // https://github.com/mohayonao/inline-worker 3 | // 4 | // The MIT License (MIT) 5 | // Copyright © 2018 Nao Yonamine 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 | // 11 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 12 | 13 | 14 | var WORKER_ENABLED = !!window.Worker; 15 | var global = window; 16 | 17 | function InlineWorker(func, self) { 18 | var _this = this; 19 | var functionBody; 20 | 21 | self = self || {}; 22 | 23 | if (WORKER_ENABLED) { 24 | functionBody = func.toString().trim().match( 25 | /^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/ 26 | )[1]; 27 | 28 | return new global.Worker(global.URL.createObjectURL( 29 | new global.Blob([ functionBody ], { type: 'text/javascript' }) 30 | )); 31 | } 32 | 33 | function postMessage(data) { 34 | setTimeout(function() { 35 | _this.onmessage({ data: data }); 36 | }, 0); 37 | } 38 | 39 | this.self = self; 40 | this.self.postMessage = postMessage; 41 | 42 | setTimeout(func.bind(self, self), 0); 43 | } 44 | 45 | InlineWorker.prototype.postMessage = function postMessage(data) { 46 | var _this = this; 47 | 48 | setTimeout(function() { 49 | _this.self.onmessage({ data: data }); 50 | }, 0); 51 | }; 52 | 53 | module.exports = InlineWorker; 54 | -------------------------------------------------------------------------------- /src/android/res/drawable/dummy_mylocation_button_shadow.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /src/android/res/values-ar/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | أغلق 4 | مع مفتاح API الخاص بك \"GOOGLE_MAPS_ANDROID_API_KEY\" يرجى استبدال config.xml في منصات 5 | غير متوفر لسبب ما على هذا الجهاز Google Maps Android API v2 6 | تم تكوين التطبيق بشكل خاطئ. هذا الخطأ غير قابل للاسترداد وسيتم التعامل معه على أنه مميت. يجب على مطور البرامج النظر في السجلات بعد ذلك لتحديد مزيد من المعلومات القابلة للتنفيذ 7 | يرجى إعادة المحاولة ، ويجب أن تحل المشكلة ، Google Play حدث خطأ داخلي في خدمات 8 | لقد حاولت الاتصال بالخدمة باسم حساب غير صالح 9 | .التطبيق غير مرخص للمستخدم. هذا الخطأ غير قابل للاسترداد وسيتم التعامل معه على أنه مميت 10 | .حدث خطأ في الشبكة. الرجاء المحاولة مرة أخرى ، ويجب أن تحل المشكلة 11 | Google Play على هذا الجهاز. الرجاء تشغيل خدمات Google Play تم تعطيل الإصدار المثبت من خدمات 12 | Google play من متجر Google Play المثبتة على هذا الجهاز غير أصلي. يرجى تحديث خدمات Google Play إصدار خدمات 13 | Google Play مفقودة على هذا الجهاز. الرجاء تثبيت خدمات Google Play خدمات 14 | Google Play من متجر Google Play قديم. يرجى تحديث خدمات Google Play الإصدار المثبت من خدمات 15 | Google Play لقد حاولت الاتصال بالخدمة ولكنك لم تسجل الدخول. يرجى التحقق من تكوين خدمات 16 | . نظرًا لأن هذا الجهاز لا يحتوي على أي موفر للموقع ، لا يمكن لهذا التطبيق اكتشاف موقعك 17 | تم تعطيل خدمة الموقع 18 | خدمة الموقع مرفوضة من قبل المستخدم 19 | .لا يمكن الكشف عن موقعك. حاول ثانية 20 | 21 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginMarker.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginMarker.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import "CordovaGoogleMaps.h" 10 | #import "IPluginProtocol.h" 11 | #import "PluginUtil.h" 12 | #import "UIImageCache.h" 13 | 14 | @interface PluginMarker : CDVPlugin 15 | 16 | @property (nonatomic) BOOL initialized; 17 | 18 | @property (nonatomic, strong) PluginMapViewController* mapCtrl; 19 | - (void)create:(CDVInvokedUrlCommand*)command; 20 | - (void)showInfoWindow:(CDVInvokedUrlCommand*)command; 21 | - (void)hideInfoWindow:(CDVInvokedUrlCommand*)command; 22 | - (void)getPosition:(CDVInvokedUrlCommand*)command; 23 | - (void)setSnippet:(CDVInvokedUrlCommand*)command; 24 | - (void)setTitle:(CDVInvokedUrlCommand*)command; 25 | - (void)setFlat:(CDVInvokedUrlCommand*)command; 26 | - (void)setOpacity:(CDVInvokedUrlCommand*)command; 27 | - (void)setDraggable:(CDVInvokedUrlCommand*)command; 28 | - (void)setDisableAutoPan:(CDVInvokedUrlCommand*)command; 29 | - (void)setVisible:(CDVInvokedUrlCommand*)command; 30 | - (void)setIcon:(CDVInvokedUrlCommand*)command; 31 | - (void)setIconAnchor:(CDVInvokedUrlCommand*)command; 32 | - (void)setInfoWindowAnchor:(CDVInvokedUrlCommand*)command; 33 | - (void)remove:(CDVInvokedUrlCommand*)command; 34 | - (void)setPosition:(CDVInvokedUrlCommand*)command; 35 | - (void)setRotation:(CDVInvokedUrlCommand*)command; 36 | - (void)setAnimation:(CDVInvokedUrlCommand*)command; 37 | - (void)downloadImageWithURL:(NSURL *)url completionBlock:(void (^)(BOOL succeeded, UIImage *image))completionBlock; 38 | 39 | 40 | // Internal use 41 | /* 42 | -(void)setMarkerAnimation_:(NSString *)animation marker:(GMSMarker *)marker pluginResult:(CDVPluginResult *)pluginResult callbackId:(NSString*)callbackId; 43 | -(void)setDropAnimation_:(GMSMarker *)marker pluginResult:(CDVPluginResult *)pluginResult callbackId:(NSString*)callbackId; 44 | -(void)setBounceAnimation_:(GMSMarker *)marker pluginResult:(CDVPluginResult *)pluginResult callbackId:(NSString*)callbackId; 45 | */ 46 | - (void)_create:(NSString *)markerId markerOptions:(NSDictionary *)json callbackBlock:(void (^)(BOOL successed, id resultObj)) callbackBlock; 47 | -(void)setIcon_:(GMSMarker *)marker iconProperty:(NSDictionary *)iconProperty callbackBlock:(void (^)(BOOL successed, id resultObj)) callbackBlock; 48 | -(void)_removeMarker:(GMSMarker *)marker; 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /src/android/res/values-nl/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sluiten 4 | Vervang \"GOOGLE_MAPS_ANDROID_API_KEY\" in config.xml met je API Key! 5 | Google Maps Android API v2 is niet beschikbaar op dit apparaat. 6 | De applicatie is onjuist geconfigureerd. Deze foutmelding kan niet hesteld worden. De ontwikkelaar moet de logboek informatie bekijken om dit probleem op te lossen. 7 | Er heeft een interne fout van Google Play Services plaatsgevonden. Probeer het opnieuw. 8 | Je hebt geprobeerd om te verbinden met de service met een ongeldig gebruikersnaam. 9 | Er is geen licentie voor de gebruiker. Deze foutmelding kan niet hersteld worden. 10 | Er heeft een netwerkfout plaatsgevonden. Probeer het opnieuw. 11 | De geinstalleerde versie van Google Play services staat uit op dit apparaat. Zet Google Play Services aan. 12 | De geinstaleerde versie van Google Play services is niet autentiek. Update Google Play Services van de Google Play Store. 13 | Google Play services ontbreekt op dit apparaat. Installeer Google Play Services. 14 | De geinstalleerde Google Play services is niet langer geldig. Update Google Play Services van de Google Play Store. 15 | Je probeert te verbinden met de service maar je bent niet ingelogd. Controleer de Google Play Services configuratie 16 | Omdat dit apparaat geen locatie provider heeft kan de app je locatie niet bepalen. 17 | Locatie service staat uit. 18 | Locatie service is afgewezen door de gebruiker. 19 | Kan je locatie niet bepalen. Probeer opnieuw. 20 | 21 | -------------------------------------------------------------------------------- /src/android/res/values-hi/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | बंद 4 | कृपया config.xml मे \'GOOGLE_MAPS_ANDROID_API_KEY\' को अपनी एपीआई कुंजी से बदलें 5 | इस डिवाइस पर Google Maps Android API v2 उपलब्ध नहीं है 6 | यह एप्लिकेशन गलत तरीके से कॉन्फ़िगर किया गया है. इस त्रुटि को ठीक किया नहीं जासकता इसे घातक माना जायेगा. डेवलपर को चाहिए वे लोग में देखकर कार्रवाई योग्य प्राप्त करे. 7 | Google Play सेवाओं की एक आंतरिक त्रुटि हुई. कृप्या फिरसे प्रयास करें, इस से समस्या हल होनी चाहिए. 8 | आप ने एक अमान्य खाता नाम के साथ सेवा से जुड़ने का प्रयास है. 9 | इस उपयोगकर्ता के पास इस एप्लीकेशन लाइसेंस नहीं है. इस त्रुटि को ठीक किया नहीं जासकता इसे घातक माना जायेग. 10 | एक नेटवर्क त्रुटि हुई. कृप्या फिरसे प्रयास करें, इस से समस्या हल होनी चाहिए. 11 | इस डिवाइस पर Google Play सेवाओं का स्थापित संस्करण अक्षम है. कृपया Google Play सेवाएं चालू करें. 12 | इस डिवाइस पर स्थापित Google Play सेवाओं का संस्करण प्रामाणिक नहीं है. कृपया Google Play Store से Google Play सेवाएं अपडेट करें. 13 | इस डिवाइस पर Google Play सेवाएं मौजूद नहीं हैं. कृपया Google Play सेवाएं स्थापित करें. 14 | Google Play सेवाओं का स्थापित संस्करण पुराना है. कृपया Google Play Store से Google Play सेवाएं अपडेट करें. 15 | आप ने साइन किये बिना इस सेवा से जुड़ने का प्रयास किया है. कृपया Google Play सेवाएं कॉन्फ़िगरेशन जांचें 16 | इस डिवाइस में कोई स्थान प्रदाता नहीं है, इसके कारण यह ऐप आपके स्थान का पता नहीं लगा सकता. 17 | स्थान सेवा अक्षम है. 18 | उपयोगकर्ता ने स्थान सेवा अस्वीकार कर दिया है. 19 | आप के स्थान का पता नही चल रहा है. कृप्या फिरसे प्रयास करें. 20 | 21 | -------------------------------------------------------------------------------- /src/android/res/values-uk/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Закрити 4 | Будь ласка, замініть \'GOOGLE_MAPS_ANDROID_API_KEY\' в config.xml на Ваш API ключ! 5 | По якісь причині Google Maps Android API v2 не доступний на цьому пристрої. 6 | Програма невірно налаштована. Виникла фатальна помилка. Розробник додатку повинен подивитись в логи, щоб виправити помилку. 7 | Відбулася внутрішня помилка Google Play Services. Будь ласка, спробуйте ще раз для вирішення проблеми. 8 | Ви спробували підключитися до сервісу з недійсним ім\'ям облікового запису. 9 | Виникла фатальна помилка. Додаток не ліцензійований для користувача. 10 | Виникла помилка мережі. Будь ласка, спробуйте ще раз для вирішення проблеми. 11 | Встановлений Google Play Services на цьому пристрої - відключений. Будь ласка, увімкніть Google Play Services. 12 | Встановлена версія Google Play Services на цьому пристрої не є автентична. Будь ласка, обновіть Google Play Services із Google Play Store. 13 | Google Play Services відсутній на цьому пристрої. Будь ласка, встановіть Google Play Services. 14 | Встановлена версія Google Play Services застаріла. Будь ласка, обновіть Google Play Services із Google Play Store. 15 | Ви спробували підключитися до сервісу, але ви не ввійшли в систему. Будь ласка, перевірте конфігурацію Google Play Services. 16 | Оскільки цей пристрій не підтримує пошук місцезнаходження, цей додаток не може визначити Ваше розташування. 17 | Сервіс місцезнаходження вимкнений. 18 | Сервіс пошуку місцезнаходження відхилений користувачем. 19 | Не вдається виявити Ваше місцезнаходження. Спробуйте знову. 20 | 21 | -------------------------------------------------------------------------------- /src/android/res/values-vi/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Đóng 4 | Vui lòng thay \'GOOGLE_MAPS_ANDROID_API_KEY\' trong config.xml với API Key của bạn! 5 | Google Maps Android API v2 vì một lý do nào đó không hoạt động trên thiết bị của bạn. 6 | Ứng dụng chưa được cấu hình. Lỗi này là nghiêm trọng và làm cho hệ thống ngừng hoạt động. Nhà phát triển cần kiểm tra hệ thống Logs để có hướng khắc phục cụ thể.. 7 | Lỗi xảy ra với dịch vụ Google Play. Vui lòng khởi động lại để hệ thống hoạt động bình thường.. 8 | Bạn sử dụng tài khoản không hợp lệ để kết nối với dịch vụ. 9 | Người sử dụng không được cấp phép sử dụng ứng dụng. Lỗi này là nghiêm trọng và làm cho hệ thống ngừng hoạt động. 10 | Đường truyền mạng có lỗi. Vui lòng thử lại, và hệ thống sẽ hoạt động bình thường. 11 | Dịch vụ Google Play không hoạt động trên thiết bị của bạn. Vui lòng bật dịch vụ Google Play để hệ thống hoạt động. 12 | Dịch vụ Google Play cài đặt trên máy của bạn không hợp lệ. Vui lòng cập nhật dịch vụ Google Play trên Kho ứng dụng Google Play. 13 | Dịch vụ Google PLay chưa được cài đặt trên thiết bị của bạn. Vui lòng cài đặt dịch vụ Google Play. 14 | Dịch vụ Google Play của bạn đã lỗi thời. Vui lòng cập nhật dịch vụ Google Play trên Kho ứng dụng Google Play. 15 | Bạn chưa thực hiện đăng nhập để kết nối với dịch vụ. Vui lòng xem lại cấu hình dịch vụ Google Play. 16 | Thiết bị không hỗ trợ xác định vị trí vì vậy ứng dụng không thể xác định vị trí của bạn. 17 | Dịch vụ xác định vị trí không được kích hoạt. 18 | Người dùng không cho phép sử dụng dịch vụ xác định vị trí. 19 | Không thể xác định vị trí của bạn. Vui lòng thử lại.. 20 | 21 | -------------------------------------------------------------------------------- /src/android/res/values-in/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Tutup 4 | Silahkan ganti \'GOOGLE_MAPS_ANDROID_API_KEY\' di config.xml dengan Key API anda! 5 | Google Maps Android API v2 tidak dapat digunakan pada perangkat ini. 6 | Pengaturan applikasi ini salah. Kesalahan ini tidak dapat diperbaharui dan dianggap FATAL. Developer harus memeriksa informasi logs setelah ini untuk memastikan tidandakan. 7 | terdapat kesalahan pada Google Play Services. Silahkan Coba lagi, untuk memperbaiki masalah. 8 | Anda mencoba menghubungi service dengan nama akun yang tidak sesuai. 9 | Appilkasi ini tidak diberikan licensi kepada pengguna. Error ini tidak dapat diperbaharui dan dianggap FATAL. 10 | Kesalahan pada Jaringan. Silahkan Coba lagi,untuk memperbaiki masalah. 11 | versi Google Play yang di install telah di non aktifkan pada perangkat ini. Silahkan Aktifkan Google Play Services. 12 | Versi Google Play services yang di install pada perangkat ini tidak asli. Silahkan perbaharui Google Play Services melalui Google Play Store. 13 | Google Play services tidak terdapat pada perangkat ini. Silahkan install Google Play Services. 14 | Versi Google Play services sudha ketinggalan. Silahkan perbaharui Google Play Services melalui Google Play Store. 15 | Anda mencoba terhubung pada service tetapi belum signed in. Silahkan periksa pengaturan Google Play Services 16 | Karena perangkat ini tidak tersedia provider lokasi, Applikasi tidak dapat mengetahui lokasi anda. 17 | Service Lokasi tidak aktif. 18 | Service Lokasi Ditolak pengguna. 19 | Tidak dapat mengetahui lokasi anda. Silahkan Coba lagi. 20 | 21 | -------------------------------------------------------------------------------- /src/android/res/values-ru/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Закрыть 4 | Пожалуйста, замените \'GOOGLE_MAPS_ANDROID_API_KEY\' в config.xml на Ваш API ключ! 5 | По какой то причине Google Maps Android API v2 не доступен на этом устройстве. 6 | Приложение неправильно настроено. Произошла фатальная ошибка. Разработчик приложения должен посмотреть в логи, чтобы исправить ошибку. 7 | Произошла внутренняя ошибка Google Play Services. Пожалуйста, повторите попытку для решения проблемы. 8 | Вы попытались подключиться к сервису с недопустимым именем учетной записи. 9 | Произошла фатальная ошибка. Приложение не лицензировано для этого пользователя. 10 | Произошла сетевая ошибка. Пожалуйста, повторите попытку для решения проблемы. 11 | Установленная версия Google Play Services отключена на этом устройстве. Пожалуйста, включите Google Play Services. 12 | Версия Google Play Services установлена на этом уствройстве не подлинная. Пожалуйста, обновите Google Play Services из Google Play Store. 13 | Google Play Services отсутствует на этом устройстве. Пожалуйста, установите Google Play Services. 14 | Установленная версия Google Play Services устаревшая. Пожалуйста, обновите Google Play Services из Google Play Store. 15 | Вы попытались подключиться к сервису, но вы не вошли в систему. Пожалуйста, проверьте конфигурацию Google Play Services. 16 | Поскольку это устройство не поддерживает поиск местоположения, это приложение не может определить Ваше расположение. 17 | Сервис определения местоположения отключен. 18 | Определение местоположения отклонено пользователем. 19 | Не удается определить Ваше местоположение. Попробуй еще раз. 20 | 21 | -------------------------------------------------------------------------------- /src/android/res/values/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Close 4 | Please replace \'GOOGLE_MAPS_ANDROID_API_KEY\' in the config.xml with your API Key! 5 | Google Maps Android API v2 is not available for some reason on this device. 6 | The application is miss-configured. This error is not recoverable and will be treated as fatal. The developer should look at the logs after this to determine more actionable information. 7 | An internal error of Google Play Services occurred. Please retry, and it should resolve the problem. 8 | You attempted to connect to the service with an invalid account name specified. 9 | The application is not licensed to the user. This error is not recoverable and will be treated as fatal. 10 | A network error occurred. Please retry, and it should resolve the problem. 11 | The installed version of Google Play services has been disabled on this device. Please turn on Google Play Services. 12 | The version of the Google Play services installed on this device is not authentic. Please update the Google Play Services from Google Play Store. 13 | Google Play services is missing on this device. Please install the Google Play Services. 14 | The installed version of Google Play services is out of date. Please update the Google Play Services from Google Play Store. 15 | You attempted to connect to the service but you are not signed in. Please check the Google Play Services configuration 16 | Since this device does not have any location provider, this app can not detect your location. 17 | Location service is disabled. 18 | Location service is rejected by user. 19 | Can not detect your location. Try again. 20 | 21 | -------------------------------------------------------------------------------- /src/android/res/values-nb/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Lukk 4 | Vennligst erstatt \'GOOGLE_MAPS_ANDROID_API_KEY\' i config.xml med din API-nøkkel! 5 | Google Maps Android API v2 er ikke tilgjengelig av ukjent grunn på enheten. 6 | Applikasjon er feilkonfigurert. Denne feilen er ikke gjenvinnbart og skal behandles som fatal. Utvikleren bør se på loggen etter dette for å fastslå mer handlingsbar informasjon. 7 | Det har skjedd en intern feil av Google Play tjeneste. Vennligst prøv igjen og problemme skal løses ut. 8 | Du prøver å koble til tjeneste med ugyldig brukkernavn. 9 | Applikasjon har ikke licensing for dette brukkernavnet. Denne feilen er ikke gjenvinnbart og skal behandles som fatal. 10 | Det har skjedd koblingsfailen. Vennligst prøv igjen og problemme skal løses ut. 11 | Innstallert versjon av Google Play tjenesten har vært deaktivert på denne innhetten. Vennligst slå av Google Play tjenesten. 12 | Innstallert versjon av Google Play tjenesten har ikke vært autentisk. Vennligst oppdater Google Play tjenesten fra Google Play Store. 13 | Google Play tjenesten er utilghengelig på denne enheten. Vennligst installer Google Play tjenesten. 14 | Innstallert verjson av Google Play tjenesten er ikke oppdatert. Vennligst oppdater Google Play tjenesten fra Google Play Store. 15 | Du prøver å koble til tjeneste, men du har ikke logget inn. Vennligst sjekk Google Play tjenesten innstellinger. 16 | Siden enheten har ingen stedleverandør, kan ikke din lokasjon oppdages av enheten. 17 | Stedtjenester er deaktivert. 18 | Stedtjenester er avvist av brukeren. 19 | Kan ikke oppdage din lokasjon. Vannligst prøv igjen. 20 | 21 | -------------------------------------------------------------------------------- /src/android/res/values-pt-rPT/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Fechar 4 | Por favor substitua \'GOOGLE_MAPS_ANDROID_API_KEY\' em config.xml com sua chave de API! 5 | Google Maps Android API v2 não está disponível nesse dispositivo por alguma razão. 6 | O aplicativo está mal configurado. Este erro não é recuperável e será tratado como fatal. O desenvolvedor deve analisar os logs para determinar o que pode ser feito 7 | Ocorreu um erro interno no Google Play Services. Por favor tente novamente e o erro deverá estar resolvido. 8 | Você tentou se conectar ao serviço com um nome de conta inválido. 9 | O aplicativo não está licenciado para o usuário. Esse erro não é recuperável e será tratado como fatal. 10 | Ocorreu um erro de rede. Por favor tente novamente e o erro deverá estar resolvido. 11 | A versão instalada do Google Play Services foi desativada nesse dispositivo. Por favor ative o Google Play Services. 12 | A versão do Google Play Services instalada nesse dispositivo não é autêntica. Atualize o Google Play Services na Google Play Store. 13 | O Google Play services não existe nesse dispositivo. Por favor instale o Google Play Services. 14 | A versão do Google Play Services instalada está desatualizada. Por favor atualize o Google Play Services na Google Play Store. 15 | Você tentou se conectar ao serviço mas você não está logado. Por favor cheque a configuração do Google Play Services. 16 | Esse dispositivo não tem nenhum provedor de localização, logo, este aplicativo não pode detectar sua localização. 17 | O serviço de Localização está desativado. 18 | O serviço de Localização foi rejeitado pelo usuário. 19 | Não foi possível detectar sua localização. Tente novamente. 20 | 21 | -------------------------------------------------------------------------------- /src/android/res/values-pl/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Zamknij 4 | Proszę zastąpić \'GOOGLE_MAPS_ANDROID_API_KEY\' w pliku config.xml własnym kluczem API! 5 | Google Maps Android API v2 . 6 | Aplikacja posiada niepoprawną konfigurację. Tego błędu nie można odtworzyć i będzie on traktowany jako krytyczny. W celu uzyskania bardziej szczegółowych informacji programista powinien przejrzeć pliki z logami. 7 | Wystąpił błąd wewnątrz usług Google Play. Ponowne uruchomienie powinno rozwiązać problem. 8 | Próbę nawiązania połączenia z usługą nie powiodła się, z powodu nieprawidłowej nazwy konta. 9 | Aplikacja nie jest licencjonowana dla użytkownika. Tego błędu nie można odtworzyć i będzie on traktowany jako krytyczny. 10 | Wystąpił błąd połączenia internetowego. Proszę spróbować ponownie. 11 | Zainstalowana wersja usług Google Play została wyłączona na urządzeniu. Proszę włączyć usługi Google Play. 12 | Zainstalowana na urządzeniu wersja usług Google Play jest fałszywa. Proszę zaktualizować usługi Google Play ze sklepu Google Play. 13 | Nie odnaleziono zainstalowanej wersji usług Google Play. Proszę zainstalować usługi Google Play. 14 | Zainstalowana wersja usług Google Play jest przestarzała. Proszę zaktualizować usługi Google Play Services w sklepie Google Play. 15 | Próbowano połączyć się z usługami Google Play nie będąc zalogowanym. Proszę sprawdzić konfigurację usług Google Play. 16 | Na urządzeniu nie odnaleziono usług dostarczających położenie. Aplikacja nie będzie w stanie określić położenia. 17 | Usługi lokalizacji są wyłączone. 18 | Zgoda na usługi lokalizacji została odrzucona przez użytkownika. 19 | Nie można określić położenia. Spróbuj ponownie. 20 | 21 | -------------------------------------------------------------------------------- /src/android/res/values-da/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Luk 4 | Vær sød at ændre \'GOOGLE_MAPS_ANDROID_API_KEY\' i config.xml med din egen API-nøgle! 5 | Google Maps Android API v2 er, af en eller anden grund, ikke tilgængelig på denne enhed. 6 | Applikationen er fejlkonfigureret. Denne fejl er ikke genoprettelig og vil blive betragtet som fatal. Udvikleren bør kigge i logs efter dette for at finde mere handlingsrettet information. 7 | En intern fejl skete med Google Play Services. Vær sød at prøve igen, og så burde det løse problemet. 8 | Du prøvede at tilslutte til servicen med et invalidt kontonavn specificeret 9 | Applikationen er ikke licenseret til brugeren. Denne fejl er ikke genoprettelig og vil blive betragtet som fatal. 10 | Der skete en netværksfejl. Vær sød at prøve igen, og så burde det løse problemet. 11 | Den installeret version af Google Play Services er blevet has been deaktiveret på denne enhed. Vær sød at tænde for Google Play Services. 12 | Versionen for Google Play Services installeret på denne enhed er ikke autentisk. Vær sød at opdatere Google Play Services fra Google Play Store. 13 | Google Play services mangler på denne enhed. Vær sød at installere Google Play Services. 14 | Den installeret version af Google Play services er forældet. Vær sød at opdatere Google Play Services fra Google Play Store. 15 | Du prøvede at tilslutte til servicen, men du er ikke logget ind. Vær sød at tjekke Google Play Services konfigurationen 16 | Siden denne enhed ikke har en lokationsudbyder kan denne app ikke finde din lokation 17 | Lokationsservice er deaktiveret. 18 | Lokationsservice blev afvist af bruger. 19 | Kan ikke finde din lokation. Prøv igen. 20 | 21 | -------------------------------------------------------------------------------- /www/encoding.js: -------------------------------------------------------------------------------- 1 | var LatLng = require('./LatLng'); 2 | var common = require('./Common'); 3 | 4 | /***************************************************************************** 5 | * geometry Encode / decode points 6 | * http://jsfiddle.net/8nzg7tta/ 7 | *****************************************************************************/ 8 | //decode function 9 | function decodePath(encoded, precision) { 10 | precision = precision || 5; 11 | precision = Math.pow(10, -precision); 12 | var len = encoded.length, 13 | index = 0, 14 | lat = 0, 15 | lng = 0, 16 | array = []; 17 | while (index < len) { 18 | var b, shift = 0, 19 | result = 0; 20 | do { 21 | b = encoded.charCodeAt(index++) - 63; 22 | result |= (b & 0x1f) << shift; 23 | shift += 5; 24 | } while (b >= 0x20); 25 | var dlat = ((result & 1) ? ~(result >> 1) : (result >> 1)); 26 | lat += dlat; 27 | shift = 0; 28 | result = 0; 29 | do { 30 | b = encoded.charCodeAt(index++) - 63; 31 | result |= (b & 0x1f) << shift; 32 | shift += 5; 33 | } while (b >= 0x20); 34 | var dlng = ((result & 1) ? ~(result >> 1) : (result >> 1)); 35 | lng += dlng; 36 | array.push(new LatLng(lat * precision, lng * precision)); 37 | } 38 | return array; 39 | } 40 | 41 | //encode functions 42 | function encodePath(points) { 43 | var plat = 0; 44 | var plng = 0; 45 | var encoded_points = ''; 46 | 47 | points = common.convertToPositionArray(points); 48 | 49 | for (var i = 0; i < points.length; ++i) { 50 | encoded_points += encodePoint(plat, plng, points[i].lat, points[i].lng); 51 | plat = points[i].lat; 52 | plng = points[i].lng; 53 | } 54 | 55 | return encoded_points; 56 | } 57 | 58 | function encodePoint(plat, plng, lat, lng) { 59 | var late5 = Math.round(lat * 1e5); 60 | var plate5 = Math.round(plat * 1e5); 61 | 62 | var lnge5 = Math.round(lng * 1e5); 63 | var plnge5 = Math.round(plng * 1e5); 64 | 65 | var dlng = lnge5 - plnge5; 66 | var dlat = late5 - plate5; 67 | 68 | return encodeSignedNumber(dlat) + encodeSignedNumber(dlng); 69 | } 70 | 71 | function encodeSignedNumber(num) { 72 | var sgn_num = num << 1; 73 | 74 | if (num < 0) { 75 | sgn_num = ~(sgn_num); 76 | } 77 | 78 | return (encodeNumber(sgn_num)); 79 | } 80 | 81 | function encodeNumber(num) { 82 | var encodeString = ''; 83 | 84 | while (num >= 0x20) { 85 | encodeString += (String.fromCharCode((0x20 | (num & 0x1f)) + 63)); 86 | num >>= 5; 87 | } 88 | 89 | encodeString += (String.fromCharCode(num + 63)); 90 | return encodeString; 91 | } 92 | 93 | module.exports = { 94 | decodePath: decodePath, 95 | encodePath: encodePath 96 | }; 97 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 23 | 24 | **I'm submitting a ...** (check one with "x") 25 | - [ ] question 26 | - [ ] any problem or bug report 27 | - [ ] feature request 28 | 29 | **If you choose 'problem or bug report', please select OS:** (check one with "x") 30 | - [ ] **Android** 31 | - [ ] **iOS** 32 | 33 | **cordova information:** (run `$> cordova plugin list`) 34 | 35 | ``` 36 | insert the output from the command here 37 | ``` 38 | 39 | **If you use `@ionic-native/google-maps`, please tell the package.json (only `@ionic-native/core` and `@ionic-native/google-maps` are fine mostly)** 40 | 41 | **Current behavior:** 42 | 43 | 44 | **Expected behavior:** 45 | 46 | 47 | **Screen capture or video record:** 48 | 56 | 57 | **Related code, data or error log (please format your code or data):** 58 | 59 | ``` 60 | The person who share your project files on Github (or other git repository) is in faster lane than other people. 61 | Please share your project files on Github or others(Bitbucket, Gitlabs...etc). 62 | If you don't want to share your project files, please create a demo project, then share it. 63 | 64 | Screen captures, and/or native logs(such as Logcat, xcode logs) are appreciate. 65 | 66 | Giving much information, you are waiting time is less. 67 | Thank you for your cooperation. 68 | ``` 69 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginStreetViewPanoramaController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginStreetViewPanoramaController.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | #import "PluginUtil.h" 13 | #import "IPluginProtocol.h" 14 | #import "PluginObjects.h" 15 | #import "PluginViewController.h" 16 | #import 17 | 18 | @interface PluginStreetViewPanoramaController : PluginViewController 19 | 20 | @property (nonatomic) GMSPanoramaView* panoramaView; 21 | 22 | //---------------------------------------------------- 23 | // In order to keep the compatibility with Android, 24 | // some delegate methods are commented-out. 25 | //---------------------------------------------------- 26 | 27 | //// Called when starting a move to another panorama. 28 | //- (void)panoramaView:(GMSPanoramaView *)view willMoveToPanoramaID:(NSString *)panoramaID; 29 | 30 | //This is invoked every time the view.panorama property changes. 31 | - (void)panoramaView:(GMSPanoramaView *)view didMoveToPanorama:(nullable GMSPanorama *)panorama; 32 | 33 | // Called when the panorama change was caused by invoking moveToPanoramaNearCoordinate:. 34 | - (void)panoramaView:(GMSPanoramaView *)view didMoveToPanorama:(nonnull GMSPanorama *)panorama nearCoordinate:(CLLocationCoordinate2D)coordinate; 35 | 36 | // Called when moveNearCoordinate: produces an error. 37 | - (void)panoramaView:(GMSPanoramaView *)view error:(nonnull NSError *)error onMoveNearCoordinate:(CLLocationCoordinate2D)coordinate; 38 | 39 | // Called when moveToPanoramaID: produces an error. 40 | - (void)panoramaView:(GMSPanoramaView *)view error:(nonnull NSError *)error onMoveToPanoramaID:(nonnull NSString *)panoramaID; 41 | 42 | // Called repeatedly during changes to the camera on GMSPanoramaView. 43 | - (void)panoramaView:(GMSPanoramaView *)view didMoveCamera:(nonnull GMSPanoramaCamera *)camera; 44 | 45 | // Called when a user has tapped on the GMSPanoramaView, but this tap was not consumed (taps may be consumed by e.g., tapping on a navigation arrow). 46 | - (void)panoramaView:(GMSPanoramaView *)view didTap:(CGPoint)point; 47 | 48 | 49 | //// Called after a marker has been tapped. 50 | //- (void)panoramaView:(GMSPanoramaView *)view didTapMarker:(nonnull GMSMarker *)marker; 51 | // 52 | //// Called when the panorama tiles for the current view have just been requested and are beginning to load. 53 | //- (void)panoramaViewDidStartRendering:(GMSPanoramaView *)panoramaView; 54 | // 55 | //// Called when the panorama tiles have been loaded (or permanently failed to load) and rendered on screen. 56 | //- (void)panoramaViewDidFinishRendering:(GMSPanoramaView *)panoramaView; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /src/android/res/values-es/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Cerrar 4 | Por favor reemplace \'GOOGLE_MAPS_ANDROID_API_KEY\' en el archivo config.xml por su API Key! 5 | Por alguna razón Google Maps Android API v2 no está disponible en este dispositivo. 6 | La aplicación no está configurada correctamente. Ya que no es posible recuperarse de este error, será tratado como fatal. El desarrollador debe revisar los registros para determinar si existe alguna acción por realizar. 7 | Ocurrió un error interno en Google Play Services. Por favor inténtalo de nuevo, y el problema debería resolverse. 8 | Intentaste conectarte al servicio especificando un nombre de cuenta invalido. 9 | La aplicación no tiene licencia para el usuario. Ya que no es posible recuperarse de este error, será tratado como fatal. 10 | Ocurrió un error de red. Por favor inténtalo de nuevo, y el problema debería resolverse. 11 | La versión instalada de Google Play Services ha sido deshabilitada en este dispositivo. Por favor encienda Google Play Services. 12 | La versión instalada de Google Play Services no es autentica. Por favor actualice Google Play Services desde Google Play Store. 13 | No se encontró Google Play Services en el dispositivo. Por favor instale Google Play Services. 14 | La versión instalada de Google Play services está desactualizada. Por favor actualice Google Play Services desde Google Play Store. 15 | Intentaste conectarte a los servicios pero no has iniciado sesión. Por favor revisa la configuración de Google Play Services 16 | En vista de que este dispositivo no tiene ningún proveedor de localización, la aplicación no puede detectar tu ubicación. 17 | Servicio de localización desactivado. 18 | El servicio de localización fue rechazado por el usuario. 19 | No se pudo detectar tu ubicación. Inténtalo de nuevo. 20 | 21 | -------------------------------------------------------------------------------- /src/android/res/values-de/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Schließen 4 | Bitte ersetzen Sie \'GOOGLE_MAPS_ANDROID_API_KEY\' unter config.xml durch Ihren API Key! 5 | Google Maps Android API v2 ist auf diesem Gerät aus einem unbekannten Grund nicht verfügbar. 6 | Die Anwendung ist falsch konfiguriert und kann nicht fortgefahren werden. Der Entwickler muss die Protokolle inspezieren, um weitere Informationen zu erhalten. 7 | Ein interner Fehler der Google Play-Dienste ist aufgetreten. Bitte versuchen Sie es erneut. 8 | Sie haben versucht, eine Verbindung zum Dienst mit einem ungültigen Kontonamen herzustellen. 9 | Die Anwendung ist für den Benutzer nicht lizenziert. Dieser Fehler ist nicht wiederherstellbar und wird als fatal behandelt. 10 | Ein Netzwerkfehler ist aufgetreten. Bitte stellen Sie eine Internetverbindung her und versuchen Sie es erneut. 11 | Die installierte Version der Google Play-Dienste wurde auf diesem Gerät deaktiviert. Bitte schalten Sie die Google Play-Dienste ein. 12 | Die Version der auf diesem Gerät installierten Google Play-Dienste konnte nicht authentifiziert werden. Bitte Aktualisieren Sie die Google Play-Dienste im Google Play Store. 13 | Google Play-Dienste fehlen auf diesem Gerät. Bitte installieren Sie die Google Play-Dienste über den Play Store. 14 | 15 | Die installierte Version der Google Play-Dienste ist veraltet. Aktualisieren Sie die Google Play-Dienste im Google Play Store. 16 | Sie haben versucht, eine Verbindung mit dem Dienst herzustellen, aber Sie sind nicht angemeldet. Überprüfen Sie die Konfiguration der Google Play-Dienste 17 | Da dieses Gerät keinen Standortanbieter hat, kann diese App Ihren Standort nicht orten. 18 | Der Standortdienst ist deaktiviert. 19 | Der Standortdienst wird vom Benutzer abgelehnt. 20 | Sie konnten nicht lokalisiert werden. Versuchen Sie es bitte erneut. 21 | 22 | -------------------------------------------------------------------------------- /src/android/res/values-fr/pgm_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Fermer 4 | Veuillez remplacer \"GOOGLE_MAPS_ANDROID_API_KEY\" dans le fichier config.xml avec votre propre clé API! 5 | Google Maps Android API v2 n\'est pas disponible sur cet appareil pour une raison non identifiée. 6 | L\'application a mal été configurée. Cette erreur n\'est pas récupérable et sera traitée comme étant fatale. Le développeur devrait inspecter le journal d\'erreur afin de trouver des informations plus précises. 7 | Une erreur interne est intervenue au niveau du Google Play Services. Veuillez réessayer, cela devrait résoudre le problème. 8 | Vous avez tenté de vous connecter au service avec un nom de compte invalide. 9 | L\'application ne contient pas de licence pour cet utilisateur. Cette erreur n\'est pas récupérable et sera traitée comme étant fatale. 10 | Un problème de réseau est intervenu. Veuillez réessayer, cela devrait résoudre le problème. 11 | La version du Google Play Services installée sur cet appareil a été désactivée. Veuillez activer le Google Play Services. 12 | La version du Google Play Services installée sur cet appareil n\'est pas authentique. Merci de mettre à jour le Google Play Services à partir du Google Play Store. 13 | Google Play Services n\'est pas installé sur cet appareil. Merci d\'installer le Google Play Services. 14 | La version du Google Play Services installée sur cet appareil a expirée. Veuillez mettre à jour le Google Play Services à partir du Google Play Store. 15 | Vous avez tenté de vous connecter au service, mais vous n\'est pas authentifié. Merci de vérifier la configuration du Google Play Services. 16 | Cet appareil n\'est pas équipé d\'un service de localisation, cette application ne peut donc pas récupérer votre position. 17 | Le service de localisation est désactivé. 18 | Le service de localisation est rejeté par l\'utilisateur. 19 | Localisation introuvable. Veuillez réessayer. 20 | 21 | -------------------------------------------------------------------------------- /www/__test__/__snapshots__/Geocoder.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Geocode geocode() multiple request address1 should call the native plugin with the correct parameters 1`] = ` 4 | Array [ 5 | Array [ 6 | [Function], 7 | [Function], 8 | "PluginGeocoder", 9 | "geocode", 10 | Array [ 11 | Object { 12 | "address": "Tokyo, Japan", 13 | "idx": 0, 14 | }, 15 | ], 16 | ], 17 | Array [ 18 | [Function], 19 | [Function], 20 | "PluginGeocoder", 21 | "geocode", 22 | Array [ 23 | Object { 24 | "address": "Kyoto, Japan", 25 | "idx": 1, 26 | }, 27 | ], 28 | ], 29 | ] 30 | `; 31 | 32 | exports[`Geocode geocode() multiple request position should call the native plugin with the correct parameters 1`] = ` 33 | Array [ 34 | Array [ 35 | [Function], 36 | [Function], 37 | "PluginGeocoder", 38 | "geocode", 39 | Array [ 40 | Object { 41 | "idx": 0, 42 | "position": Object { 43 | "lat": 0, 44 | "lng": 0, 45 | }, 46 | }, 47 | ], 48 | ], 49 | Array [ 50 | [Function], 51 | [Function], 52 | "PluginGeocoder", 53 | "geocode", 54 | Array [ 55 | Object { 56 | "idx": 1, 57 | "position": Object { 58 | "lat": 1, 59 | "lng": 1, 60 | }, 61 | }, 62 | ], 63 | ], 64 | ] 65 | `; 66 | 67 | exports[`Geocode geocode() should call the if both position and address options are provided 1`] = `[Error: Invalid request]`; 68 | 69 | exports[`Geocode geocode() should error if both position and address options are provided 1`] = `[Error: Invalid request]`; 70 | 71 | exports[`Geocode geocode() should return a promise if a callback is not passed 1`] = `Promise {}`; 72 | 73 | exports[`Geocode geocode() should return a promise if a callback is not passed 2`] = ` 74 | Array [ 75 | Object { 76 | "foo": "bar", 77 | }, 78 | ] 79 | `; 80 | 81 | exports[`Geocode geocode() single request address should call the native plugin with the correct parameters 1`] = ` 82 | Array [ 83 | Array [ 84 | [Function], 85 | [Function], 86 | "PluginGeocoder", 87 | "geocode", 88 | Array [ 89 | Object { 90 | "address": "Tokyo, Japan", 91 | "idx": -1, 92 | }, 93 | ], 94 | ], 95 | ] 96 | `; 97 | 98 | exports[`Geocode geocode() single request position should call the native plugin with the correct parameters 1`] = ` 99 | Array [ 100 | Array [ 101 | [Function], 102 | [Function], 103 | "PluginGeocoder", 104 | "geocode", 105 | Array [ 106 | Object { 107 | "idx": -1, 108 | "position": Object { 109 | "lat": 0, 110 | "lng": 0, 111 | }, 112 | }, 113 | ], 114 | ], 115 | ] 116 | `; 117 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | env: 4 | global: 5 | - NODE_VERSION="10.12.0" 6 | - ANDROID_API="28" 7 | - ANDROID_BUILD_TOOLS="28.0.3" 8 | - CORDOVA_VERSION="9.0.0" 9 | 10 | notifications: 11 | email: false 12 | 13 | before_cache: 14 | # Do not cache a few Gradle files/directories (see https://docs.travis-ci.com/user/languages/java/#Caching) 15 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock 16 | - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ 17 | 18 | cache: 19 | directories: 20 | 21 | # Gradle dependencies 22 | - $HOME/.gradle/caches/ 23 | - $HOME/.gradle/wrapper/ 24 | 25 | # Android directory 26 | - $HOME/.android 27 | 28 | # NVM 29 | - $HOME/.nvm 30 | 31 | matrix: 32 | include: 33 | - os: linux 34 | env: CORDOVA_PLATFORM="browser" 35 | language: node_js 36 | node_js: '${NODE_VERSION}' 37 | 38 | - if: branch = master 39 | os: osx 40 | env: CORDOVA_PLATFORM="ios" 41 | language: objective-c 42 | cache: 43 | - bundler 44 | - cocoapods 45 | node_js: '${NODE_VERSION}' 46 | osx_image: xcode9.4 47 | before_script: 48 | - exist=$(which ios-deploy); if [[ -z "${exist}" ]]; then 49 | npm -g install ios-deploy > /dev/null; 50 | fi 51 | 52 | - if: branch = master 53 | env: CORDOVA_PLATFORM="android" 54 | os: linux 55 | node_js: '${NODE_VERSION}' 56 | language: android 57 | jdk: oraclejdk8 58 | android: 59 | components: 60 | - tools 61 | - android-${ANDROID_API} 62 | - platform-tools 63 | # The BuildTools version used by your project 64 | - build-tools-${ANDROID_BUILD_TOOLS} 65 | # The SDK version used to compile your project 66 | - android-${ANDROID_API} 67 | # Additional components 68 | - extra-android-m2repository 69 | - extra-google-m2repository 70 | - sys-img-x86-android-${ANDROID_API} 71 | licenses: 72 | - 'android-sdk-license-.+' 73 | - '.+' 74 | 75 | install: 76 | 77 | - exist=$(which nvm); if [[ -z "${exist}" ]]; then 78 | rm -rf ~/.nvm > /dev/null; 79 | git clone https://github.com/creationix/nvm.git ~/.nvm > /dev/null; 80 | (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags` > /dev/null); 81 | source ~/.nvm/nvm.sh && nvm > /dev/null; 82 | fi 83 | - exist=$(nvm list | grep ${NODE_VERSION}); if [[ -z "${exist}" ]]; then 84 | nvm install ${NODE_VERSION} > /dev/null; 85 | fi 86 | - nvm use ${NODE_VERSION} > /dev/null; 87 | - node --version 88 | - exist=$(which cordova); if [[ -z "${exist}" ]]; then 89 | npm -g install cordova@${CORDOVA_VERSION} > /dev/null; 90 | fi 91 | - cordova --version 92 | - exist=$(which cordova-paramedic); if [[ -z "${exist}" ]]; then 93 | npm -g install https://github.com/apache/cordova-paramedic; 94 | fi 95 | - npm i > /dev/null 96 | 97 | script: 98 | - /bin/bash build_test.sh 99 | -------------------------------------------------------------------------------- /www/poly.js: -------------------------------------------------------------------------------- 1 | var LatLngBounds = require('./LatLngBounds'), 2 | BaseArrayClass = require('./BaseArrayClass'); 3 | 4 | function containsLocation(latLng, path) { 5 | if ('lat' in latLng === false || 6 | 'lng' in latLng === false) { 7 | return false; 8 | } 9 | if (path instanceof BaseArrayClass) { 10 | path = path.getArray(); 11 | } 12 | var points = JSON.parse(JSON.stringify(path)); 13 | 14 | var first = points[0], 15 | last = points[points.length - 1]; 16 | if (first.lat !== last.lat || first.lng !== last.lng) { 17 | points.push({ 18 | lat: first.lat, 19 | lng: first.lng 20 | }); 21 | } 22 | var point = { 23 | lat: latLng.lat, 24 | lng: latLng.lng 25 | }; 26 | 27 | var wn = 0, 28 | bounds = new LatLngBounds(points), 29 | sw = bounds.southwest, 30 | ne = bounds.northeast, 31 | offsetLng360 = sw.lng <= 0 && ne.lng >= 0 && sw.lng < ne.lng ? 360 : 0; 32 | 33 | sw.lng += offsetLng360; 34 | point.lng += offsetLng360; 35 | 36 | points = points.map(function(vertex) { 37 | vertex.lng += +offsetLng360; 38 | return vertex; 39 | }); 40 | 41 | var vt, a, b; 42 | 43 | for (var i = 0; i < points.length - 1; i++) { 44 | a = points[i]; 45 | b = points[i + 1]; 46 | 47 | if ((a.lat <= point.lat) && (b.lat > point.lat)) { 48 | vt = (point.lat - a.lat) / (b.lat - a.lat); 49 | if (point.lng < (a.lng + (vt * (b.lng - a.lng)))) { 50 | wn++; 51 | } 52 | } else if ((a.lat > point.lat) && (b.lat <= point.lat)) { 53 | vt = (point.lat - a.lat) / (b.lat - a.lat); 54 | if (point.lng < (a.lng + (vt * (b.lng - a.lng)))) { 55 | wn--; 56 | } 57 | } 58 | } 59 | 60 | return (wn !== 0); 61 | } 62 | 63 | function isLocationOnEdge(latLng, path) { 64 | if ('lat' in latLng === false || 65 | 'lng' in latLng === false) { 66 | return false; 67 | } 68 | 69 | var Sx, Sy; 70 | var p0, p1; 71 | var point = {'lat': latLng.lat, 'lng': latLng.lng}; 72 | 73 | if (path instanceof BaseArrayClass) { 74 | path = path.getArray(); 75 | } 76 | var points = JSON.parse(JSON.stringify(path)); 77 | 78 | var bounds = new LatLngBounds(points), 79 | sw = bounds.southwest, 80 | ne = bounds.northeast, 81 | offsetLng360 = sw.lng <= 0 && ne.lng >= 0 && sw.lng < ne.lng ? 360 : 0; 82 | 83 | point.lng += offsetLng360; 84 | 85 | points = points.map(function(vertex) { 86 | vertex.lng += offsetLng360; 87 | return vertex; 88 | }); 89 | 90 | p0 = points[0]; 91 | for (var i = 1; i < points.length; i++) { 92 | p1 = points[i]; 93 | Sx = (point.lng - p0.lng) / (p1.lng - p0.lng); 94 | Sy = (point.lat - p0.lat) / (p1.lat - p0.lat); 95 | if (Math.abs(Sx - Sy) < 0.05 && Sx < 1 && Sx > 0) { 96 | return true; 97 | } 98 | p0 = p1; 99 | } 100 | return false; 101 | } 102 | 103 | module.exports = { 104 | containsLocation: containsLocation, 105 | isLocationOnEdge: isLocationOnEdge 106 | }; 107 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question-or-bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question or bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | 29 | 30 | **I'm submitting a ...** (check one with "x") 31 | - [ ] question 32 | - [ ] any problem or bug report 33 | 34 | **OS:** (check one with "x") 35 | - [ ] **Android** 36 | - [ ] **iOS** 37 | - [ ] **Browser** 38 | 39 | **cordova information:** (run `$> cordova plugin list`) 40 | 41 | ``` 42 | insert the output from the command here 43 | ``` 44 | 45 | **If you use `@ionic-native/google-maps`, please tell the package.json (only `@ionic-native/core` and `@ionic-native/google-maps` are fine mostly)** 46 | ``` 47 | @ionic-native/core : 48 | @ionic-native/google-maps : 49 | ``` 50 | 51 | **Current behavior:** 52 | 53 | 54 | **Expected behavior:** 55 | 56 | 57 | **Screen capture or video record:** 58 | 67 | 68 | **Related code, data or error log (please format your code or data):** 69 | 70 | ``` 71 | Please share your project files on Github or others(Bitbucket, Gitlabs...etc). 72 | If you don't want to share your project files, please create a demo project, then share it. 73 | 74 | Screen captures, and/or native logs(such as Logcat, xcode logs) are appreciate. 75 | 76 | Giving much information, you are waiting time is less. 77 | Thank you for your cooperation. 78 | ``` 79 | 80 | **Support this plugin activity** 81 | 82 | I appreicate if you give me a beer :beer: from [here]( 83 | https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=SQPLZJ672HJ9N&lc=US&item_name=Cordova%2dGoogleMaps%2dPlugin&amount=5%2e00¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) 84 | -------------------------------------------------------------------------------- /www/Cluster.js: -------------------------------------------------------------------------------- 1 | var LatLngBounds = require('./LatLngBounds'); 2 | 3 | /***************************************************************************** 4 | * Cluster Class 5 | *****************************************************************************/ 6 | var Cluster = function(__pgmId, geocell) { 7 | var obj = {}; 8 | 9 | var self = this; 10 | Object.defineProperty(self, '__pgmId', { 11 | value: __pgmId, 12 | writable: false 13 | }); 14 | Object.defineProperty(self, 'geocell', { 15 | value: geocell, 16 | writable: false 17 | }); 18 | 19 | Object.defineProperty(self, 'type', { 20 | value: 'Cluster', 21 | writable: false 22 | }); 23 | Object.defineProperty(self, '_markerArray', { 24 | value: [], 25 | writable: false 26 | }); 27 | 28 | 29 | Object.defineProperty(self, 'set', { 30 | value: function(key, value) { 31 | obj[key] = value; 32 | }, 33 | writable: false 34 | }); 35 | 36 | Object.defineProperty(self, 'get', { 37 | value: function(key) { 38 | return obj[key]; 39 | }, 40 | writable: false 41 | }); 42 | }; 43 | 44 | Cluster.prototype.NO_CLUSTER_MODE = 1; 45 | Cluster.prototype.CLUSTER_MODE = 2; 46 | 47 | Cluster.prototype.getPluginName = function() { 48 | return this.map.getId() + '-cluster'; 49 | }; 50 | Cluster.prototype.getBounds = function() { 51 | return this.get('bounds'); 52 | }; 53 | /* 54 | Cluster.prototype.getBounds = function() { 55 | var bounds = this.get('bounds'); 56 | if (!bounds) { 57 | bounds = geomodel.computeBox(this.geocell); 58 | this.set('bounds', bounds); 59 | } 60 | return bounds; 61 | }; 62 | */ 63 | Cluster.prototype.getCenter = function() { 64 | return this.getBounds().getCenter(); 65 | }; 66 | 67 | Cluster.prototype.getMarkers = function() { 68 | return this._markerArray; 69 | }; 70 | 71 | Cluster.prototype.addMarkers = function(markerRefs) { 72 | var self = this; 73 | var bounds = this.get('bounds') || new LatLngBounds(markerRefs[0].get('position'), markerRefs[0].get('position')); 74 | 75 | markerRefs.forEach(function(marker) { 76 | if (self._markerArray.indexOf(marker) === -1) { 77 | marker.get('_cluster').isAdded = true; 78 | self._markerArray.push(marker); 79 | bounds.extend(marker.get('position')); 80 | } 81 | }); 82 | 83 | this.set('bounds', bounds); 84 | }; 85 | Cluster.prototype.getId = function() { 86 | return this.__pgmId; 87 | }; 88 | Cluster.prototype.setMode = function(mode) { 89 | this.set('mode', mode); 90 | }; 91 | Cluster.prototype.getMode = function() { 92 | return this.get('mode'); 93 | }; 94 | Cluster.prototype.removeMarker = function(marker) { 95 | 96 | var idx = this._markerArray.indexOf(marker); 97 | if (idx !== -1) { 98 | this._markerArray.splice(idx, 1); 99 | } 100 | }; 101 | 102 | Cluster.prototype.remove = function() { 103 | this.set('isRemoved', true); 104 | this._markerArray.forEach(function(marker) { 105 | marker.get('_cluster').isAdded = false; 106 | }); 107 | }; 108 | Cluster.prototype.getItemLength = function() { 109 | return this._markerArray.length; 110 | }; 111 | 112 | module.exports = Cluster; 113 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginUtil.h: -------------------------------------------------------------------------------- 1 | // 2 | // PluginUtil.h 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #ifndef MIN 10 | #import 11 | #endif 12 | #import 13 | #import 14 | #import "MainViewController.h" 15 | #import 16 | #import 17 | //#import "MFGoogleMapAdditions/GMSCoordinateBounds+Geometry.h" 18 | #import "GMSCoordinateBounds+Geometry.h" 19 | #import 20 | #import "IPluginProtocol.h" 21 | #import "PluginViewController.h" 22 | #import 23 | #import 24 | 25 | typedef void (^MYCompletionHandler)(NSError *error); 26 | 27 | // Switch statement in Objective-C 28 | //http://qiita.com/GeneralD/items/5a05f176ac2321e7a51b 29 | #define CASE(str) if ([__s__ isEqualToString:(str)]) 30 | #define SWITCH(s) for (NSString *__s__ = (s); __s__; __s__ = nil) 31 | #define DEFAULT 32 | 33 | @interface UIView (GoogleMapsPlugin) 34 | - (void)setFrameWithDictionary:(NSDictionary *) params; 35 | - (void)setFrameWithInt:(int)left top:(int)top width:(int)width height:(int)height; 36 | @end 37 | 38 | @interface NSArray (GoogleMapsPlugin) 39 | - (UIColor*)parsePluginColor; 40 | @end 41 | 42 | @interface NSString (GoogleMapsPlugin) 43 | - (NSString*)regReplace:(NSString*)pattern replaceTxt:(NSString*)replaceTxt options:(NSRegularExpressionOptions)options; 44 | @end 45 | 46 | 47 | @interface UIImage (GoogleMapsPlugin) 48 | - (UIImage*)imageByApplyingAlpha:(CGFloat) alpha; 49 | - (UIImage *)resize:(CGFloat)width height:(CGFloat)height; 50 | @end 51 | 52 | @interface CDVCommandDelegateImpl (GoogleMapsPlugin) 53 | - (void)hookSendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId; 54 | @end 55 | 56 | // 57 | // animationDidStop for group animation 58 | // http://stackoverflow.com/a/28051909/697856 59 | // 60 | typedef void (^TIFAnimationGroupCompletionBlock)(); 61 | @interface CAAnimationGroup (Blocks) 62 | - (void)setCompletionBlock:(TIFAnimationGroupCompletionBlock)handler; 63 | @end 64 | 65 | 66 | @interface PluginUtil : NSObject 67 | + (BOOL)isPolygonContains:(GMSPath *)path coordinate:(CLLocationCoordinate2D)coordinate projection:(GMSProjection *)projection; 68 | + (CLLocationCoordinate2D)isPointOnTheLine:(GMSPath *)path coordinate:(CLLocationCoordinate2D)coordinate projection:(GMSProjection *)projection; 69 | + (CLLocationCoordinate2D)isPointOnTheGeodesicLine:(GMSPath *)path coordinate:(CLLocationCoordinate2D)coordinate threshold:(double)threshold projection:(GMSProjection *)projection; 70 | + (BOOL)isCircleContains:(GMSCircle *)circle coordinate:(CLLocationCoordinate2D)point; 71 | + (BOOL)isInDebugMode; 72 | + (GMSMutablePath *)getMutablePathFromCircle:(CLLocationCoordinate2D)center radius:(double)radius; 73 | + (NSString *)getAbsolutePathFromCDVFilePath:(UIView*)theWebView cdvFilePath:(NSString *)cdvFilePath; 74 | + (NSString *)PGM_LOCALIZATION:(NSString *)key; 75 | @end 76 | 77 | 78 | 79 | @implementation UIGestureRecognizer (Cancel) 80 | - (void)cancel { 81 | self.enabled = NO; 82 | self.enabled = YES; 83 | } 84 | @end 85 | 86 | 87 | 88 | @interface CDVPlugin (GoogleMapsPlugin) 89 | - (void)setPluginViewController: (PluginViewController*)viewCtrl; 90 | @end 91 | -------------------------------------------------------------------------------- /www/__test__/Geocoder.spec.js: -------------------------------------------------------------------------------- 1 | // jshint esversion: 6 2 | const Geocoder = require('../Geocoder'); 3 | 4 | describe('Geocode', () => { 5 | // Initialize them here so that vscode typing 6 | // will work without this being a TS project 7 | let geocoder = new Geocoder(); 8 | let execSpy = jest.fn(); 9 | 10 | beforeEach(() => { 11 | execSpy = jest.fn(); 12 | geocoder = new Geocoder(execSpy); 13 | }); 14 | 15 | it('should exist', () => { 16 | expect(geocoder).toBeDefined(); 17 | }); 18 | 19 | describe('geocode()', () => { 20 | it('should exist', () => { 21 | expect(geocoder.geocode).toBeDefined(); 22 | }); 23 | 24 | it('should return a promise if a callback is not passed', async () => { 25 | const request = { 26 | address: '', 27 | }; 28 | const mockResults = [ 29 | { 30 | foo: 'bar', 31 | }, 32 | ]; 33 | execSpy.mockImplementation(resolve => { 34 | resolve({ 35 | results: mockResults, 36 | }); 37 | }); 38 | 39 | const results = geocoder.geocode(request); 40 | expect(results).toMatchSnapshot(); 41 | await expect(results).resolves.toMatchSnapshot(); 42 | }); 43 | 44 | it('should error if both position and address options are provided', async () => { 45 | const request = { 46 | position: [], 47 | address: [], 48 | }; 49 | 50 | await expect(geocoder.geocode(request)).rejects.toMatchSnapshot(); 51 | }); 52 | 53 | it('should call the if both position and address options are provided', () => { 54 | const request = { 55 | position: [], 56 | address: [], 57 | }; 58 | 59 | expect(geocoder.geocode(request)).rejects.toMatchSnapshot(); 60 | }); 61 | 62 | describe('single request', () => { 63 | describe('position', () => { 64 | it('should call the native plugin with the correct parameters', () => { 65 | geocoder.geocode({ 66 | position: { 67 | lat: 0, 68 | lng: 0, 69 | }, 70 | }); 71 | expect(execSpy.mock.calls).toMatchSnapshot(); 72 | }); 73 | }); 74 | 75 | describe('address', () => { 76 | it('should call the native plugin with the correct parameters', () => { 77 | geocoder.geocode({ 78 | address: 'Tokyo, Japan', 79 | }); 80 | expect(execSpy.mock.calls).toMatchSnapshot(); 81 | }); 82 | }); 83 | }); 84 | 85 | 86 | 87 | describe('multiple request', () => { 88 | describe('position', () => { 89 | it('should call the native plugin with the correct parameters', () => { 90 | geocoder.geocode({ 91 | position: [ 92 | { 93 | lat: 0, 94 | lng: 0, 95 | }, 96 | { 97 | lat: 1, 98 | lng: 1, 99 | }, 100 | ] 101 | }); 102 | expect(execSpy.mock.calls).toMatchSnapshot(); 103 | }); 104 | }); 105 | 106 | describe('address1', () => { 107 | it('should call the native plugin with the correct parameters', () => { 108 | geocoder.geocode({ 109 | address: [ 110 | 'Tokyo, Japan', 111 | 'Kyoto, Japan', 112 | ] 113 | }); 114 | expect(execSpy.mock.calls).toMatchSnapshot(); 115 | }); 116 | }); 117 | }); 118 | 119 | }); 120 | }); 121 | -------------------------------------------------------------------------------- /www/Overlay.js: -------------------------------------------------------------------------------- 1 | 2 | var BaseClass = require('./BaseClass'), 3 | utils = require('cordova/utils'), 4 | BaseArrayClass = require('./BaseArrayClass'); 5 | 6 | /***************************************************************************** 7 | * Overlay Class 8 | *****************************************************************************/ 9 | var Overlay = function (map, options, className, _exec, extras) { 10 | extras = extras || {}; 11 | BaseClass.apply(this); 12 | 13 | var self = this; 14 | 15 | //----------------------------------------------- 16 | // Sets the initialize option to each property 17 | //----------------------------------------------- 18 | var ignores = ['map', '__pgmId', 'hashCode', 'type']; 19 | if (extras.ignores) { 20 | ignores = ignores.concat(extras.ignores); 21 | } 22 | for (var key in options) { 23 | if (ignores.indexOf(key) === -1) { 24 | self.set(key, options[key]); 25 | } 26 | } 27 | 28 | //------------------------------------------------------------------------------- 29 | // If app code wants to execute some method before `_isReady = true`, 30 | // just stack in to the internal queue. 31 | // If this overlay is ready, execute it. 32 | //------------------------------------------------------------------------------- 33 | var cmdQueue = new BaseArrayClass(); 34 | cmdQueue.on('insert_at', function () { 35 | if (!self._isReady) { 36 | return; 37 | } 38 | var cmd; 39 | while (cmdQueue.getLength() > 0) { 40 | cmd = cmdQueue.removeAt(0, true); 41 | if (cmd && cmd.target && cmd.args && cmd.args[0] !== 'nop') { 42 | _exec.apply(cmd.target, cmd.args); 43 | } 44 | } 45 | }); 46 | 47 | Object.defineProperty(self, '_cmdQueue', { 48 | enumerable: false, 49 | value: cmdQueue, 50 | writable: false 51 | }); 52 | 53 | Object.defineProperty(self, '_isReady', { 54 | value: false, 55 | writable: true 56 | }); 57 | Object.defineProperty(self, 'map', { 58 | value: map, 59 | writable: false 60 | }); 61 | Object.defineProperty(self, '__pgmId', { 62 | value: extras.__pgmId || (className.toLowerCase()) + '_' + this.hashCode, 63 | writable: false 64 | }); 65 | Object.defineProperty(self, 'type', { 66 | value: className, 67 | writable: false 68 | }); 69 | 70 | Object.defineProperty(self, 'getPluginName', { 71 | writable: false, 72 | value: function () { 73 | return this.map.getId() + '-' + className.toLowerCase(); 74 | } 75 | }); 76 | }; 77 | 78 | utils.extend(Overlay, BaseClass); 79 | 80 | Overlay.prototype._privateInitialize = function (options) { 81 | var self = this; 82 | //----------------------------------------------- 83 | // Sets the initialize option to each property 84 | //----------------------------------------------- 85 | if (options) { 86 | var ignores = ['map', '__pgmId', 'hashCode', 'type']; 87 | for (var key in options) { 88 | if (ignores.indexOf(key) === -1) { 89 | self.set(key, options[key], true); 90 | } 91 | } 92 | } 93 | 94 | //----------------------------------------------- 95 | // Trigger internal command queue 96 | //----------------------------------------------- 97 | Object.defineProperty(self, '_isReady', { 98 | value: true, 99 | writable: false 100 | }); 101 | self.exec('nop'); 102 | }; 103 | 104 | Overlay.prototype.exec = function () { 105 | this._cmdQueue.push.call(this._cmdQueue, { 106 | target: this, 107 | args: Array.prototype.slice.call(arguments, 0) 108 | }); 109 | }; 110 | Overlay.prototype.getId = function () { 111 | return this.__pgmId; 112 | }; 113 | Overlay.prototype.getMap = function () { 114 | return this.map; 115 | }; 116 | Overlay.prototype.getHashCode = function () { 117 | return this.hashCode; 118 | }; 119 | 120 | module.exports = Overlay; 121 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/GMSCoordinateBounds+Geometry.m: -------------------------------------------------------------------------------- 1 | // 2 | // GMSCoordinateBounds+Geometry.m 3 | // 4 | // Created by Marius Feldmann on 8/12/14. 5 | // Copyright (c) 2014 Marius Feldmann. All rights reserved. 6 | // 7 | 8 | #import "GMSCoordinateBounds+Geometry.h" 9 | 10 | #define RADIANS_TO_DEGREES(radians) ((radians) * (180.0 / M_PI)) 11 | 12 | @implementation GMSCoordinateBounds (MFAdditions) 13 | 14 | - (CLLocationCoordinate2D)southEast { 15 | CLLocationDegrees southEastLat = self.southWest.latitude; 16 | CLLocationDegrees southEastLng = self.northEast.longitude; 17 | CLLocationCoordinate2D southEast = CLLocationCoordinate2DMake(southEastLat, southEastLng); 18 | 19 | return southEast; 20 | } 21 | 22 | 23 | - (CLLocationCoordinate2D)northWest { 24 | CLLocationDegrees northWestLat = self.northEast.latitude; 25 | CLLocationDegrees northWestLng = self.southWest.longitude; 26 | CLLocationCoordinate2D northWest = CLLocationCoordinate2DMake(northWestLat, northWestLng); 27 | 28 | return northWest; 29 | } 30 | 31 | 32 | - (CLLocationCoordinate2D)center { 33 | double fraction = 0.5; 34 | CLLocationCoordinate2D center = GMSGeometryInterpolate(self.northEast, self.southWest, fraction); 35 | 36 | return center; 37 | } 38 | 39 | 40 | - (GMSPath *)path { 41 | GMSMutablePath *path = [[GMSMutablePath alloc] init]; 42 | [path addCoordinate:self.northWest]; 43 | [path addCoordinate:self.northEast]; 44 | [path addCoordinate:self.southEast]; 45 | [path addCoordinate:self.southWest]; 46 | 47 | return path; 48 | } 49 | 50 | 51 | - (NSArray *)divideIntoNumberOfBoxes:(NSInteger)numberOfBoxes { 52 | NSMutableArray *rectArray = [[NSMutableArray alloc] init]; 53 | 54 | NSInteger columns = ceil(sqrt(numberOfBoxes)); 55 | NSInteger fullRows = numberOfBoxes / columns; 56 | NSInteger orphans = numberOfBoxes % columns; 57 | 58 | double width = GMSGeometryDistance(self.northWest, self.northEast); 59 | double boxWidth = width / columns; 60 | 61 | double height = GMSGeometryDistance(self.northEast, self.southEast); 62 | double boxHeight = height / (orphans == 0 ? fullRows : (fullRows+1)); 63 | 64 | for (int y=0; y 0) { 88 | NSInteger orphanWidth = width / orphans; 89 | 90 | for (int x=0; x 0) { 88 | NSInteger orphanWidth = width / orphans; 89 | 90 | for (int x=0; x nodes 18 | def configXmlFile = searchFileInParents("config.xml") 19 | 20 | if (configXmlFile == null) { 21 | // #2. Find (project)/app/src/main/res/xml/config.xml file, 22 | // cordova should copy to this file 23 | configXmlFile = searchFileInParents("app/src/main/res/xml/config.xml") 24 | } 25 | 26 | if (configXmlFile == null) { 27 | throw new GradleException("Can not find config.xml file.") 28 | } 29 | 30 | // parse xml file 31 | def widget = new XmlParser().parse(configXmlFile) 32 | if (widget.preference == null) { 33 | throw new GradleException("widget is null.") 34 | } 35 | if (widget.preference.size() == 0) { 36 | throw new GradleException("Please add '' to the config.xml file.") 37 | } 38 | println("preference = " + widget.preference.size()) 39 | Properties props = new Properties() 40 | def isKeyFound = 0 41 | def useBetaSdk = 0 42 | props.setProperty("GOOGLE_MAPS_PLAY_SERVICES_VERSION", "16.0.0"); 43 | props.setProperty("ANDROID_SUPPORT_V4_VERSION", "27.1.1"); 44 | props.setProperty("GOOGLE_MAPS_ANDROID_SDK", ""); 45 | 46 | widget.preference.each { pref -> 47 | def name = pref.attributes().name 48 | def value = pref.attributes().value 49 | println("name = " + name); 50 | if (name == "GOOGLE_MAPS_ANDROID_API_KEY") { 51 | isKeyFound = 1 52 | props.setProperty(name, value) 53 | } 54 | if (name == "GOOGLE_MAPS_PLAY_SERVICES_VERSION" || 55 | name == "ANDROID_SUPPORT_V4_VERSION") { 56 | props.setProperty(name, value) 57 | } 58 | if (name == "GOOGLE_MAPS_ANDROID_SDK") { 59 | useBetaSdk = 1 60 | props.setProperty("GOOGLE_MAPS_ANDROID_SDK", value) 61 | } 62 | } 63 | 64 | 65 | if (isKeyFound == 0) { 66 | throw new GradleException("Please add '' to the config.xml file.") 67 | } 68 | 69 | if (useBetaSdk == 1) { 70 | def libsDirPath = System.getProperty("user.dir") 71 | def libsDir = new File("${libsDirPath}/libs/") 72 | if (!libsDir.exists()) { 73 | libsDir.mkdirs() 74 | } 75 | 76 | def mapsSDK = props.getProperty("GOOGLE_MAPS_ANDROID_SDK") 77 | def f = new File("${libsDir.absolutePath}/${mapsSDK}.aar") 78 | println("---->lib = " + f.absolutePath); 79 | if (!f.exists()) { 80 | new URL("https://dl.google.com/dl/geosdk/${mapsSDK}.aar").withInputStream{ i -> f.withOutputStream{ it << i }} 81 | } 82 | dependencies { 83 | implementation name: mapsSDK, ext:'aar' 84 | } 85 | } 86 | 87 | def PLAY_SERVICES_VERSION = props.get("GOOGLE_MAPS_PLAY_SERVICES_VERSION") 88 | def ANDROID_SUPPORT_V4_VERSION = props.get("ANDROID_SUPPORT_V4_VERSION") 89 | println("---->PLAY_SERVICES_VERSION = ${PLAY_SERVICES_VERSION}") 90 | println("---->ANDROID_SUPPORT_V4_VERSION = ${ANDROID_SUPPORT_V4_VERSION}") 91 | dependencies { 92 | implementation "com.google.android.gms:play-services-maps:${PLAY_SERVICES_VERSION}" 93 | implementation "com.google.android.gms:play-services-location:${PLAY_SERVICES_VERSION}" 94 | implementation "com.android.support:support-core-utils:${ANDROID_SUPPORT_V4_VERSION}" 95 | } 96 | 97 | 98 | buildTypes { 99 | debug { 100 | manifestPlaceholders.GOOGLE_MAPS_ANDROID_API_KEY = props.getProperty("GOOGLE_MAPS_ANDROID_API_KEY") 101 | } 102 | release { 103 | manifestPlaceholders.GOOGLE_MAPS_ANDROID_API_KEY = props.getProperty("GOOGLE_MAPS_ANDROID_API_KEY") 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /www/LatLngBounds.js: -------------------------------------------------------------------------------- 1 | var LatLng = require('./LatLng'); 2 | 3 | /***************************************************************************** 4 | * LatLngBounds Class 5 | *****************************************************************************/ 6 | var LatLngBounds = function () { 7 | Object.defineProperty(this, 'type', { 8 | value: 'LatLngBounds', 9 | writable: false 10 | }); 11 | 12 | var args = []; 13 | if (arguments.length === 1 && 14 | typeof arguments[0] === 'object' && 15 | 'push' in arguments[0]) { 16 | args = arguments[0]; 17 | } else { 18 | args = Array.prototype.slice.call(arguments, 0); 19 | } 20 | 21 | for (var i = 0; i < args.length; i++) { 22 | if (args[i] && 'lat' in args[i] && 'lng' in args[i]) { 23 | this.extend(args[i]); 24 | } 25 | } 26 | }; 27 | 28 | LatLngBounds.prototype.northeast = null; 29 | LatLngBounds.prototype.southwest = null; 30 | 31 | LatLngBounds.prototype.toString = function () { 32 | return '{"southwest":' + this.southwest.toString() + ', "northeast":' + this.northeast.toString() + '}'; 33 | }; 34 | LatLngBounds.prototype.toUrlValue = function (precision) { 35 | precision = precision || 6; 36 | return '[' + this.southwest.toUrlValue(precision) + ',' + this.northeast.toUrlValue(precision) + ']'; 37 | }; 38 | 39 | LatLngBounds.prototype.extend = function (latLng) { 40 | if (latLng && 'lat' in latLng && 'lng' in latLng) { 41 | if (!this.southwest && !this.northeast) { 42 | this.southwest = latLng; 43 | this.northeast = latLng; 44 | } else { 45 | var south = Math.min(latLng.lat, this.southwest.lat); 46 | var north = Math.max(latLng.lat, this.northeast.lat); 47 | 48 | var west = this.southwest.lng, 49 | east = this.northeast.lng; 50 | 51 | if (west > 0 && east < 0) { 52 | if (latLng.lng > 0) { 53 | west = Math.min(latLng.lng, west); 54 | } else { 55 | east = Math.max(latLng.lng, east); 56 | } 57 | } else { 58 | 59 | west = Math.min(latLng.lng, this.southwest.lng); 60 | east = Math.max(latLng.lng, this.northeast.lng); 61 | } 62 | 63 | delete this.southwest; 64 | delete this.northeast; 65 | this.southwest = new LatLng(south, west); 66 | this.northeast = new LatLng(north, east); 67 | } 68 | } 69 | }; 70 | 71 | LatLngBounds.prototype.getCenter = function () { 72 | var centerLat = (this.southwest.lat + this.northeast.lat) / 2; 73 | 74 | var swLng = this.southwest.lng; 75 | var neLng = this.northeast.lng; 76 | var sumLng = swLng + neLng; 77 | var centerLng = sumLng / 2; 78 | 79 | if ((swLng > 0 && neLng < 0 && sumLng < 180)) { 80 | centerLng += sumLng > 0 ? -180 : 180; 81 | } 82 | return new LatLng(centerLat, centerLng); 83 | }; 84 | LatLngBounds.prototype.contains = function (latLng) { 85 | if (!latLng || !('lat' in latLng) || !('lng' in latLng)) { 86 | return false; 87 | } 88 | var y = latLng.lat, 89 | x = latLng.lng; 90 | 91 | var y90 = y + 90; 92 | var south = this.southwest.lat, 93 | north = this.northeast.lat, 94 | west = this.southwest.lng, 95 | east = this.northeast.lng; 96 | var south90 = south + 90, 97 | north90 = north + 90; 98 | 99 | var containX = false, 100 | containY = false; 101 | 102 | if (west <= 0 && east <= 0 && west <= east) { 103 | if (x > 0) { 104 | containX = false; 105 | } else { 106 | containX = (west <= x && x <= east); 107 | } 108 | } else if (east <= 0 && west > 0 && east <= west) { 109 | if (x > 0) { 110 | containX = (x >= west && x <= 180); 111 | } else { 112 | containX = (-180 <= x && x <= west); 113 | } 114 | } else if (west <= 0 && east > 0 && west <= east) { 115 | if (x < 0) { 116 | containX = (west <= x && x <= 0); 117 | } else { 118 | containX = (x >= 0 && x <= east); 119 | } 120 | } else { 121 | containX = (west <= x && x <= east); 122 | } 123 | 124 | containY = (south90 <= y90 && y90 <= north90) || //#a 125 | (south >= 0 && north <= 0 && ((south <= y && y <= 90) || (y >= -90 && y <= north))); // #d 126 | 127 | return containX && containY; 128 | }; 129 | 130 | module.exports = LatLngBounds; 131 | -------------------------------------------------------------------------------- /www/geomodel.js: -------------------------------------------------------------------------------- 1 | /** 2 | # 3 | # Copyright 2010 Alexandre Gellibert 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | */ 17 | 18 | var LatLng = require('./LatLng'), 19 | LatLngBounds = require('./LatLngBounds'), 20 | GEOCELL_GRID_SIZE = 4, 21 | GEOCELL_ALPHABET = '0123456789abcdef'; 22 | 23 | function computeBox(geocell) { 24 | var subcell_lng_span, subcell_lat_span; 25 | var xy, x, y; 26 | var bbox = _createBoundingBox(90.0, 180.0, -90.0, -180.0); 27 | while(geocell.length > 0) { 28 | //geoChar = geocell.charAt(i); 29 | //pos = GEOCELL_ALPHABET.indexOf(geoChar); 30 | 31 | subcell_lng_span = (bbox.getEast() - bbox.getWest()) / GEOCELL_GRID_SIZE; 32 | subcell_lat_span = (bbox.getNorth() - bbox.getSouth()) / GEOCELL_GRID_SIZE; 33 | 34 | xy = _subdiv_xy(geocell.charAt(0)); 35 | x = xy[0]; 36 | y = xy[1]; 37 | 38 | bbox = _createBoundingBox(bbox.getSouth() + subcell_lat_span * (y + 1), 39 | bbox.getWest() + subcell_lng_span * (x + 1), 40 | bbox.getSouth() + subcell_lat_span * y, 41 | bbox.getWest() + subcell_lng_span * x); 42 | 43 | geocell = geocell.substring(1); 44 | } 45 | var sw = new LatLng(bbox.getSouth(), bbox.getWest()); 46 | var ne = new LatLng(bbox.getNorth(), bbox.getEast()); 47 | var bounds = new LatLngBounds(sw, ne); 48 | return bounds; 49 | } 50 | 51 | function _createBoundingBox(north, east, south, west) { 52 | var north_,south_; 53 | 54 | if(south > north) { 55 | south_ = north; 56 | north_ = south; 57 | } else { 58 | south_ = south; 59 | north_ = north; 60 | } 61 | return { 62 | northEast: {lat: north_, lng: east}, 63 | southWest: {lat: south_, lng: west}, 64 | getNorth: function() { 65 | return this.northEast.lat; 66 | }, 67 | getSouth: function() { 68 | return this.southWest.lat; 69 | }, 70 | getWest: function() { 71 | return this.southWest.lng; 72 | }, 73 | getEast: function() { 74 | return this.northEast.lng; 75 | } 76 | }; 77 | } 78 | 79 | 80 | /** 81 | * https://code.google.com/p/geomodel/source/browse/trunk/geo/geocell.py#370 82 | * @param latLng 83 | * @param resolution 84 | * @return 85 | */ 86 | function getGeocell(lat, lng, resolution) { 87 | var cell = ''; 88 | var north = 90.0; 89 | var south = -90.0; 90 | var east = 180.0; 91 | var west = -180.0; 92 | 93 | var subcell_lng_span, subcell_lat_span; 94 | var x, y; 95 | while(cell.length < resolution + 1) { 96 | subcell_lng_span = (east - west) / GEOCELL_GRID_SIZE; 97 | subcell_lat_span = (north - south) / GEOCELL_GRID_SIZE; 98 | 99 | x = Math.min(Math.floor(GEOCELL_GRID_SIZE * (lng - west) / (east - west)), GEOCELL_GRID_SIZE - 1); 100 | y = Math.min(Math.floor(GEOCELL_GRID_SIZE * (lat - south) / (north - south)),GEOCELL_GRID_SIZE - 1); 101 | cell += _subdiv_char(x, y); 102 | 103 | south += subcell_lat_span * y; 104 | north = south + subcell_lat_span; 105 | 106 | west += subcell_lng_span * x; 107 | east = west + subcell_lng_span; 108 | } 109 | return cell; 110 | } 111 | 112 | 113 | /* 114 | * Returns the (x, y) of the geocell character in the 4x4 alphabet grid. 115 | */ 116 | function _subdiv_xy(char) { 117 | // NOTE: This only works for grid size 4. 118 | var charI = GEOCELL_ALPHABET.indexOf(char); 119 | return [(charI & 4) >> 1 | (charI & 1) >> 0, 120 | (charI & 8) >> 2 | (charI & 2) >> 1]; 121 | } 122 | 123 | /** 124 | * Returns the geocell character in the 4x4 alphabet grid at pos. (x, y). 125 | * @return 126 | */ 127 | function _subdiv_char(posX, posY) { 128 | // NOTE: This only works for grid size 4. 129 | return GEOCELL_ALPHABET.charAt( 130 | (posY & 2) << 2 | 131 | (posX & 2) << 1 | 132 | (posY & 1) << 1 | 133 | (posX & 1) << 0); 134 | } 135 | 136 | module.exports = { 137 | computeBox: computeBox, 138 | getGeocell: getGeocell 139 | }; 140 | -------------------------------------------------------------------------------- /www/Geocoder.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | /***************************************************************************** 4 | * Geocoder class 5 | *****************************************************************************/ 6 | var common = require('./Common'), 7 | utils = require('cordova/utils'); 8 | 9 | var Geocoder = function (exec) { 10 | 11 | return { 12 | geocode: function (geocoderRequest, callback) { 13 | 14 | geocoderRequest = geocoderRequest || {}; 15 | var requestProperty = null; 16 | if ('position' in geocoderRequest && !('address' in geocoderRequest)) { 17 | requestProperty = 'position'; 18 | } else if ('address' in geocoderRequest && !('position' in geocoderRequest)) { 19 | requestProperty = 'address'; 20 | } 21 | if (!requestProperty) { 22 | var error = new Error('Invalid request'); 23 | if (typeof callback === 'function') { 24 | callback([], error); 25 | } else { 26 | return Promise.reject(error); 27 | } 28 | } 29 | 30 | if (geocoderRequest[requestProperty] instanceof Array || Array.isArray(geocoderRequest[requestProperty])) { 31 | //------------------------- 32 | // Geocoder.geocode({ 33 | // address: [ 34 | // 'Kyoto, Japan', 35 | // 'Tokyo, Japan' 36 | // ] 37 | // }) 38 | //------------------------- 39 | 40 | var mvcResults = common.createMvcArray(); 41 | for (var i = 0; i < requestCnt; i++) { 42 | mvcResults.push(-1, true); 43 | } 44 | 45 | // Execute geocoder.geocode() when a new request is instearted. 46 | var requestCnt = geocoderRequest[requestProperty].length; 47 | var requests = common.createMvcArray(); 48 | requests.on('insert_at', function (idx) { 49 | var request = requests.getAt(idx); 50 | request.idx = idx; 51 | exec.call({ 52 | _isReady: true 53 | }, function (result) { 54 | 55 | mvcResults.insertAt(result.idx, result.results); 56 | if (mvcResults.getLength() === requestCnt) { 57 | var tmp = mvcResults.getArray(); 58 | var tmp2 = tmp.filter(function (ele) { 59 | return ele === -1; 60 | }); 61 | if (tmp2.length === 0) { 62 | // Notifies `finish` event when all results are received. 63 | mvcResults.trigger('finish'); 64 | } 65 | } 66 | 67 | }, function (error) { 68 | mvcResults.trigger('error', error); 69 | }, 'PluginGeocoder', 'geocode', [request]); 70 | }); 71 | 72 | var request; 73 | var baseRequest = utils.clone(geocoderRequest); 74 | delete baseRequest[requestProperty]; 75 | for (i = 0; i < requestCnt; i++) { 76 | request = utils.clone(baseRequest); 77 | request[requestProperty] = geocoderRequest[requestProperty][i]; 78 | request.idx = i; 79 | if (requestProperty === 'position') { 80 | request.position.lat = request.position.lat || 0.0; 81 | request.position.lng = request.position.lng || 0.0; 82 | } 83 | requests.push(request); 84 | } 85 | if (typeof callback === 'function') { 86 | callback(mvcResults); 87 | } else { 88 | return Promise.resolve(mvcResults); 89 | } 90 | } else { 91 | //------------------------- 92 | // Geocoder.geocode({ 93 | // address: 'Kyoto, Japan' 94 | // }) 95 | //------------------------- 96 | if (requestProperty === 'position') { 97 | geocoderRequest.position.lat = geocoderRequest.position.lat || 0.0; 98 | geocoderRequest.position.lng = geocoderRequest.position.lng || 0.0; 99 | } 100 | geocoderRequest.idx = -1; 101 | 102 | var resolver1 = function (resolve, reject) { 103 | exec.call({ 104 | _isReady: true 105 | }, function (_results) { 106 | resolve(_results.results); 107 | }, reject, 'PluginGeocoder', 'geocode', [geocoderRequest]); 108 | }; 109 | 110 | if (typeof callback === 'function') { 111 | resolver1(callback, function (error) { 112 | callback([], error); 113 | }); 114 | } else { 115 | return new Promise(resolver1); 116 | } 117 | 118 | } 119 | } 120 | 121 | }; 122 | }; 123 | 124 | module.exports = Geocoder; 125 | -------------------------------------------------------------------------------- /src/android/plugin/google/maps/PluginEnvironment.java: -------------------------------------------------------------------------------- 1 | package plugin.google.maps; 2 | 3 | import android.content.Intent; 4 | import android.graphics.Color; 5 | import android.net.Uri; 6 | import android.os.Handler; 7 | import android.util.Log; 8 | 9 | import com.google.android.gms.common.ConnectionResult; 10 | import com.google.android.gms.common.GoogleApiAvailability; 11 | 12 | import org.apache.cordova.CallbackContext; 13 | import org.apache.cordova.CordovaInterface; 14 | import org.apache.cordova.CordovaPlugin; 15 | import org.apache.cordova.CordovaWebView; 16 | import org.apache.cordova.PluginManager; 17 | import org.apache.cordova.PluginResult; 18 | import org.json.JSONArray; 19 | import org.json.JSONException; 20 | 21 | import java.lang.reflect.Method; 22 | 23 | public class PluginEnvironment extends CordovaPlugin { 24 | public PluginManager pluginManager; 25 | 26 | @Override 27 | public void initialize(final CordovaInterface cordova, final CordovaWebView webView) { 28 | pluginManager = webView.getPluginManager(); 29 | } 30 | 31 | @Override 32 | public boolean execute(final String action, final JSONArray args, final CallbackContext callbackContext) { 33 | cordova.getThreadPool().submit(new Runnable() { 34 | @Override 35 | public void run() { 36 | try { 37 | Method method = PluginEnvironment.this.getClass().getDeclaredMethod(action, JSONArray.class, CallbackContext.class); 38 | if (!method.isAccessible()) { 39 | method.setAccessible(true); 40 | } 41 | method.invoke(PluginEnvironment.this, args, callbackContext); 42 | } catch (Exception e) { 43 | Log.e("CordovaLog", "An error occurred", e); 44 | callbackContext.error(e.toString()); 45 | } 46 | } 47 | }); 48 | 49 | return true; 50 | } 51 | 52 | @SuppressWarnings("unused") 53 | public void isAvailable(final JSONArray args, final CallbackContext callbackContext) throws JSONException { 54 | 55 | // ------------------------------ 56 | // Check of Google Play Services 57 | // ------------------------------ 58 | int checkGooglePlayServices = 59 | GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(cordova.getActivity()); 60 | if (checkGooglePlayServices != ConnectionResult.SUCCESS) { 61 | String errorMsg = GoogleApiAvailability.getInstance().getErrorString(checkGooglePlayServices); 62 | callbackContext.error(errorMsg); 63 | 64 | try { 65 | cordova.getActivity().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.google.android.gms"))); 66 | } catch (android.content.ActivityNotFoundException anfe) { 67 | cordova.getActivity().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=com.google.android.gms"))); 68 | } 69 | 70 | // End the app (in order to prevent lots of crashes) 71 | cordova.getActivity().finish(); 72 | 73 | return; 74 | } 75 | 76 | // ------------------------------ 77 | // Check of Google Maps Android API v2 78 | // ------------------------------ 79 | try { 80 | @SuppressWarnings({ "rawtypes" }) 81 | Class GoogleMapsClass = Class.forName("com.google.android.gms.maps.GoogleMap"); 82 | } catch (Exception e) { 83 | Log.e("GoogleMaps", "Error", e); 84 | callbackContext.error(e.getMessage()); 85 | return; 86 | } 87 | callbackContext.success(); 88 | } 89 | 90 | 91 | 92 | /** 93 | * Set the app background 94 | * @param args Parameters given from JavaScript side 95 | * @param callbackContext Callback contect for sending back the result. 96 | * @throws JSONException 97 | */ 98 | @SuppressWarnings("unused") 99 | public void setBackGroundColor(final JSONArray args, final CallbackContext callbackContext) throws JSONException { 100 | 101 | JSONArray rgba = args.getJSONArray(0); 102 | int backgroundColor = Color.WHITE; 103 | 104 | if (rgba != null && rgba.length() == 4) { 105 | backgroundColor = PluginUtil.parsePluginColor(rgba); 106 | } 107 | final int finalBackgroundColor = backgroundColor; 108 | 109 | 110 | final CordovaGoogleMaps googleMaps = (CordovaGoogleMaps) pluginManager.getPlugin("CordovaGoogleMaps"); 111 | 112 | Handler handler = new Handler(cordova.getActivity().getMainLooper()); 113 | handler.postDelayed(new Runnable() { 114 | public void run() { 115 | googleMaps.mPluginLayout.setBackgroundColor(finalBackgroundColor); 116 | callbackContext.success(); 117 | } 118 | }, googleMaps.initialized ? 0 : 250); 119 | } 120 | 121 | @SuppressWarnings("unused") 122 | public Boolean getLicenseInfo(JSONArray args, final CallbackContext callbackContext) { 123 | callbackContext.success("Google Maps Android API v2 does not need this method anymore. But for iOS, you still need to display the lincense."); 124 | return true; 125 | } 126 | 127 | @SuppressWarnings("unused") 128 | public Boolean setEnv(JSONArray args, final CallbackContext callbackContext) { 129 | // stub 130 | callbackContext.success(); 131 | return true; 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /src/ios/GoogleMaps/PluginEnvironment.m: -------------------------------------------------------------------------------- 1 | // 2 | // PluginEnvironment.m 3 | // cordova-googlemaps-plugin v2 4 | // 5 | // Created by Masashi Katsumata. 6 | // 7 | // 8 | 9 | #import "PluginEnvironment.h" 10 | 11 | @implementation PluginEnvironment 12 | 13 | dispatch_queue_t queue; 14 | 15 | - (void)pluginInitialize 16 | { 17 | queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul); 18 | } 19 | 20 | - (void)pluginUnload 21 | { 22 | queue = nil; 23 | } 24 | - (void)isAvailable:(CDVInvokedUrlCommand *)command { 25 | // Return true always in iOS. 26 | dispatch_async(queue, ^{ 27 | //------------------------------- 28 | // Check the Google Maps API key 29 | //------------------------------- 30 | NSString *errorMsg = nil; 31 | 32 | NSString *APIKey = [((CDVViewController *)self.viewController).settings objectForKey:@"google_maps_ios_api_key"]; 33 | 34 | if (APIKey == nil) { 35 | NSString *errorTitle = [PluginUtil PGM_LOCALIZATION:@"APIKEY_IS_UNDEFINED_TITLE"]; 36 | NSString *errorMsg = [PluginUtil PGM_LOCALIZATION:@"APIKEY_IS_UNDEFINED_MESSAGE"]; 37 | 38 | UIAlertController* alert = [UIAlertController alertControllerWithTitle:errorTitle 39 | message:errorMsg 40 | preferredStyle:UIAlertControllerStyleAlert]; 41 | 42 | NSString *closeBtnLabel = [PluginUtil PGM_LOCALIZATION:@"CLOSE_BUTTON"]; 43 | UIAlertAction* ok = [UIAlertAction actionWithTitle:closeBtnLabel 44 | style:UIAlertActionStyleDefault 45 | handler:^(UIAlertAction* action) 46 | { 47 | [alert dismissViewControllerAnimated:YES completion:nil]; 48 | }]; 49 | 50 | [alert addAction:ok]; 51 | 52 | [self.viewController presentViewController:alert 53 | animated:YES 54 | completion:nil]; 55 | return; 56 | } 57 | 58 | /*--------------------------------------------------------------------------------------- 59 | * If CFBundleExecutable is not English, the Google Maps SDK for iOS will crash. 60 | * So must be English. 61 | * 62 | * If you want to use non-english name for your app, you need to change your config.xml like this. 63 | * 64 | * 65 | * 66 | * (english app name) 67 | *---------------------------------------------------------------------------------------*/ 68 | 69 | NSDictionary *info = [[NSBundle mainBundle] infoDictionary]; 70 | NSString *CFBundleExecutable = [info objectForKey:@"CFBundleExecutable"]; 71 | 72 | NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^[a-zA-Z0-9$@$!%*?&#^\\-_.\\s+]+$" options:NSRegularExpressionCaseInsensitive error:nil]; 73 | if ([regex numberOfMatchesInString:CFBundleExecutable options:0 range:NSMakeRange(0, CFBundleExecutable.length)] == 0) { 74 | errorMsg = [PluginUtil PGM_LOCALIZATION:@"APP_NAME_ERROR_MESSAGE"]; 75 | } 76 | 77 | CDVPluginResult* pluginResult; 78 | if (errorMsg) { 79 | pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errorMsg]; 80 | } else { 81 | pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; 82 | } 83 | [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; 84 | }); 85 | 86 | } 87 | 88 | - (void)setBackGroundColor:(CDVInvokedUrlCommand *)command { 89 | 90 | dispatch_async(queue, ^{ 91 | // Load the GoogleMap.m 92 | CDVViewController *cdvViewController = (CDVViewController*)self.viewController; 93 | CordovaGoogleMaps *googlemaps = [cdvViewController getCommandInstance:@"CordovaGoogleMaps"]; 94 | 95 | NSArray *rgbColor = [command.arguments objectAtIndex:0]; 96 | dispatch_async(dispatch_get_main_queue(), ^{ 97 | googlemaps.pluginLayer.backgroundColor = [rgbColor parsePluginColor]; 98 | }); 99 | 100 | CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; 101 | [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; 102 | }); 103 | } 104 | 105 | - (void)getLicenseInfo:(CDVInvokedUrlCommand *)command { 106 | 107 | dispatch_async(queue, ^{ 108 | dispatch_async(dispatch_get_main_queue(), ^{ 109 | NSString *txt = [GMSServices openSourceLicenseInfo]; 110 | CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:txt]; 111 | [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; 112 | }); 113 | }); 114 | } 115 | 116 | - (void)setEnv:(CDVInvokedUrlCommand *)command { 117 | // stub 118 | CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; 119 | [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; 120 | } 121 | @end 122 | -------------------------------------------------------------------------------- /www/GroundOverlay.js: -------------------------------------------------------------------------------- 1 | var utils = require('cordova/utils'), 2 | common = require('./Common'), 3 | Overlay = require('./Overlay'); 4 | 5 | /***************************************************************************** 6 | * GroundOverlay Class 7 | *****************************************************************************/ 8 | var GroundOverlay = function (map, groundOverlayOptions, _exec) { 9 | Overlay.call(this, map, groundOverlayOptions, 'GroundOverlay', _exec); 10 | 11 | var self = this; 12 | groundOverlayOptions.visible = groundOverlayOptions.visible === undefined ? true : groundOverlayOptions.visible; 13 | groundOverlayOptions.zIndex = groundOverlayOptions.zIndex || 1; 14 | groundOverlayOptions.opacity = groundOverlayOptions.opacity || 1; 15 | groundOverlayOptions.bounds = groundOverlayOptions.bounds || []; 16 | groundOverlayOptions.anchor = groundOverlayOptions.anchor || [0, 0]; 17 | groundOverlayOptions.bearing = groundOverlayOptions.bearing || 0; 18 | 19 | //----------------------------------------------- 20 | // Sets event listeners 21 | //----------------------------------------------- 22 | self.on('visible_changed', function () { 23 | var visible = self.get('visible'); 24 | self.exec.call(self, null, self.errorHandler, self.getPluginName(), 'setVisible', [self.getId(), visible]); 25 | }); 26 | self.on('image_changed', function () { 27 | var image = self.get('image'); 28 | self.exec.call(self, null, self.errorHandler, self.getPluginName(), 'setImage', [self.getId(), image]); 29 | }); 30 | self.on('bounds_changed', function () { 31 | var bounds = self.get('bounds'); 32 | self.exec.call(self, null, self.errorHandler, self.getPluginName(), 'setBounds', [self.getId(), bounds]); 33 | }); 34 | self.on('opacity_changed', function () { 35 | var opacity = self.get('opacity'); 36 | self.exec.call(self, null, self.errorHandler, self.getPluginName(), 'setOpacity', [self.getId(), opacity]); 37 | }); 38 | self.on('clickable_changed', function () { 39 | var clickable = self.get('clickable'); 40 | self.exec.call(self, null, self.errorHandler, self.getPluginName(), 'setClickable', [self.getId(), clickable]); 41 | }); 42 | self.on('bearing_changed', function () { 43 | var bearing = self.get('bearing'); 44 | self.exec.call(self, null, self.errorHandler, self.getPluginName(), 'setBearing', [self.getId(), bearing]); 45 | }); 46 | self.on('zIndex_changed', function () { 47 | var zIndex = self.get('zIndex'); 48 | self.exec.call(self, null, self.errorHandler, self.getPluginName(), 'setZIndex', [self.getId(), zIndex]); 49 | }); 50 | 51 | }; 52 | 53 | utils.extend(GroundOverlay, Overlay); 54 | 55 | GroundOverlay.prototype.setVisible = function (visible) { 56 | this.set('visible', visible); 57 | }; 58 | 59 | GroundOverlay.prototype.getVisible = function () { 60 | return this.get('visible'); 61 | }; 62 | 63 | GroundOverlay.prototype.setImage = function (url) { 64 | this.set('image', url); 65 | }; 66 | 67 | GroundOverlay.prototype.setBounds = function (points) { 68 | var i, 69 | bounds = []; 70 | for (i = 0; i < points.length; i++) { 71 | bounds.push({ 72 | 'lat': parseFloat(points[i].lat, 10), 73 | 'lng': parseFloat(points[i].lng, 10) 74 | }); 75 | } 76 | this.set('bounds', bounds); 77 | }; 78 | 79 | GroundOverlay.prototype.getOpacity = function () { 80 | return this.get('opacity'); 81 | }; 82 | 83 | GroundOverlay.prototype.getBearing = function () { 84 | return this.get('bearing'); 85 | }; 86 | 87 | GroundOverlay.prototype.setOpacity = function (opacity) { 88 | if (!opacity && opacity !== 0) { 89 | console.log('opacity value must be int or double'); 90 | return false; 91 | } 92 | this.set('opacity', opacity); 93 | }; 94 | GroundOverlay.prototype.setBearing = function (bearing) { 95 | if (bearing > 360) { 96 | bearing = bearing - Math.floor(bearing / 360) * 360; 97 | } 98 | this.set('bearing', bearing); 99 | }; 100 | 101 | GroundOverlay.prototype.getZIndex = function () { 102 | return this.get('zIndex'); 103 | }; 104 | 105 | GroundOverlay.prototype.setZIndex = function (zIndex) { 106 | this.set('zIndex', zIndex); 107 | }; 108 | GroundOverlay.prototype.setClickable = function (clickable) { 109 | clickable = common.parseBoolean(clickable); 110 | this.set('clickable', clickable); 111 | return this; 112 | }; 113 | GroundOverlay.prototype.getClickable = function () { 114 | return this.get('clickable'); 115 | }; 116 | 117 | GroundOverlay.prototype.remove = function (callback) { 118 | var self = this; 119 | if (self._isRemoved) { 120 | if (typeof callback === 'function') { 121 | return; 122 | } else { 123 | return Promise.resolve(); 124 | } 125 | } 126 | Object.defineProperty(self, '_isRemoved', { 127 | value: true, 128 | writable: false 129 | }); 130 | self.trigger(self.__pgmId + '_remove'); 131 | 132 | var resolver = function(resolve, reject) { 133 | self.exec.call(self, 134 | function() { 135 | self.destroy(); 136 | resolve.call(self); 137 | }, 138 | reject.bind(self), 139 | self.getPluginName(), 'remove', [self.getId()], { 140 | remove: true 141 | }); 142 | }; 143 | 144 | if (typeof callback === 'function') { 145 | resolver(callback, self.errorHandler); 146 | } else { 147 | return new Promise(resolver); 148 | } 149 | 150 | }; 151 | 152 | module.exports = GroundOverlay; 153 | --------------------------------------------------------------------------------