@mapsindoors/react-native-maps-indoors-mapbox 1.0.1 → 1.0.3

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 (150) hide show
  1. package/LICENSE +10 -10
  2. package/README.md +187 -183
  3. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  4. package/android/.gradle/7.4/checksums/md5-checksums.bin +0 -0
  5. package/android/.gradle/7.4/checksums/sha1-checksums.bin +0 -0
  6. package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
  7. package/android/.gradle/7.4/executionHistory/executionHistory.lock +0 -0
  8. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  9. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  10. package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
  11. package/android/README.md +14 -14
  12. package/android/build.gradle +166 -166
  13. package/android/gradle/wrapper/gradle-wrapper.properties +5 -5
  14. package/android/gradle.properties +16 -16
  15. package/android/gradlew +234 -234
  16. package/android/src/main/AndroidManifest.xml +6 -6
  17. package/android/src/main/java/com/reactlibrary/MapboxMapView.java +116 -116
  18. package/android/src/main/java/com/reactlibrary/MapsIndoorsPackage.java +53 -53
  19. package/android/src/main/java/com/reactlibrary/MapsIndoorsViewManager.java +119 -119
  20. package/android/src/main/java/com/reactlibrary/core/DirectionsRendererModule.java +218 -208
  21. package/android/src/main/java/com/reactlibrary/core/DirectionsServiceModule.java +130 -130
  22. package/android/src/main/java/com/reactlibrary/core/MPDisplayRuleModule.java +816 -816
  23. package/android/src/main/java/com/reactlibrary/core/MapControlModule.java +636 -628
  24. package/android/src/main/java/com/reactlibrary/core/MapsIndoorsModule.java +327 -327
  25. package/android/src/main/java/com/reactlibrary/core/RCMapView.java +16 -16
  26. package/android/src/main/java/com/reactlibrary/core/README.md +92 -92
  27. package/android/src/main/java/com/reactlibrary/core/UtilsModule.java +166 -166
  28. package/android/src/main/java/com/reactlibrary/core/models/Bounds.java +19 -19
  29. package/android/src/main/java/com/reactlibrary/core/models/Filter.java +77 -77
  30. package/android/src/main/java/com/reactlibrary/core/models/Location.java +17 -17
  31. package/android/src/main/java/com/reactlibrary/core/models/MPCameraPosition.java +34 -34
  32. package/android/src/main/java/com/reactlibrary/core/models/MPCameraUpdate.java +68 -68
  33. package/android/src/main/java/com/reactlibrary/core/models/MPError.java +38 -38
  34. package/android/src/main/java/com/reactlibrary/core/models/PositionProvider.java +46 -46
  35. package/android/src/main/java/com/reactlibrary/core/models/PositionResult.java +117 -117
  36. package/android/src/main/java/com/reactlibrary/core/models/Query.java +30 -30
  37. package/android/src/main/res/values/google_maps_api_key.xml +3 -3
  38. package/android/src/main/res/values/mapbox_api_key.xml +5 -5
  39. package/index.ts +183 -183
  40. package/ios/MapsIndoors.xcodeproj/project.pbxproj +318 -318
  41. package/ios/MapsIndoors.xcworkspace/contents.xcworkspacedata +7 -7
  42. package/ios/MapsIndoors.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
  43. package/ios/MapsIndoorsViewManager.swift +111 -111
  44. package/ios/MapsIndoorsViewManagerBridge.m +9 -9
  45. package/ios/core/CameraPosition.swift +15 -15
  46. package/ios/core/CameraUpdate.swift +19 -19
  47. package/ios/core/CameraUpdateError.swift +11 -11
  48. package/ios/core/DirectionsRendererBridge.m +61 -57
  49. package/ios/core/DirectionsRendererModule.swift +256 -237
  50. package/ios/core/DirectionsServiceBridge.m +46 -46
  51. package/ios/core/DirectionsServiceModule.swift +149 -149
  52. package/ios/core/MPDisplayRuleBridge.m +410 -410
  53. package/ios/core/MPDisplayRuleModule.swift +845 -845
  54. package/ios/core/MapControlBridge.m +184 -178
  55. package/ios/core/MapControlModule.swift +554 -515
  56. package/ios/core/MapsIndoorsBridge.m +116 -116
  57. package/ios/core/MapsIndoorsData.swift +218 -218
  58. package/ios/core/MapsIndoorsModule.swift +296 -296
  59. package/ios/core/RCMapView.swift +14 -14
  60. package/ios/core/README.md +92 -92
  61. package/ios/core/ReactPositionProvider.swift +25 -25
  62. package/ios/core/UtilsBridge.m +63 -63
  63. package/ios/core/UtilsModule.swift +146 -146
  64. package/ios/core/helpers.swift +57 -57
  65. package/ios/react-native-maps-indoors-Bridging-Header.h +6 -6
  66. package/package.json +53 -53
  67. package/react-native-maps-indoors-mapbox.podspec +30 -30
  68. package/src/core/EventNames.ts +20 -20
  69. package/src/core/MPBounds.ts +154 -154
  70. package/src/core/MPBuilding.ts +333 -333
  71. package/src/core/MPBuildingCollection.ts +56 -56
  72. package/src/core/MPBuildingInfo.ts +62 -62
  73. package/src/core/MPCameraEvent.ts +16 -16
  74. package/src/core/MPCameraEventListener.ts +16 -16
  75. package/src/core/MPCameraPosition.ts +82 -82
  76. package/src/core/MPCameraUpdate.ts +174 -174
  77. package/src/core/MPCameraViewFitMode.ts +20 -20
  78. package/src/core/MPCategory.ts +75 -75
  79. package/src/core/MPCategoryCollection.ts +61 -61
  80. package/src/core/MPCollection.ts +58 -58
  81. package/src/core/MPCollisionHandling.ts +11 -11
  82. package/src/core/MPDataField.ts +68 -68
  83. package/src/core/MPDirectionsRenderer.ts +205 -193
  84. package/src/core/MPDirectionsService.ts +118 -118
  85. package/src/core/MPDisplayRule.ts +1027 -1027
  86. package/src/core/MPEntity.ts +59 -59
  87. package/src/core/MPEntityInfo.ts +27 -27
  88. package/src/core/MPError.ts +122 -122
  89. package/src/core/MPFilter.ts +167 -167
  90. package/src/core/MPFilterBehavior.ts +94 -94
  91. package/src/core/MPFloor.ts +169 -169
  92. package/src/core/MPFloorSelectorInterface.ts +62 -62
  93. package/src/core/MPGeometry.ts +90 -90
  94. package/src/core/MPHighway.ts +14 -14
  95. package/src/core/MPIconSize.ts +38 -38
  96. package/src/core/MPLocation.ts +385 -385
  97. package/src/core/MPLocationPropertyNames.ts +29 -29
  98. package/src/core/MPLocationType.ts +15 -15
  99. package/src/core/MPMapConfig.ts +210 -210
  100. package/src/core/MPMapStyle.ts +56 -56
  101. package/src/core/MPMultiPolygon.ts +217 -217
  102. package/src/core/MPPoint.ts +169 -169
  103. package/src/core/MPPolygon.ts +218 -218
  104. package/src/core/MPPositionProviderInterface.ts +44 -44
  105. package/src/core/MPPositionResultInterface.ts +41 -41
  106. package/src/core/MPPropertyData.ts +214 -214
  107. package/src/core/MPQuery.ts +68 -68
  108. package/src/core/MPRoute.ts +94 -94
  109. package/src/core/MPRouteCoordinate.ts +94 -94
  110. package/src/core/MPRouteLeg.ts +127 -127
  111. package/src/core/MPRouteProperty.ts +82 -82
  112. package/src/core/MPRouteStep.ts +176 -175
  113. package/src/core/MPSelectionBehavior.ts +92 -92
  114. package/src/core/MPSettings3D.ts +106 -106
  115. package/src/core/MPSize.ts +20 -20
  116. package/src/core/MPSolution.ts +179 -179
  117. package/src/core/MPSolutionConfig.ts +126 -126
  118. package/src/core/MPSolutionDisplayRule.ts +13 -13
  119. package/src/core/MPUserRole.ts +59 -59
  120. package/src/core/MPUserRoleCollection.ts +36 -36
  121. package/src/core/MPUtils.ts +156 -156
  122. package/src/core/MPVenue.ts +293 -293
  123. package/src/core/MPVenueCollection.ts +57 -57
  124. package/src/core/MPVenueInfo.ts +61 -61
  125. package/src/core/MapControl.ts +876 -864
  126. package/src/core/MapView.tsx +33 -33
  127. package/src/core/MapsIndoors.ts +530 -530
  128. package/src/core/OnBuildingFoundAtCameraTargetListener.ts +16 -16
  129. package/src/core/OnFloorSelectionChangedListener.ts +16 -16
  130. package/src/core/OnFloorUpdateListener.ts +15 -15
  131. package/src/core/OnLegSelectedListener.ts +16 -16
  132. package/src/core/OnLiveLocationUpdateListener.ts +16 -16
  133. package/src/core/OnLocationSelectedListener.ts +16 -16
  134. package/src/core/OnMapClickListener.ts +19 -19
  135. package/src/core/OnMarkerClickListener.ts +16 -16
  136. package/src/core/OnMarkerInfoWindowClickListener.ts +16 -16
  137. package/src/core/OnPositionUpdateListener.ts +16 -16
  138. package/src/core/OnVenueFoundAtCameraTargetListener.ts +16 -16
  139. package/src/core/README.md +92 -92
  140. package/android/.gradle/7.4/executionHistory/executionHistory.bin +0 -0
  141. package/android/.gradle/7.4/fileHashes/fileHashes.bin +0 -0
  142. package/android/.gradle/7.4/fileHashes/resourceHashesCache.bin +0 -0
  143. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  144. package/android/.gradle/file-system.probe +0 -0
  145. package/android/.idea/compiler.xml +0 -6
  146. package/android/.idea/gradle.xml +0 -19
  147. package/android/.idea/jarRepositories.xml +0 -60
  148. package/android/.idea/misc.xml +0 -10
  149. package/android/.idea/vcs.xml +0 -7
  150. package/android/local.properties +0 -8
