@mapsindoors/react-native-maps-indoors-mapbox 2.10.0 → 2.12.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/Package.swift +87 -0
- package/README.md +127 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/mapsindoorsrn/core/MPDisplayRuleModule.java +24 -0
- package/index.ts +4 -233
- package/ios/core/MPDisplayRuleBridge.m +9 -0
- package/ios/core/MPDisplayRuleModule.swift +18 -0
- package/ios/core/MapsIndoorsModule.swift +12 -0
- package/ios/spm-bridges/include/MapsIndoorsBridges.h +1 -0
- package/package.json +8 -3
- package/react-native-maps-indoors-mapbox.podspec +9 -12
- package/specs/NativeMPDisplayRuleModule.ts +2 -0
- package/src/core/MPBuilding.ts +3 -2
- package/src/core/MPCameraEvent.ts +1 -1
- package/src/core/MPCameraEventListener.ts +1 -1
- package/src/core/MPCategory.ts +1 -1
- package/src/core/MPDirectionsRenderer.ts +1 -1
- package/src/core/MPDirectionsRendererOptions.ts +1 -1
- package/src/core/MPDirectionsService.ts +1 -1
- package/src/core/MPDisplayRule.ts +26 -1
- package/src/core/MPEntity.ts +1 -1
- package/src/core/MPEntityInfo.ts +1 -1
- package/src/core/MPFilter.ts +1 -1
- package/src/core/MPFilterBehavior.ts +1 -1
- package/src/core/MPFloor.ts +26 -1
- package/src/core/MPFloorSelectorInterface.ts +1 -1
- package/src/core/MPHighlightBehavior.ts +1 -1
- package/src/core/MPLocation.ts +1 -1
- package/src/core/MPMapConfig.ts +1 -1
- package/src/core/MPMultiPolygon.ts +1 -1
- package/src/core/MPPolygon.ts +1 -1
- package/src/core/MPPositionProviderInterface.ts +1 -1
- package/src/core/MPPositionResultInterface.ts +1 -1
- package/src/core/MPPropertyData.ts +1 -1
- package/src/core/MPQuery.ts +1 -1
- package/src/core/MPRoute.ts +1 -1
- package/src/core/MPRouteCoordinate.ts +1 -1
- package/src/core/MPRouteLeg.ts +1 -1
- package/src/core/MPRouteStep.ts +1 -1
- package/src/core/MPSelectionBehavior.ts +1 -1
- package/src/core/MPSettings3D.ts +1 -1
- package/src/core/MPSolution.ts +1 -1
- package/src/core/MPSolutionConfig.ts +43 -1
- package/src/core/MPSolutionDisplayRule.ts +1 -1
- package/src/core/MPUserRoleCollection.ts +1 -1
- package/src/core/MPUtils.ts +1 -1
- package/src/core/MPVenue.ts +1 -1
- package/src/core/MapControl.ts +1 -1
- package/src/core/MapsIndoors.ts +13 -15
- package/src/core/OnBuildingFoundAtCameraTargetListener.ts +1 -1
- package/src/core/OnFloorSelectionChangedListener.ts +1 -1
- package/src/core/OnLegSelectedListener.ts +1 -1
- package/src/core/OnLocationSelectedListener.ts +1 -1
- package/src/core/OnMapClickListener.ts +1 -1
- package/src/core/OnMarkerClickListener.ts +1 -1
- package/src/core/OnMarkerInfoWindowClickListener.ts +1 -1
- package/src/core/OnPositionUpdateListener.ts +1 -1
- package/src/core/OnVenueFoundAtCameraTargetListener.ts +1 -1
- package/src/core/index.ts +237 -0
- package/ios/.swift-format +0 -79
|
@@ -33,6 +33,8 @@ export interface Spec extends TurboModule {
|
|
|
33
33
|
setIconSize(displayRuleId: string, size: string): Promise<null>;
|
|
34
34
|
getIconScale(displayRuleId: string): Promise<number | null>;
|
|
35
35
|
setIconScale(displayRuleId: string, scale: number): Promise<null>;
|
|
36
|
+
getIconZoomFactor(displayRuleId: string): Promise<number>;
|
|
37
|
+
setIconZoomFactor(displayRuleId: string, factor: number): Promise<null>;
|
|
36
38
|
getIconPlacement(displayRuleId: string): Promise<number | null>;
|
|
37
39
|
setIconPlacement(displayRuleId: string, placement: number): Promise<null>;
|
|
38
40
|
|
package/src/core/MPBuilding.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import MPEntity from "./MPEntity";
|
|
2
|
-
import { MPPoint, MPPolygon, MPFloor, MPBounds, MPDataField, MPPointParams, MPFloorParams } from "
|
|
2
|
+
import { MPPoint, MPPolygon, MPFloor, MPBounds, MPDataField, MPPointParams, MPFloorParams } from "./index";
|
|
3
3
|
import MPBuildingInfo, { MPBuildingInfoParams } from "./MPBuildingInfo";
|
|
4
4
|
import { Platform } from "react-native";
|
|
5
5
|
|
|
@@ -247,7 +247,8 @@ export default class MPBuilding extends MPEntity {
|
|
|
247
247
|
"anchor": this.anchor.toJSON(),
|
|
248
248
|
"buildingInfo": this.buildingInfo,
|
|
249
249
|
"geometry": this.geometry,
|
|
250
|
-
|
|
250
|
+
// JSON.stringify writes a Map as {}. Keys become strings, as the native SDKs send them.
|
|
251
|
+
"floors": Object.fromEntries(this._floors),
|
|
251
252
|
"defaultFloor": this.defaultFloor,
|
|
252
253
|
"address": this.address,
|
|
253
254
|
"boundingBox": this.bounds.toJSON()
|
package/src/core/MPCategory.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EmitterSubscription, NativeEventEmitter, NativeModules } from 'react-native';
|
|
2
|
-
import { MPCameraViewFitMode, MPDirectionsRendererOptions, MPError, MPRoute, OnLegSelectedListener } from "
|
|
2
|
+
import { MPCameraViewFitMode, MPDirectionsRendererOptions, MPError, MPRoute, OnLegSelectedListener } from "./index";
|
|
3
3
|
import { EventNames } from './EventNames';
|
|
4
4
|
import { nativeRouteId } from './RouteHandles';
|
|
5
5
|
import { RouteStopIconConfig } from './RouteStopIconConfig';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MPLegBoundaryIcons, MPRouteAnimationType, MPRouteArrowStyle, MPRouteMarkerDisplayRule, MPRouteStampType, MPStrokeStyle } from "
|
|
1
|
+
import { MPLegBoundaryIcons, MPRouteAnimationType, MPRouteArrowStyle, MPRouteMarkerDisplayRule, MPRouteStampType, MPStrokeStyle } from "./index";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The styling and camera options for a route rendered by {@link MPDirectionsRenderer}.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NativeModules } from 'react-native';
|
|
2
|
-
import { MPError, MPPoint, MPRoute, MPHighway } from "
|
|
2
|
+
import { MPError, MPPoint, MPRoute, MPHighway } from "./index";
|
|
3
3
|
import { attachNativeRoute } from './RouteHandles';
|
|
4
4
|
|
|
5
5
|
const { DirectionsService } = NativeModules;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NativeModules } from 'react-native';
|
|
2
|
-
import { MPError, MPIconSize } from "
|
|
2
|
+
import { MPError, MPIconSize } from "./index";
|
|
3
3
|
import { MPIconPlacement } from './MPIconPlacement';
|
|
4
4
|
import { MPLabelType } from './MPLabelType';
|
|
5
5
|
import { MPBadgePosition } from './MPBadgePosition';
|
|
@@ -1103,6 +1103,31 @@ export default class MPDisplayRule {
|
|
|
1103
1103
|
});
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
1106
|
+
/**
|
|
1107
|
+
* Get the factor the icon grows to across the solution's icon zoom range. Defaults to 1.
|
|
1108
|
+
* @returns Promise<number>
|
|
1109
|
+
*/
|
|
1110
|
+
public async getIconZoomFactor(): Promise<number> {
|
|
1111
|
+
return DisplayRule.getIconZoomFactor(this.id).catch((err: Error) => {
|
|
1112
|
+
return Promise.reject(MPError.create(JSON.parse(err.message)));
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
/**
|
|
1117
|
+
* Set the factor the icon grows to across the solution's icon zoom range.
|
|
1118
|
+
* It must be finite and within 0 < factor <= 4; any other value is ignored with a warning.
|
|
1119
|
+
* @returns Promise<void>
|
|
1120
|
+
*/
|
|
1121
|
+
public async setIconZoomFactor(factor: number): Promise<void> {
|
|
1122
|
+
if (!Number.isFinite(factor) || factor <= 0 || factor > 4) {
|
|
1123
|
+
console.warn(`MapsIndoors: ignoring iconZoomFactor ${factor}, must be finite and within 0 < factor <= 4`);
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
return DisplayRule.setIconZoomFactor(this.id, factor).catch((err: Error) => {
|
|
1127
|
+
return Promise.reject(MPError.create(JSON.parse(err.message)));
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1106
1131
|
/**
|
|
1107
1132
|
* Get the icon's anchor value.
|
|
1108
1133
|
* @returns Promise<MPIconAnchor>
|
package/src/core/MPEntity.ts
CHANGED
package/src/core/MPEntityInfo.ts
CHANGED
package/src/core/MPFilter.ts
CHANGED
package/src/core/MPFloor.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import MPEntity from "./MPEntity";
|
|
2
|
-
import { MPMultiPolygon, MPMultiPolygonParams, MPBounds, MPPoint, MPBuilding } from "
|
|
2
|
+
import { MPMultiPolygon, MPMultiPolygonParams, MPBounds, MPPoint, MPBuilding } from "./index";
|
|
3
3
|
import { Platform } from "react-native";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -119,6 +119,31 @@ export default class MPFloor extends MPEntity {
|
|
|
119
119
|
return this.geometry!.bounds.center;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Writes the floor in the shape the native SDKs send it.
|
|
124
|
+
*
|
|
125
|
+
* Omits `geometry` when it has no coordinates: iOS sends none for a floor whose backend geometry
|
|
126
|
+
* is a single Polygon (SPEX-1803), and decodes a present `geometry` strictly, so sending an empty
|
|
127
|
+
* one would fail the whole building. `entityBounds` carries the extent instead, as native sends it.
|
|
128
|
+
*
|
|
129
|
+
* @public
|
|
130
|
+
* @returns {object}
|
|
131
|
+
*/
|
|
132
|
+
public toJSON(): object {
|
|
133
|
+
const bbox = this.geometry?.bbox;
|
|
134
|
+
const hasBounds = Array.isArray(bbox) && bbox.length === 4 && bbox.every(Number.isFinite);
|
|
135
|
+
return {
|
|
136
|
+
type: this.type,
|
|
137
|
+
id: this.id,
|
|
138
|
+
name: this.name,
|
|
139
|
+
...(this.geometry?.coordinates ? { geometry: this.geometry } : {}),
|
|
140
|
+
aliases: this.aliases,
|
|
141
|
+
floorIndex: this.floorIndex,
|
|
142
|
+
buildingId: this.buildingId,
|
|
143
|
+
...(hasBounds ? { entityBounds: this.geometry!.bounds.toJSON() } : {}),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
122
147
|
}
|
|
123
148
|
|
|
124
149
|
/**
|
package/src/core/MPLocation.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Platform } from "react-native";
|
|
2
|
-
import { MPGeometry, MPPoint, MPPolygon, MPBuilding, MPVenue, MPMultiPolygon, MPBounds, MPLocationType, MPLocationPropertyNames } from "
|
|
2
|
+
import { MPGeometry, MPPoint, MPPolygon, MPBuilding, MPVenue, MPMultiPolygon, MPBounds, MPLocationType, MPLocationPropertyNames } from "./index";
|
|
3
3
|
import MPEntity from "./MPEntity";
|
|
4
4
|
import MPPropertyData from "./MPPropertyData";
|
|
5
5
|
import MPLocationSettings from "./MPLocationSettings";
|
package/src/core/MPMapConfig.ts
CHANGED
package/src/core/MPPolygon.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Platform } from "react-native";
|
|
2
|
-
import { MPPoint, MPDataField, MPPointParams } from "
|
|
2
|
+
import { MPPoint, MPDataField, MPPointParams } from "./index";
|
|
3
3
|
import { MPEntityInfo } from "./MPEntityInfo";
|
|
4
4
|
import MPLocationSettings from "./MPLocationSettings";
|
|
5
5
|
import { MPAdditionalDetail } from "./MPAdditionalDetail";
|
package/src/core/MPQuery.ts
CHANGED
package/src/core/MPRoute.ts
CHANGED
package/src/core/MPRouteLeg.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MPRouteStep, MPRouteProperty, MPRoutePropertyParams, MPRouteCoordinate, MPRouteCoordinateParams, MPRoute } from "
|
|
1
|
+
import { MPRouteStep, MPRouteProperty, MPRoutePropertyParams, MPRouteCoordinate, MPRouteCoordinateParams, MPRoute } from "./index";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A leg of a {@link MPRoute} is defined as all steps between any context shifts (entering/exiting buildings, changing floors).
|
package/src/core/MPRouteStep.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Platform } from "react-native";
|
|
2
|
-
import { MPRouteProperty, MPRoutePropertyParams, MPRouteCoordinate, MPRouteCoordinateParams } from "
|
|
2
|
+
import { MPRouteProperty, MPRoutePropertyParams, MPRouteCoordinate, MPRouteCoordinateParams } from "./index";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Description placeholder.
|
package/src/core/MPSettings3D.ts
CHANGED
package/src/core/MPSolution.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MPCollisionHandling, MPSettings3D } from "
|
|
1
|
+
import { MPCollisionHandling, MPSettings3D } from "./index";
|
|
2
2
|
import MPLocationSettings from "./MPLocationSettings";
|
|
3
3
|
import MPUtils from "./MPUtils";
|
|
4
4
|
|
|
@@ -26,6 +26,8 @@ export default class MPSolutionConfig {
|
|
|
26
26
|
* @param {?MPCollisionHandling} [_mpCollisionHandling]
|
|
27
27
|
* @param {?boolean} [_isNewSelection]
|
|
28
28
|
* @param {?number} [_automatedZoomLimit]
|
|
29
|
+
* @param {?number} [_iconScaleZoomFrom]
|
|
30
|
+
* @param {?number} [_iconScaleZoomTo]
|
|
29
31
|
*/
|
|
30
32
|
private constructor(
|
|
31
33
|
public readonly id: string,
|
|
@@ -35,6 +37,8 @@ export default class MPSolutionConfig {
|
|
|
35
37
|
private _mpCollisionHandling?: MPCollisionHandling,
|
|
36
38
|
private _isNewSelection?: boolean,
|
|
37
39
|
private _automatedZoomLimit?: number,
|
|
40
|
+
private _iconScaleZoomFrom?: number,
|
|
41
|
+
private _iconScaleZoomTo?: number,
|
|
38
42
|
) { }
|
|
39
43
|
|
|
40
44
|
|
|
@@ -55,6 +59,8 @@ export default class MPSolutionConfig {
|
|
|
55
59
|
object?.collisionHandling,
|
|
56
60
|
object?.isNewSelection,
|
|
57
61
|
object?.automatedZoomLimit,
|
|
62
|
+
object?.iconScaleZoomFrom,
|
|
63
|
+
object?.iconScaleZoomTo,
|
|
58
64
|
);
|
|
59
65
|
}
|
|
60
66
|
|
|
@@ -131,6 +137,28 @@ export default class MPSolutionConfig {
|
|
|
131
137
|
public set selectable(selectable: boolean | undefined) {
|
|
132
138
|
this.locationSettings.selectable = selectable;
|
|
133
139
|
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Get the MapsIndoors zoom where icons start to grow towards their display rule's icon zoom
|
|
143
|
+
* factor, as the solution stores it. Undefined when not set.
|
|
144
|
+
*
|
|
145
|
+
* @public
|
|
146
|
+
* @type {number | undefined}
|
|
147
|
+
*/
|
|
148
|
+
public get iconScaleZoomFrom(): number | undefined {
|
|
149
|
+
return this._iconScaleZoomFrom;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Get the MapsIndoors zoom where icons reach their display rule's icon zoom factor, as the
|
|
154
|
+
* solution stores it. Undefined when not set.
|
|
155
|
+
*
|
|
156
|
+
* @public
|
|
157
|
+
* @type {number | undefined}
|
|
158
|
+
*/
|
|
159
|
+
public get iconScaleZoomTo(): number | undefined {
|
|
160
|
+
return this._iconScaleZoomTo;
|
|
161
|
+
}
|
|
134
162
|
}
|
|
135
163
|
|
|
136
164
|
/**
|
|
@@ -185,4 +213,18 @@ export interface MPSolutionConfigParams {
|
|
|
185
213
|
* @type {number}
|
|
186
214
|
*/
|
|
187
215
|
automatedZoomLimit?: number,
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Start of the icon zoom range
|
|
219
|
+
*
|
|
220
|
+
* @type {?number}
|
|
221
|
+
*/
|
|
222
|
+
iconScaleZoomFrom?: number,
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* End of the icon zoom range
|
|
226
|
+
*
|
|
227
|
+
* @type {?number}
|
|
228
|
+
*/
|
|
229
|
+
iconScaleZoomTo?: number,
|
|
188
230
|
}
|
package/src/core/MPUtils.ts
CHANGED
package/src/core/MPVenue.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Platform } from "react-native";
|
|
2
|
-
import { MPPoint, MPPointParams, MPBounds, MPMapStyle, MPPolygon, MPVenueInfo, MPDataField, MPBuilding, MPLocation } from '
|
|
2
|
+
import { MPPoint, MPPointParams, MPBounds, MPMapStyle, MPPolygon, MPVenueInfo, MPDataField, MPBuilding, MPLocation } from './index';
|
|
3
3
|
import MPEntity from "./MPEntity";
|
|
4
4
|
import MPUtils from "./MPUtils";
|
|
5
5
|
|
package/src/core/MapControl.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
OnVenueFoundAtCameraTargetListener, OnBuildingFoundAtCameraTargetListener,
|
|
8
8
|
OnMarkerClickListener, OnMarkerInfoWindowClickListener,
|
|
9
9
|
OnLiveLocationUpdateListener, MPCameraEvent, MPMapStyle, MPCameraUpdate, MPCameraPosition, MPEntity,
|
|
10
|
-
} from "
|
|
10
|
+
} from "./index"
|
|
11
11
|
import { EventNames } from './EventNames';
|
|
12
12
|
import MPHighlightBehavior from './MPHighlightBehavior';
|
|
13
13
|
import { MPSelectionMode } from './MPSelectionMode';
|
package/src/core/MapsIndoors.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
MPLocation, MPSolution, MPVenue, MPQuery, MPFilter,
|
|
5
5
|
MPDisplayRule, MPSolutionDisplayRule, MPPositionProviderInterface,
|
|
6
6
|
MPPositionResultInterface, MPUserRole, MPError, MPCategoryCollection, MPUserRoleCollection
|
|
7
|
-
} from "
|
|
7
|
+
} from "./index";
|
|
8
8
|
import MPBuildingCollection from './MPBuildingCollection';
|
|
9
9
|
import MPVenueCollection from './MPVenueCollection';
|
|
10
10
|
import { EventNames } from './EventNames';
|
|
@@ -14,21 +14,20 @@ import { OnBaseMapCacheProgressListener } from './OnBaseMapCacheProgressListener
|
|
|
14
14
|
const { MapsIndoorsModule } = NativeModules;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* The published version of the map package this
|
|
18
|
-
* package.json
|
|
17
|
+
* The published version of the map package this core is bundled into. The map package sets it from
|
|
18
|
+
* its own package.json (see its index.ts): the core is shared, so it cannot know which package or
|
|
19
|
+
* version it ships in.
|
|
19
20
|
*
|
|
20
21
|
* It is sent on {@link MapsIndoors.load} so the native side can name this wrapper as the component
|
|
21
22
|
* behind the MapsIndoors Insights session. The SDK snapshots the component when the session starts,
|
|
22
23
|
* inside the native load, so the version has to travel on the load call itself.
|
|
23
24
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
})();
|
|
25
|
+
let sdkVersion = 'unknown';
|
|
26
|
+
|
|
27
|
+
/** @internal Called once by the map package's index.ts. */
|
|
28
|
+
export function setSdkVersion(version: string | undefined): void {
|
|
29
|
+
sdkVersion = version ?? 'unknown';
|
|
30
|
+
}
|
|
32
31
|
|
|
33
32
|
/**
|
|
34
33
|
* Main class for accessing data in the MapsIndoors SDK.
|
|
@@ -700,10 +699,9 @@ export default class MapsIndoors {
|
|
|
700
699
|
* This runs independently of {@link synchronizeContent} and {@link cacheData}, which cache the
|
|
701
700
|
* MapsIndoors content itself. Both are needed for a fully offline map.
|
|
702
701
|
*
|
|
703
|
-
*
|
|
704
|
-
*
|
|
705
|
-
*
|
|
706
|
-
* requirement.
|
|
702
|
+
* Works before any {@link MapView} exists, so tiles can be cached ahead of the first map. On
|
|
703
|
+
* iOS, until `MapControl.create` has run this caches the MapsIndoors Mapbox style, so an app
|
|
704
|
+
* rendering its own style should call `MapControl.create` before syncing.
|
|
707
705
|
*
|
|
708
706
|
* Run one call at a time. Progress arrives on a single channel carrying only the fraction, with
|
|
709
707
|
* nothing identifying the call, so two overlapping calls interleave their progress - including
|