@mapsindoors/react-native-maps-indoors-mapbox 2.5.4 → 2.6.1

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.
Files changed (130) hide show
  1. package/README.md +3 -3
  2. package/android/build.gradle +1 -1
  3. package/package.json +1 -1
  4. package/react-native-maps-indoors-mapbox.podspec +2 -2
  5. package/android/src/main/java/com/mapsindoorsrn/core/DirectionsRendererModule.java +0 -322
  6. package/android/src/main/java/com/mapsindoorsrn/core/DirectionsServiceModule.java +0 -166
  7. package/android/src/main/java/com/mapsindoorsrn/core/MPDisplayRuleModule.java +0 -1699
  8. package/android/src/main/java/com/mapsindoorsrn/core/MapControlModule.java +0 -761
  9. package/android/src/main/java/com/mapsindoorsrn/core/MapsIndoorsModule.java +0 -410
  10. package/android/src/main/java/com/mapsindoorsrn/core/RCMapView.java +0 -16
  11. package/android/src/main/java/com/mapsindoorsrn/core/README.md +0 -3
  12. package/android/src/main/java/com/mapsindoorsrn/core/UtilsModule.java +0 -227
  13. package/android/src/main/java/com/mapsindoorsrn/core/models/BitmapStopIconConfig.java +0 -22
  14. package/android/src/main/java/com/mapsindoorsrn/core/models/Bounds.java +0 -19
  15. package/android/src/main/java/com/mapsindoorsrn/core/models/Filter.java +0 -77
  16. package/android/src/main/java/com/mapsindoorsrn/core/models/Location.java +0 -17
  17. package/android/src/main/java/com/mapsindoorsrn/core/models/MPCameraPosition.java +0 -34
  18. package/android/src/main/java/com/mapsindoorsrn/core/models/MPCameraUpdate.java +0 -68
  19. package/android/src/main/java/com/mapsindoorsrn/core/models/MPError.java +0 -38
  20. package/android/src/main/java/com/mapsindoorsrn/core/models/PositionProvider.java +0 -46
  21. package/android/src/main/java/com/mapsindoorsrn/core/models/PositionResult.java +0 -117
  22. package/android/src/main/java/com/mapsindoorsrn/core/models/Query.java +0 -30
  23. package/android/src/main/java/com/mapsindoorsrn/core/models/RouteStopIconConfigModel.java +0 -35
  24. package/ios/core/CameraPosition.swift +0 -15
  25. package/ios/core/CameraUpdate.swift +0 -19
  26. package/ios/core/CameraUpdateError.swift +0 -11
  27. package/ios/core/DirectionsRendererBridge.m +0 -59
  28. package/ios/core/DirectionsRendererModule.swift +0 -359
  29. package/ios/core/DirectionsServiceBridge.m +0 -55
  30. package/ios/core/DirectionsServiceModule.swift +0 -186
  31. package/ios/core/IconStopUrl.swift +0 -17
  32. package/ios/core/LabelGraphic.swift +0 -15
  33. package/ios/core/MPDisplayRuleBridge.m +0 -696
  34. package/ios/core/MPDisplayRuleModule.swift +0 -1704
  35. package/ios/core/MapControlBridge.m +0 -213
  36. package/ios/core/MapControlModule.swift +0 -702
  37. package/ios/core/MapsIndoorsBridge.m +0 -128
  38. package/ios/core/MapsIndoorsData.swift +0 -288
  39. package/ios/core/MapsIndoorsModule.swift +0 -363
  40. package/ios/core/RCMapView.swift +0 -16
  41. package/ios/core/README.md +0 -3
  42. package/ios/core/ReactPositionProvider.swift +0 -27
  43. package/ios/core/RouteIcon.swift +0 -34
  44. package/ios/core/UtilsBridge.m +0 -73
  45. package/ios/core/UtilsModule.swift +0 -182
  46. package/ios/core/helpers.swift +0 -57
  47. package/src/core/EventNames.ts +0 -21
  48. package/src/core/MPBadgePosition.ts +0 -12
  49. package/src/core/MPBounds.ts +0 -155
  50. package/src/core/MPBuilding.ts +0 -333
  51. package/src/core/MPBuildingCollection.ts +0 -57
  52. package/src/core/MPBuildingInfo.ts +0 -63
  53. package/src/core/MPCameraEvent.ts +0 -17
  54. package/src/core/MPCameraEventListener.ts +0 -17
  55. package/src/core/MPCameraPosition.ts +0 -82
  56. package/src/core/MPCameraUpdate.ts +0 -174
  57. package/src/core/MPCameraViewFitMode.ts +0 -25
  58. package/src/core/MPCategory.ts +0 -76
  59. package/src/core/MPCategoryCollection.ts +0 -62
  60. package/src/core/MPCollection.ts +0 -59
  61. package/src/core/MPCollisionHandling.ts +0 -12
  62. package/src/core/MPDataField.ts +0 -69
  63. package/src/core/MPDirectionsRenderer.ts +0 -238
  64. package/src/core/MPDirectionsService.ts +0 -152
  65. package/src/core/MPDisplayRule.ts +0 -1823
  66. package/src/core/MPEntity.ts +0 -60
  67. package/src/core/MPEntityInfo.ts +0 -28
  68. package/src/core/MPError.ts +0 -122
  69. package/src/core/MPFeatureTypes.ts +0 -8
  70. package/src/core/MPFilter.ts +0 -168
  71. package/src/core/MPFilterBehavior.ts +0 -115
  72. package/src/core/MPFloor.ts +0 -170
  73. package/src/core/MPFloorSelectorInterface.ts +0 -63
  74. package/src/core/MPGeometry.ts +0 -91
  75. package/src/core/MPHighlightBehavior.ts +0 -115
  76. package/src/core/MPHighway.ts +0 -14
  77. package/src/core/MPIconPlacement.ts +0 -13
  78. package/src/core/MPIconSize.ts +0 -39
  79. package/src/core/MPLabelGraphic.ts +0 -24
  80. package/src/core/MPLabelPosition.ts +0 -12
  81. package/src/core/MPLabelType.ts +0 -11
  82. package/src/core/MPLocation.ts +0 -410
  83. package/src/core/MPLocationPropertyNames.ts +0 -30
  84. package/src/core/MPLocationSettings.ts +0 -40
  85. package/src/core/MPLocationType.ts +0 -16
  86. package/src/core/MPMapConfig.ts +0 -280
  87. package/src/core/MPMapStyle.ts +0 -57
  88. package/src/core/MPMultiPolygon.ts +0 -218
  89. package/src/core/MPPOIType.ts +0 -43
  90. package/src/core/MPPoint.ts +0 -169
  91. package/src/core/MPPolygon.ts +0 -219
  92. package/src/core/MPPositionProviderInterface.ts +0 -45
  93. package/src/core/MPPositionResultInterface.ts +0 -42
  94. package/src/core/MPPropertyData.ts +0 -224
  95. package/src/core/MPQuery.ts +0 -69
  96. package/src/core/MPRoute.ts +0 -105
  97. package/src/core/MPRouteCoordinate.ts +0 -95
  98. package/src/core/MPRouteLeg.ts +0 -158
  99. package/src/core/MPRouteProperty.ts +0 -83
  100. package/src/core/MPRouteStep.ts +0 -186
  101. package/src/core/MPRouteStopIconConfig.ts +0 -82
  102. package/src/core/MPSelectionBehavior.ts +0 -114
  103. package/src/core/MPSelectionMode.ts +0 -4
  104. package/src/core/MPSettings3D.ts +0 -107
  105. package/src/core/MPSize.ts +0 -21
  106. package/src/core/MPSolution.ts +0 -189
  107. package/src/core/MPSolutionConfig.ts +0 -188
  108. package/src/core/MPSolutionDisplayRule.ts +0 -15
  109. package/src/core/MPUserRole.ts +0 -60
  110. package/src/core/MPUserRoleCollection.ts +0 -37
  111. package/src/core/MPUtils.ts +0 -178
  112. package/src/core/MPVenue.ts +0 -294
  113. package/src/core/MPVenueCollection.ts +0 -58
  114. package/src/core/MPVenueInfo.ts +0 -62
  115. package/src/core/MapControl.ts +0 -961
  116. package/src/core/MapView.tsx +0 -34
  117. package/src/core/MapsIndoors.ts +0 -571
  118. package/src/core/OnBuildingFoundAtCameraTargetListener.ts +0 -17
  119. package/src/core/OnFloorSelectionChangedListener.ts +0 -17
  120. package/src/core/OnFloorUpdateListener.ts +0 -16
  121. package/src/core/OnLegSelectedListener.ts +0 -17
  122. package/src/core/OnLiveLocationUpdateListener.ts +0 -17
  123. package/src/core/OnLocationSelectedListener.ts +0 -17
  124. package/src/core/OnMapClickListener.ts +0 -20
  125. package/src/core/OnMarkerClickListener.ts +0 -17
  126. package/src/core/OnMarkerInfoWindowClickListener.ts +0 -17
  127. package/src/core/OnPositionUpdateListener.ts +0 -17
  128. package/src/core/OnVenueFoundAtCameraTargetListener.ts +0 -17
  129. package/src/core/README.md +0 -3
  130. package/src/core/RouteStopIconConfig.ts +0 -10