@@ -1,386 +1,386 @@
1
- import { Platform } from "react-native";
2
- import { MPGeometry, MPPoint, MPPolygon, MPBuilding, MPVenue, MPMultiPolygon, MPBounds, MPLocationType, MPLocationPropertyNames } from "../../index";
3
- import MPEntity from "./MPEntity";
4
- import MPPropertyData from "./MPPropertyData";
5
-
6
- /**
7
- * A MapsIndoors geographical entity. A location can exist anywhere,
8
- * but it is usually only used inside {@link MPVenue}s and {@link MPBuilding}s.
9
- *
10
- * @export
11
- * @class MPLocation
12
- * @typedef {MPLocation}
13
- * @extends {MPEntity}
14
- */
15
- export default class MPLocation extends MPEntity {
16
- /**
17
- * The locations bounds
18
- *
19
- * @private
20
- * @type {?MPBounds}
21
- */
22
- public bounds?: MPBounds;
23
-
24
- /**
25
- * Get whether this location's geometry is a {@link MPPoint}.
26
- *
27
- * @public
28
- * @readonly
29
- * @type {boolean}
30
- */
31
- public get isPoint(): boolean {
32
- return this.geometry instanceof MPPoint;
33
- }
34
-
35
- /**
36
- * Get the location's position.
37
- *
38
- * @public
39
- * @override
40
- * @readonly
41
- * @type {MPPoint}
42
- */
43
- public override get position(): MPPoint {
44
- return this.properties?.anchor ? this.properties.anchor : new MPPoint(0, 0);
45
- }
46
-
47
- /**
48
- * Creates an instance of MPLocation.
49
- *
50
- * @constructor
51
- * @private
52
- * @param {string} id The location's ID.
53
- * @param {string[]} restrictions An array of restrictions placed on the location.
54
- * @param {?MPGeometry} [geometry] The geometry of the location.
55
- * @param {?MPPropertyData} [properties] The location's properties.
56
- */
57
- private constructor(
58
- readonly id: string,
59
- readonly restrictions: string[],
60
- readonly geometry?: MPGeometry,
61
- private properties?: MPPropertyData,
62
- ) {
63
- super("MPLocation");
64
- switch (this.geometry?.type) {
65
- case MPGeometry.multiPolygon:
66
- case MPGeometry.polygon: {
67
- this.bounds = (this.geometry as MPPolygon | MPMultiPolygon).bounds;
68
- break;
69
- }
70
- case MPGeometry.point:
71
- default: {
72
- this.bounds = new MPBounds(this.position, this.position);
73
- break;
74
- }
75
- }
76
- }
77
-
78
- /**
79
- * Creator for MPLocation, used to decode JSON from the MapsIndoors SDK.
80
- *
81
- * @public
82
- * @static
83
- * @param {?*} [object]
84
- * @returns {MPLocation}
85
- */
86
- public static create(object?: any): MPLocation {
87
- // TODO: make sure iOS sends geometry too
88
-
89
- let geo: MPGeometry | undefined;
90
- if (object?.geometry) {
91
- if (Platform.OS === 'ios') {
92
- switch (object?.geometryType) {
93
- case MPGeometry.point:
94
- geo = MPPoint.create(object?.geometry);
95
- break;
96
- case MPGeometry.polygon:
97
- geo = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.northeast, object?.entityBounds?.southwest)});
98
- break;
99
- case MPGeometry.multiPolygon:
100
- geo = MPMultiPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.northeast, object?.entityBounds?.southwest)})
101
- break;
102
- default:
103
- break;
104
- }
105
- }else {
106
- switch (object?.geometry?.type) {
107
- case MPGeometry.point:
108
- geo = MPPoint.create(object?.geometry);
109
- break;
110
- case MPGeometry.polygon:
111
- geo = MPPolygon.create(object?.geometry);
112
- break;
113
- case MPGeometry.multiPolygon:
114
- geo = MPMultiPolygon.create(object?.geometry);
115
- break;
116
- default:
117
- break;
118
- }
119
- }
120
- }
121
-
122
- return new MPLocation(
123
- object?.id,
124
- object?.restrictions,
125
- geo,
126
- MPPropertyData.create(object?.properties),
127
- );
128
-
129
- }
130
-
131
- /**
132
- * Get the location's name.
133
- *
134
- * @public
135
- * @readonly
136
- * @type {string}
137
- */
138
- public get name(): string {
139
- return this.properties?.name!;
140
- }
141
-
142
- /**
143
- * Get the location's aliases.
144
- *
145
- * @public
146
- * @readonly
147
- * @type {string[]}
148
- */
149
- public get aliases(): string[] {
150
- return this.properties?.aliases!;
151
- }
152
-
153
- /**
154
- * Get the location's categories.
155
- *
156
- * @public
157
- * @readonly
158
- * @type {(string[] | undefined)}
159
- */
160
- public get categories(): string[] | undefined {
161
- return (this.properties?.categories !== undefined) ?
162
- Array.from(this.properties!.categories!.values()) :
163
- undefined;
164
- }
165
-
166
- /**
167
- * Get the location's floorIndex.
168
- *
169
- * @public
170
- * @readonly
171
- * @type {number}
172
- */
173
- public get floorIndex(): number {
174
- return this.properties?.floor!;
175
- }
176
-
177
- /**
178
- * Get the name of the floor the location is on.
179
- *
180
- * @public
181
- * @readonly
182
- * @type {string}
183
- */
184
- public get floorName(): string {
185
- return this.properties?.floorName!;
186
- }
187
-
188
- /**
189
- * Get the name of the building the location is in.
190
- *
191
- * @public
192
- * @readonly
193
- * @type {string}
194
- */
195
- public get buildingName(): string {
196
- return this.properties?.building!;
197
- }
198
-
199
- /**
200
- * Get the name of the venue the location is on.
201
- *
202
- * @public
203
- * @readonly
204
- * @type {string}
205
- */
206
- public get venueName(): string {
207
- return this.properties?.venue!;
208
- }
209
-
210
- /**
211
- * Get the location's type name.
212
- *
213
- * @public
214
- * @readonly
215
- * @type {string}
216
- */
217
- public get typeName(): string {
218
- return this.properties?.type!;
219
- }
220
-
221
- /**
222
- * Get the location's description.
223
- *
224
- * @public
225
- * @readonly
226
- * @type {string}
227
- */
228
- public get description(): string {
229
- return this.properties?.description!;
230
- }
231
-
232
- /**
233
- * Get the location's external identifier.
234
- *
235
- * @public
236
- * @readonly
237
- * @type {string}
238
- */
239
- public get externalId(): string {
240
- return this.properties?.externalId!;
241
- }
242
-
243
- /**
244
- * Get the time location is active from.
245
- *
246
- * @public
247
- * @readonly
248
- * @type {number}
249
- */
250
- public get activeFrom(): number {
251
- return this.properties?.activeFrom!;
252
- }
253
-
254
- /**
255
- * Get the time location is active to.
256
- *
257
- * @public
258
- * @readonly
259
- * @type {number}
260
- */
261
- public get activeTo(): number {
262
- return this.properties?.activeTo!;
263
- }
264
-
265
- /**
266
- * Get the URL of the location's icon image.
267
- *
268
- * @public
269
- * @readonly
270
- * @type {string}
271
- */
272
- public get imageUrl(): string {
273
- return this.properties?.imageUrl!;
274
- }
275
-
276
- /**
277
- * Get whether the location is bookable.
278
- *
279
- * @public
280
- * @returns {boolean}
281
- */
282
- public isBookable(): boolean {
283
- return this.properties?.bookable ? this.properties.bookable : false;
284
- }
285
-
286
- /**
287
- * Get the location's basetype.
288
- *
289
- * @public
290
- * @readonly
291
- * @type {MPLocationType}
292
- */
293
- public get baseType(): MPLocationType {
294
- switch (this.properties?.type) {
295
- case "area": {
296
- return MPLocationType.area;
297
- }
298
- case "venue": {
299
- return MPLocationType.venue;
300
- }
301
- case "building": {
302
- return MPLocationType.building;
303
- }
304
- case "room": {
305
- return MPLocationType.room;
306
- }
307
- case "floor": {
308
- return MPLocationType.floor;
309
- }
310
- case "asset": {
311
- return MPLocationType.asset;
312
- }
313
- case "poi":
314
- default: {
315
- return MPLocationType.poi;
316
- }
317
- }
318
- }
319
-
320
- /**
321
- * Get a property of the location.
322
- *
323
- * @public
324
- * @param {MPLocationPropertyNames} key
325
- * @returns {*}
326
- */
327
- public getProperty(key: MPLocationPropertyNames): any {
328
- switch (key) {
329
- case MPLocationPropertyNames.name: {
330
- return this.properties?.name;
331
- }
332
- case MPLocationPropertyNames.aliases: {
333
- return this.properties?.aliases;
334
- }
335
- case MPLocationPropertyNames.categories: {
336
- return this.properties?.categories;
337
- }
338
- case MPLocationPropertyNames.floor: {
339
- return this.properties?.floor;
340
- }
341
- case MPLocationPropertyNames.floorName: {
342
- return this.properties?.floorName;
343
- }
344
- case MPLocationPropertyNames.building: {
345
- return this.properties?.building;
346
- }
347
- case MPLocationPropertyNames.venue: {
348
- return this.properties?.venue;
349
- }
350
- case MPLocationPropertyNames.type: {
351
- return this.properties?.type;
352
- }
353
- case MPLocationPropertyNames.description: {
354
- return this.properties?.description;
355
- }
356
- case MPLocationPropertyNames.roomId:
357
- case MPLocationPropertyNames.externalId: {
358
- return this.properties?.externalId;
359
- }
360
- case MPLocationPropertyNames.activeFrom: {
361
- return this.properties?.activeFrom;
362
- }
363
- case MPLocationPropertyNames.activeTo: {
364
- return this.properties?.activeTo;
365
- }
366
- case MPLocationPropertyNames.contact: {
367
- return this.properties?.contact;
368
- }
369
- case MPLocationPropertyNames.fields: {
370
- return this.properties?.fields;
371
- }
372
- case MPLocationPropertyNames.imageURL: {
373
- return this.properties?.imageUrl;
374
- }
375
- case MPLocationPropertyNames.locationType: {
376
- return this.properties?.locationType;
377
- }
378
- case MPLocationPropertyNames.anchor: {
379
- return this.properties?.anchor;
380
- }
381
- case MPLocationPropertyNames.bookable: {
382
- return this.properties?.bookable;
383
- }
384
- }
385
- }
1
+ import { Platform } from "react-native";
2
+ import { MPGeometry, MPPoint, MPPolygon, MPBuilding, MPVenue, MPMultiPolygon, MPBounds, MPLocationType, MPLocationPropertyNames } from "../../index";
3
+ import MPEntity from "./MPEntity";
4
+ import MPPropertyData from "./MPPropertyData";
5
+
6
+ /**
7
+ * A MapsIndoors geographical entity. A location can exist anywhere,
8
+ * but it is usually only used inside {@link MPVenue}s and {@link MPBuilding}s.
9
+ *
10
+ * @export
11
+ * @class MPLocation
12
+ * @typedef {MPLocation}
13
+ * @extends {MPEntity}
14
+ */
15
+ export default class MPLocation extends MPEntity {
16
+ /**
17
+ * The locations bounds
18
+ *
19
+ * @private
20
+ * @type {?MPBounds}
21
+ */
22
+ public bounds?: MPBounds;
23
+
24
+ /**
25
+ * Get whether this location's geometry is a {@link MPPoint}.
26
+ *
27
+ * @public
28
+ * @readonly
29
+ * @type {boolean}
30
+ */
31
+ public get isPoint(): boolean {
32
+ return this.geometry instanceof MPPoint;
33
+ }
34
+
35
+ /**
36
+ * Get the location's position.
37
+ *
38
+ * @public
39
+ * @override
40
+ * @readonly
41
+ * @type {MPPoint}
42
+ */
43
+ public override get position(): MPPoint {
44
+ return this.properties?.anchor ? this.properties.anchor : new MPPoint(0, 0);
45
+ }
46
+
47
+ /**
48
+ * Creates an instance of MPLocation.
49
+ *
50
+ * @constructor
51
+ * @private
52
+ * @param {string} id The location's ID.
53
+ * @param {string[]} restrictions An array of restrictions placed on the location.
54
+ * @param {?MPGeometry} [geometry] The geometry of the location.
55
+ * @param {?MPPropertyData} [properties] The location's properties.
56
+ */
57
+ private constructor(
58
+ readonly id: string,
59
+ readonly restrictions: string[],
60
+ readonly geometry?: MPGeometry,
61
+ private properties?: MPPropertyData,
62
+ ) {
63
+ super("MPLocation");
64
+ switch (this.geometry?.type) {
65
+ case MPGeometry.multiPolygon:
66
+ case MPGeometry.polygon: {
67
+ this.bounds = (this.geometry as MPPolygon | MPMultiPolygon).bounds;
68
+ break;
69
+ }
70
+ case MPGeometry.point:
71
+ default: {
72
+ this.bounds = new MPBounds(this.position, this.position);
73
+ break;
74
+ }
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Creator for MPLocation, used to decode JSON from the MapsIndoors SDK.
80
+ *
81
+ * @public
82
+ * @static
83
+ * @param {?*} [object]
84
+ * @returns {MPLocation}
85
+ */
86
+ public static create(object?: any): MPLocation {
87
+ // TODO: make sure iOS sends geometry too
88
+
89
+ let geo: MPGeometry | undefined;
90
+ if (object?.geometry) {
91
+ if (Platform.OS === 'ios') {
92
+ switch (object?.geometryType) {
93
+ case MPGeometry.point:
94
+ geo = MPPoint.create(object?.geometry);
95
+ break;
96
+ case MPGeometry.polygon:
97
+ geo = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.northeast, object?.entityBounds?.southwest)});
98
+ break;
99
+ case MPGeometry.multiPolygon:
100
+ geo = MPMultiPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.northeast, object?.entityBounds?.southwest)})
101
+ break;
102
+ default:
103
+ break;
104
+ }
105
+ }else {
106
+ switch (object?.geometry?.type) {
107
+ case MPGeometry.point:
108
+ geo = MPPoint.create(object?.geometry);
109
+ break;
110
+ case MPGeometry.polygon:
111
+ geo = MPPolygon.create(object?.geometry);
112
+ break;
113
+ case MPGeometry.multiPolygon:
114
+ geo = MPMultiPolygon.create(object?.geometry);
115
+ break;
116
+ default:
117
+ break;
118
+ }
119
+ }
120
+ }
121
+
122
+ return new MPLocation(
123
+ object?.id,
124
+ object?.restrictions,
125
+ geo,
126
+ MPPropertyData.create(object?.properties),
127
+ );
128
+
129
+ }
130
+
131
+ /**
132
+ * Get the location's name.
133
+ *
134
+ * @public
135
+ * @readonly
136
+ * @type {string}
137
+ */
138
+ public get name(): string {
139
+ return this.properties?.name!;
140
+ }
141
+
142
+ /**
143
+ * Get the location's aliases.
144
+ *
145
+ * @public
146
+ * @readonly
147
+ * @type {string[]}
148
+ */
149
+ public get aliases(): string[] {
150
+ return this.properties?.aliases!;
151
+ }
152
+
153
+ /**
154
+ * Get the location's categories.
155
+ *
156
+ * @public
157
+ * @readonly
158
+ * @type {(string[] | undefined)}
159
+ */
160
+ public get categories(): string[] | undefined {
161
+ return (this.properties?.categories !== undefined) ?
162
+ Array.from(this.properties!.categories!.values()) :
163
+ undefined;
164
+ }
165
+
166
+ /**
167
+ * Get the location's floorIndex.
168
+ *
169
+ * @public
170
+ * @readonly
171
+ * @type {number}
172
+ */
173
+ public get floorIndex(): number {
174
+ return this.properties?.floor!;
175
+ }
176
+
177
+ /**
178
+ * Get the name of the floor the location is on.
179
+ *
180
+ * @public
181
+ * @readonly
182
+ * @type {string}
183
+ */
184
+ public get floorName(): string {
185
+ return this.properties?.floorName!;
186
+ }
187
+
188
+ /**
189
+ * Get the name of the building the location is in.
190
+ *
191
+ * @public
192
+ * @readonly
193
+ * @type {string}
194
+ */
195
+ public get buildingName(): string {
196
+ return this.properties?.building!;
197
+ }
198
+
199
+ /**
200
+ * Get the name of the venue the location is on.
201
+ *
202
+ * @public
203
+ * @readonly
204
+ * @type {string}
205
+ */
206
+ public get venueName(): string {
207
+ return this.properties?.venue!;
208
+ }
209
+
210
+ /**
211
+ * Get the location's type name.
212
+ *
213
+ * @public
214
+ * @readonly
215
+ * @type {string}
216
+ */
217
+ public get typeName(): string {
218
+ return this.properties?.type!;
219
+ }
220
+
221
+ /**
222
+ * Get the location's description.
223
+ *
224
+ * @public
225
+ * @readonly
226
+ * @type {string}
227
+ */
228
+ public get description(): string {
229
+ return this.properties?.description!;
230
+ }
231
+
232
+ /**
233
+ * Get the location's external identifier.
234
+ *
235
+ * @public
236
+ * @readonly
237
+ * @type {string}
238
+ */
239
+ public get externalId(): string {
240
+ return this.properties?.externalId!;
241
+ }
242
+
243
+ /**
244
+ * Get the time location is active from.
245
+ *
246
+ * @public
247
+ * @readonly
248
+ * @type {number}
249
+ */
250
+ public get activeFrom(): number {
251
+ return this.properties?.activeFrom!;
252
+ }
253
+
254
+ /**
255
+ * Get the time location is active to.
256
+ *
257
+ * @public
258
+ * @readonly
259
+ * @type {number}
260
+ */
261
+ public get activeTo(): number {
262
+ return this.properties?.activeTo!;
263
+ }
264
+
265
+ /**
266
+ * Get the URL of the location's icon image.
267
+ *
268
+ * @public
269
+ * @readonly
270
+ * @type {string}
271
+ */
272
+ public get imageUrl(): string {
273
+ return this.properties?.imageUrl!;
274
+ }
275
+
276
+ /**
277
+ * Get whether the location is bookable.
278
+ *
279
+ * @public
280
+ * @returns {boolean}
281
+ */
282
+ public isBookable(): boolean {
283
+ return this.properties?.bookable ? this.properties.bookable : false;
284
+ }
285
+
286
+ /**
287
+ * Get the location's basetype.
288
+ *
289
+ * @public
290
+ * @readonly
291
+ * @type {MPLocationType}
292
+ */
293
+ public get baseType(): MPLocationType {
294
+ switch (this.properties?.type) {
295
+ case "area": {
296
+ return MPLocationType.area;
297
+ }
298
+ case "venue": {
299
+ return MPLocationType.venue;
300
+ }
301
+ case "building": {
302
+ return MPLocationType.building;
303
+ }
304
+ case "room": {
305
+ return MPLocationType.room;
306
+ }
307
+ case "floor": {
308
+ return MPLocationType.floor;
309
+ }
310
+ case "asset": {
311
+ return MPLocationType.asset;
312
+ }
313
+ case "poi":
314
+ default: {
315
+ return MPLocationType.poi;
316
+ }
317
+ }
318
+ }
319
+
320
+ /**
321
+ * Get a property of the location.
322
+ *
323
+ * @public
324
+ * @param {MPLocationPropertyNames} key
325
+ * @returns {*}
326
+ */
327
+ public getProperty(key: MPLocationPropertyNames): any {
328
+ switch (key) {
329
+ case MPLocationPropertyNames.name: {
330
+ return this.properties?.name;
331
+ }
332
+ case MPLocationPropertyNames.aliases: {
333
+ return this.properties?.aliases;
334
+ }
335
+ case MPLocationPropertyNames.categories: {
336
+ return this.properties?.categories;
337
+ }
338
+ case MPLocationPropertyNames.floor: {
339
+ return this.properties?.floor;
340
+ }
341
+ case MPLocationPropertyNames.floorName: {
342
+ return this.properties?.floorName;
343
+ }
344
+ case MPLocationPropertyNames.building: {
345
+ return this.properties?.building;
346
+ }
347
+ case MPLocationPropertyNames.venue: {
348
+ return this.properties?.venue;
349
+ }
350
+ case MPLocationPropertyNames.type: {
351
+ return this.properties?.type;
352
+ }
353
+ case MPLocationPropertyNames.description: {
354
+ return this.properties?.description;
355
+ }
356
+ case MPLocationPropertyNames.roomId:
357
+ case MPLocationPropertyNames.externalId: {
358
+ return this.properties?.externalId;
359
+ }
360
+ case MPLocationPropertyNames.activeFrom: {
361
+ return this.properties?.activeFrom;
362
+ }
363
+ case MPLocationPropertyNames.activeTo: {
364
+ return this.properties?.activeTo;
365
+ }
366
+ case MPLocationPropertyNames.contact: {
367
+ return this.properties?.contact;
368
+ }
369
+ case MPLocationPropertyNames.fields: {
370
+ return this.properties?.fields;
371
+ }
372
+ case MPLocationPropertyNames.imageURL: {
373
+ return this.properties?.imageUrl;
374
+ }
375
+ case MPLocationPropertyNames.locationType: {
376
+ return this.properties?.locationType;
377
+ }
378
+ case MPLocationPropertyNames.anchor: {
379
+ return this.properties?.anchor;
380
+ }
381
+ case MPLocationPropertyNames.bookable: {
382
+ return this.properties?.bookable;
383
+ }
384
+ }
385
+ }
386
386
  }