diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 875057b7e..02edccc11 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -8,35 +8,84 @@ import 'rxjs/add/observable/fromEvent'; export type MapType = 'MAP_TYPE_NORMAL' | 'MAP_TYPE_ROADMAP' | 'MAP_TYPE_SATELLITE' | 'MAP_TYPE_HYBRID' | 'MAP_TYPE_TERRAIN' | 'MAP_TYPE_NONE'; export interface GoogleMapOptions { - mapType: MapType; - controls: { - compass: boolean; - myLocationButton: boolean; - indoorPicker: boolean; - zoom: boolean; + mapType?: MapType; + controls?: { + /** + * Turns the compass on or off. + */ + compass?: boolean; + /** + * Turns the myLocation picker on or off. If turns on this button, the application displays a permission dialog to obtain the geolocation data. + */ + myLocationButton?: boolean; + /** + * Turns the indoor picker on or off. + */ + indoorPicker?: boolean; + /** + * Turns the map toolbar on or off. This option is for Android only. + */ + mapToolbar?: boolean }; - gestures: { - scroll: boolean; - tilt: boolean; - zoom: boolean; - rotate: boolean; + gestures?: { + scroll?: boolean; + tilt?: boolean; + zoom?: boolean; + rotate?: boolean; }; - styles: any[]; - camera: CameraPosition; - preferences: { - zoom: { - minZoom: number; - maxZoom: number; + /** + * Map styles + * @ref https://developers.google.com/maps/documentation/javascript/style-reference + */ + styles?: any[]; + /** + * Initial camera position + */ + camera?: CameraPosition; + preferences?: { + /** + * Minimum and maximum zoom levels for zooming gestures. + */ + zoom?: { + minZoom?: number; + maxZoom?: number; }, - building: boolean; + /** + * Paddings of controls. + */ + padding?: { + left?: number, + top?: number, + bottom?: number, + right?: number + }, + /** + * Turns the 3D buildings layer on or off. + */ + building?: boolean }; } export interface AnimateCameraOptions { - target?: LatLng | Array | LatLngBounds; + /** + * Center position of the camera target. + */ + target?: ILatLng | Array | LatLngBounds; + /** + * View angle of camera from 0 to 90 + */ tilt?: number; + /** + * Zoom level from 0 to 20 + */ zoom?: number; + /** + * Heading from 0 to 359 + */ bearing?: number; + /** + * Duration of camera animation in milli seconds + */ duration?: number; } @@ -44,7 +93,7 @@ export interface CameraPosition { /** * The center location of the camera view. */ - target?: LatLng | LatLngBounds | LatLng[]; + target?: ILatLng | LatLngBounds | ILatLng[]; /** * View angle */ @@ -64,11 +113,12 @@ export interface CameraPosition { } export interface CircleOptions { - center?: LatLng; + center?: ILatLng; radius?: number; strokeColor?: string; strokeWidth?: number; fillColor?: string; + clickable?: boolean; visible?: boolean; zIndex?: number; } @@ -105,15 +155,19 @@ export interface GroundOverlayOptions { */ url?: string; /** - * Bounds, array of LatLng + * Bounds, array of ILatLng */ - bounds?: Array; + bounds?: Array; + /** + * Set to false to ignore click event + */ + clickable?: boolean; /** * Set to false to hide */ visible?: boolean; /** - * Opacity. From 0 to 1. + * Opacity. From 0.0 to 1.0 . */ opacity?: number; /** @@ -158,7 +212,7 @@ export interface MarkerOptions { /** * The position of the marker. */ - position?: LatLng; + position?: ILatLng; /** * Specify the anchor of the InfoWindow @@ -186,7 +240,7 @@ export interface MarkerOptions { visible?: boolean; /** - * Specify the options for title. + * Specify the options for title. This property work for normal InfoWindow. */ styles?: any; @@ -196,7 +250,7 @@ export interface MarkerOptions { animation?: string; /** - * iOS only, Plugin Version >= 1.3.3 Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays. (You're able to run this on Android, but it will have no effect) + * Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays. */ zIndex?: number; @@ -223,7 +277,7 @@ export interface MyLocationOptions { } export interface PolygonOptions { - points?: Array; + points?: Array; geodesic?: boolean; strokeColor?: string; strokeWidth?: number; @@ -234,7 +288,7 @@ export interface PolygonOptions { } export interface PolylineOptions { - points?: Array; + points?: Array; visible?: boolean; geodesic?: boolean; color?: string; @@ -349,12 +403,12 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = { * } * ); * - * // create LatLng object - * let ionic: LatLng = new LatLng(43.0741904,-89.3809802); - * * // create CameraPosition * let position: CameraPosition = { - * target: ionic, + * target: { + * lat: 43.0741904, + * lng: -89.3809802 + * }, * zoom: 18, * tilt: 30 * }; @@ -379,6 +433,7 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = { * @classes * GoogleMap * Circle + * Encoding * Environment * Geocoder * GroundOverlay @@ -389,6 +444,7 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = { * Marker * Polygon * Polyline + * Spherical * TileOverlay * BaseClass * BaseArrayClass @@ -423,40 +479,60 @@ export const GoogleMapsMapTypeId: { [mapType: string]: MapType; } = { export class GoogleMaps extends IonicNativePlugin { /** + * Keep a single instance of Environment in memory * @hidden */ _environment: Environment = new Environment(); /** - * Checks if a map object has been created and is available. - * - * @returns {Promise} + * @hidden */ - @Cordova() - isAvailable(): Promise { return; } + _spherical: Spherical = new Spherical(); + + /** + * @hidden + */ + _encoding: Encoding = new Encoding(); /** * Creates a new GoogleMap instance * @param element {string | HTMLElement} Element ID or reference to attach the map to * @param options {any} Options - * @returns {GoogleMap} + * @return {GoogleMap} */ create(element: string | HTMLElement, options?: GoogleMapOptions): GoogleMap { return new GoogleMap(element, options); } /** - * Convenience method that returns an instance of Environment class - * @return {Object} + * Method that returns an instance of Environment class + * @return {Environment} */ environment(): Environment { return this._environment; } + /** + * Method that returns an instance of Spherical class + * @returns {Spherical} + */ + spherical(): Spherical { + return this._spherical; + } + + /** + * Method that returns an instance of Encoding class + * @returns {Encoding} + */ + encoding(): Encoding { + return this._encoding; + } + } /** * @hidden + * https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/class/BaseArrayClass/README.md */ @Plugin({ plugin: 'cordova-plugin-googlemaps', @@ -477,7 +553,7 @@ export class BaseArrayClass extends IonicNativePlugin { /** * Add an event listener * @param event {string} name of the event. Can be `insert_at`, `remove_at`, `set_at`, or `finish`. - * @returns {Observable} returns an Observable + * @return {Observable} returns an Observable */ @InstanceCheck({ observable: true }) on(event: 'insert_at' | 'remove_at' | 'set_at' | 'finish') { @@ -489,14 +565,15 @@ export class BaseArrayClass extends IonicNativePlugin { /** * Removes all elements from the array. + * @param noNotify? {boolean} Set true to prevent remove_at events. */ @CordovaInstance({ sync: true }) - empty(): void {} + empty(noNotify?: boolean): void {} /** * Iterate over each element, calling the provided callback. * @param fn {Function} - * @param callback {Function} + * @param callback? {Function} */ @CordovaInstance({ sync: true }) forEach(fn: ((element: T, index?: number) => void) | ((element: T, callback: () => void) => void), callback?: () => void): void {} @@ -505,12 +582,21 @@ export class BaseArrayClass extends IonicNativePlugin { * Iterate over each element, calling the provided callback. * Then you can get the results of each callback. * @param fn {Function} - * @param callback {Function} + * @param callback? {Function} * @return {Array} returns a new array with the results */ @CordovaInstance({ sync: true }) map(fn: Function, callback?: ((element: T, index: number) => T) | ((element: T, callback: (newElement: T) => void) => void)): T[] { return; } + /** + * The filter() method creates a new array with all elements that pass the test implemented by the provided function. + * @param fn {Function} + * @param callback? {Function} + * @return {Array} returns a new array with the results + */ + @CordovaInstance({ sync: true }) + filter(fn: Function, callback?: ((element: T, index: number) => T) | ((element: T, callback: (newElement: T) => void) => void)): T[] { return; } + /** * Returns a reference to the underlying Array. * @return {Array} @@ -526,47 +612,80 @@ export class BaseArrayClass extends IonicNativePlugin { @CordovaInstance({ sync: true }) getAt(index: number): any {} + /** + * Returns the number of the elements. + * @return {number} + */ + @CordovaInstance({ sync: true }) + getLength(): number { return; } + + /** + * The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present. + * @param element {Object} + * @return {number} + */ + @CordovaInstance({ sync: true }) + indexOf(element: T): number { return; } + + /** + * The reverse() method reverses an array in place. + */ + @CordovaInstance({ sync: true }) + reverse(): void {} + + /** + * The sort() method sorts the elements of an array in place and returns the array. + */ + @CordovaInstance({ sync: true }) + sort(): void {} + /** * Inserts an element at the specified index. * @param index {number} * @param element {Object} + * @param noNotify? {boolean} Set true to prevent insert_at events. * @return {Object} */ @CordovaInstance({ sync: true }) - insertAt(index: number, element: T) {} + insertAt(index: number, element: T, noNotify?: boolean) {} /** * Removes the last element of the array and returns that element. + * @param noNotify? {boolean} Set true to prevent remove_at events. * @return {Object} */ @CordovaInstance({ sync: true }) - pop(): T { return; } + pop(noNotify?: boolean): T { return; } /** * Adds one element to the end of the array and returns the new length of the array. * @param element {object} + * @param noNotify? {boolean} Set true to prevent insert_at events. */ @CordovaInstance({ sync: true }) - push(element: T): void {} + push(element: T, noNotify?: boolean): void {} /** * Removes an element from the specified index. * @param index {number} + * @param noNotify? {boolean} Set true to prevent insert_at events. */ @CordovaInstance({ sync: true }) - removeAt(index: number): void {} + removeAt(index: number, noNotify?: boolean): void {} /** * Sets an element at the specified index. * @param index {number} * @param element {object} + * @param noNotify? {boolean} Set true to prevent set_at events. */ @CordovaInstance({ sync: true }) - setAt(index: number, element: T): void {} + setAt(index: number, element: T, noNotify?: boolean): void {} } /** * @hidden + * https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/class/BaseClass/README.md */ export class BaseClass { protected _objectInstance: any; @@ -574,7 +693,7 @@ export class BaseClass { /** * Adds an event listener. * - * @returns {Observable} + * @return {Observable} */ @InstanceCheck() addEventListener(eventName: string): Observable { @@ -584,7 +703,7 @@ export class BaseClass { /** * Adds an event listener that works once. * - * @returns {Promise} + * @return {Promise} */ @InstanceCheck() addListenerOnce(eventName: string): Promise { @@ -606,10 +725,20 @@ export class BaseClass { @CordovaInstance({ sync: true }) set(key: string, value: any): void { } + /** + * Bind a key to another object + * @param key {string} + * @param target {any} + * @param targetKey? {string} + * @param noNotify? {boolean} + */ + @CordovaInstance({ sync: true }) + bindTo(key: string, target: any, targetKey: string, noNotify: boolean): void { } + /** * Listen to a map event. * - * @returns {Observable} + * @return {Observable} */ @InstanceCheck({ observable: true }) on(eventName: string): Observable { @@ -619,7 +748,7 @@ export class BaseClass { /** * Listen to a map event only once. * - * @returns {Promise} + * @return {Promise} */ @InstanceCheck() one(eventName: string): Promise { @@ -632,33 +761,46 @@ export class BaseClass { @CordovaInstance({ sync: true }) empty(): void { } + /** + * Dispatch event. + */ @CordovaInstance({ sync: true }) trigger(eventName: string, ...parameters: any[]): void {} } /** * @hidden + * https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/class/Circle/README.md */ export class Circle extends BaseClass { - constructor(_objectInstance: any) { + private _map: GoogleMap; + + constructor(_map: GoogleMap, _objectInstance: any) { super(); + this._map = _map; this._objectInstance = _objectInstance; } + /** + * Return the map instance. + * @return {GoogleMap} + */ + getMap(): any { return this._map; } + /** * Change the center position. - * @param latLng {LatLng} + * @param latLng {ILatLng} */ @CordovaInstance({ sync: true }) - setCenter(latLng: LatLng): void {} + setCenter(latLng: ILatLng): void {} /** * Return the current center position - * @return {LatLng} + * @return {ILatLng} */ @CordovaInstance({ sync: true }) - getCenter(): LatLng { return; } + getCenter(): ILatLng { return; } /** * Return the current circle radius. @@ -785,7 +927,7 @@ export class Environment extends IonicNativePlugin { /** * Get the open source software license information for Google Maps Android API v2 and Google Maps SDK for iOS. - * @returns {Promise} + * @return {Promise} */ @Cordova() getLicenseInfo(): Promise { return; } @@ -812,12 +954,123 @@ export class Geocoder { /** * Converts position to address and vice versa * @param {GeocoderRequest} request Request object with either an address or a position - * @returns {Promise>} + * @return {Promise>} */ @Cordova() geocode(request: GeocoderRequest): Promise> { return; } } +/** + * @hidden + */ +@Plugin({ + pluginName: 'GoogleMaps', + pluginRef: 'plugin.google.maps.geometry.encoding', + plugin: 'cordova-plugin-googlemaps', + repo: '' +}) +export class Encoding { + /** + * Decodes an encoded path string into a sequence of LatLngs. + * @param encoded {string} an encoded path string + * @param precision? {number} default: 5 + * @return {LatLng} + */ + @Cordova({ sync: true }) + decodePath(encoded: string, precision?: number): LatLng { return; } + + /** + * Encodes a sequence of LatLngs into an encoded path string. + * @param path {Array | BaseArrayClass} a sequence of LatLngs + * @return {string} + */ + @Cordova({ sync: true }) + encodePath(path: Array | BaseArrayClass): string { return; } +} + +/** + * @hidden + */ +@Plugin({ + pluginName: 'GoogleMaps', + pluginRef: 'plugin.google.maps.geometry.spherical', + plugin: 'cordova-plugin-googlemaps', + repo: '' +}) +export class Spherical { + /** + * Returns the distance, in meters, between two LatLngs. + * @param locationA {ILatLng} + * @param locationB {ILatLng} + * @return {number} + */ + @Cordova({ sync: true }) + computeDistanceBetween(from: ILatLng, to: ILatLng): number { return; } + + /** + * Returns the LatLng resulting from moving a distance from an origin in the specified heading (expressed in degrees clockwise from north) + * @param from {ILatLng} + * @param distance {number} + * @param heading {number} + * @return {LatLng} + */ + @Cordova({ sync: true }) + computeOffset(from: ILatLng, distance: number, heading: number): LatLng { return; } + + /** + * Returns the location of origin when provided with a LatLng destination, meters travelled and original heading. Headings are expressed in degrees clockwise from North. This function returns null when no solution is available. + * @param to {ILatLng} The destination LatLng. + * @param distance {number} The distance travelled, in meters. + * @param heading {number} The heading in degrees clockwise from north. + * @return {LatLng} + */ + @Cordova({ sync: true }) + computeOffsetOrigin(to: ILatLng, distance: number, heading: number): LatLng { return; } + + /** + * Returns the length of the given path. + * @param path {Array | BaseArrayClass} + * @return {number} + */ + @Cordova({ sync: true }) + computeLength(path: Array | BaseArrayClass): number { return; } + + /** + * Returns the area of a closed path. The computed area uses the same units as the radius. + * @param path {Array | BaseArrayClass}. + * @return {number} + */ + @Cordova({ sync: true }) + computeArea(path: Array | BaseArrayClass): number { return; } + + /** + * Returns the signed area of a closed path. The signed area may be used to determine the orientation of the path. + * @param path {Array | BaseArrayClass}. + * @return {number} + */ + @Cordova({ sync: true }) + computeSignedArea(path: Array | BaseArrayClass): number { return; } + + /** + * Returns the heading from one LatLng to another LatLng. Headings are expressed in degrees clockwise from North within the range (-180,180). + * @param from {ILatLng} + * @param to {ILatLng} + * @return {number} + */ + @Cordova({ sync: true }) + computeHeading(from: ILatLng, to: ILatLng): number { return; } + + /** + * Returns the LatLng which lies the given fraction of the way between the origin LatLng and the destination LatLng. + * @param from {ILatLng} The LatLng from which to start. + * @param to {ILatLng} The LatLng toward which to travel. + * @param fraction {number} A fraction of the distance to travel from 0.0 to 1.0 . + * @return {LatLng} + */ + @Cordova({ sync: true }) + interpolate(from: ILatLng, to: ILatLng, fraction: number): LatLng { return; } +} + /** * @hidden */ @@ -859,48 +1112,52 @@ export class GoogleMap extends BaseClass { /** * Moves the camera with animation - * @returns {Promise} + * @return {Promise} */ @CordovaInstance() animateCamera(animateCameraOptions: AnimateCameraOptions): Promise { return; } /** * Zooming in the camera with animation + * @return {Promise} */ @CordovaInstance() - animateCameraZoomIn(): void {} + animateCameraZoomIn(): Promise { return; } /** * Zooming out the camera with animation + * @return {Promise} */ @CordovaInstance() - animateCameraZoomOut(): void {} + animateCameraZoomOut(): Promise { return; } /** * Moves the camera without animation - * @returns {Promise} + * @return {Promise} */ @CordovaInstance() moveCamera(cameraPosition: CameraPosition): Promise { return; } /** * Zooming in the camera without animation + * @return {Promise} */ @CordovaInstance() - moveCameraZoomIn(): void {} + moveCameraZoomIn(): Promise { return; } /** * Zooming out the camera without animation + * @return {Promise} */ @CordovaInstance() - moveCameraZoomOut(): void {} + moveCameraZoomOut(): Promise { return; } /** * Get the position of the camera. - * @returns {Promise} + * @return {CameraPosition} */ - @CordovaInstance() - getCameraPosition(): Promise { return; } + @CordovaInstance({ sync: true }) + getCameraPosition(): CameraPosition { return; } /** * Get the current camera target position @@ -932,10 +1189,10 @@ export class GoogleMap extends BaseClass { /** * Set the center position of the camera view - * @param latLng {LatLng} + * @param latLng {ILatLng | Array} */ @CordovaInstance({ sync: true }) - setCameraTarget(latLng: LatLng): void { } + setCameraTarget(latLng: ILatLng | Array): void { } /** * Set zoom level of the camera @@ -967,15 +1224,15 @@ export class GoogleMap extends BaseClass { panBy(x: string | number, y: string | number): void { } /** - * Get the current visible region (sw and ne) - * @returns {Promise} + * Get the current visible region (southWest and northEast) + * @return {VisibleRegion} */ - @CordovaInstance() - getVisibleRegion(): Promise { return; } + @CordovaInstance({ sync: true }) + getVisibleRegion(): VisibleRegion { return; } /** * Get the current device location - * @returns {Promise} + * @return {Promise} */ @CordovaInstance() getMyLocation(options?: MyLocationOptions): Promise { return; } @@ -995,20 +1252,21 @@ export class GoogleMap extends BaseClass { /** * Remove all overlays, such as marker + * @return {Promise} */ @CordovaInstance({ sync: true }) - clear(): void {} + clear(): Promise { return; } /** * Convert the unit from LatLng to the pixels from the left/top of the map div - * @returns {Promise} + * @return {Promise} */ @CordovaInstance() - fromLatLngToPoint(latLng: LatLng): Promise { return; } + fromLatLngToPoint(latLng: ILatLng): Promise { return; } /** * Convert the unit from the pixels from the left/top to the LatLng - * @returns {Promise} + * @return {Promise} */ @CordovaInstance() fromPointToLatLng(point: any): Promise { return; } @@ -1056,14 +1314,14 @@ export class GoogleMap extends BaseClass { setAllGesturesEnabled(enabled: boolean): void {} /** - * Set visiblity of the map + * Set visibility of the map * @param visible {boolean} */ @CordovaInstance({ sync: true }) setVisible(visible: boolean): void {} /** - * Adjust the map padding + * Adjust the map padding (same as CSS padding rule) * @param top {number} * @param right {number} * @param left {number} @@ -1081,14 +1339,14 @@ export class GoogleMap extends BaseClass { /** * Adds a marker - * @returns {Promise} + * @return {Promise} */ @InstanceCheck() addMarker(options: MarkerOptions): Promise { return new Promise((resolve, reject) => { this._objectInstance.addMarker(options, (marker: any) => { if (marker) { - resolve(new Marker(marker)); + resolve(new Marker(this, marker)); } else { reject(); } @@ -1098,14 +1356,14 @@ export class GoogleMap extends BaseClass { /** * Adds a circle - * @returns {Promise} + * @return {Promise} */ @InstanceCheck() addCircle(options: CircleOptions): Promise { return new Promise((resolve, reject) => { this._objectInstance.addCircle(options, (circle: any) => { if (circle) { - resolve(new Circle(circle)); + resolve(new Circle(this, circle)); } else { reject(); } @@ -1115,14 +1373,14 @@ export class GoogleMap extends BaseClass { /** * Adds a polygon - * @returns {Promise} + * @return {Promise} */ @InstanceCheck() addPolygon(options: PolygonOptions): Promise { return new Promise((resolve, reject) => { this._objectInstance.addPolygon(options, (polygon: any) => { if (polygon) { - resolve(new Polygon(polygon)); + resolve(new Polygon(this, polygon)); } else { reject(); } @@ -1132,14 +1390,14 @@ export class GoogleMap extends BaseClass { /** * - * @returns {Promise} + * @return {Promise} */ @InstanceCheck() addPolyline(options: PolylineOptions): Promise { return new Promise((resolve, reject) => { this._objectInstance.addPolyline(options, (polyline: any) => { if (polyline) { - resolve(new Polyline(polyline)); + resolve(new Polyline(this, polyline)); } else { reject(); } @@ -1148,14 +1406,14 @@ export class GoogleMap extends BaseClass { } /** - * @returns {Promise} + * @return {Promise} */ @InstanceCheck() addTileOverlay(options: TileOverlayOptions): Promise { return new Promise((resolve, reject) => { this._objectInstance.addTileOverlay(options, (tileOverlay: any) => { if (tileOverlay) { - resolve(new TileOverlay(tileOverlay)); + resolve(new TileOverlay(this, tileOverlay)); } else { reject(); } @@ -1164,14 +1422,14 @@ export class GoogleMap extends BaseClass { } /** - * @returns {Promise} + * @return {Promise} */ @InstanceCheck() addGroundOverlay(options: GroundOverlayOptions): Promise { return new Promise((resolve, reject) => { this._objectInstance.addGroundOverlay(options, (groundOverlay: any) => { if (groundOverlay) { - resolve(new GroundOverlay(groundOverlay)); + resolve(new GroundOverlay(this, groundOverlay)); } else { reject(); } @@ -1187,13 +1445,13 @@ export class GoogleMap extends BaseClass { refreshLayout(): void {} /** - * @returns {Promise} + * @return {Promise} */ @CordovaInstance() toDataURL(): Promise { return; } // /** - // * @returns {Promise} + // * @return {Promise} // */ // @InstanceCheck() // addKmlOverlay(options: KmlOverlayOptions): Promise { @@ -1214,25 +1472,27 @@ export class GoogleMap extends BaseClass { */ export class GroundOverlay extends BaseClass { - constructor(_objectInstance: any) { + private _map: GoogleMap; + + constructor(_map: GoogleMap, _objectInstance: any) { super(); + this._map = _map; this._objectInstance = _objectInstance; } + /** + * Return the map instance. + * @return {GoogleMap} + */ + getMap(): any { return this._map; } + /** * Change the bounds of the GroundOverlay - * @param bounds {ILatLng[]} + * @param bounds { ILatLng[]} */ @CordovaInstance({ sync: true }) setBounds(bounds: ILatLng[]): void {} - /** - * Return the current center position - * @return {ILatLng[]} - */ - @CordovaInstance({ sync: true }) - getBounds(): ILatLng[] { return; } - /** * Change the bearing of the ground overlay * @param bearing {number} @@ -1254,7 +1514,7 @@ export class GroundOverlay extends BaseClass { setImage(image: string): void {}; /** - * Change the opacity of the ground overlay + * Change the opacity of the ground overlay from 0.0 to 1.0 * @param opacity {number} */ @CordovaInstance({ sync: true }) @@ -1409,7 +1669,7 @@ export class LatLngBounds { toString(): string { return; } /** - * Returns a string of the form "lat_lo,lng_lo,lat_hi,lng_hi" for this bounds, where "lo" corresponds to the southwest corner of the bounding box, while "hi" corresponds to the northeast corner of that box. + * Returns a string of the form "lat_sw,lng_sw,lat_ne,lng_ne" for this bounds, where "sw" corresponds to the southwest corner of the bounding box, while "ne" corresponds to the northeast corner of that box. * @param precision {number} * @return {string} */ @@ -1432,7 +1692,7 @@ export class LatLngBounds { /** * Computes the center of this LatLngBounds - * @return {ILatLng} + * @return {LatLng} */ @CordovaInstance({ sync: true }) getCenter(): LatLng { return; } @@ -1443,38 +1703,45 @@ export class LatLngBounds { */ export class Marker extends BaseClass { - constructor(_objectInstance: any) { + private _map: GoogleMap; + + constructor(_map: GoogleMap, _objectInstance: any) { super(); + this._map = _map; this._objectInstance = _objectInstance; } + /** + * Return the map instance. + * @return {GoogleMap} + */ + getMap(): any { return this._map; } + /** * Set the marker position. - * @param latLng {LatLng} + * @param latLng {ILatLng} */ @CordovaInstance({ sync: true }) - setPosition(latLng: LatLng): void { return; } + setPosition(latLng: ILatLng): void { return; } /** * Return the marker position. - * @return {Promise} - */ - @CordovaInstance() - getPosition(): Promise { return; } - - /** - * Show the infoWindow of the marker. - * @return {number} + * @return {ILatLng} */ @CordovaInstance({ sync: true }) - showInfoWindow(): number { return; } + getPosition(): ILatLng { return; } /** - * Hide the infoWindow of the marker. - * @return {number} + * Show the normal infoWindow of the marker. */ @CordovaInstance({ sync: true }) - hideInfoWindow(): number { return; } + showInfoWindow(): void {} + + /** + * Hide the normal infoWindow of the marker. + */ + @CordovaInstance({ sync: true }) + hideInfoWindow(): void {} /** * Specify the animation either `DROP` or `BOUNCE` @@ -1494,7 +1761,7 @@ export class Marker extends BaseClass { * Set false if you want to hide the marker. * @param visible */ - @CordovaInstance() + @CordovaInstance({ sync: true }) setVisible(visible: boolean): void {} /** @@ -1504,7 +1771,7 @@ export class Marker extends BaseClass { isVisible(): boolean { return; } /** - * Change title of the infoWindow. + * Change title of the normal infoWindow. * @param title {string} */ @CordovaInstance({ sync: true }) @@ -1518,7 +1785,7 @@ export class Marker extends BaseClass { getTitle(): string { return; } /** - * Change snippet of the infoWindow. + * Change snippet of the normal infoWindow. * @param snippet {string} */ @CordovaInstance({ sync: true }) @@ -1532,7 +1799,7 @@ export class Marker extends BaseClass { getSnippet(): string { return; } /** - * Change the marker opacity. + * Change the marker opacity from 0.0 to 1.0. * @param alpha {number} Opacity */ @CordovaInstance({ sync: true }) @@ -1546,29 +1813,29 @@ export class Marker extends BaseClass { getOpacity(): number { return; } /** - * Remove the marker completely. + * Remove the marker. */ @CordovaInstance({ sync: true }) remove(): void {} /** * Change the info window anchor. This defaults to 50% from the left of the image and at the bottom of the image. - * @param x {number} - * @param y {number} + * @param x {number} Distance from left of the icon image in pixels. + * @param y {number} Distance from top of the icon image in pixels. */ @CordovaInstance({ sync: true }) setIconAnchor(x: number, y: number): void {} /** * Change the info window anchor. This defaults to 50% from the left of the image and at the top of the image. - * @param x {number} - * @param y {number} + * @param x {number} Distance from left of the icon image in pixels. + * @param y {number} Distance from top of the icon image in pixels. */ @CordovaInstance({ sync: true }) setInfoWindowAnchor(x: number, y: number): void {} /** - * Retrurn true if the infoWindow is shown on the marker + * Return true if the infoWindow is shown on the marker * @return {boolean} */ @CordovaInstance({ sync: true }) @@ -1582,10 +1849,11 @@ export class Marker extends BaseClass { getHashCode(): string { return; } /** - * iOS only, Plugin Version >= 1.3.3 Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays. (You're able to run this on Android, but it will have no effect) + * Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays. + * @param y {number} z-index */ @CordovaInstance({ sync: true }) - setZIndex(): void {} + setZIndex(zIndex: number): void {} /** * Get z-index @@ -1595,7 +1863,7 @@ export class Marker extends BaseClass { getZIndex(): number { return; } /** - * Set true if you allows all users to drag the marker. + * Set true if you allow all users to drag the marker. * @param draggable {boolean} */ @CordovaInstance({ sync: true }) @@ -1636,14 +1904,6 @@ export class Marker extends BaseClass { @CordovaInstance({ sync: true }) getRotation(): number { return; } - /** - * Return the map instance. - * Note that this method returns the original Google Map object, and not the Ionic Native wrapper. - * @return {Object} - */ - @CordovaInstance({ sync: true }) - getMap(): any { return; } - } /** @@ -1651,11 +1911,20 @@ export class Marker extends BaseClass { */ export class Polygon extends BaseClass { - constructor(_objectInstance: any) { + private _map: GoogleMap; + + constructor(_map: GoogleMap, _objectInstance: any) { super(); + this._map = _map; this._objectInstance = _objectInstance; } + /** + * Return the map instance. + * @return {GoogleMap} + */ + getMap(): any { return this._map; } + /** * Change the polygon points. * @param points {ILatLng[]} @@ -1701,7 +1970,7 @@ export class Polygon extends BaseClass { getFillColor(): string { return; } /** - * Change the stroke color (outter color) + * Change the stroke color (outer color) * @param strokeColor {string} */ @CordovaInstance({ sync: true }) @@ -1755,12 +2024,21 @@ export class Polygon extends BaseClass { @CordovaInstance({ sync: true }) getZIndex(): number { return; } + /** + * Remove the polygon. + */ @CordovaInstance({ sync: true }) remove(): void {} + /** + * Change the polygon stroke width + */ @CordovaInstance({ sync: true }) setStrokeWidth(strokeWidth: number): void {} + /** + * Return the polygon stroke width + */ @CordovaInstance({ sync: true }) getStrokeWidth(): number { return; } @@ -1777,6 +2055,7 @@ export class Polygon extends BaseClass { */ @CordovaInstance({ sync: true }) getGeodesic(): boolean { return; } + } /** @@ -1784,11 +2063,20 @@ export class Polygon extends BaseClass { */ export class Polyline extends BaseClass { - constructor(_objectInstance: any) { + private _map: GoogleMap; + + constructor(_map: GoogleMap, _objectInstance: any) { super(); + this._map = _map; this._objectInstance = _objectInstance; } + /** + * Return the map instance. + * @return {GoogleMap} + */ + getMap(): any { return this._map; } + /** * Change the polyline points. * @param points {ILatLng[]} @@ -1801,7 +2089,7 @@ export class Polyline extends BaseClass { * You can modify the points. */ @CordovaInstance({ sync: true }) - getPoints(): BaseArrayClass { return; } + getPoints(): BaseArrayClass { return; } /** * When true, edges of the polyline are interpreted as geodesic and will follow the curvature of the Earth. @@ -1892,9 +2180,6 @@ export class Polyline extends BaseClass { @CordovaInstance({ sync: true }) remove(): void {} - @CordovaInstance({ sync: true }) - getMap(): any { return; } - } /** @@ -1902,11 +2187,20 @@ export class Polyline extends BaseClass { */ export class TileOverlay extends BaseClass { - constructor(_objectInstance: any) { + private _map: GoogleMap; + + constructor(_map: GoogleMap, _objectInstance: any) { super(); + this._map = _map; this._objectInstance = _objectInstance; } + /** + * Return the map instance. + * @return {GoogleMap} + */ + getMap(): any { return this._map; } + /** * Set whether the tiles should fade in. * @param fadeIn {boolean} @@ -1995,7 +2289,7 @@ export class TileOverlay extends BaseClass { // /** // * Adds an event listener. // * -// * @returns {Observable} +// * @return {Observable} // */ // addEventListener(eventName: string): Observable { // return Observable.fromEvent(this._objectInstance, eventName); @@ -2004,7 +2298,7 @@ export class TileOverlay extends BaseClass { // /** // * Adds an event listener that works once. // * -// * @returns {Promise} +// * @return {Promise} // */ // addListenerOnce(eventName: string): Promise { // if (!this._objectInstance) { @@ -2033,7 +2327,7 @@ export class TileOverlay extends BaseClass { // /** // * Listen to a map event. // * -// * @returns {Observable} +// * @return {Observable} // */ // on(eventName: string): Observable { // if (!this._objectInstance) { @@ -2053,7 +2347,7 @@ export class TileOverlay extends BaseClass { // /** // * Listen to a map event only once. // * -// * @returns {Promise} +// * @return {Promise} // */ // one(eventName: string): Promise { // if (!this._objectInstance) {