@@ -1,961 +0,0 @@
1
- import { EmitterSubscription, NativeEventEmitter, NativeModules } from 'react-native';
2
- import {
3
- MPError, MPFilter, MPFilterBehavior, MPLocation, MPMapConfig,
4
- MPFloorSelectorInterface, MPSelectionBehavior, MPFloor,
5
- MPVenue, MPBuilding, OnMapClickListener, MPPoint, MPCameraEventListener,
6
- OnFloorUpdateListener, OnLocationSelectedListener,
7
- OnVenueFoundAtCameraTargetListener, OnBuildingFoundAtCameraTargetListener,
8
- OnMarkerClickListener, OnMarkerInfoWindowClickListener,
9
- OnLiveLocationUpdateListener, MPCameraEvent, MPMapStyle, MPCameraUpdate, MPCameraPosition, MPEntity,
10
- } from "../../index"
11
- import { EventNames } from './EventNames';
12
- import MPHighlightBehavior from './MPHighlightBehavior';
13
- import { MPSelectionMode } from './MPSelectionMode';
14
- import { MPFeatureType } from './MPFeatureTypes';
15
-
16
-
17
- const { MapControlModule } = NativeModules;
18
-
19
- /**
20
- * Internal - Documentation will follow.
21
- *
22
- * @export
23
- * @class MapControl
24
- * @typedef {MapControl}
25
- */
26
- export default class MapControl {
27
- /**
28
- * Creates an instance of MapControl
29
- *
30
- * @constructor
31
- * @private
32
- */
33
- private constructor() { }
34
-
35
- /**
36
- * Internal - Documentation will follow.
37
- *
38
- * @private
39
- * @type {?EmitterSubscription}
40
- */
41
- private floorSelector?: EmitterSubscription;
42
- /**
43
- * Internal - Documentation will follow.
44
- *
45
- * @private
46
- * @type {?NativeEventEmitter}
47
- */
48
- private eventEmitter?: NativeEventEmitter;
49
- /**
50
- * Internal - Documentation will follow.
51
- *
52
- * @private
53
- * @type {?EmitterSubscription}
54
- */
55
- private onMapClickSub?: EmitterSubscription;
56
- /**
57
- * Internal - Documentation will follow.
58
- *
59
- * @private
60
- * @type {?EmitterSubscription}
61
- */
62
- private onLocationSelectedSub?: EmitterSubscription;
63
- /**
64
- * Internal - Documentation will follow.
65
- *
66
- * @private
67
- * @type {?EmitterSubscription}
68
- */
69
- private onCurrentVenueChangedSub?: EmitterSubscription;
70
- /**
71
- * Internal - Documentation will follow.
72
- *
73
- * @private
74
- * @type {?EmitterSubscription}
75
- */
76
- private onCurrentBuildingChangedSub?: EmitterSubscription;
77
- /**
78
- * Internal - Documentation will follow.
79
- *
80
- * @private
81
- * @type {?EmitterSubscription}
82
- */
83
- private onMarkerClickSub?: EmitterSubscription;
84
- /**
85
- * Internal - Documentation will follow.
86
- *
87
- * @private
88
- * @type {?EmitterSubscription}
89
- */
90
- private onMarkerInfoWindowClickSub?: EmitterSubscription;
91
- /**
92
- * Internal - Documentation will follow.
93
- *
94
- * @private
95
- * @type {Map<MPCameraEventListener, EmitterSubscription | undefined>}
96
- */
97
- private onCameraEventSubs: Map<MPCameraEventListener, EmitterSubscription | undefined> = new Map;
98
- /**
99
- * Internal - Documentation will follow.
100
- *
101
- * @private
102
- * @type {Map<OnFloorUpdateListener, EmitterSubscription | undefined>}
103
- */
104
- private onFloorUpdateSubs: Map<OnFloorUpdateListener, EmitterSubscription | undefined> = new Map;
105
- /**
106
- * Internal - Documentation will follow.
107
- *
108
- * @private
109
- * @type {Map<string, EmitterSubscription | undefined>}
110
- */
111
- private onLiveUpdateSubs: Map<string, EmitterSubscription | undefined> = new Map;
112
-
113
- /**
114
- * Create a new MapControl instance.
115
- *
116
- * Note that new MapControl instances will only be created when/if the MapsIndoors SDK has initialized successfully.
117
- *
118
- * This method will wait until this condition has been met.
119
- *
120
- * @public
121
- * @static
122
- * @async
123
- * @param {MPMapConfig} config A configuration object that handles setting multiple options for MapControl.
124
- * @param {typeof NativeEventEmitter} nativeEventEmitter An event emitter needed to communicate with the native SDKs.
125
- * @returns {Promise<MapControl>} A ready to use MapControl instace.
126
- */
127
- public static async create(config: MPMapConfig, nativeEventEmitter: typeof NativeEventEmitter): Promise<MapControl> {
128
- return MapControlModule.initMapControl(config).then(() => {
129
- const mapControl = new MapControl();
130
- mapControl.eventEmitter = new nativeEventEmitter(MapControlModule);
131
- if (config.floorSelector !== undefined) {
132
- mapControl.setFloorSelector(config.floorSelector);
133
- }
134
- return Promise.resolve(mapControl);
135
- }).catch((err: Error) => Promise.reject(MPError.parse(err)));
136
- }
137
-
138
- /**
139
- * Internal - Documentation will follow.
140
- *
141
- * @private
142
- * @param {MPFloor} newFloor
143
- */
144
- private onFloorSelectionChanged(newFloor: MPFloor): void {
145
- MapControlModule.onFloorSelectionChanged(JSON.stringify(newFloor));
146
- }
147
-
148
- /**
149
- * Select a venue, optionally move the camera to the given venue.
150
- *
151
- * @public
152
- * @async
153
- * @param {MPVenue} venue
154
- * @param {boolean} moveCamera Whether to move the camera such that it shows the selected venue
155
- * @returns {Promise<void>} When the selection (and possible camera animation) has completed
156
- */
157
- public async selectVenue(venue: MPVenue, moveCamera: boolean): Promise<void> {
158
- return MapControlModule.selectVenue(JSON.stringify(venue), moveCamera).then(() => {});
159
- }
160
-
161
- /**
162
- * Get the currently selected venue, if there is any.
163
- *
164
- * @public
165
- * @async
166
- * @returns {Promise<MPVenue | undefined>} The current venue, if any is selected.
167
- */
168
- public async getCurrentVenue(): Promise<MPVenue | undefined> {
169
- return MapControlModule.getCurrentVenue().then((venue: string) =>
170
- venue ? Promise.resolve(MPVenue.create(JSON.parse(venue as string))) : undefined);
171
- }
172
-
173
- /**
174
- * Get the currently selected building, if there is any.
175
- *
176
- * @public
177
- * @async
178
- * @returns {Promise<MPBuilding | undefined>} The current building, if any is selected.
179
- */
180
- public async getCurrentBuilding(): Promise<MPBuilding | undefined> {
181
- return MapControlModule.getCurrentBuilding().then((building: string) =>
182
- building ? Promise.resolve(MPBuilding.create(JSON.parse(building as string))) : undefined);
183
- }
184
-
185
- /**
186
- * Select a building, optionally move the camera to the given building.
187
- *
188
- * @public
189
- * @async
190
- * @param {MPBuilding} building
191
- * @param {boolean} moveCamera Whether to move the camera such that it shows the selected building
192
- * @returns {Promise<void>} When the selection (and possible camera animation) has completed
193
- */
194
- public async selectBuilding(building: MPBuilding, moveCamera: boolean): Promise<void> {
195
- return MapControlModule.selectBuilding(JSON.stringify(building), moveCamera);
196
- }
197
-
198
- /**
199
- * Selects a location based on a {@link MPLocation} object.
200
- *
201
- * @public
202
- * @async
203
- * @param {MPLocation} location
204
- * @param {MPSelectionBehavior} behavior Optionally apply a {@link MPSelectionBehavior}.
205
- * @returns {Promise<void>}
206
- */
207
- public async selectLocation(location: MPLocation, behavior: MPSelectionBehavior): Promise<void>;
208
- /**
209
- * Selects a location based on a id string object.
210
- *
211
- * @public
212
- * @async
213
- * @param {string} id
214
- * @param {MPSelectionBehavior} behavior Optionally apply a {@link MPSelectionBehavior}.
215
- * @returns {Promise<void>}
216
- */
217
- public async selectLocation(id: string, behavior: MPSelectionBehavior): Promise<void>;
218
- /**
219
- * Selects a location based on a id string or location object.
220
- *
221
- * @public Internal, combination of other overrides.
222
- * @async
223
- * @param {(MPLocation | string)} locationOrId
224
- * @param {MPSelectionBehavior} behavior Optionally apply a {@link MPSelectionBehavior}.
225
- * @returns {Promise<void>}
226
- */
227
- public async selectLocation(locationOrId: MPLocation | string, behavior: MPSelectionBehavior): Promise<void> {
228
- if (locationOrId instanceof MPLocation) {
229
- return Promise.resolve(MapControlModule.selectLocation(JSON.stringify(locationOrId), JSON.stringify(behavior)));
230
- } else {
231
- return Promise.resolve(MapControlModule.selectLocationWithId(locationOrId, JSON.stringify(behavior)));
232
- }
233
- }
234
-
235
- /**
236
- * Invoke this method to restore the map to its default state (POIs shown based on their display rules, etc.).
237
- *
238
- * @public
239
- * @async
240
- * @returns {Promise<void>}
241
- */
242
- public async clearFilter(): Promise<void> {
243
- return Promise.resolve(MapControlModule.clearFilter());
244
- }
245
-
246
- /**
247
- * Use this method to display temporary locations, not points of interests location. Use [clearFilter()] to exit this state.
248
- *
249
- * @public
250
- * @async
251
- * @param {MPLocation[]} locations A list of locations to display.
252
- * @param {MPFilterBehavior} filterBehavior How the map should show the applied filter.
253
- * @returns {Promise<boolean>} True if any locations are available.
254
- */
255
- public async setFilter(locations: MPLocation[], filterBehavior: MPFilterBehavior): Promise<boolean>;
256
- /**
257
- * Use this method to display temporary locations, not points of interests location. Use [clearFilter()] to exit this state.
258
- *
259
- * @public
260
- * @async
261
- * @param {MPFilter} filter The applied filter.
262
- * @param {MPFilterBehavior} filterBehavior How the map should show the applied filter.
263
- * @returns {Promise<boolean>} True if any locations are available.
264
- */
265
- public async setFilter(filter: MPFilter, filterBehavior: MPFilterBehavior): Promise<boolean>;
266
-
267
- /**
268
- * Use this method to display temporary locations. Use [clearFilter()] to exit this state.
269
- *
270
- * @public
271
- * @async
272
- * @param {(MPLocation[] | MPFilter)} locationOrFilter The applied filter.
273
- * @param {MPFilterBehavior} filterBehavior How the map should show the applied filter.
274
- * @returns {Promise<boolean>} True if any locations are available.
275
- */
276
- public async setFilter(locationOrFilter: MPLocation[] | MPFilter, filterBehavior: MPFilterBehavior): Promise<boolean> {
277
- if (Array.isArray(locationOrFilter)) {
278
- const locationIds: string[] = new Array();
279
- locationOrFilter.forEach((location => {
280
- locationIds.push(location.id);
281
- }));
282
- return Promise.resolve(MapControlModule.setFilterWithLocations(JSON.stringify(locationIds), JSON.stringify(filterBehavior)));
283
- } else {
284
- return Promise.resolve(MapControlModule.setFilter(JSON.stringify(locationOrFilter), JSON.stringify(filterBehavior)));
285
- }
286
- }
287
-
288
- /**
289
- *
290
- * Use this method to highlight a list of locations. Use [clearHighlight()] to exit this state.
291
- *
292
- * @param locations the locations to highlight
293
- * @param highlightBehavior How the map should show the applied highlight
294
- * @returns
295
- */
296
- public async setHighlight(locations: MPLocation[], highlightBehavior: MPHighlightBehavior): Promise<void> {
297
- const locationIds: string[] = new Array();
298
- locations.forEach((location => {
299
- locationIds.push(location.id);
300
- }));
301
- return Promise.resolve(MapControlModule.setHighlight(JSON.stringify(locationIds), JSON.stringify(highlightBehavior)));
302
- }
303
-
304
- public async clearHighlight(): Promise<void> {
305
- return MapControlModule.clearHighlight();
306
- }
307
-
308
- /**
309
- * Focus the map on the given {@link MPEntity}.
310
- *
311
- * Examples of classes of type {@link MPEntity} are: {@link MPVenue}, {@link MPBuilding},
312
- * {@link MPBuilding}, {@link MPLocation}.
313
- *
314
- * @public
315
- * @async
316
- * @param {MPEntity} entity The entity to move to.
317
- * @returns {Promise<void>}
318
- */
319
- public async goTo(entity: MPEntity, maxZoom?: number): Promise<void> {
320
- if (maxZoom) {
321
- return MapControlModule.goTo(JSON.stringify(entity), entity.type, maxZoom);
322
- }
323
- return MapControlModule.goTo(JSON.stringify(entity), entity.type, -999);
324
- }
325
-
326
- /**
327
- * Sets padding on the map.
328
- *
329
- * @public
330
- * @async
331
- * @param {number} start
332
- * @param {number} top
333
- * @param {number} end
334
- * @param {number} bottom
335
- * @returns {Promise<void>}
336
- */
337
- public async setMapPadding(start: number, top: number, end: number, bottom: number): Promise<void> {
338
- await MapControlModule.setMapPadding(start, top, end, bottom);
339
- }
340
-
341
- /**
342
- * Gets the Map View bottom padding.
343
- *
344
- * @public
345
- * @async
346
- * @returns {Promise<number>}
347
- */
348
- public async getMapViewPaddingStart(): Promise<number> {
349
- return MapControlModule.getMapViewPaddingStart();
350
- }
351
-
352
- /**
353
- * Gets the Map View bottom padding.
354
- *
355
- * @public
356
- * @async
357
- * @returns {Promise<number>}
358
- */
359
- public async getMapViewPaddingTop(): Promise<number> {
360
- return MapControlModule.getMapViewPaddingTop();
361
- }
362
-
363
- /**
364
- * Gets the Map View bottom padding.
365
- *
366
- * @public
367
- * @async
368
- * @returns {Promise<number>}
369
- */
370
- public async getMapViewPaddingEnd(): Promise<number> {
371
- return MapControlModule.getMapViewPaddingEnd();
372
- }
373
-
374
- /**
375
- * Gets the Map View bottom padding.
376
- *
377
- * @public
378
- * @async
379
- * @returns {Promise<number>}
380
- */
381
- public async getMapViewPaddingBottom(): Promise<number> {
382
- return MapControlModule.getMapViewPaddingBottom();
383
- }
384
-
385
- /**
386
- * Sets the map style for MapsIndoors tiles.
387
- *
388
- * @public
389
- * @async
390
- * @param {MPMapStyle} style Is a {@link MPMapStyle} object, a list of available {@link MPMapStyle}s can be fetched via {@link MapsIndoors.getMapStyles}.
391
- * @returns {Promise<void>}
392
- */
393
- public async setMapStyle(style: MPMapStyle): Promise<void> {
394
- await MapControlModule.setMapStyle(JSON.stringify(style));
395
- }
396
-
397
- /**
398
- * Gets the current map style of MapsIndoors tiles.
399
- *
400
- * @public
401
- * @async
402
- * @returns {Promise<MPMapStyle>}
403
- */
404
- public async getMapStyle(): Promise<MPMapStyle|undefined> {
405
- let mapStyleString = await MapControlModule.getMapStyle();
406
- return Promise.resolve(mapStyleString ? MPMapStyle.create(JSON.parse(mapStyleString)) : undefined);
407
- }
408
-
409
- /**
410
- * Enables/disables the info window on user-selected locations.
411
- *
412
- * The info window is shown by default when the user selects a location (by tapping on it)
413
- *
414
- * @public
415
- * @async
416
- * @param {boolean} show
417
- * @returns {Promise<void>}
418
- */
419
- public async showInfoWindowOnClickedLocation(show: boolean): Promise<void> {
420
- await MapControlModule.showInfoWindowOnClickedLocation(show);
421
- }
422
-
423
- /**
424
- * Call this to deselect a location previously selected with {@link selectLocation(MPLocation, MPSelectionBehavior)}.
425
- *
426
- * @public
427
- * @async
428
- * @returns {Promise<void>}
429
- */
430
- public async deSelectLocation(): Promise<void> {
431
- await MapControlModule.deSelectLocation();
432
- }
433
-
434
- /**
435
- * Returns the current {@link MPFloor} of the current {@link MPBuilding} in focus.
436
- *
437
- * @public
438
- * @async
439
- * @returns {Promise<MPFloor>}
440
- */
441
- public async getCurrentBuildingFloor(): Promise<MPFloor|undefined> {
442
- let floorString = await MapControlModule.getCurrentBuildingFloor();
443
- return Promise.resolve(floorString ? MPFloor.create(JSON.parse(floorString)) : undefined);
444
- }
445
-
446
- /**
447
- * Returns the current floor index or {@link MPFloor.defaultGroundFloorIndex} if no {@link MPBuilding} is in focus.
448
- *
449
- * @public
450
- * @async
451
- * @returns {Promise<number>}
452
- */
453
- public async getCurrentFloorIndex(): Promise<number> {
454
- return MapControlModule.getCurrentFloorIndex();
455
- }
456
-
457
- /**
458
- * Get the zoom level that MapsIndoors is currently using for displaying icons on the map.
459
- *
460
- * @public
461
- * @async
462
- * @returns {Promise<number>}
463
- */
464
- public async getCurrentMapsIndoorsZoom(): Promise<number> {
465
- return MapControlModule.getCurrentMapsIndoorsZoom();
466
- }
467
-
468
- /**
469
- * Sets the current visible floor to the given floorIndex one.
470
- *
471
- * For floor names/z-index pairs check the value returned by {@link MPBuilding.floors}
472
- *
473
- * @public
474
- * @async
475
- * @param {number} floorIndex
476
- * @returns {Promise<void>}
477
- */
478
- public async selectFloor(floorIndex: number): Promise<void> {
479
- await MapControlModule.selectFloor(floorIndex);
480
- }
481
-
482
- /**
483
- * Returns the visibility state of the currently used {@link MPFloorSelectorInterface}.
484
- *
485
- * @public
486
- * @async
487
- * @returns {Promise<boolean>}
488
- */
489
- public async isFloorSelectorHidden(): Promise<boolean> {
490
- return MapControlModule.isFloorSelectorHidden();
491
- }
492
-
493
- /**
494
- * Shows or hides the {@link MPFloorSelectorInterface}, i.e. hiding the View from {@link MapControl}.
495
- *
496
- * {@link MapControl} will still receive relevant events on floor updates, building change etc.
497
- *
498
- * The Interface will also receive the events, making it possible to show/hide in real time, without refreshing the map.
499
- *
500
- * @public
501
- * @async
502
- * @param {boolean} hide
503
- * @returns {Promise<void>}
504
- */
505
- public async hideFloorSelector(hide: boolean): Promise<void> {
506
- await MapControlModule.hideFloorSelector(hide);
507
- }
508
-
509
- /**
510
- * Replaces the default FloorSelector with a custom one.
511
- *
512
- * @public
513
- * @async
514
- * @param {?MPFloorSelectorInterface} [floorSelector]
515
- * @returns {Promise<void>}
516
- */
517
- public async setFloorSelector(floorSelector?: MPFloorSelectorInterface): Promise<void> {
518
- if (floorSelector) {
519
- floorSelector.setOnFloorSelectionChangedListener(this.onFloorSelectionChanged);
520
- await this.setupFloorSelector(floorSelector);
521
- } else {
522
- await this.teardownFloorSelector();
523
- }
524
- }
525
-
526
- /**
527
- * Sets up the floor selector to be able to receive events from the native SDK.
528
- *
529
- * @private
530
- * @async
531
- * @param {MPFloorSelectorInterface} floorSelector
532
- * @returns {Promise<void>}
533
- */
534
- private async setupFloorSelector(floorSelector: MPFloorSelectorInterface): Promise<void> {
535
- return MapControlModule.setFloorSelector(true, floorSelector.isAutoFloorChangeEnabled()).then(() => {
536
- const sub = this.eventEmitter?.addListener(EventNames.floorSelector, event => {
537
- const fs = floorSelector;
538
- const method: String = event.method;
539
- switch (method) {
540
- case "setList": {
541
- fs.setFloors(event.list ?
542
- JSON.parse(event.list).map((venue: any) => MPFloor.create(venue)) :
543
- undefined);
544
- }
545
- break;
546
- case "show": {
547
- fs.show(event.show, event.animated);
548
- }
549
- break;
550
- case "setSelectedFloor": {
551
- fs.setSelectedFloor(MPFloor.create(JSON.parse(event.floor)));
552
- }
553
- break;
554
- case "setSelectedFloorByFloorIndex": {
555
- fs.setSelectedFloorByFloorIndex(event.floorIndex);
556
- }
557
- break;
558
- case "zoomLevelChanged": {
559
- fs.zoomLevelChanged(event.zoom);
560
- }
561
- break;
562
- case "setUserPositionFloor": {
563
- fs.setUserPositionFloor(event.floor);
564
- }
565
- break;
566
- }
567
- });
568
- this.floorSelector = sub;
569
- return Promise.resolve();
570
- });
571
- }
572
-
573
- /**
574
- * Removes a custom floor selector.
575
- *
576
- * @private
577
- * @async
578
- * @returns {Promise<void>}
579
- */
580
- private async teardownFloorSelector(): Promise<void> {
581
- return MapControlModule.setFloorSelector(false).then(() => {
582
- this.floorSelector?.remove();
583
- this.floorSelector = undefined;
584
- return Promise.resolve();
585
- });
586
- }
587
-
588
-
589
- /**
590
- * Renders the positioning blue dot at the last known user position on the map.
591
- *
592
- * @public
593
- * @async
594
- * @param {boolean} show
595
- * @returns {Promise<void>}
596
- */
597
- public async showUserPosition(show: boolean): Promise<void> {
598
- return MapControlModule.showUserPosition(show).then(() => Promise.resolve());
599
- }
600
-
601
- /**
602
- * Returns the current visibility state of the user location icon (blue dot).
603
- *
604
- * @public
605
- * @async
606
- * @returns {Promise<boolean>}
607
- */
608
- public async isUserPositionShown(): Promise<boolean> {
609
- return MapControlModule.isUserPositionShown();
610
- }
611
-
612
- /**
613
- * Enables live data on a specific domain and uses MapsIndoors standard graphic implementation.
614
- *
615
- * Uses a domainType string, use {@link LiveDataDomainTypes} to get supported strings.
616
- *
617
- * @public
618
- * @async
619
- * @param {string} domainType
620
- * @param {?OnLiveLocationUpdateListener} [listener]
621
- * @returns {Promise<void>}
622
- */
623
- public async enableLiveData(domainType: string, listener?: OnLiveLocationUpdateListener): Promise<void> {
624
- await MapControlModule.enableLiveData(domainType, listener !== undefined);
625
- if (listener) {
626
- this.addLiveDataListener(domainType, listener);
627
- }
628
- }
629
-
630
- /**
631
- * Set up livedata listener to receive events from the native SDK.
632
- *
633
- * @private
634
- * @param {string} domainType
635
- * @param {OnLiveLocationUpdateListener} listener
636
- */
637
- private addLiveDataListener(domainType: string, listener: OnLiveLocationUpdateListener) {
638
- this.onLiveUpdateSubs.get(domainType)?.remove();
639
- const sub = this.eventEmitter?.addListener(EventNames.onLiveLocationUpdate, event => {
640
- const location = MPLocation.create(JSON.parse(event.location));
641
- listener(location);
642
- });
643
- this.onLiveUpdateSubs.set(domainType, sub);
644
- }
645
-
646
- /**
647
- * Disables live data for a specific domainType.
648
- *
649
- * @public
650
- * @async
651
- * @param {string} domainType
652
- * @returns {Promise<void>}
653
- */
654
- public async disableLiveData(domainType: string): Promise<void> {
655
- await MapControlModule.disableLiveData(domainType);
656
- this.removeLiveDataListener(domainType);
657
- }
658
-
659
- /**
660
- * Destroy up livedata listener to receive events from the native SDK.
661
- *
662
- * @private
663
- * @param {string} domainType
664
- */
665
- private removeLiveDataListener(domainType: string) {
666
- this.onLiveUpdateSubs.get(domainType)?.remove();
667
- this.onLiveUpdateSubs.delete(domainType);
668
- }
669
-
670
- /**
671
- * Uses a camera update to animate the camera.
672
- *
673
- * @public
674
- * @async
675
- * @param {MPCameraUpdate} update How to update the camera.
676
- * @param {?number} [duration] how long the animation should take in ms.
677
- * @returns {Promise<void>}
678
- */
679
- public async animateCamera(update: MPCameraUpdate, duration?: number): Promise<void> {
680
- if (duration === undefined) {
681
- duration = -1;
682
- }
683
- await MapControlModule.animateCamera(JSON.stringify(update), duration);
684
- }
685
-
686
- /**
687
- * Uses a camera update to move the camera instantly.
688
- *
689
- * @public
690
- * @async
691
- * @param {MPCameraUpdate} update How to update the camera.
692
- * @returns {Promise<void>}
693
- */
694
- public async moveCamera(update: MPCameraUpdate): Promise<void> {
695
- await MapControlModule.moveCamera(JSON.stringify(update));
696
- }
697
-
698
- /**
699
- * Saves the current position of the camera into a {@link MPCameraPosition}.
700
- *
701
- * @public
702
- * @async
703
- * @returns {Promise<MPCameraPosition>}
704
- */
705
- public async getCurrentCameraPosition(): Promise<MPCameraPosition> {
706
- let positionString = await MapControlModule.getCurrentCameraPosition();
707
- return Promise.resolve(MPCameraPosition.create(JSON.parse(positionString)));
708
- }
709
-
710
- /**
711
- * Set a listener for when the map has been tapped.
712
- *
713
- * @public
714
- * @param {?OnMapClickListener} [listener] Call with undefined to remove the listener.
715
- * @param {?boolean} [consumeEvent] Whether the SDK should also react to this event.
716
- */
717
- public setOnMapClickListener(listener?: OnMapClickListener, consumeEvent?: boolean): void {
718
- MapControlModule.setOnMapClickListener(listener !== undefined, consumeEvent ? true : false);
719
- this.onMapClickSub?.remove();
720
- if (listener !== undefined) {
721
- this.onMapClickSub = this.eventEmitter?.addListener(EventNames.onMapClick, event => {
722
- const point: MPPoint = MPPoint.create(JSON.parse(event.point));
723
- if (event.locations != null) {
724
- const locs: MPLocation[] = JSON.parse(event.locations).map((loc: any) => MPLocation.create(loc));
725
- listener(point, locs);
726
- }else {
727
- listener(point, undefined)
728
- }
729
- });
730
- }
731
- }
732
-
733
- /**
734
- * Set a location selection listener, invoked when a location is selected,
735
- * either by tapping on it, or programmatically with {@link selectLocation}.
736
- *
737
- * @public
738
- * @param {?OnLocationSelectedListener} [listener]
739
- * @param {?boolean} [consumeEvent] Whether the SDK should also react to this event.
740
- */
741
- public setOnLocationSelectedListener(listener?: OnLocationSelectedListener, consumeEvent?: boolean): void {
742
- MapControlModule.setOnLocationSelectedListener(listener !== undefined, consumeEvent !== undefined && consumeEvent);
743
- this.onLocationSelectedSub?.remove();
744
- if (listener !== undefined) {
745
- this.onLocationSelectedSub = this.eventEmitter?.addListener(EventNames.onLocationSelected, event => {
746
- const loc: MPLocation = MPLocation.create(JSON.parse(event.location));
747
- listener(loc);
748
- });
749
- }
750
- }
751
-
752
- /**
753
- * Set a current venue changed event listener, which is invoked when the currently selected venue changes.
754
- *
755
- * @public
756
- * @param {?OnVenueFoundAtCameraTargetListener} [listener]
757
- */
758
- public setOnCurrentVenueChangedListener(listener?: OnVenueFoundAtCameraTargetListener): void {
759
- MapControlModule.setOnCurrentVenueChangedListener(listener !== undefined);
760
- this.onCurrentVenueChangedSub?.remove();
761
- if (listener !== undefined) {
762
- this.onCurrentVenueChangedSub = this.eventEmitter?.addListener(EventNames.onVenueFoundAtCameraTarget, event => {
763
- const venueString = JSON.parse(event.venue);
764
- if (venueString != undefined) {
765
- listener(MPVenue.create(venueString))
766
- } else {
767
- listener();
768
- }
769
- });
770
- }
771
- }
772
-
773
- /**
774
- * Set a current building changed event listener, which is invoked when the currently selected building changes.
775
- *
776
- * @public
777
- * @param {?OnBuildingFoundAtCameraTargetListener} [listener]
778
- */
779
- public setOnCurrentBuildingChangedListener(listener?: OnBuildingFoundAtCameraTargetListener): void {
780
- MapControlModule.setOnCurrentBuildingChangedListener(listener !== undefined);
781
- this.onCurrentBuildingChangedSub?.remove();
782
- if (listener !== undefined) {
783
- this.onCurrentBuildingChangedSub = this.eventEmitter?.addListener(EventNames.onBuildingFoundAtCameraTarget, event => {
784
- const buildingString = JSON.parse(event.building);
785
- if (buildingString != undefined) {
786
- listener(MPBuilding.create(buildingString));
787
- } else {
788
- listener();
789
- }
790
-
791
- });
792
- }
793
- }
794
-
795
- /**
796
- * Set a marker click event listener, invoked when a marker is clicked.
797
- *
798
- * @public
799
- * @param {?OnMarkerClickListener} [listener]
800
- * @param {?boolean} [consumeEvent] Whether the SDK should also react to this event.
801
- */
802
- public setOnMarkerClickListener(listener?: OnMarkerClickListener, consumeEvent?: boolean): void {
803
- MapControlModule.setOnMarkerClickListener(listener !== undefined, consumeEvent !== undefined && consumeEvent);
804
- this.onMarkerClickSub?.remove();
805
- if (listener !== undefined) {
806
- this.onMarkerClickSub = this.eventEmitter?.addListener(EventNames.onMarkerClick, event => {
807
- const locId = event.locationId;
808
- listener(locId);
809
- });
810
- }
811
- }
812
-
813
- /**
814
- * Set a info window click listener, invoked when an info window is clicked.
815
- *
816
- * @public
817
- * @param {?OnMarkerInfoWindowClickListener} [listener]
818
- */
819
- public setOnMarkerInfoWindowClickListener(listener?: OnMarkerInfoWindowClickListener): void {
820
- MapControlModule.setOnMarkerInfoWindowClickListener(listener !== undefined);
821
- this.onMarkerInfoWindowClickSub?.remove();
822
- if (listener !== undefined) {
823
- this.onMarkerInfoWindowClickSub = this.eventEmitter?.addListener(EventNames.onInfoWindowClick, event => {
824
- const locId = event.locationId;
825
- listener(locId);
826
- });
827
- }
828
- }
829
-
830
- /**
831
- * Add a camera event listener, invoked when a camera event occurs (e.g. moved, idle) (see {@link MPCameraEvent}).
832
- *
833
- * @public
834
- * @param {MPCameraEventListener} listener
835
- */
836
- public addOnCameraEventListener(listener: MPCameraEventListener): void {
837
- if (this.onCameraEventSubs.size == 0) {
838
- MapControlModule.setMPCameraEventListener(true);
839
- }
840
- const sub = this.eventEmitter?.addListener(EventNames.cameraEvent, event => {
841
- const cameraEvent: MPCameraEvent = event.event;
842
- listener(cameraEvent);
843
- });
844
- this.onCameraEventSubs.set(listener, sub);
845
- }
846
-
847
- /**
848
- * Remove a camera event listener.
849
- *
850
- * @public
851
- * @param {MPCameraEventListener} listener
852
- */
853
- public removeOnCameraEventListener(listener: MPCameraEventListener): void {
854
- this.onCameraEventSubs.get(listener)?.remove();
855
- this.onCameraEventSubs.delete(listener);
856
- if (this.onCameraEventSubs.size == 0) {
857
- MapControlModule.setMPCameraEventListener(false);
858
- }
859
- }
860
-
861
- /**
862
- * Add a listener object to catch floor changes made by either the user or the positioning service.
863
- *
864
- * @public
865
- * @param {OnFloorUpdateListener} listener
866
- */
867
- public addOnFloorUpdateListener(listener: OnFloorUpdateListener): void {
868
- if (this.onCameraEventSubs.size == 0) {
869
- MapControlModule.setOnFloorUpdateListener(true);
870
- }
871
- const sub = this.eventEmitter?.addListener(EventNames.onFloorUpdate, event => {
872
- const floor = event.floorIndex;
873
- listener(floor);
874
- });
875
- this.onFloorUpdateSubs.set(listener, sub);
876
- }
877
-
878
- /**
879
- * Remove a floor update listener.
880
- *
881
- * @public
882
- * @param {OnFloorUpdateListener} listener
883
- */
884
- public removeOnFloorUpdateListener(listener: OnFloorUpdateListener): void {
885
- this.onFloorUpdateSubs.get(listener)?.remove();
886
- this.onFloorUpdateSubs.delete(listener);
887
- if (this.onCameraEventSubs.size == 0) {
888
- MapControlModule.setOnFloorUpdateListener(false);
889
- }
890
- }
891
-
892
- /**
893
- * Set options for location labels
894
- *
895
- * @public
896
- * @param textSize if undefined keeps the current textsize
897
- * @param color if undefined keeps the current color
898
- * @param showHalo default false
899
- */
900
- public setLabelOptions(textSize?: number, color?: String, showHalo?: boolean): Promise<void> {
901
- if (showHalo === undefined) {
902
- showHalo = false;
903
- }
904
- if (textSize == undefined) {
905
- textSize = -1;
906
- }
907
- return MapControlModule.setLabelOptions(textSize, color, showHalo).then(() => Promise.resolve());
908
- }
909
-
910
- /**
911
- * Set the selection mode for buildings.
912
- *
913
- * @public
914
- * @param selectionMode
915
- */
916
- public setBuildingSelectionMode(selectionMode: MPSelectionMode): Promise<void> {
917
- return MapControlModule.setBuildingSelectionMode(selectionMode);
918
- }
919
-
920
- /**
921
- * Get the selection mode for buildings.
922
- *
923
- * @public
924
- */
925
- public getBuildingSelectionMode(): Promise<MPSelectionMode> {
926
- return MapControlModule.getBuildingSelectionMode();
927
- }
928
-
929
- /**
930
- * Set the selection mode for floors.
931
- *
932
- * @public
933
- * @param selectionMode
934
- */
935
- public setFloorSelectionMode(selectionMode: MPSelectionMode): Promise<void> {
936
- return MapControlModule.setFloorSelectionMode(selectionMode);
937
- }
938
-
939
- /**
940
- * Get the selection mode for floors.
941
- *
942
- * @public
943
- */
944
- public getFloorSelectionMode(): Promise<MPSelectionMode> {
945
- return MapControlModule.getFloorSelectionMode();
946
- }
947
-
948
- /**
949
- * Set features to hide on the map.
950
- */
951
- public setHiddenFeatures(features: MPFeatureType[]): Promise<void> {
952
- return MapControlModule.setHiddenFeatures(JSON.stringify(features));
953
- }
954
-
955
- /**
956
- * Get features that are hidden on the map.
957
- */
958
- public getHiddenFeatures(): Promise<MPFeatureType[]> {
959
- return MapControlModule.getHiddenFeatures().then((features: string) => JSON.parse(features));
960
- }
961
- }