mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
add googlemap features
This commit is contained in:
parent
6c485ed1f6
commit
9f67fa79db
@ -21,7 +21,7 @@ declare var plugin: any;
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginRef: 'plugin.google.maps',
|
||||
pluginRef: 'plugin.google.maps.Map',
|
||||
plugin: 'cordova-plugin-googlemaps',
|
||||
repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps'
|
||||
})
|
||||
@ -29,21 +29,198 @@ export class GoogleMaps {
|
||||
|
||||
private _objectInstance: any;
|
||||
|
||||
/**
|
||||
* Checks if a map object has been created.
|
||||
* @return {Promise<GoogleMaps>} returns a promise that resolves with the Map object (if it exists).
|
||||
*/
|
||||
@Cordova()
|
||||
static isAvailable (): Promise<GoogleMaps> {return; }
|
||||
|
||||
constructor (elementId: string) {
|
||||
this._objectInstance = plugin.google.maps.Map.getMap(document.getElementById(elementId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get notified via an Observable when the user clicks on the map. (Event: MAP_CLICK)
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'plugin.google.maps.event.MAP_CLICK'
|
||||
})
|
||||
static onMapClick (): Observable<GoogleMaps> {return; }
|
||||
|
||||
/**
|
||||
* Get notified via an Observable when the user long-clicks on the map. (Event: MAP_LONG_CLICK)
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'plugin.google.maps.event.MAP_LONG_CLICK'
|
||||
})
|
||||
static onMapLongClick (): Observable<GoogleMaps> {return; }
|
||||
|
||||
/**
|
||||
* Get notified via an Observable when the user clicks the `My Location` button. (Event: MY_LOCATION_BUTTON_CLICK)
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'plugin.google.maps.event.MY_LOCATION_BUTTON_CLICK'
|
||||
})
|
||||
static onMyLocationButtonClick (): Observable<GoogleMaps> {return; }
|
||||
|
||||
/**
|
||||
* Get notified via an Observable when the user changes the view. (Event: CAMERA_CHANGE)
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'plugin.google.maps.event.CAMERA_CHANGE'
|
||||
})
|
||||
static onCameraChange (): Observable<GoogleMaps> {return; }
|
||||
|
||||
/**
|
||||
* Get notified via an Observable when the view is on idle. (Event: CAMERA_IDLE)
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'plugin.google.maps.event.CAMERA_IDLE',
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static onCameraIdle (): Observable<GoogleMaps> {return; }
|
||||
|
||||
/**
|
||||
* Get notified via an Observable when the map is ready. (Event: MAP_READY)
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'plugin.google.maps.event.MAP_READY'
|
||||
})
|
||||
static onInit (): Observable<GoogleMaps> {return; }
|
||||
static onMapReady (): Observable<GoogleMaps> {return; }
|
||||
|
||||
/**
|
||||
* Get notified via an Observable when the map is loaded. (Event: MAP_LOADED)
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'plugin.google.maps.event.MAP_LOADED',
|
||||
platforms: ['Android']
|
||||
})
|
||||
static onMapLoaded (): Observable<GoogleMaps> {return; }
|
||||
|
||||
/**
|
||||
* Get notified via an Observable when the map will move. (Event: MAP_WILL_MOVE)
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'plugin.google.maps.event.MAP_WILL_MOVE',
|
||||
platforms: ['iOS']
|
||||
})
|
||||
static onMapWillMove (): Observable<GoogleMaps> {return; }
|
||||
|
||||
/**
|
||||
* Get notified via an Observable when the user closes the map. (Event: MAP_CLOSE)
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'plugin.google.maps.event.MAP_CLOSE'
|
||||
})
|
||||
static onMapClose (): Observable<GoogleMaps> {return; }
|
||||
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
setDebuggable (isDebuggable: boolean): void {}
|
||||
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
setClickable (isClickable: boolean): void {}
|
||||
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
animateCamera (options: AnimateCameraOptions): void {return; }
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getCameraPosition (): Promise<CameraPosition> {return; }
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getMyLocation (): Promise<MyLocation> {return; }
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getVisibleRegion (): Promise<VisibleRegion> {return; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
export interface AnimateCameraOptions {
|
||||
target: string;
|
||||
tilt: number;
|
||||
zoom: number;
|
||||
bearing: number;
|
||||
duration: number;
|
||||
}
|
||||
|
||||
export interface CameraPosition {
|
||||
target: {
|
||||
lat: string;
|
||||
lng: string;
|
||||
};
|
||||
zoom: number;
|
||||
tilt: number;
|
||||
bearing: number;
|
||||
}
|
||||
|
||||
export interface MyLocation {
|
||||
latLng: {
|
||||
lat: string;
|
||||
lng: string;
|
||||
};
|
||||
speed: number;
|
||||
time: string;
|
||||
bearing: number;
|
||||
}
|
||||
|
||||
export interface VisibleRegion {
|
||||
northeast: any;
|
||||
southwest: any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
Google Maps LatLng
|
||||
**/
|
||||
@Plugin({
|
||||
pluginRef: 'plugin.google.maps.Map',
|
||||
plugin: 'cordova-plugin-googlemaps',
|
||||
repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps'
|
||||
})
|
||||
export class GoogleMapsLatLng {
|
||||
constructor (public lat: string, public lng: string) {
|
||||
return plugin.google.maps.LatLng(lat, lng);
|
||||
}
|
||||
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
equals (other: GoogleMapsLatLng): boolean {return; }
|
||||
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
toString (): string {return; }
|
||||
|
||||
@CordovaInstance({
|
||||
sync: true
|
||||
})
|
||||
toUrlValue (precision?: number): string {return; }
|
||||
}
|
Loading…
Reference in New Issue
Block a user