import { Color, ContentView, ImageSource, Property } from '@nativescript/core'; export * from './geo.utils'; export * from './expression/expression-parser'; export * from './layers/layer-factory'; export * from './layers/parser/property-parser'; export declare const MapboxTraceCategory = "NativescriptMapbox"; export declare enum CLogTypes { log = 0, info = 1, warning = 2, error = 3 } export declare const CLog: (type: CLogTypes, ...args: any[]) => void; export declare enum MapStyle { DARK = "dark", OUTDOORS = "outdoors", LIGHT = "light", SATELLITE = "satellite", SATELLITE_STREETS = "satellite_streets", STREETS = "streets", TRAFFIC_DAY = "traffic_day", TRAFFIC_NIGHT = "traffic_night" } export interface LatLng { lat: number; lng: number; } export interface QueryRenderedFeaturesOptions { point?: LatLng; layers?: string[]; filter?: any[]; } export interface QuerySourceFeaturesOptions { sourceLayer?: string; filter?: any[]; } export interface Feature { id?: any; type: string; geometry: object; properties: object; } export interface AddPolygonOptions { /** * Set this in case you want to later pass it to 'removePolygons'. TODO doesn't exist yet ;) */ id?: any; points: LatLng[]; fillColor?: string | Color; /** * Transparency / alpha, ranging from 0 to 1. * Default fully opaque (1). */ fillOpacity?: number; /** * The line around the polygon. Barely visible on Android. */ strokeColor?: string | Color; /** * iOS only. */ strokeWidth?: number; /** * iOS only. */ strokeOpacity?: number; } export interface UserLocation { location: LatLng; speed: number; } export interface SetCenterOptions extends LatLng { animated?: boolean; } export interface AddPolylineOptions { /** * Set this in case you want to later pass it to 'removePolylines'. */ id?: any; /** * Width of the line, default 5. */ width?: number; /** * Color of the line, default black. */ color?: string | Color; /** * Transparency / alpha, ranging from 0 to 1. * Default fully opaque (1). */ opacity?: number; points: LatLng[]; } export interface MapboxMarker extends LatLng { /** * Set this in case you want to later pass it to 'removeMarker'. */ id?: number; title?: string; subtitle?: string; /** * Prefix with 'res://' and load a file from the resources folder. * Details on how 'res://' is used can be found here: https://docs.nativescript.org/ui/images#load-images-from-resource * Example: "res://icon.file" */ icon?: string; /** * The preferred way is using the 'icon' property, but you can still reference a local file directly. * Example: "~/assets/markers/green_pin_marker.png" */ iconPath?: string; /** * Runtime-generated image used directly as a marker icon. * Useful when the app composes an icon in memory instead of loading it from a resource, file path, or URL. */ imageSource?: ImageSource; /** * A callback function to invoke when the marker is tapped. */ onTap?: Function; /** * A callback function to invoke when the callout (popup) of this marker is tapped. */ onCalloutTap?: Function; /** * Set to true to select the marker when rendered - effectively showing any configured callout. * Note that only 1 callout will be shown at any time on a Mapbox map. * Default false. */ selected?: boolean; update?: (newSettings: MapboxMarker) => void; ios?: any; android?: any; /** * internally used to know if the marker image is already downloaded */ downloadedIcon?: ImageSource; } export interface SetZoomLevelOptions { level: number; animated: boolean; } export interface SetTiltOptions { /** * default 30 (degrees) */ tilt: number; /** * default 5000 (milliseconds) */ duration: number; animated?: boolean; } export interface ShowOptionsMargins { left?: number; right?: number; top?: number; bottom?: number; } export interface Bounds { north: number; east: number; south: number; west: number; } export interface Viewport { bounds: Bounds; zoomLevel: number; } export interface SetViewportOptions { bounds: Bounds; /** * Add an animation of about 1 second. * Default true. */ animated?: boolean; /** * Optional padding. */ padding?: number | { top?: number; left?: number; right?: number; bottom?: number; }; } export interface DeleteOfflineRegionOptions { /** * The id of the offline region to delete. */ id?: string; /** * The name of the offline region to delete. */ name?: string; } export interface MapboxCluster { points: number; color: string; } export interface AddGeoJsonClusteredOptions { id: any; url: any; pointColor: string; pointRadius: number; /** * A unique identifier, like: "earthquakes" */ name: string; /** * URL, like: "https://www.mapbox.com/mapbox-gl-js/assets/earthquakes.geojson" */ data: string; clusterMaxZoom?: number; clusterRadius?: number; clusters?: MapboxCluster[]; } export type LayerType = 'fill' | 'line' | 'symbol' | 'circle' | 'heatmap' | 'fill-extrusion' | 'raster' | 'hillshade' | 'background' | 'sky'; export type SupportedLayerType = LayerType & ('line' | 'circle' | 'fill' | 'symbol' | 'raster'); export interface AddLayerOptions { id: string; source: string; sourceLayer: string; type: SupportedLayerType; /** * 'circle' paint properties */ circleColor?: string | Color; circleOpacity?: number; circleRadius?: number; circleStrokeColor?: string | Color; circleStrokeWidth?: number; /** * 'fill' paint properties */ fillColor?: string | Color; fillOpacity?: number; /** * 'line' layout properties */ lineCap?: string; lineJoin?: string; /** * 'line' paint properties */ lineColor?: string | Color; lineOpacity?: number; lineWidth?: number; } export type UserTrackingMode = 'NONE' | 'FOLLOW' | 'FOLLOW_WITH_HEADING' | 'FOLLOW_WITH_COURSE'; export type AddSourceOptions = VectorSource | GeoJSONSource | RasterSource; export type UpdateSourceOptions = VectorSource | GeoJSONSource | RasterSource; export interface Source { type: 'vector' | 'raster' | 'geojson'; scheme?: 'xyz' | 'tms'; } export interface RasterSource extends Source { type: 'raster'; tiles: string[]; bounds?: number[]; minzoom?: number; maxzoom?: number; tileSize?: number; } export interface VectorSource extends Source { type: 'vector'; url?: string; tiles?: string[]; bounds?: number[]; minzoom?: number; maxzoom?: number; tileSize?: number; } export interface GeoJSONSource extends Source { url: any; type: 'geojson'; data?: any; minzoom?: number; maxzoom?: number; lineMetrics?: boolean; cluster?: { radius: any; maxZoom: any; properties?: { [property: string]: [any, any]; }; }; } export type UserLocationCameraMode = 'NONE' | 'NONE_COMPASS' | 'NONE_GPS' | 'TRACKING' | 'TRACKING_COMPASS' | 'TRACKING_GPS' | 'TRACKING_GPS_NORTH'; export interface TrackUserOptions { cameraMode: UserLocationCameraMode; renderMode?: 'NORMAL' | 'COMPASS' | 'GPS'; /** * iOS only, as Android is always animated. Default true (because of Android). */ animated?: boolean; } export interface AddExtrusionOptions { id?: string; source?: string; sourceLayer?: string; minZoom?: any; color?: string; opacity?: any; } export interface OfflineRegion { name: string; bounds: Bounds; minZoom?: number; maxZoom?: number; style: MapStyle; metadata?: any; pixelRatio?: any; type?: any; } export interface DownloadProgress { name: string; completed: number; expected: number; percentage: number; complete: boolean; /** * Android only, the size in bytes of the download so far. */ completedSize?: number; } export interface DownloadOfflineRegionOptions extends OfflineRegion { styleUrl: any; onProgress?: (data: DownloadProgress) => void; /** * Optional, used on Android only. * Set this, in case no map has been show yet (and thus, no accessToken has been passed in yet). */ accessToken?: string; regionId?: string; minZoom?: number; maxZoom?: number; } export interface ListOfflineRegionsOptions { /** * Optional, used on Android only. * Set this, in case no map has been show yet (and thus, no accessToken has been passed in yet). */ accessToken?: string; } export declare enum ControlPosition { TOP_LEFT = 0, TOP_RIGHT = 1, BOTTOM_LEFT = 2, BOTTOM_RIGHT = 3 } /** * The options object passed into the show function. */ export interface ShowOptions { accessToken: string; /** * default 'streets' */ style?: string | MapStyle; margins?: ShowOptionsMargins; center?: Partial; /** * default 0 (which is almost the entire planet) */ zoomLevel?: number; /** * default false (true requires adding `NSLocationWhenInUseUsageDescription` or `NSLocationAlwaysUsageDescription` to the .plist) */ showUserLocation?: boolean; /** * default false (required for the 'starter' plan) */ hideLogo?: boolean; /** * default BOTTOM_LEFT */ logoPosition?: ControlPosition; /** * default true */ hideAttribution?: boolean; /** * default BOTTOM_LEFT */ attributionPosition?: ControlPosition; /** * default false */ hideCompass?: boolean; /** * default TOP_RIGHT */ compassPosition?: ControlPosition; /** * default false */ disableRotation?: boolean; /** * default false */ disableScroll?: boolean; /** * default false */ disableZoom?: boolean; /** * default false */ disableTilt?: boolean; /** * Immediately add markers to the map */ markers?: MapboxMarker[]; /** * callback on location permission granted * * Android Only */ onLocationPermissionGranted?: any; /** * callback on location permission denied * * Android Only */ onLocationPermissionDenied?: any; /** * callback on Map Ready */ onMapReady?: any; /** * callback on scroll event */ onScrollEvent?: any; /** * callback on move begin event */ onMoveBeginEvent?: any; /** * Android context */ context?: any; /** * Android parent View */ parentView?: any; /** * On Android by default there is a 200ms delay before showing the map to work around a race condition. */ delay?: number; /** * See https://docs.mapbox.com/archive/android/maps/api/9.0.0/com/mapbox/mapboxsdk/location/LocationComponentOptions.html */ locationComponentOptions: any; } export interface ShowResult { ios: any; android: any; } export interface AnimateCameraOptions { target?: LatLng; bounds?: Bounds; padding?: number; zoomLevel?: number; /** * For iOS, in meters from the ground */ altitude?: number; bearing?: number; tilt?: number; duration?: number; } export interface LayerCommon { id: string; visibility(): boolean; show(): void; hide(): void; getNativeInstance(): any; setFilter(filter: any[]): void; getFilter(): any[]; type(): LayerType; } export interface MapboxCommonApi { requestFineLocationPermission(): Promise; hasFineLocationPermission(): Promise; } export interface MapboxApi { setMapboxViewInstance(mapboxNativeViewInstance: any): void; initEventHandlerShim(settings: any, mapboxNativeViewInstance: any): void; onMapEvent(eventName: any, id: any, callback: any, nativeMapView?: any): void; offMapEvent(eventName: any, id: any, nativeMapView?: any): void; show(options: ShowOptions): Promise; hide(): Promise; unhide(): Promise; destroy(nativeMap?: any): Promise; onStart(nativeMap?: any): Promise; onStop(nativeMap?: any): Promise; onDestroy(nativeMap?: any): Promise; setMapStyle(style: string | MapStyle, nativeMap?: any): Promise; addMarkers(markers: MapboxMarker[], nativeMap?: any): Promise; removeMarkers(options?: any, nativeMap?: any): Promise; setCenter(options: SetCenterOptions, nativeMap?: any): Promise; getCenter(nativeMap?: any): Promise; setZoomLevel(options: SetZoomLevelOptions, nativeMap?: any): Promise; getZoomLevel(nativeMap?: any): Promise; setTilt(options: SetTiltOptions, nativeMap?: any): Promise; getTilt(nativeMap?: any): Promise; getUserLocation(nativeMap?: any): Promise; showUserLocationMarker(options: any, nativeMap?: any): void; hideUserLocationMarker(nativeMap?: any): void; forceUserLocationUpdate(location: any, nativeMap?: any): void; trackUser(options: TrackUserOptions, nativeMap?: any): Promise; addSource(id: string, options: AddSourceOptions, nativeMapView?: any): Promise; updateSource(id: string, options: UpdateSourceOptions, nativeMapView?: any): Promise; removeSource(id: string, nativeMap?: any): Promise; removeSource(id: string, nativeMap?: any): Promise; addLayer(style: any, belowLayerId?: string, nativeMapView?: any): Promise; addLayer(options: AddLayerOptions, belowLayerId?: string): Promise; removeLayer(id: string, nativeMapView?: any): Promise; removeLayer(id: string, nativeMap?: any): Promise; addLinePoint(id: string, point: any, sourceId?: any, nativeMapView?: any): Promise; queryRenderedFeatures(options: QueryRenderedFeaturesOptions, nativeMap?: any): Promise; querySourceFeatures(sourceId: string, options?: QuerySourceFeaturesOptions, nativeMap?: any): Promise; addPolygon(options: AddPolygonOptions, nativeMap?: any): Promise; removePolygons(ids?: any[], nativeMap?: any): Promise; addPolyline(options: AddPolylineOptions, nativeMap?: any): Promise; removePolylines(ids?: any[], nativeMap?: any): Promise; animateCamera(options: AnimateCameraOptions, nativeMap?: any): Promise; setOnMapClickListener(listener: (data: LatLng) => boolean, nativeMap?: any): Promise; setOnMapLongClickListener(listener: (data: LatLng) => boolean, nativeMap?: any): Promise; setOnScrollListener(listener: (data?: LatLng) => void, nativeMap?: any): Promise; setOnMoveBeginListener(listener: (data?: LatLng) => void, nativeMap?: any): Promise; setOnMoveEndListener(listener: (data?: LatLng) => void, nativeMap?: any): Promise; setOnFlingListener(listener: () => void, nativeMap?: any): Promise; setOnCameraChangeListener(listener: (reason: any, animated?: boolean) => void, nativeMap?: any): Promise; setOnCameraMoveCancelListener(listener: () => void, nativeMap?: any): Promise; setOnMapIdleListener(listener: () => void, nativeMap?: any): Promise; requestFineLocationPermission(): Promise; hasFineLocationPermission(): Promise; getViewport(nativeMap?: any): Promise; setViewport(options: SetViewportOptions, nativeMap?: any): Promise; downloadOfflineRegion(options: DownloadOfflineRegionOptions): Promise; listOfflineRegions(options?: ListOfflineRegionsOptions): Promise; deleteOfflineRegion(options: DeleteOfflineRegionOptions): Promise; addGeoJsonClustered(options: AddGeoJsonClusteredOptions): Promise; getLayer(name: string, nativeMap?: any): Promise; getLayers(nativeMap?: any): Promise; getImage(imageId: string, nativeMap?: any): Promise; addImage(imageId: string, imagePath: string, nativeMap?: any): Promise; removeImage(imageId: string, nativeMap?: any): Promise; project(data: LatLng): { x: number; y: number; }; projectBack(point: { x: number; y: number; }): LatLng; } export declare abstract class MapboxCommon implements MapboxCommonApi { view?: MapboxViewCommonBase; constructor(view?: MapboxViewCommonBase); static defaults: Partial; static merge(obj1: {}, obj2: {}): any; hasFineLocationPermission(): Promise; /** * Request fine locaion permission * */ requestFineLocationPermission(): Promise; protected fetchImageSource(imagePath: string): Promise; } /** * Interface definition for a View of a mapbox map. */ export interface MapboxViewApi { addMarkers(markers: MapboxMarker[]): Promise; onMapEvent(eventName: any, id: any, callback: any): void; offMapEvent(eventName: any, id: any): void; removeMarkers(options?: any): Promise; queryRenderedFeatures(options: QueryRenderedFeaturesOptions): Promise; querySourceFeatures(sourceId: string, options?: QuerySourceFeaturesOptions): Promise; setOnMapClickListener(listener: (data: LatLng) => boolean): Promise; setOnMapLongClickListener(listener: (data: LatLng) => boolean): Promise; setOnScrollListener(listener: (data?: LatLng) => void): Promise; setOnMoveBeginListener(listener: (data?: LatLng) => void): Promise; setOnFlingListener(listener: () => void): Promise; setOnCameraChangeListener(listener: (reason: any, animated?: boolean) => void): Promise; setOnCameraMoveCancelListener(listener: () => void): Promise; setOnCameraIdleListener(listener: () => void): Promise; getViewport(): Promise; setViewport(options: SetViewportOptions): Promise; setMapStyle(style: string | MapStyle): Promise; getCenter(): Promise; setCenter(options: SetCenterOptions): Promise; getZoomLevel(): Promise; setZoomLevel(options: SetZoomLevelOptions): Promise; getTilt(): Promise; setTilt(options: SetTiltOptions): Promise; getUserLocation(): Promise; trackUser(options: TrackUserOptions): Promise; showUserLocationMarker(options: any): void; hideUserLocationMarker(options: any): void; forceUserLocationUpdate(location: any): void; addSource(id: string, options: AddSourceOptions): Promise; updateSource(id: string, options: UpdateSourceOptions): Promise; removeSource(id: string, nativeMap?: any): Promise; addLayer(style: any, belowLayerId?: string): Promise; removeLayer(id: string): Promise; addLinePoint(id: string, point: any, sourceId?: any): Promise; addPolygon(options: AddPolygonOptions): Promise; removePolygons(ids?: any[]): Promise; addPolyline(options: AddPolylineOptions): Promise; removePolylines(ids?: any[]): Promise; animateCamera(options: AnimateCameraOptions): Promise; getLayer(name: string, nativeMap?: any): Promise; getLayers(nativeMap?: any): Promise; getImage(imageId: string, nativeMap?: any): Promise; addImage(imageId: string, imagePath: string, nativeMap?: any): Promise; removeImage(imageId: string, nativeMap?: any): Promise; destroy(): Promise; onStart(): Promise; onStop(): Promise; onDestroy(): Promise; project(data: LatLng): { x: number; y: number; }; projectBack(screenCoordinate: { x: number; y: number; }): LatLng; } /** * common base for views created in XML. * * Instead of returning a reference to the Mapbox API instance (class Mapbox) from the view * the author decided to implement shim methods for a subset of the API. I'm not sure what the * reasoning was. * * @see Mapbox */ export declare abstract class MapboxViewCommonBase extends ContentView implements MapboxViewApi { protected mapbox: MapboxApi; telemetry: boolean; abstract getNativeMapView(): any; /** * map event * * The base NativeScript ContentView class has on() and off() methods. */ onMapEvent(eventName: any, id: any, callback: any): void; offMapEvent(eventName: any, id: any): void; addMarkers(markers: MapboxMarker[]): Promise; removeMarkers(options?: any): Promise; setOnMapClickListener(listener: (data: LatLng) => boolean): Promise; setOnMapLongClickListener(listener: (data: LatLng) => boolean): Promise; setOnScrollListener(listener: (data?: LatLng) => void, nativeMap?: any): Promise; setOnMoveBeginListener(listener: (data?: LatLng) => void, nativeMap?: any): Promise; setOnMoveEndListener(listener: (data?: LatLng) => void, nativeMap?: any): Promise; setOnFlingListener(listener: () => void, nativeMap?: any): Promise; setOnCameraChangeListener(listener: (reason: any, animated?: boolean) => void, nativeMap?: any): Promise; setOnCameraMoveCancelListener(listener: () => void, nativeMap?: any): Promise; setOnCameraIdleListener(listener: () => void, nativeMap?: any): Promise; getViewport(): Promise; setViewport(options: SetViewportOptions): Promise; setMapStyle(style: string | MapStyle): Promise; getCenter(): Promise; setCenter(options: SetCenterOptions): Promise; getZoomLevel(): Promise; setZoomLevel(options: SetZoomLevelOptions): Promise; getTilt(): Promise; setTilt(options: SetTiltOptions): Promise; getUserLocation(): Promise; showUserLocationMarker(options: any): void; hideUserLocationMarker(): void; forceUserLocationUpdate(location: any): void; trackUser(options: TrackUserOptions): Promise; addSource(id: string, options: AddSourceOptions): Promise; updateSource(id: string, options: UpdateSourceOptions): Promise; removeSource(id: string): Promise; addLayer(style: any, belowLayerId?: string): Promise; removeLayer(id: string): Promise; addLinePoint(id: string, point: any, sourceId?: any): Promise; queryRenderedFeatures(options: QueryRenderedFeaturesOptions): Promise; querySourceFeatures(sourceId: string, options?: QuerySourceFeaturesOptions): Promise; addPolygon(options: AddPolygonOptions): Promise; removePolygons(ids?: any[]): Promise; addPolyline(options: AddPolylineOptions): Promise; removePolylines(ids?: any[]): Promise; animateCamera(options: AnimateCameraOptions): Promise; getLayer(name: string, nativeMap?: any): Promise; getLayers(nativeMap?: any): Promise; getImage(imageId: string): Promise; addImage(imageId: string, imagePath: string): Promise; removeImage(imageId: string): Promise; destroy(): Promise; onStart(): Promise; onStop(nativeMap?: any): Promise; onDestroy(nativeMap?: any): Promise; project(data: LatLng): { x: number; y: number; }; projectBack(screenCoordinate: { x: number; y: number; }): LatLng; downloadOfflineRegion(options: DownloadOfflineRegionOptions): Promise; listOfflineRegions(options?: ListOfflineRegionsOptions): Promise; deleteOfflineRegion(options: DeleteOfflineRegionOptions): Promise; } /** * Properties definitions for the Mapbox XML tag. * * @link https://docs.nativescript.org/plugins/ui-plugin-custom */ export declare const mapReadyProperty: Property; export declare const zoomLevelProperty: Property; export declare const accessTokenProperty: Property; export declare const mapStyleProperty: Property; export declare const latitudeProperty: Property; export declare const longitudeProperty: Property; export declare const showUserLocationProperty: Property; export declare const locationComponentOptionsProperty: Property; export declare const hideLogoProperty: Property; export declare const logoPositionProperty: Property; export declare const hideAttributionProperty: Property; export declare const attributionPositionProperty: Property; export declare const telemetryProperty: Property; export declare const hideCompassProperty: Property; export declare const compassPositionProperty: Property; export declare const disableZoomProperty: Property; export declare const disableRotationProperty: Property; export declare const disableScrollProperty: Property; export declare const disableTiltProperty: Property; export declare const delayProperty: Property; /** * base class for views created in XML * * This is the glue that creates a config object based on the XML attributes passed to * the Mapbox XML tag. * * @see MapboxView * * @link https://docs.nativescript.org/plugins/ui-plugin-custom */ export declare abstract class MapboxViewBase extends MapboxViewCommonBase { [zoomLevelProperty.setNative]: (value: number) => void; [mapStyleProperty.setNative]: (value: string) => void; [accessTokenProperty.setNative]: (value: string) => void; [delayProperty.setNative]: (value: number) => void; [latitudeProperty.setNative]: (value: number) => void; [longitudeProperty.setNative]: (value: number) => void; [showUserLocationProperty.setNative]: (value: boolean) => void; [locationComponentOptionsProperty.setNative]: (value: boolean) => void; [hideLogoProperty.setNative]: (value: boolean) => void; [logoPositionProperty.setNative]: (value: ControlPosition) => void; [hideAttributionProperty.setNative]: (value: boolean) => void; [attributionPositionProperty.setNative]: (value: ControlPosition) => void; [hideCompassProperty.setNative]: (value: boolean) => void; [compassPositionProperty.setNative]: (value: ControlPosition) => void; [disableZoomProperty.setNative]: (value: boolean) => void; [disableRotationProperty.setNative]: (value: boolean) => void; [disableScrollProperty.setNative]: (value: boolean) => void; [disableTiltProperty.setNative]: (value: boolean) => void; static mapReadyEvent: string; static scrollEvent: string; static moveBeginEvent: string; static moveEndEvent: string; static locationPermissionGrantedEvent: string; static locationPermissionDeniedEvent: string; protected config: Partial; }