@nativescript-community/ui-massifmaps 3.0.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +237 -0
- package/api/bridge.android.d.ts +2 -0
- package/api/bridge.android.js +162 -0
- package/api/bridge.android.js.map +1 -0
- package/api/bridge.d.ts +90 -0
- package/api/bridge.ios.d.ts +2 -0
- package/api/bridge.ios.js +153 -0
- package/api/bridge.ios.js.map +1 -0
- package/api/index.common.d.ts +495 -0
- package/api/index.common.js +1449 -0
- package/api/index.common.js.map +1 -0
- package/api/index.d.ts +2 -0
- package/api/index.js +3 -0
- package/api/index.js.map +1 -0
- package/api/massif-api.d.ts +12398 -0
- package/api/resolve.d.ts +52 -0
- package/api/resolve.js +214 -0
- package/api/resolve.js.map +1 -0
- package/api/schema.d.ts +67 -0
- package/api/schema.js +538 -0
- package/api/schema.js.map +1 -0
- package/bindings/components/Options.d.ts +14 -13
- package/bindings/components/Options.js.map +1 -1
- package/bindings/core/Variant.d.ts +2 -1
- package/bindings/core/Variant.js.map +1 -1
- package/bindings/enums.d.ts +138 -0
- package/bindings/enums.js +153 -0
- package/bindings/enums.js.map +1 -0
- package/bindings/graphics/Bitmap.d.ts +2 -1
- package/bindings/graphics/Bitmap.js.map +1 -1
- package/bindings/layers/ClusterElementBuilder.d.ts +2 -1
- package/bindings/layers/ClusterElementBuilder.js.map +1 -1
- package/bindings/layers/CompositeVectorTileLayer.d.ts +3 -7
- package/bindings/layers/CompositeVectorTileLayer.js +3 -6
- package/bindings/layers/CompositeVectorTileLayer.js.map +1 -1
- package/bindings/layers/HillshadeRasterTileLayer.d.ts +3 -2
- package/bindings/layers/HillshadeRasterTileLayer.js.map +1 -1
- package/bindings/layers/Layer.d.ts +2 -1
- package/bindings/layers/Layer.js.map +1 -1
- package/bindings/layers/RasterTileLayer.d.ts +3 -2
- package/bindings/layers/RasterTileLayer.js.map +1 -1
- package/bindings/layers/TileLayer.d.ts +5 -3
- package/bindings/layers/TileLayer.js +1 -1
- package/bindings/layers/TileLayer.js.map +1 -1
- package/bindings/layers/VectorEditEventListener.d.ts +2 -1
- package/bindings/layers/VectorEditEventListener.js.map +1 -1
- package/bindings/layers/VectorTileLayer.d.ts +5 -4
- package/bindings/layers/VectorTileLayer.js.map +1 -1
- package/bindings/packagemanager/PackageInfo.d.ts +2 -1
- package/bindings/packagemanager/PackageInfo.js.map +1 -1
- package/bindings/packagemanager/PackageManagerListener.d.ts +2 -1
- package/bindings/packagemanager/PackageManagerListener.js.map +1 -1
- package/bindings/packagemanager/PackageStatus.d.ts +2 -1
- package/bindings/packagemanager/PackageStatus.js.map +1 -1
- package/bindings/packagemanager/PackageTileMask.d.ts +2 -1
- package/bindings/packagemanager/PackageTileMask.js.map +1 -1
- package/bindings/routing/RouteMatchingPoint.d.ts +2 -1
- package/bindings/routing/RouteMatchingPoint.js.map +1 -1
- package/bindings/routing/RoutingInstruction.js.map +1 -1
- package/bindings/styles/AnimationStyle.d.ts +3 -2
- package/bindings/styles/AnimationStyle.js.map +1 -1
- package/bindings/styles/AnimationStyleBuilder.d.ts +7 -6
- package/bindings/styles/AnimationStyleBuilder.js.map +1 -1
- package/bindings/styles/LabelStyle.js.map +1 -1
- package/bindings/styles/LabelStyleBuilder.d.ts +5 -4
- package/bindings/styles/LabelStyleBuilder.js.map +1 -1
- package/bindings/styles/LineStyle.d.ts +2 -1
- package/bindings/styles/LineStyle.js.map +1 -1
- package/bindings/styles/LineStyleBuilder.d.ts +6 -5
- package/bindings/styles/LineStyleBuilder.js.map +1 -1
- package/bindings/styles/MarkerStyle.js.map +1 -1
- package/bindings/styles/MarkerStyleBuilder.d.ts +5 -4
- package/bindings/styles/MarkerStyleBuilder.js.map +1 -1
- package/bindings/styles/NMLModelStyle.js.map +1 -1
- package/bindings/styles/NMLModelStyleBuilder.d.ts +5 -4
- package/bindings/styles/NMLModelStyleBuilder.js.map +1 -1
- package/bindings/ui/BalloonPopupButtonClickInfo.js.map +1 -1
- package/bindings/ui/ClickInfo.js.map +1 -1
- package/bindings/ui/MapClickInfo.js.map +1 -1
- package/bindings/ui/PopupClickInfo.js.map +1 -1
- package/bindings/ui/RasterTileClickInfo.js.map +1 -1
- package/bindings/ui/UTFGridClickInfo.js.map +1 -1
- package/bindings/ui/VectorElementClickInfo.js.map +1 -1
- package/bindings/ui/VectorElementDragInfo.d.ts +2 -1
- package/bindings/ui/VectorElementDragInfo.js.map +1 -1
- package/bindings/ui/VectorTileClickInfo.d.ts +3 -1
- package/bindings/ui/VectorTileClickInfo.js +5 -2
- package/bindings/ui/VectorTileClickInfo.js.map +1 -1
- package/bindings/utils/BundleAssetPackage.d.ts +15 -0
- package/bindings/utils/BundleAssetPackage.js +8 -0
- package/bindings/utils/BundleAssetPackage.js.map +1 -0
- package/bindings/utils/index.d.ts +1 -0
- package/bindings/utils/index.js +1 -0
- package/bindings/utils/index.js.map +1 -1
- package/bindings/vectortiles/MBVectorTileDecoder.d.ts +4 -3
- package/bindings/vectortiles/MBVectorTileDecoder.js.map +1 -1
- package/celestial/CelestialArc.android.d.ts +0 -1
- package/celestial/CelestialArc.android.js +0 -3
- package/celestial/CelestialArc.android.js.map +1 -1
- package/celestial/CelestialArc.d.ts +1 -3
- package/celestial/CelestialArc.ios.d.ts +0 -1
- package/celestial/CelestialArc.ios.js +0 -1
- package/celestial/CelestialArc.ios.js.map +1 -1
- package/celestial/CelestialObject.android.d.ts +0 -1
- package/celestial/CelestialObject.android.js +0 -1
- package/celestial/CelestialObject.android.js.map +1 -1
- package/celestial/CelestialObject.d.ts +0 -2
- package/celestial/CelestialObject.ios.d.ts +0 -1
- package/celestial/CelestialObject.ios.js +0 -1
- package/celestial/CelestialObject.ios.js.map +1 -1
- package/celestial/CelestialObjectVector.android.d.ts +0 -1
- package/celestial/CelestialObjectVector.android.js +0 -4
- package/celestial/CelestialObjectVector.android.js.map +1 -1
- package/celestial/CelestialObjectVector.d.ts +0 -2
- package/celestial/CelestialObjectVector.ios.d.ts +0 -1
- package/celestial/CelestialObjectVector.ios.js +0 -1
- package/celestial/CelestialObjectVector.ios.js.map +1 -1
- package/celestial/CelestialSprite.android.d.ts +0 -1
- package/celestial/CelestialSprite.android.js +0 -3
- package/celestial/CelestialSprite.android.js.map +1 -1
- package/celestial/CelestialSprite.d.ts +1 -3
- package/celestial/CelestialSprite.ios.d.ts +0 -1
- package/celestial/CelestialSprite.ios.js +0 -1
- package/celestial/CelestialSprite.ios.js.map +1 -1
- package/components/index.android.d.ts +9 -27
- package/components/index.android.js +3 -21
- package/components/index.android.js.map +1 -1
- package/components/index.d.ts +4 -26
- package/components/index.ios.d.ts +3 -21
- package/components/index.ios.js +3 -21
- package/components/index.ios.js.map +1 -1
- package/core/index.android.js +1 -1
- package/core/index.android.js.map +1 -1
- package/core/index.ios.js +1 -2
- package/core/index.ios.js.map +1 -1
- package/datasources/mbtiles.android.d.ts +2 -2
- package/index.android.d.ts +1 -6
- package/index.android.js +4 -8
- package/index.android.js.map +1 -1
- package/index.common.d.ts +3 -6
- package/index.common.js +3 -6
- package/index.common.js.map +1 -1
- package/index.d.ts +6 -0
- package/index.ios.d.ts +1 -6
- package/index.ios.js +1 -6
- package/index.ios.js.map +1 -1
- package/layers/CelestialLayer.android.d.ts +0 -1
- package/layers/CelestialLayer.android.js +0 -3
- package/layers/CelestialLayer.android.js.map +1 -1
- package/layers/CelestialLayer.d.ts +1 -4
- package/layers/CelestialLayer.ios.d.ts +0 -1
- package/layers/CelestialLayer.ios.js +1 -4
- package/layers/CelestialLayer.ios.js.map +1 -1
- package/layers/composite.android.d.ts +3 -5
- package/layers/composite.android.js +0 -6
- package/layers/composite.android.js.map +1 -1
- package/layers/composite.d.ts +6 -25
- package/layers/composite.ios.d.ts +2 -6
- package/layers/composite.ios.js +2 -10
- package/layers/composite.ios.js.map +1 -1
- package/layers/index.android.d.ts +3 -3
- package/layers/index.d.ts +4 -22
- package/layers/raster.android.d.ts +8 -8
- package/layers/raster.android.js +1 -1
- package/layers/raster.android.js.map +1 -1
- package/layers/raster.d.ts +2 -11
- package/layers/vector.android.d.ts +10 -10
- package/layers/vector.android.js +2 -2
- package/layers/vector.android.js.map +1 -1
- package/layers/vector.d.ts +15 -71
- package/nativeclass.common.d.ts +6 -31
- package/nativeclass.common.js +4 -21
- package/nativeclass.common.js.map +1 -1
- package/nativescript.config.ts +7 -6
- package/package.json +2 -2
- package/platforms/android/include-settings.gradle +18 -4
- package/platforms/android/include.gradle +9 -1
- package/platforms/android/java/com/nativescript/massifmaps/additions/CelestialEventListener.java +1 -1
- package/platforms/android/java/com/nativescript/massifmaps/additions/ClusterElementBuilder.java +1 -1
- package/platforms/android/java/com/nativescript/massifmaps/additions/HillshadeRasterTileLayer.java +4 -4
- package/platforms/android/java/com/nativescript/massifmaps/additions/RasterTileEventListener.java +1 -1
- package/platforms/android/java/com/nativescript/massifmaps/additions/RendererCaptureListener.java +1 -1
- package/platforms/android/java/com/nativescript/massifmaps/additions/SynchronousHandler.java +28 -0
- package/platforms/android/java/com/nativescript/massifmaps/additions/TileDownloadListener.java +4 -4
- package/platforms/android/java/com/nativescript/massifmaps/additions/VectorElementEventListener.java +1 -1
- package/platforms/android/java/com/nativescript/massifmaps/additions/VectorTileEventListener.java +1 -1
- package/platforms/android/java/com/nativescript/massifmaps/additions2/FeatureCollectionSearchService.java +1 -2
- package/platforms/android/java/com/nativescript/massifmaps/additions2/VectorEditEventListener.java +21 -20
- package/platforms/android/java/com/nativescript/massifmaps/additions2/VectorTileSearchService.java +1 -2
- package/platforms/android/java/com/nativescript/massifmaps/api/EventListener.java +60 -0
- package/platforms/android/java/com/nativescript/massifmaps/geocoding/GeocodingServiceAdditions.java +5 -5
- package/platforms/android/java/com/nativescript/massifmaps/packagemanager/PackageManagerListener.java +11 -11
- package/platforms/android/java/com/nativescript/massifmaps/routing/RoutingServiceAdditions.java +19 -36
- package/platforms/android/native-api-usage.json +8 -0
- package/platforms/ios/build.xcconfig +4 -1
- package/platforms/ios/native-api-usage.json +1 -0
- package/platforms/ios/src/MassifMapsAdditions.h +1 -0
- package/platforms/ios/src/NSMSFApiEventListener.h +23 -0
- package/platforms/ios/src/NSMSFApiEventListener.mm +33 -0
- package/platforms/ios/src/NSMSFFeatureCollectionSearchService.swift +1 -1
- package/platforms/ios/src/NSMSFGeocodingServiceAdditions.swift +1 -1
- package/platforms/ios/src/NSMSFHillshadeRasterTileLayer.swift +1 -1
- package/platforms/ios/src/NSMSFMainThread.swift +21 -0
- package/platforms/ios/src/NSMSFRoutingServiceAdditions.swift +1 -1
- package/platforms/ios/src/NSMSFVectorTileSearchService.swift +1 -1
- package/projections/index.ios.js.map +1 -1
- package/renderers/index.d.ts +3 -10
- package/routing/index.android.d.ts +17 -17
- package/tsconfig.tsbuildinfo +1 -1
- package/typings/massifmaps.android.d.ts +1913 -410
- package/typings/massifmaps.ios.d.ts +21 -4
- package/typings/ns.massifmaps.android.d.ts +44 -175
- package/typings/ns.massifmaps.ios.d.ts +10 -63
- package/ui/index.android.d.ts +10 -14
- package/ui/index.android.js +6 -66
- package/ui/index.android.js.map +1 -1
- package/ui/index.common.d.ts +31 -0
- package/ui/index.common.js +130 -2
- package/ui/index.common.js.map +1 -1
- package/ui/index.d.ts +60 -21
- package/ui/index.ios.d.ts +4 -6
- package/ui/index.ios.js +5 -92
- package/ui/index.ios.js.map +1 -1
- package/utils/index.android.d.ts +9 -22
- package/utils/index.android.js +20 -129
- package/utils/index.android.js.map +1 -1
- package/utils/index.d.ts +9 -7
- package/utils/index.ios.d.ts +10 -18
- package/utils/index.ios.js +20 -109
- package/utils/index.ios.js.map +1 -1
- package/vectorelements/index.android.d.ts +6 -6
- package/vectorelements/line.android.d.ts +8 -11
- package/vectorelements/line.android.js +1 -4
- package/vectorelements/line.android.js.map +1 -1
- package/vectorelements/line.ios.d.ts +1 -4
- package/vectorelements/line.ios.js +1 -4
- package/vectorelements/line.ios.js.map +1 -1
- package/vectortiles/index.android.d.ts +0 -2
- package/vectortiles/index.android.js +0 -9
- package/vectortiles/index.android.js.map +1 -1
- package/platforms/android/java/com/nativescript/massifmaps/additions/AssetPackage.java +0 -59
- package/platforms/android/java/com/nativescript/massifmaps/additions/DirAssetPackage.java +0 -53
- package/platforms/android/java/com/nativescript/massifmaps/additions/MapEventListener.java +0 -17
- package/platforms/android/java/com/nativescript/massifmaps/additions/MapView.java +0 -167
- package/platforms/android/java/com/nativescript/massifmaps/additions/TextureMapView.java +0 -166
- package/platforms/ios/src/NSMSFMapEventListener.swift +0 -43
- package/platforms/ios/src/NSMSFMapView.swift +0 -106
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,43 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.0.0](https://github.com/nativescript-community/ui-massifmaps/compare/v3.0.1...v4.0.0) (2026-10-09)
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* map events require a surface-API SDK, and mapClicked no longer carries its
|
|
11
|
+
platform-specific `android` field.
|
|
12
|
+
|
|
13
|
+
Verified: tsc clean, and `node scripts/examples/check.mjs` reports "examples typecheck OK". The
|
|
14
|
+
Java and Swift are NOT compiled here and nothing ran on a device - the whole event path is
|
|
15
|
+
untested at runtime.
|
|
16
|
+
|
|
17
|
+
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|
18
|
+
* requires an SDK with MapMoveReason on MapEventListener (MassifMaps #163).
|
|
19
|
+
The native MapEventListener additions take an int reason where they took a boolean
|
|
20
|
+
userAction. App code reading `e.data.userAction` still works; `e.data.reason` is the one to
|
|
21
|
+
move to.
|
|
22
|
+
|
|
23
|
+
Verified: tsc clean over the whole plugin, and a temporary type test confirmed
|
|
24
|
+
`e.data.reason` infers as the string union from the event name (a deliberately wrong
|
|
25
|
+
annotation failed the build). NOT run on a device, and the Java/Swift additions are not
|
|
26
|
+
compile-checked here.
|
|
27
|
+
|
|
28
|
+
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* **api:** add onCelestialClick for the celestial.clicked event ([7c1a540](https://github.com/nativescript-community/ui-massifmaps/commit/7c1a5407c03f02eeeaad8cac172ad31de5ce674b))
|
|
33
|
+
* **api:** build the plugin on the SDK's surface API ([a6accd3](https://github.com/nativescript-community/ui-massifmaps/commit/a6accd31c2064236a9b76c03c93cb5a46bc07598)), closes [massif-maps/MassifMaps#146](https://github.com/massif-maps/MassifMaps/issues/146) [#159](https://github.com/nativescript-community/ui-massifmaps/issues/159)
|
|
34
|
+
* **api:** style parameters, aliases and one-crossing writes ([eb9aa7c](https://github.com/nativescript-community/ui-massifmaps/commit/eb9aa7c7f31c902d1191ab694d3d0003c2a93d97))
|
|
35
|
+
* take the map's events from the surface API, and delete the native listener ([657562a](https://github.com/nativescript-community/ui-massifmaps/commit/657562a24023778a35c45669cbdb3c8b86d85abc))
|
|
36
|
+
* take the map's move reason from the SDK, and type every map event ([cc49474](https://github.com/nativescript-community/ui-massifmaps/commit/cc49474b034567ddf722c7655f1b1a36e60c48b2))
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* **bindings:** keep every class a facade call touches in the Android metadata ([eab0123](https://github.com/nativescript-community/ui-massifmaps/commit/eab0123f1bcd6b85b6576e805c093c0f097c7022))
|
|
41
|
+
* **ios:** link OpenGLES and GLKit only outside Mac Catalyst ([6c65478](https://github.com/nativescript-community/ui-massifmaps/commit/6c6547895cbe187e6cc22692c23281e7f56bbc94))
|
|
42
|
+
|
|
6
43
|
## [3.0.1](https://github.com/nativescript-community/ui-massifmaps/compare/v3.0.0...v3.0.1) (2026-08-22)
|
|
7
44
|
|
|
8
45
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -39,6 +39,18 @@
|
|
|
39
39
|
|
|
40
40
|
* [Installation](#installation)
|
|
41
41
|
* [API](#api)
|
|
42
|
+
* [The surface API](#the-surface-api)
|
|
43
|
+
* [Getting a map](#getting-a-map)
|
|
44
|
+
* [Layers and sources are specs](#layers-and-sources-are-specs)
|
|
45
|
+
* [Properties](#properties)
|
|
46
|
+
* [The camera](#the-camera)
|
|
47
|
+
* [Events are Observable events](#events-are-observable-events)
|
|
48
|
+
* [Methods](#methods)
|
|
49
|
+
* [Routing](#routing)
|
|
50
|
+
* [Moving over a piece at a time](#moving-over-a-piece-at-a-time)
|
|
51
|
+
* [Typings](#typings)
|
|
52
|
+
* [Requirements and known gaps](#requirements-and-known-gaps)
|
|
53
|
+
* [The example gallery](#the-example-gallery)
|
|
42
54
|
* [Usage in Svelte](#usage-in-svelte)
|
|
43
55
|
* [Examples](#examples)
|
|
44
56
|
* [Usage in Vue](#usage-in-vue)
|
|
@@ -71,6 +83,231 @@ Run the following command from the root of your project:
|
|
|
71
83
|
The API documentation for this plugin is available [here](https://nativescript-community.github.io/ui-massifmaps/).
|
|
72
84
|
|
|
73
85
|
|
|
86
|
+
[](#the-surface-api)
|
|
87
|
+
|
|
88
|
+
## The surface API
|
|
89
|
+
|
|
90
|
+
There are two public surfaces. The **object API** — `MassifMap`, `VectorTileLayer`, `HTTPTileDataSource` — is what the rest of this README shows and is unchanged. The **surface API** is the SDK's id/handle + JSON facade, and is what new code should use: it is six verbs (`create`, `destroy`, `set`, `get`, `call`, `on`) over a table generated from the SDK itself, so a new SDK option costs no plugin code at all.
|
|
91
|
+
|
|
92
|
+
It is exported namespaced, because both surfaces spell a layer `MassifLayer` and a map `MassifMap`:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import { api } from '@nativescript-community/ui-massifmaps';
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Getting a map
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
// from the mapReady event - the map's Options must exist
|
|
102
|
+
const map = api.attach(mapView, { projection: 'EPSG:4326' });
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The view's own event listener is **chained**, not replaced, so whatever the plugin (or your app) had installed keeps being called.
|
|
106
|
+
|
|
107
|
+
### Layers and sources are specs
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
api.createSource('osm', { type: 'http', minZoom: 0, maxZoom: 14, url: 'https://tiles/{z}/{x}/{y}.pbf' });
|
|
111
|
+
|
|
112
|
+
map.addLayer('base', {
|
|
113
|
+
type: 'vector',
|
|
114
|
+
opacity: 0.8,
|
|
115
|
+
source: 'osm', // an id, or an inline spec of the kind that builds it
|
|
116
|
+
style: { type: 'mbvt', project: { type: 'project', assets: { type: 'dir', path: '/sdcard/massif_style' }, name: 'osm' } }
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
A spec's keys are the constructor's parameters **plus every writable property of the class it builds**, so `opacity` (declared on `Layer`) works even though no layer constructor takes one. Creating an id that already exists with an identical spec returns the same object — that is how two maps share one source. A different spec under the same id is refused rather than silently replacing it.
|
|
121
|
+
|
|
122
|
+
### Properties
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
map.set('fogOptions.rangeStart', 2.5); // a dotted path walks object properties
|
|
126
|
+
map.set('fog.rangeStart', 2.5); // `fog` is an alias for `fogOptions` - same property
|
|
127
|
+
map.fog().set('rangeEnd', 4); // or scope onto one
|
|
128
|
+
map.terrain().apply({ exaggeration: 1.4, viewDistanceFactor: 2 }); // ONE crossing, not two
|
|
129
|
+
|
|
130
|
+
const speed: number = base.get('labelBlendingSpeed');
|
|
131
|
+
const at = e.getPos('clickPos', 'EPSG:4326'); // a coordinate, in the projection you want
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
A style's CartoCSS `param::` values, an HTTP header set and a layer's metadata are **bags**: the
|
|
135
|
+
rest of the path is a key of your own, and the property itself takes every key at once.
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
style.set('params.water_color', '#0af');
|
|
139
|
+
style.apply({ params: { water_color: '#0af', show_buildings: 'false' } });
|
|
140
|
+
source.set('HTTPHeaders.User-Agent', 'my-app/1.0');
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
`apply` is one native call whatever the key count, which is what makes it worth using over a loop
|
|
144
|
+
of `set`.
|
|
145
|
+
|
|
146
|
+
Values cross as the JavaScript type they should be: an enum is its **constant name**, a position is `[lon, lat]`, a struct is the JSON it encodes, a colour is an ARGB integer.
|
|
147
|
+
|
|
148
|
+
The handful of properties every app touches also have named, chainable accessors — one call reads, one writes:
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
base.visible(true).opacity(0.5).zoomRange([4, 18]).refresh();
|
|
152
|
+
if (!base.visible()) { … }
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
That list is **closed** (`opacity`, `visible`, `zoomRange`, plus `refresh`, `clearTileCaches`, `moveTo`, `detach`, `elevations`). A named accessor per property is a non-goal — there are 700 and the list grows with the SDK, which is what `set` / `apply` / `group` are for.
|
|
156
|
+
|
|
157
|
+
### The camera
|
|
158
|
+
|
|
159
|
+
A camera move is a flight with a duration, not a property, so it lives on its own object. Set the duration once and every move after it uses that:
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
map.camera().animate(400).zoom(14).tilt(45);
|
|
163
|
+
|
|
164
|
+
// position, zoom, rotation and tilt in ONE flight - four separate setters animate
|
|
165
|
+
// independently and visibly fight each other
|
|
166
|
+
map.camera().moveTo([5.7606, 45.2442], { zoom: 13.6, tilt: 25, duration: 800 });
|
|
167
|
+
|
|
168
|
+
map.camera().fitBounds([[5.7, 45.1], [5.8, 45.3]]);
|
|
169
|
+
const [lon, lat] = map.camera().position();
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Positions are accepted either way round — `[lon, lat]` or the plugin's own `{ lat, lon }` — so the two surfaces mix freely.
|
|
173
|
+
|
|
174
|
+
### Events are Observable events
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
map.on('map.clicked', (e) => console.log(e.getPos('clickPos')));
|
|
178
|
+
|
|
179
|
+
base.on('vectortile.clicked', (e) => {
|
|
180
|
+
console.log(e.get('featureLayerName'), e.get('featureId'), e.get('feature.properties.name'));
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
`on`, `once` and `off` are NativeScript's own. The native subscription is taken when the first handler for an event is added and dropped when the last one goes. Use `subscribe(event, handler, options)` when one handler needs a different projection from the object's default.
|
|
185
|
+
|
|
186
|
+
**Every handler runs on the main thread.** There is no delivery option, because in NativeScript there is no other answer: the SDK emits from its render and tile threads, and there is no JavaScript runtime on those — a callback there does not run late, it fails to run at all. The plugin's own native listener hops onto the main thread and *waits* before calling into JavaScript, which is also what lets `consumed` get back to the SDK in time and keeps the payload alive while the handler reads it.
|
|
187
|
+
|
|
188
|
+
For an event that fires above frame rate — `map.moved` is 47–159 a second during a drag — use `throttle`:
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
map.subscribe('map.moved', reposition, { throttle: 16 });
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
That is a plugin-side drop, not the facade's coalescing. Coalescing replaces a *pending* payload, and nothing is ever pending when the producer and the handler are the same thread. Never throttle a consumable event: a dropped click is one the SDK is still waiting on.
|
|
195
|
+
|
|
196
|
+
The payload is valid **only while the handler runs** — read what you need, do not keep the object.
|
|
197
|
+
|
|
198
|
+
Claim an event by setting `consumed`, the way a DOM handler calls `preventDefault`:
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
base.on('vectortile.clicked', (e) => {
|
|
202
|
+
if (e.get('featureLayerName') === 'poi') {
|
|
203
|
+
e.consumed = true; // nothing behind this handler sees the click
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
`e.consumable` says whether that will do anything. Only a **consumable** event can be claimed — `vectortile.clicked`, `vectorelement.clicked` and `celestial.clicked`; `map.clicked` cannot, because `MapEventListener::onMapClicked` returns void and there is nothing to tell. Setting it anywhere else is accepted, ignored, and warned about once.
|
|
209
|
+
|
|
210
|
+
### Methods
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
const tile = source.call('loadTile', [8467, 5852, 14]);
|
|
214
|
+
const bytes = tile.getData('data'); // an ArrayBuffer, never a string
|
|
215
|
+
tile.destroy(); // an object result is yours
|
|
216
|
+
|
|
217
|
+
const metres = hillshade.call('getElevations', [[5.76, 45.24], [5.77, 45.25]]); // number[], one crossing
|
|
218
|
+
|
|
219
|
+
// on a worker; `extract` runs while the result is alive, because the facade frees it afterwards
|
|
220
|
+
const data = await source.callAsync('loadTile', [[8467, 5852, 14]], (t) => t.getData('data'));
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
A method can be addressed through a path: `base.call('tileDecoder.loadTile', [8467, 5852, 14])`. A style parameter is *not* one of them any more - it is a property, `base.set('style.params.buildings', 'false')`.
|
|
224
|
+
|
|
225
|
+
### Routing
|
|
226
|
+
|
|
227
|
+
Routing needs no plugin code — it is `create` plus `callAsync`, like everything else:
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
const router = map.object('routing', 'valhalla', {
|
|
231
|
+
type: 'valhalla-online',
|
|
232
|
+
profile: 'bicycle',
|
|
233
|
+
customServiceURL: 'https://valhalla1.openstreetmap.de/{service}'
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
const request = map.object('routing', 'trip',
|
|
237
|
+
{ type: 'request', projection: 'EPSG:4326', points: [[5.72, 45.18], [5.74, 45.24]] },
|
|
238
|
+
'massif::RoutingRequest');
|
|
239
|
+
request.set('params.language', 'fr-FR'); // a bag again - valhalla's parameters nest, so
|
|
240
|
+
request.set('params.costing_options.bicycle.cycling_speed', 22); // a dotted key stays one key
|
|
241
|
+
|
|
242
|
+
const trip = await router.callAsync('calculateRoute', [request.handle], (result) => ({
|
|
243
|
+
metres: result.get('totalDistance'),
|
|
244
|
+
// the path is the FLAT channel - a 9 km route is 562 positions
|
|
245
|
+
path: result.call('getPoints'),
|
|
246
|
+
steps: result.collect((step) => step.get('streetName'),
|
|
247
|
+
{ countPath: 'instructionCount', method: 'getInstruction' })
|
|
248
|
+
}));
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
`profile`, `customServiceURL` and `timeout` are ordinary properties, so they complete and type-check. The **request** is one of the few things the SDK still builds with a hand-written factory, so it names its class — that is what the third argument is for, and it is required precisely so a misspelt key in a kind the schema *does* describe cannot slip through it.
|
|
252
|
+
|
|
253
|
+
**Geocoding is not reachable yet**, and that is an SDK gap rather than a plugin one: no geocoding class carries a `!spec` declaration or a registered method, and the module is absent from the generated schema entirely. Nothing here has to change once it lands — a spec kind and a method row are data.
|
|
254
|
+
|
|
255
|
+
### Moving over a piece at a time
|
|
256
|
+
|
|
257
|
+
```ts
|
|
258
|
+
const base = api.adoptLayer('base', existingLayer.getNative());
|
|
259
|
+
base.on('vectortile.clicked', …);
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
The concrete class is read off the native object, so an adopted `VectorTileLayer` answers to a vector tile layer's properties rather than only to `Layer`'s.
|
|
263
|
+
|
|
264
|
+
### Typings
|
|
265
|
+
|
|
266
|
+
`src/ui-massifmaps/api/massif-api.d.ts` and `schema.ts` are **generated** from the SDK's own `docs/api/massif-api.json` — the same schema its C++ property table is built from.
|
|
267
|
+
|
|
268
|
+
`massif-api.d.ts` is types only — a `.d.ts`, so it is never compiled and never reaches your bundle, whatever its size. The only runtime cost is `schema.ts` (~34 KB): each class' own properties, its base, the enum constants, and the method and event tables — the minimum a dotted path needs to be resolved the way the C++ resolves it. It is tree-shaken away entirely if you never import `api`.
|
|
269
|
+
|
|
270
|
+
Regenerate them after an SDK bump:
|
|
271
|
+
|
|
272
|
+
```sh
|
|
273
|
+
npm run typings.api # reads $MASSIF_SDK_HOME/docs/api/massif-api.json
|
|
274
|
+
npm run typings.api.check # typechecks the layer and its typing tests
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
That is what makes a wrong path, a misspelt spec key, an enum constant from the wrong enum, a method on the wrong class and an unknown event name all **compile errors**.
|
|
278
|
+
|
|
279
|
+
### Requirements and known gaps
|
|
280
|
+
|
|
281
|
+
- Needs an SDK built **with** `all/native/api` (`com.massifmaps.api.MassifApi` / `MSFMassifApi`). `api.isAvailable()` says whether it is there, and every call throws a clear error when it is not. On Android, `-PmassifApi=false` drops the plugin's own listener shim so the object API still builds against an older SDK.
|
|
282
|
+
- **`e.consumed` needs an SDK whose `MassifApi.on` takes the consume flag.** The rest of the chain is already there — the listener's return value is forwarded all the way to `Context::emit`, which only acts on it for a subscription that asked to consume, and `MassifApi::on` passes a literal `false`. `api.canConsume()` reports it, `e.consumable` reports it per event, and a handler that sets `consumed` anyway is warned once instead of silently doing nothing.
|
|
283
|
+
- An **object property cannot be read** (`get('fogOptions')`) — the facade has no `getObject`. Use `group('fogOptions')`, which is what you want anyway.
|
|
284
|
+
- A **collection** is read one element per crossing (`collect()`); a route's path and an elevation profile use the flat numeric channel instead.
|
|
285
|
+
- **Geocoding has no facade surface** — see [Routing](#routing). An SDK gap, not a plugin one.
|
|
286
|
+
- **An object property's value type is a bare `Handle`.** The brand is invariant, so branding it would reject the subclasses the SDK accepts (a `PolygonGeometry` where a `Geometry` is declared). The class is still known — `group()` stays fully typed — and the SDK downcasts and refuses a wrong class at runtime.
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
[](#the-example-gallery)
|
|
290
|
+
|
|
291
|
+
## The example gallery
|
|
292
|
+
|
|
293
|
+
The demo app opens on the same gallery the Android demo does — the SDK's own examples, grouped into the same sections, in the same order, with the same titles, descriptions and screenshots.
|
|
294
|
+
|
|
295
|
+
That is not a copy: `npm run examples` reads the SDK's `docs/examples/examples.json` — the manifest generated from each example's `@ExampleInfo` annotation, and the one the Android app and the website also build from — and writes `demo-snippets/svelte/examples/generated.ts`. A title can only be changed in one place, and the three galleries cannot drift.
|
|
296
|
+
|
|
297
|
+
```sh
|
|
298
|
+
npm run examples # rebuild the metadata from the manifest
|
|
299
|
+
npm run examples.check # typecheck every example's script against the plugin typings
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Screenshots are **linked**, not bundled — `raw.githubusercontent.com/massif-maps/MassifMaps/master/docs/examples/screenshots/<id>.png`. That keeps 1.6 MB of PNG out of the package, needs no image rule in the host app's bundler, and means a recaptured screenshot shows up without a resync. The grid wants the network the first time it is opened. `--image-base <url>` points it elsewhere — a fork, a branch, or a local server.
|
|
303
|
+
|
|
304
|
+
The examples themselves are hand-written ports (the Java is Java, the Svelte is Svelte), written against the **surface API**. The generator pairs them by id — `display-a-map` ↔ `DisplayAMap.svelte` — and *reports* a manifest entry with no component rather than dropping it.
|
|
305
|
+
|
|
306
|
+
The menu offers a **grid** whenever the snippets carry that metadata: section headings, a card per example with its screenshot, title and description. The toolbar switches to the plain list; a snippet package that exports only `demos` gets the list and nothing changes for it.
|
|
307
|
+
|
|
308
|
+
`examples.check` is worth knowing about: a `<script lang="ts">` block is ordinary TypeScript, so each one is extracted and run through `tsc` against the real typings. A misspelt spec key or a property path that does not exist is a build failure rather than a warning on a device.
|
|
309
|
+
|
|
310
|
+
|
|
74
311
|
[](#usage-in-svelte)
|
|
75
312
|
|
|
76
313
|
## Usage in Svelte
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/** Stands in for a null default: Swig's std::string typemap rejects null. Contains a NUL, so no real value equals it. */
|
|
2
|
+
const ABSENT = '\u0000massif:absent';
|
|
3
|
+
function lookup() {
|
|
4
|
+
try {
|
|
5
|
+
return com?.massifmaps?.api?.MassifApi ?? null;
|
|
6
|
+
}
|
|
7
|
+
catch (e) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/** MassifInterop takes SDK types; MassifApi is kept to strings, numbers and handles so a hand-written binding can carry it. */
|
|
12
|
+
function lookupInterop() {
|
|
13
|
+
try {
|
|
14
|
+
return com?.massifmaps?.api?.MassifInterop ?? null;
|
|
15
|
+
}
|
|
16
|
+
catch (e) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Java shim: the SDK emits from render/tile threads with no JS runtime, so it hops to the main
|
|
22
|
+
* looper and waits - which is how a consuming subscription can still answer synchronously.
|
|
23
|
+
*/
|
|
24
|
+
function lookupListener() {
|
|
25
|
+
try {
|
|
26
|
+
return com?.nativescript?.massifmaps?.api?.EventListener ?? null;
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const MassifApi = lookup();
|
|
33
|
+
const MassifInterop = lookupInterop();
|
|
34
|
+
const NativeEventListener = lookupListener();
|
|
35
|
+
/** An SDK whose `on` hardcodes consume has 6 parameters; one taking the consume flag has 7. */
|
|
36
|
+
const CAN_CONSUME = (() => {
|
|
37
|
+
try {
|
|
38
|
+
const methods = MassifApi?.class?.getDeclaredMethods() ?? [];
|
|
39
|
+
for (let i = 0; i < methods.length; i++) {
|
|
40
|
+
if (methods[i].getName() === 'on' && methods[i].getParameterTypes().length === 7) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
// A reflection failure is not a reason to fail the subscription.
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
})();
|
|
50
|
+
/** Keeps each subscription's director alive; the C++ side holds it as a raw pointer. */
|
|
51
|
+
const listeners = new Map();
|
|
52
|
+
function toArrayBuffer(bytes) {
|
|
53
|
+
try {
|
|
54
|
+
return ArrayBuffer.from(java.nio.ByteBuffer.wrap(bytes));
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
// Older runtimes have no ByteBuffer conversion; copying is slow but never wrong.
|
|
58
|
+
const out = new Int8Array(bytes.length);
|
|
59
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
60
|
+
out[i] = bytes[i];
|
|
61
|
+
}
|
|
62
|
+
return out.buffer;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export const bridge = {
|
|
66
|
+
available: !!MassifApi && !!MassifInterop,
|
|
67
|
+
create: (kind, id, json) => MassifApi.create(kind, id, json),
|
|
68
|
+
destroy: (handle) => MassifApi.destroy(handle),
|
|
69
|
+
isValid: (handle) => MassifApi.isValid(handle),
|
|
70
|
+
findObject: (kind, id) => MassifApi.findObject(kind, id),
|
|
71
|
+
unregisterObject: (kind, id) => MassifApi.unregisterObject(kind, id),
|
|
72
|
+
setFloat: (handle, path, value) => MassifApi.setFloat(handle, path, value),
|
|
73
|
+
setInt: (handle, path, value) => MassifApi.setInt(handle, path, value),
|
|
74
|
+
setBool: (handle, path, value) => MassifApi.setBool(handle, path, value),
|
|
75
|
+
setString: (handle, path, value) => MassifApi.setString(handle, path, value),
|
|
76
|
+
setObject: (handle, path, value) => MassifApi.setObject(handle, path, value),
|
|
77
|
+
// Only on an SDK that carries it: an older one keeps the per-key path.
|
|
78
|
+
setAll: MassifApi?.setAll ? (handle, json, projection) => MassifApi.setAll(handle, json, projection) : undefined,
|
|
79
|
+
getObject: (handle, path) => MassifApi.getObject(handle, path),
|
|
80
|
+
getFloat: (handle, path, defaultValue) => MassifApi.getFloat(handle, path, defaultValue),
|
|
81
|
+
getInt: (handle, path, defaultValue) => MassifApi.getInt(handle, path, defaultValue),
|
|
82
|
+
getBool: (handle, path, defaultValue) => MassifApi.getBool(handle, path, defaultValue),
|
|
83
|
+
getString(handle, path) {
|
|
84
|
+
const value = MassifApi.getString(handle, path, ABSENT);
|
|
85
|
+
return value === ABSENT ? null : value;
|
|
86
|
+
},
|
|
87
|
+
getPos(handle, path, projection) {
|
|
88
|
+
const json = MassifApi.getPos(handle, path, projection);
|
|
89
|
+
return json ? json : null;
|
|
90
|
+
},
|
|
91
|
+
call: (handle, method, argsJson) => MassifApi.call(handle, method, argsJson),
|
|
92
|
+
callAsync: (handle, method, argsJson, event) => MassifApi.callAsync(handle, method, argsJson, event),
|
|
93
|
+
cancelCall: (call) => MassifApi.cancelCall(call),
|
|
94
|
+
cancelCalls: (handle) => MassifApi.cancelCalls(handle),
|
|
95
|
+
getDoubles(handle) {
|
|
96
|
+
const native = MassifApi.getDoubles(handle);
|
|
97
|
+
const out = new Array(native ? native.length : 0);
|
|
98
|
+
for (let i = 0; i < out.length; i++) {
|
|
99
|
+
out[i] = native[i];
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
},
|
|
103
|
+
getData(handle, path) {
|
|
104
|
+
// An empty array is what a path that is not a blob returns.
|
|
105
|
+
const data = MassifApi.getData(handle, path);
|
|
106
|
+
return data && data.length ? toArrayBuffer(data) : null;
|
|
107
|
+
},
|
|
108
|
+
canConsume: CAN_CONSUME,
|
|
109
|
+
on(handle, event, handler, delivery, coalesce, projection, consume) {
|
|
110
|
+
if (!NativeEventListener) {
|
|
111
|
+
throw new Error('the plugin was built without com.nativescript.massifmaps.api.EventListener - see the surface API notes in the README');
|
|
112
|
+
}
|
|
113
|
+
const listener = new NativeEventListener(new NativeEventListener.Listener({
|
|
114
|
+
onEvent: (target, name, payload) => handler(target, name, payload)
|
|
115
|
+
}));
|
|
116
|
+
const subscription = CAN_CONSUME ? MassifApi.on(handle, event, listener, delivery, coalesce, projection, consume) : MassifApi.on(handle, event, listener, delivery, coalesce, projection);
|
|
117
|
+
if (subscription) {
|
|
118
|
+
listeners.set(subscription, listener);
|
|
119
|
+
}
|
|
120
|
+
return subscription;
|
|
121
|
+
},
|
|
122
|
+
off(subscription) {
|
|
123
|
+
const removed = MassifApi.off(subscription);
|
|
124
|
+
listeners.delete(subscription);
|
|
125
|
+
return removed;
|
|
126
|
+
},
|
|
127
|
+
offAll(handle) {
|
|
128
|
+
return MassifApi.offAll(handle);
|
|
129
|
+
},
|
|
130
|
+
// One overloaded Java method; the runtime picks by the proxy's own class, so each of these
|
|
131
|
+
// has to be handed a concrete native object - never null, which would be ambiguous.
|
|
132
|
+
adoptOptions: (kind, id, options) => MassifInterop.adopt(kind, id, options),
|
|
133
|
+
adoptLayer: (kind, id, layer) => MassifInterop.adopt(kind, id, layer),
|
|
134
|
+
adoptLayers: (kind, id, layers) => MassifInterop.adopt(kind, id, layers),
|
|
135
|
+
adoptSource: (kind, id, source) => MassifInterop.adopt(kind, id, source),
|
|
136
|
+
adoptView: (kind, id, view) => MassifInterop.adopt(kind, id, view),
|
|
137
|
+
adoptAssets: (kind, id, assets) => MassifInterop.adopt(kind, id, assets),
|
|
138
|
+
getNativeLayer: (id) => MassifInterop.getLayer(id),
|
|
139
|
+
getNativeSource: (id) => MassifInterop.getSource(id),
|
|
140
|
+
getNativeLayerByHandle: (handle) => MassifInterop.getLayerByHandle(handle),
|
|
141
|
+
getNativeSourceByHandle: (handle) => MassifInterop.getSourceByHandle(handle),
|
|
142
|
+
attachMapEvents(mapView, handle) {
|
|
143
|
+
mapView.setMapEventListener(MassifInterop.createEventBridge(handle, mapView.getMapEventListener()));
|
|
144
|
+
},
|
|
145
|
+
attachVectorTileEvents(layer, handle) {
|
|
146
|
+
layer.setVectorTileEventListener(MassifInterop.createVectorTileEventBridge(handle, layer.getVectorTileEventListener()));
|
|
147
|
+
},
|
|
148
|
+
attachVectorElementEvents(layer, handle) {
|
|
149
|
+
layer.setVectorElementEventListener(MassifInterop.createVectorElementEventBridge(handle, layer.getVectorElementEventListener()));
|
|
150
|
+
},
|
|
151
|
+
attachCelestialEvents(layer, handle) {
|
|
152
|
+
layer.setCelestialEventListener(MassifInterop.createCelestialEventBridge(handle, layer.getCelestialEventListener()));
|
|
153
|
+
},
|
|
154
|
+
nativeShortClassName(nativeObject) {
|
|
155
|
+
if (!nativeObject || typeof nativeObject.getClass !== 'function') {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
const name = nativeObject.getClass().getName();
|
|
159
|
+
return name.substring(name.lastIndexOf('.') + 1) || null;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
//# sourceMappingURL=bridge.android.js.map
|
|
@@ -0,0 +1 @@
|
|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CAAC,CAAC;IACzH,CAAC;IAED,oBAAoB,CAAC,YAAY;QAC7B,IAAI,CAAC,YAAY,IAAI,OAAO,YAAY,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;YAC/D,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,IAAI,GAAW,YAAY,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC;QACvD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;IAC7D,CAAC;CACJ,CAAC"}
|
package/api/bridge.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Not typed against the SDK typings on purpose: `com.massifmaps.api` / `MSFMassifApi` are not in
|
|
7
|
+
* the generated typings yet and hand declarations would collide once regenerated.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** Return true to consume the event. */
|
|
11
|
+
export type NativeEventHandler = (target: number, event: string, payload: number) => boolean;
|
|
12
|
+
|
|
13
|
+
/** 0 the producing thread, 1 the UI thread, 2 a background thread. */
|
|
14
|
+
export type Delivery = 0 | 1 | 2;
|
|
15
|
+
|
|
16
|
+
export interface NativeBridge {
|
|
17
|
+
readonly available: boolean;
|
|
18
|
+
|
|
19
|
+
create(kind: string, id: string, json: string): number;
|
|
20
|
+
destroy(handle: number): boolean;
|
|
21
|
+
isValid(handle: number): boolean;
|
|
22
|
+
findObject(kind: string, id: string): number;
|
|
23
|
+
unregisterObject(kind: string, id: string): boolean;
|
|
24
|
+
|
|
25
|
+
setFloat(handle: number, path: string, value: number): number;
|
|
26
|
+
setInt(handle: number, path: string, value: number): number;
|
|
27
|
+
setBool(handle: number, path: string, value: boolean): number;
|
|
28
|
+
setString(handle: number, path: string, value: string): number;
|
|
29
|
+
setObject(handle: number, path: string, value: number): number;
|
|
30
|
+
/** Undefined on an older SDK; callers then fall back to one call per key (see MassifObject.apply). */
|
|
31
|
+
setAll?(handle: number, json: string, projection: string): number;
|
|
32
|
+
/** Returns a handle the caller owns; 0 when there is none. */
|
|
33
|
+
getObject(handle: number, path: string): number;
|
|
34
|
+
|
|
35
|
+
getFloat(handle: number, path: string, defaultValue: number): number;
|
|
36
|
+
getInt(handle: number, path: string, defaultValue: number): number;
|
|
37
|
+
getBool(handle: number, path: string, defaultValue: boolean): boolean;
|
|
38
|
+
/** Null when the path does not resolve. */
|
|
39
|
+
getString(handle: number, path: string): string | null;
|
|
40
|
+
/** Null when the path does not resolve. */
|
|
41
|
+
getPos(handle: number, path: string, projection: string): string | null;
|
|
42
|
+
|
|
43
|
+
/** Throws on a stale handle, an unknown method or arguments that do not fit it. */
|
|
44
|
+
call(handle: number, method: string, argsJson: string): number;
|
|
45
|
+
callAsync(handle: number, method: string, argsJson: string, event: string): number;
|
|
46
|
+
cancelCall(call: number): boolean;
|
|
47
|
+
cancelCalls(handle: number): number;
|
|
48
|
+
|
|
49
|
+
getDoubles(handle: number): number[];
|
|
50
|
+
/** Null when the path is not a blob. */
|
|
51
|
+
getData(handle: number, path: string): ArrayBuffer | null;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Keeps the native listener alive: C++ holds it as a raw pointer (iOS ARC would collect it).
|
|
55
|
+
* `consume` must be declared at subscribe time; the SDK ignores a non-consuming handler's return.
|
|
56
|
+
*/
|
|
57
|
+
on(handle: number, event: string, handler: NativeEventHandler, delivery: Delivery, coalesce: boolean, projection: string, consume: boolean): number;
|
|
58
|
+
|
|
59
|
+
/** False on an SDK whose `on` hardcodes consume; `MassifEventData.consumed` then has no effect. */
|
|
60
|
+
readonly canConsume: boolean;
|
|
61
|
+
off(subscription: number): boolean;
|
|
62
|
+
offAll(handle: number): number;
|
|
63
|
+
|
|
64
|
+
// One method per adoptable base: `adopt` is overloaded on the C++ type (a distinct ObjC selector
|
|
65
|
+
// / Java overload each). `kind` is the id namespace, never the class.
|
|
66
|
+
adoptOptions(kind: string, id: string, options: any): number;
|
|
67
|
+
adoptLayer(kind: string, id: string, layer: any): number;
|
|
68
|
+
adoptLayers(kind: string, id: string, layers: any): number;
|
|
69
|
+
adoptSource(kind: string, id: string, source: any): number;
|
|
70
|
+
/** The map view carries the camera: moveTo, flyTo, fitBounds... become `call`s on the handle. */
|
|
71
|
+
adoptView(kind: string, id: string, view: any): number;
|
|
72
|
+
/** An app subclasses assets (e.g. to read from the app folder); once adopted, a spec's `assets` key resolves the id. */
|
|
73
|
+
adoptAssets(kind: string, id: string, assets: any): number;
|
|
74
|
+
getNativeLayer(id: string): any;
|
|
75
|
+
getNativeSource(id: string): any;
|
|
76
|
+
/** For an object with no id, e.g. a child read off a property. */
|
|
77
|
+
getNativeLayerByHandle(handle: number): any;
|
|
78
|
+
getNativeSourceByHandle(handle: number): any;
|
|
79
|
+
|
|
80
|
+
// Each chains the listener already installed, so existing handlers keep firing.
|
|
81
|
+
attachMapEvents(mapView: any, handle: number): void;
|
|
82
|
+
attachVectorTileEvents(layer: any, handle: number): void;
|
|
83
|
+
attachVectorElementEvents(layer: any, handle: number): void;
|
|
84
|
+
attachCelestialEvents(layer: any, handle: number): void;
|
|
85
|
+
|
|
86
|
+
/** Leaf class name, e.g. `com.massifmaps.layers.VectorTileLayer` / `MSFVectorTileLayer` -> `VectorTileLayer`. */
|
|
87
|
+
nativeShortClassName(nativeObject: any): string | null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export declare const bridge: NativeBridge;
|