UNPKG

@nativescript/google-maps

Version:
418 lines (417 loc) 15.8 kB
import { Color, ImageSource } from '@nativescript/core'; import { CircleOptions, Coordinate, CoordinateBounds, GroundOverlayOptions, ICameraPosition, ICameraUpdate, ICircle, IGoogleMap, IGroundOverlay, IIndoorBuilding, IIndoorLevel, IMarker, IPatternItem, ICap, IPoi, IPolygon, IPolyline, IProjection, ITileOverlay, ITileProvider, IUISettings, IVisibleRegion, MarkerOptions, PolygonOptions, PolylineOptions, Style, TileOverlayOptions, ILocation } from '.'; import { JointType, MapType, MapViewBase } from './common'; export { hueFromColor, intoNativeMarkerOptions } from './utils'; export declare class CameraUpdate implements ICameraUpdate { _native: GMSCameraUpdate; static fromNative(nativeUpdate: GMSCameraUpdate): CameraUpdate; static fromCoordinate(coordinate: Coordinate, zoom?: number): CameraUpdate; static fromCoordinates(coordinates: Coordinate[], padding: number): any; static fromCameraPosition(position: CameraPosition): CameraUpdate; static zoomIn(): CameraUpdate; static zoomOut(): CameraUpdate; static zoomTo(value: number): CameraUpdate; static zoomBy(amount: number, point?: { x: number; y: number; }): CameraUpdate; static scrollBy(x: number, y: number): CameraUpdate; get native(): GMSCameraUpdate; get ios(): GMSCameraUpdate; } export declare class CameraPosition implements ICameraPosition { _native: GMSCameraPosition; constructor(target: Coordinate, zoom: number, bearing?: number, tilt?: number); static fromNative(nativePosition: GMSCameraPosition): CameraPosition; get native(): GMSCameraPosition; get ios(): GMSCameraPosition; get bearing(): number; set bearing(value: number); get target(): Coordinate; set target(value: Coordinate); get tilt(): number; set tilt(value: number); get zoom(): number; set zoom(value: number); toJSON(): { target: Coordinate; tilt: number; bearing: number; zoom: number; }; } export declare class Location implements ILocation { private _native; static fromNative(location: CLLocation): Location; get native(): CLLocation; get ios(): CLLocation; get altitudeAccuracy(): number; get accuracy(): number; get coordinate(): Coordinate; get timestamp(): Date; get altitude(): number; get speed(): number; get heading(): number; } declare class GMSMapViewDelegateImpl extends NSObject implements GMSMapViewDelegate { _owner: WeakRef<MapView>; _pendingSnapshotResolveQueue: any[]; _pendingSnapshotRejectQueue: any[]; static initWithOwner(owner: WeakRef<MapView>): GMSMapViewDelegateImpl; didTapMyLocationButtonForMapView(mapView: GMSMapView): boolean; mapViewDidBeginDraggingMarker(mapView: GMSMapView, marker: GMSMarker): void; mapViewDidChangeCameraPosition(mapView: GMSMapView, position: GMSCameraPosition): void; mapViewDidCloseInfoWindowOfMarker(mapView: GMSMapView, marker: GMSMarker): void; mapViewDidDragMarker(mapView: GMSMapView, marker: GMSMarker): void; mapViewDidEndDraggingMarker(mapView: GMSMapView, marker: GMSMarker): void; mapViewDidFinishTileRendering(mapView: GMSMapView): void; mapViewDidLongPressAtCoordinate(mapView: GMSMapView, coordinate: CLLocationCoordinate2D): void; mapViewDidLongPressInfoWindowOfMarker(mapView: GMSMapView, marker: GMSMarker): void; mapViewDidStartTileRendering(mapView: GMSMapView): void; mapViewDidTapAtCoordinate(mapView: GMSMapView, coordinate: CLLocationCoordinate2D): void; mapViewDidTapInfoWindowOfMarker(mapView: GMSMapView, marker: GMSMarker): void; mapViewDidTapMarker(mapView: GMSMapView, marker: GMSMarker): boolean; mapViewDidTapMyLocation(mapView: GMSMapView, location: CLLocationCoordinate2D): void; mapViewDidTapOverlay(mapView: GMSMapView, overlay: GMSOverlay): void; mapViewDidTapPOIWithPlaceIDNameLocation(mapView: GMSMapView, placeID: string, name: string, location: CLLocationCoordinate2D): void; mapViewIdleAtCameraPosition(mapView: GMSMapView, position: GMSCameraPosition): void; mapViewMarkerInfoContents(mapView: GMSMapView, marker: GMSMarker): UIView; mapViewMarkerInfoWindow(mapView: GMSMapView, marker: GMSMarker): UIView; mapViewSnapshotReady(mapView: GMSMapView): void; mapViewWillMove(mapView: GMSMapView, gesture: boolean): void; } declare class GMSIndoorDisplayDelegateImpl extends NSObject implements GMSIndoorDisplayDelegate { _owner: WeakRef<MapView>; static initWithOwner(owner: WeakRef<MapView>): GMSIndoorDisplayDelegateImpl; didChangeActiveBuilding(building: GMSIndoorBuilding): void; didChangeActiveLevel(level: GMSIndoorLevel): void; } export declare class MapView extends MapViewBase { nativeView: GMSMapView; _delegate: GMSMapViewDelegateImpl; _indoorDelegate: GMSIndoorDisplayDelegateImpl; static _didInit: boolean; static _init(): void; createNativeView(): GMSMapView; initNativeView(): void; disposeNativeView(): void; _isReady: boolean; onLoaded(): void; _updateCamera(map: GMSMapView, owner: { lat?: any; lng?: any; zoom?: any; tilt?: any; bearing?: any; }): void; onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void; } export declare class IndoorLevel implements IIndoorLevel { _native: GMSIndoorLevel; static fromNative(nativeIndoorLevel: GMSIndoorLevel): IndoorLevel; get native(): GMSIndoorLevel; get ios(): GMSIndoorLevel; get name(): string; get shortName(): string; } export declare class IndoorBuilding implements IIndoorBuilding { _native: GMSIndoorBuilding; static fromNative(nativeIndoorBuilding: GMSIndoorBuilding): IndoorBuilding; get native(): GMSIndoorBuilding; get ios(): GMSIndoorBuilding; get defaultLevelIndex(): number; get levels(): IndoorLevel[]; get underground(): boolean; } export declare class UISettings implements IUISettings { _native: GMSUISettings; static fromNative(nativeUiSettings: GMSUISettings): UISettings; get native(): GMSUISettings; get ios(): GMSUISettings; mapToolbarEnabled: boolean; zoomControlsEnabled: boolean; get zoomGesturesEnabled(): boolean; set zoomGesturesEnabled(value: boolean); get tiltGesturesEnabled(): boolean; set tiltGesturesEnabled(value: boolean); setAllGesturesEnabled(value: boolean): void; get compassEnabled(): boolean; set compassEnabled(value: boolean); get scrollGesturesEnabledDuringRotateOrZoom(): boolean; set scrollGesturesEnabledDuringRotateOrZoom(value: boolean); get rotateGesturesEnabled(): boolean; set rotateGesturesEnabled(value: boolean); get myLocationButtonEnabled(): boolean; set myLocationButtonEnabled(value: boolean); get indoorLevelPickerEnabled(): boolean; set indoorLevelPickerEnabled(value: boolean); get scrollGesturesEnabled(): boolean; set scrollGesturesEnabled(value: boolean); } export declare class GoogleMap implements IGoogleMap { _native: GMSMapView; static fromNative(nativeMap: GMSMapView): GoogleMap; get native(): GMSMapView; get ios(): GMSMapView; get buildingsEnabled(): boolean; set buildingsEnabled(value: boolean); get cameraPosition(): CameraPosition; set cameraPosition(value: CameraPosition); get maxZoomLevel(): number; set maxZoomLevel(value: number); get minZoomLevel(): number; set minZoomLevel(value: number); get myLocationEnabled(): boolean; set myLocationEnabled(value: boolean); get trafficEnabled(): boolean; set trafficEnabled(value: boolean); get uiSettings(): IUISettings; get mapType(): MapType; set mapType(value: MapType); _mapStyle: Style[]; get mapStyle(): Style[]; set mapStyle(value: Style[]); clear(): void; addMarker(options: MarkerOptions): Marker; removeMarker(marker: Marker): void; addCircle(options: CircleOptions): Circle; addGroundOverlay(options: GroundOverlayOptions): GroundOverlay; addPolygon(options: PolygonOptions): Polygon; addPolyline(options: PolylineOptions): Polyline; moveCamera(update: CameraUpdate): void; animateCamera(update: CameraUpdate): void; removeCircle(circle: Circle): void; removeGroundOverlay(groundOverlay: GroundOverlay): void; removePolygon(polygon: Polygon): void; removePolyline(polyline: Polyline): void; get projection(): Projection; snapshot(): Promise<ImageSource>; addTileOverlay(options: TileOverlayOptions): TileOverlay; removeTileOverlay(overlay: TileOverlay): void; } declare abstract class OverLayBase { abstract readonly native: any; get userData(): { [key: string]: any; }; set userData(data: { [key: string]: any; }); } export declare class Marker extends OverLayBase implements IMarker { _native: GMSMarker; _color: Color; _visible: boolean; static fromNative(nativeMarker: GMSMarker): Marker; get color(): string | Color; set color(value: string | Color); get opacity(): number; set opacity(value: number); get native(): GMSMarker; get ios(): GMSMarker; _icon: ImageSource; get icon(): any; set icon(value: any); get draggable(): boolean; set draggable(value: boolean); get position(): { lat: number; lng: number; }; set position(latlng: { lat: number; lng: number; }); get title(): string; set title(value: string); get snippet(): string; set snippet(value: string); get rotation(): number; set rotation(value: number); get visible(): boolean; set visible(value: boolean); get flat(): boolean; set flat(value: boolean); set zIndex(value: number); get zIndex(): number; hideInfoWindow(): void; showInfoWindow(): void; } export declare class Circle extends OverLayBase implements ICircle { _native: GMSCircle; static fromNative(nativeCircle: GMSCircle): Circle; get native(): GMSCircle; get ios(): GMSCircle; get radius(): number; set radius(value: number); get strokeColor(): Color; set strokeColor(value: string | Color); get center(): Coordinate; set center(value: Coordinate); get fillColor(): Color; set fillColor(value: string | Color); get tappable(): boolean; set tappable(value: boolean); get strokeWidth(): number; set strokeWidth(value: number); get zIndex(): number; set zIndex(value: number); strokePattern: any; visible: boolean; } export declare class Polygon extends OverLayBase implements IPolygon { _native: GMSPolygon; static fromNative(nativePolygon: GMSPolygon): Polygon; get native(): GMSPolygon; get ios(): GMSPolygon; get points(): Coordinate[]; set points(value: Coordinate[]); addPoint(point: Coordinate): void; addPoints(points: Coordinate[]): void; get holes(): Coordinate[][]; set holes(value: Coordinate[][]); get tappable(): boolean; set tappable(value: boolean); get strokeWidth(): number; set strokeWidth(value: number); get strokeColor(): Color; set strokeColor(value: Color | string); strokePattern: any[]; get zIndex(): number; set zIndex(value: number); get geodesic(): boolean; set geodesic(value: boolean); strokeJointType: JointType; visible: boolean; get fillColor(): Color; set fillColor(value: Color | string); } export declare class Polyline extends OverLayBase implements IPolyline { _native: GMSPolyline; static fromNative(nativePolyline: GMSPolyline): Polyline; get native(): GMSPolyline; get ios(): GMSPolyline; get width(): number; set width(value: number); get points(): Coordinate[]; set points(value: Coordinate[]); addPoint(point: Coordinate): void; addPoints(points: Coordinate[]): void; get tappable(): boolean; set tappable(value: boolean); get geodesic(): boolean; set geodesic(value: boolean); visible: boolean; get zIndex(): number; set zIndex(value: number); jointType: JointType; pattern: PatternItem[]; get color(): Color; set color(value: string | Color); startCap: Cap; endCap: Cap; } export declare class GroundOverlay extends OverLayBase implements IGroundOverlay { _native: GMSGroundOverlay; constructor(); static fromNative(nativeGroundOverlayOptions: GMSGroundOverlay): GroundOverlay; get native(): GMSGroundOverlay; get ios(): GMSGroundOverlay; width: number; get zIndex(): number; set zIndex(value: number); visible: boolean; transparency: number; get position(): Coordinate; set position(value: Coordinate); height: number; get anchorU(): number; set anchorU(value: number); get anchorV(): number; set anchorV(value: number); get bounds(): CoordinateBounds; get tappable(): boolean; set tappable(value: boolean); get bearing(): number; set bearing(value: number); _image: ImageSource; get image(): ImageSource; set image(value: ImageSource); } export declare class Poi implements IPoi { _name: string; _placeId: string; _coord: CLLocationCoordinate2D; static fromNative(placeID: string, name: string, location: CLLocationCoordinate2D): any; get native(): any; get ios(): any; get coordinate(): Coordinate; get name(): string; get placeId(): string; } export declare class TileOverlay implements Partial<ITileOverlay> { _native: GMSTileLayer; static fromNative(nativeOverlay: GMSTileLayer): TileOverlay; get native(): GMSTileLayer; get ios(): GMSTileLayer; get fadeIn(): boolean; set fadeIn(value: boolean); get zIndex(): number; set zIndex(value: number); set transparency(value: number); get transparency(): number; clearTileCache(): void; } export declare class Tile { _native: UIImage; static _NONE: any; static get NONE(): any; static fromNative(nativeTile: UIImage): Tile; static fromImageSource(source: ImageSource): Tile | null; get native(): UIImage; get ios(): UIImage; } export declare class TileProvider implements ITileProvider { _native: GMSTileLayer; constructor(callback: (x: number, y: number, zoom: number) => Tile); static fromNative(nativeTileProvider: GMSSyncTileLayer): TileProvider; get native(): GMSTileLayer; get ios(): GMSTileLayer; } export declare class UrlTileProvider extends TileProvider { _native: GMSURLTileLayer; constructor(callback: (x: number, y: number, zoom: number) => string, size?: number); get native(): GMSURLTileLayer; get ios(): GMSURLTileLayer; } export declare class Projection implements IProjection { _native: GMSProjection; static fromNative(nativeProjection: GMSProjection): Projection; get native(): GMSProjection; get ios(): GMSProjection; coordinateForPoint(point: { x: number; y: number; }): Coordinate; visibleRegion(): VisibleRegion; pointForCoordinate(coordinate: Coordinate): { x: number; y: number; }; containsCoordinate(coordinate: Coordinate): boolean; } export declare class VisibleRegion implements IVisibleRegion { _native: GMSVisibleRegion; static fromNative(nativeVisibleRegion: GMSVisibleRegion): VisibleRegion; get native(): GMSVisibleRegion; get ios(): GMSVisibleRegion; get farLeft(): Coordinate; get farRight(): Coordinate; get nearLeft(): Coordinate; get nearRight(): Coordinate; } export declare class PatternItem implements IPatternItem { } export declare class Cap implements ICap { } export { MapType, JointType };