Remove FusionTable layer code because FusionTable is deprecated.
MODIFY
README.md
README.md
## Release Notes
- **v2.5.0**
- - Add: (Android/iOS/Browser) `map.addFusionTableOverlay()`
- Add: (Android/iOS/Browser) Support `promise` for `TileOverlayOptions.getTile`. You must return new URL in 5 seconds.
```js
var tileOverlay = map.addTileOverlay({
- Update: (Android/iOS) Improve accuracy of touch detection on geodesic polyline.
- Update: (iOS) Remove "NSData+Base64" library. No longer necessary.
- Update: (js) ionic 4 hides Google Maps view.
+ - Fix: (Browser) `MarkerCluster.remove()` does not work on browser platform.
- **v2.4.6**
- Fix: (iOS) Only `src/ios/check_sdk_version.js` error.
@@ -534,7 +534,6 @@ You can write your code `similar to` the Google Maps JavaScript API v3.
| google.maps.Data | (not available) |
| google.maps.DirectionsService | (not available) |
| google.maps.DistanceMatrixService | (not available) |
-| google.maps.FusionTablesLayer | (not available) |
| google.maps.TransitLayer | (not available) |
| google.maps.places.* | (not available) |
| google.maps.visualization.* | (not available) |

MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.5.0-beta-20181219-2107" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
+<plugin id="cordova-plugin-googlemaps" version="2.5.0-beta-20181219-2113" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>cordova-plugin-googlemaps</name>
<js-module name="Promise" src="www/Promise.js" />
<asset src="www/promise-7.0.4.min.js.map" target="promise-7.0.4.min.js.map" />
<js-module name="KmlLoader" src="www/KmlLoader.js">
<runs/>
</js-module>
- <js-module name="FusionTableOverlay" src="www/FusionTableOverlay.js">
- <runs/>
- </js-module>
<js-module name="Environment" src="www/Environment.js">
<runs/>
</js-module>
<js-module name="PluginEnvironment" src="src/browser/PluginEnvironment.js">
<runs/>
</js-module>
- <js-module name="PluginFusionTableOverlay" src="src/browser/PluginFusionTableOverlay.js">
- <runs/>
- </js-module>
</platform>
</plugin>

DELETE
src/browser/PluginFusionTableOverlay.js
-
-var utils = require('cordova/utils'),
- event = require('cordova-plugin-googlemaps.event'),
- BaseClass = require('cordova-plugin-googlemaps.BaseClass'),
- LatLng = require('cordova-plugin-googlemaps.LatLng');
-
-function PluginFusionTableOverlay(pluginMap) {
- var self = this;
- BaseClass.apply(self);
- Object.defineProperty(self, 'pluginMap', {
- value: pluginMap,
- enumerable: false,
- writable: false
- });
-
-}
-
-utils.extend(PluginFusionTableOverlay, BaseClass);
-
-PluginFusionTableOverlay.prototype._create = function(onSuccess, onError, args) {
- var self = this,
- map = self.pluginMap.get('map'),
- fusionTableOverlayId = args[2],
- pluginOptions = args[1],
- mapId = self.pluginMap.__pgmId;
-
- var fusionTableOpts = {
- 'map': map,
- 'query': {
- 'select': pluginOptions.query.select,
- 'from': pluginOptions.query.from
- }
- };
- if (pluginOptions.where) {
- fusionTableOpts.query.where = pluginOptions.query.where;
- }
- if (pluginOptions.orderBy) {
- fusionTableOpts.query.orderBy = pluginOptions.query.orderBy;
- } else if (pluginOptions.offset) {
- fusionTableOpts.query.offset = pluginOptions.query.offset;
- }
- if (pluginOptions.limit) {
- fusionTableOpts.query.limit = pluginOptions.query.limit;
- }
-
- var fusionTableOverlay = new google.maps.FusionTablesLayer(fusionTableOpts);
-
- fusionTableOverlay.addListener('click', function(mouseEvent) {
-
- if (mapId in plugin.google.maps) {
- plugin.google.maps[mapId]({
- 'evtName': event.FUSION_TABLE_CLICK,
- 'callback': '_onOverlayEvent',
- 'args': [fusionTableOverlayId, {
- 'infoWindowHtml': mouseEvent.infoWindowHtml,
- 'latLng': new LatLng(mouseEvent.latLng.lat(), mouseEvent.latLng.lng()),
- 'row': mouseEvent.row
- }]
- });
- }
- });
-
- self.pluginMap.objects[fusionTableOverlayId] = fusionTableOverlay;
-
- onSuccess({
- '__pgmId': fusionTableOverlayId
- });
-};
-
-
-PluginFusionTableOverlay.prototype.setVisible = function(onSuccess, onError, args) {
- var self = this,
- map = self.pluginMap.get('map'),
- overlayId = args[0],
- fusionTableOverlay = self.pluginMap.objects[overlayId];
-
- if (fusionTableOverlay) {
- fusionTableOverlay.setMap(args[1] ? map : null);
- }
- onSuccess();
-};
-
-PluginFusionTableOverlay.prototype.remove = function(onSuccess, onError, args) {
- var self = this;
- var overlayId = args[0];
- var fusionTableOverlay = self.pluginMap.objects[overlayId];
- if (fusionTableOverlay) {
- google.maps.event.clearInstanceListeners(fusionTableOverlay);
- fusionTableOverlay.setMap(null);
- fusionTableOverlay = undefined;
- self.pluginMap.objects[overlayId] = undefined;
- delete self.pluginMap.objects[overlayId];
- }
- onSuccess();
-};
-
-module.exports = PluginFusionTableOverlay;

DELETE
www/FusionTableOverlay.js
-
-var utils = require('cordova/utils'),
- common = require('./Common'),
- Overlay = require('./Overlay'),
- BaseClass = require('./BaseClass'),
- event = require('./event'),
- BaseArrayClass = require('./BaseArrayClass');
-
-/*****************************************************************************
- * FusionTableOverlay Class
- *****************************************************************************/
-var FusionTableOverlay = function (map, FusionTableOverlayOptions, _exec) {
- Overlay.call(this, map, FusionTableOverlayOptions, 'FusionTableOverlay', _exec);
-
- var self = this;
-
- //-----------------------------------------------
- // Sets event listeners
- //-----------------------------------------------
- self.on('visible_changed', function () {
- var visible = self.get('visible');
- self.exec.call(self, null, self.errorHandler, self.getPluginName(), 'setVisible', [self.getId(), visible]);
- });
-
- delete self._privateInitialize;
-
- var onOverlayClick = function() {
- var overlay = this;
- self.trigger('fusion_click', overlay);
- };
-
- var _privateInitialize = function(kmlData) {
- if (!kmlData) {
- //-----------------------------------------------
- // (browser)Trigger internal command queue
- //-----------------------------------------------
- Object.defineProperty(self, '_isReady', {
- value: true,
- writable: false
- });
- self.exec('nop');
- return;
- }
-
- //--------------------------
- // Listen XXX_CLICK events
- //--------------------------
- var eventNames = {
- 'Marker': event.MARKER_CLICK,
- 'Polyline': event.POLYLINE_CLICK,
- 'Polygon': event.POLYGON_CLICK,
- 'GroundOverlay': event.GROUND_OVERLAY_CLICK
- };
- var seekOverlays = function (overlay) {
- if (overlay instanceof BaseArrayClass) {
- overlay.forEach(seekOverlays);
- } else if (Array.isArray(overlay)) {
- (new BaseArrayClass(overlay)).forEach(seekOverlays);
- } else if (overlay instanceof BaseClass && overlay.type in eventNames) {
- overlay.on(eventNames[overlay.type], onOverlayClick);
- }
- };
-
- kmlData.forEach(seekOverlays);
-
-
-
- //-----------------------------------------------
- // Trigger internal command queue
- //-----------------------------------------------
- Object.defineProperty(self, '_isReady', {
- value: true,
- writable: false
- });
- self.exec('nop');
- };
- Object.defineProperty(FusionTableOverlay.prototype, '_privateInitialize', {
- enumerable: false,
- value: _privateInitialize,
- writable: false
- });
-
-};
-
-utils.extend(FusionTableOverlay, Overlay);
-
-
-FusionTableOverlay.prototype.getPluginName = function () {
- return this.map.getId() + '-fusiontableoverlay';
-};
-
-FusionTableOverlay.prototype.getHashCode = function () {
- return this.hashCode;
-};
-
-FusionTableOverlay.prototype.getMap = function () {
- return this.map;
-};
-FusionTableOverlay.prototype.getId = function () {
- return this.__pgmId;
-};
-FusionTableOverlay.prototype.setVisible = function (visible) {
- visible = common.parseBoolean(visible);
- this.set('visible', visible);
-};
-FusionTableOverlay.prototype.getVisible = function () {
- return this.get('visible');
-};
-
-FusionTableOverlay.prototype.setOptions = function (options) {
- var currentOptions = this.get('options');
- this.set('options', {
- clickable: 'clickable' in options ? common.defaultTrueOption(options.clickable) : currentOptions.clickable,
- suppressInfoWindows: 'suppressInfoWindows' in options ? options.suppressInfoWindows === true : currentOptions.suppressInfoWindows,
- query: {
- from: options.query && 'from' in options.query ? options.query.from : currentOptions.query.from,
- limit: options.query && 'from' in options.query ? options.query.limit : currentOptions.query.limit,
- offset: options.query && 'from' in options.query ? options.query.offset : currentOptions.query.offset,
- orderBy: options.query && 'from' in options.query ? options.query.orderBy : currentOptions.query.orderBy,
- select: options.query && 'from' in options.query ? options.query.select : currentOptions.query.select,
- where: options.query && 'from' in options.where ? options.query.where : currentOptions.query.where
- }
- });
-};
-FusionTableOverlay.prototype.remove = function (callback) {
- var self = this;
- if (self._isRemoved) {
- if (typeof callback === 'function') {
- return;
- } else {
- return Promise.resolve();
- }
- }
- Object.defineProperty(self, '_isRemoved', {
- value: true,
- writable: false
- });
- self.trigger(self.__pgmId + '_remove');
-
- var resolver = function(resolve, reject) {
- self.exec.call(self,
- function() {
- self.destroy();
- resolve.call(self);
- },
- reject.bind(self),
- self.getPluginName(), 'remove', [self.getId()], {
- remove: true
- });
- };
-
- if (typeof callback === 'function') {
- resolver(callback, self.errorHandler);
- } else {
- return new Promise(resolver);
- }
-
-};
-
-module.exports = FusionTableOverlay;

MODIFY
www/Map.js
www/Map.js
@@ -18,7 +18,6 @@ var utils = require('cordova/utils'),
GroundOverlay = require('./GroundOverlay'),
KmlOverlay = require('./KmlOverlay'),
KmlLoader = require('./KmlLoader'),
- FusionTableOverlay = require('./FusionTableOverlay'),
MarkerCluster = require('./MarkerCluster');
/**
@@ -1043,134 +1042,6 @@ Map.prototype.addKmlOverlay = function(kmlOverlayOptions, callback) {
}
};
-//-----------------------------------------
-// Experimental: FusionTableOverlay
-//-----------------------------------------
-Map.prototype.addFusionTableOverlay = function(fusionTableOptions, callback) {
- var self = this;
- if (!fusionTableOptions) {
- throw new Error('Please specify fusionTableOptions');
- }
- if (!fusionTableOptions.query) {
- throw new Error('Please specify fusionTableOptions.query');
- }
- if (!fusionTableOptions.query.select) {
- throw new Error('Please specify fusionTableOptions.query.select');
- }
- if (!fusionTableOptions.query.from) {
- throw new Error('Please specify fusionTableOptions.query.from');
- }
- var limitedOptions = {
- clickable: common.defaultTrueOption(fusionTableOptions.clickable),
- suppressInfoWindows: fusionTableOptions.suppressInfoWindows === true,
- query: {
- from: fusionTableOptions.query.from,
- limit: fusionTableOptions.query.limit,
- offset: fusionTableOptions.query.offset,
- orderBy: fusionTableOptions.query.orderBy,
- select: fusionTableOptions.query.select,
- where: fusionTableOptions.query.where
- }
- };
-
-
- var fusionTableOverlay = new FusionTableOverlay(self, fusionTableOptions, exec);
- var fusionTableOverlayId = fusionTableOverlay.getId();
- self.OVERLAYS[fusionTableOverlayId] = fusionTableOverlay;
- if (cordova.platformId === 'browser') {
- //----------------------------------
- // Browser: use FusionTable layer
- //----------------------------------
- return (new Promise(function(resolve, reject) {
-
- self.exec.call(self, function() {
- fusionTableOverlay._privateInitialize();
- resolve(fusionTableOverlay);
- }, reject,
- self.__pgmId,
- 'loadPlugin', ['FusionTableOverlay', limitedOptions, fusionTableOverlayId]);
-
- }))
- .then(function(overlay) {
- if (typeof callback === 'function') {
- callback.call(self, overlay);
- } else {
- return Promise.resolve(overlay);
- }
- });
-
- }
-
-
- var query = ['select+',
- limitedOptions.query.select,
- '+from+',
- limitedOptions.query.from];
- if (limitedOptions.query.where) {
- query.push('+where+' + limitedOptions.query.where);
- }
- if (limitedOptions.query.orderBy) {
- query.push('+orderBy+' + limitedOptions.query.orderBy);
- }
- if (limitedOptions.query.offset) {
- query.push('+offset+' + limitedOptions.query.offset);
- }
- if (limitedOptions.query.limit) {
- query.push('+limit+' + limitedOptions.query.limit);
- } else {
- query.push('+limit+1000');
- }
-
- var kmlOptions = {
- clickable: limitedOptions.clickable,
- suppressInfoWindows: limitedOptions.suppressInfoWindows
- };
- kmlOptions.url =
- 'https://fusiontables.google.com/exporttable?query=' +
- query.join('') +
- '&o=kml&g=' + limitedOptions.query.select +
- '&styleId=2&templateId=2'; // including '&styleId=2&templateId=2', FusionTable exports the latest KML file
-
-
- var link = document.createElement('a');
- link.href = kmlOptions.url;
- kmlOptions.url = link.protocol+'//'+link.host+link.pathname + link.search;
-
- var invisible_dot = self.get('invisible_dot');
- if (!invisible_dot || invisible_dot._isRemoved) {
- // Create an invisible marker for kmlOverlay
- self.set('invisible_dot', self.addMarker({
- position: {
- lat: 0,
- lng: 0
- },
- icon: 'skyblue',
- visible: false
- }));
- }
-
- return (new Promise(function(resolve, reject) {
-
- var loader = new KmlLoader(self, self.exec, kmlOptions);
- loader.parseKmlFile(function(camera, kmlData) {
- if (kmlData instanceof BaseClass) {
- kmlData = new BaseArrayClass([kmlData]);
- }
- fusionTableOverlay._privateInitialize(kmlData);
-
- resolve.call(self, fusionTableOverlay);
- }, reject);
-
- }))
- .then(function(overlay) {
- if (typeof callback === 'function') {
- callback.call(self, overlay);
- } else {
- return Promise.resolve(overlay);
- }
- });
-};
-
//-------------
// Ground overlay

Remove FusionTable layer code because FusionTable is deprecated.