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

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 (132) hide show
  1. package/android/src/main/java/com/mapsindoorsrn/core/DirectionsRendererModule.java +322 -0
  2. package/android/src/main/java/com/mapsindoorsrn/core/DirectionsServiceModule.java +166 -0
  3. package/android/src/main/java/com/mapsindoorsrn/core/MPDisplayRuleModule.java +1699 -0
  4. package/android/src/main/java/com/mapsindoorsrn/core/MapControlModule.java +761 -0
  5. package/android/src/main/java/com/mapsindoorsrn/core/MapsIndoorsModule.java +410 -0
  6. package/android/src/main/java/com/mapsindoorsrn/core/RCMapView.java +16 -0
  7. package/android/src/main/java/com/mapsindoorsrn/core/README.md +3 -0
  8. package/android/src/main/java/com/mapsindoorsrn/core/UtilsModule.java +227 -0
  9. package/android/src/main/java/com/mapsindoorsrn/core/models/BitmapStopIconConfig.java +22 -0
  10. package/android/src/main/java/com/mapsindoorsrn/core/models/Bounds.java +19 -0
  11. package/android/src/main/java/com/mapsindoorsrn/core/models/Filter.java +77 -0
  12. package/android/src/main/java/com/mapsindoorsrn/core/models/Location.java +17 -0
  13. package/android/src/main/java/com/mapsindoorsrn/core/models/MPCameraPosition.java +34 -0
  14. package/android/src/main/java/com/mapsindoorsrn/core/models/MPCameraUpdate.java +68 -0
  15. package/android/src/main/java/com/mapsindoorsrn/core/models/MPError.java +38 -0
  16. package/android/src/main/java/com/mapsindoorsrn/core/models/PositionProvider.java +46 -0
  17. package/android/src/main/java/com/mapsindoorsrn/core/models/PositionResult.java +117 -0
  18. package/android/src/main/java/com/mapsindoorsrn/core/models/Query.java +30 -0
  19. package/android/src/main/java/com/mapsindoorsrn/core/models/RouteStopIconConfigModel.java +35 -0
  20. package/ios/core/CameraPosition.swift +15 -0
  21. package/ios/core/CameraUpdate.swift +19 -0
  22. package/ios/core/CameraUpdateError.swift +11 -0
  23. package/ios/core/DirectionsRendererBridge.m +59 -0
  24. package/ios/core/DirectionsRendererModule.swift +359 -0
  25. package/ios/core/DirectionsServiceBridge.m +55 -0
  26. package/ios/core/DirectionsServiceModule.swift +186 -0
  27. package/ios/core/IconStopUrl.swift +17 -0
  28. package/ios/core/LabelGraphic.swift +15 -0
  29. package/ios/core/MPDisplayRuleBridge.m +696 -0
  30. package/ios/core/MPDisplayRuleModule.swift +1704 -0
  31. package/ios/core/MapControlBridge.m +213 -0
  32. package/ios/core/MapControlModule.swift +702 -0
  33. package/ios/core/MapsIndoorsBridge.m +128 -0
  34. package/ios/core/MapsIndoorsData.swift +288 -0
  35. package/ios/core/MapsIndoorsModule.swift +363 -0
  36. package/ios/core/RCMapView.swift +16 -0
  37. package/ios/core/README.md +3 -0
  38. package/ios/core/ReactPositionProvider.swift +27 -0
  39. package/ios/core/RouteIcon.swift +34 -0
  40. package/ios/core/UtilsBridge.m +73 -0
  41. package/ios/core/UtilsModule.swift +182 -0
  42. package/ios/core/helpers.swift +57 -0
  43. package/package.json +1 -1
  44. package/src/core/EventNames.ts +21 -0
  45. package/src/core/MPAdditionalDetail.ts +102 -0
  46. package/src/core/MPBadgePosition.ts +12 -0
  47. package/src/core/MPBounds.ts +155 -0
  48. package/src/core/MPBuilding.ts +333 -0
  49. package/src/core/MPBuildingCollection.ts +57 -0
  50. package/src/core/MPBuildingInfo.ts +63 -0
  51. package/src/core/MPCameraEvent.ts +17 -0
  52. package/src/core/MPCameraEventListener.ts +17 -0
  53. package/src/core/MPCameraPosition.ts +82 -0
  54. package/src/core/MPCameraUpdate.ts +174 -0
  55. package/src/core/MPCameraViewFitMode.ts +25 -0
  56. package/src/core/MPCategory.ts +85 -0
  57. package/src/core/MPCategoryCollection.ts +62 -0
  58. package/src/core/MPCollection.ts +59 -0
  59. package/src/core/MPCollisionHandling.ts +12 -0
  60. package/src/core/MPDailyOpeningHours.ts +67 -0
  61. package/src/core/MPDataField.ts +69 -0
  62. package/src/core/MPDetailType.ts +73 -0
  63. package/src/core/MPDirectionsRenderer.ts +238 -0
  64. package/src/core/MPDirectionsService.ts +152 -0
  65. package/src/core/MPDisplayRule.ts +1823 -0
  66. package/src/core/MPEntity.ts +60 -0
  67. package/src/core/MPEntityInfo.ts +28 -0
  68. package/src/core/MPError.ts +122 -0
  69. package/src/core/MPFeatureTypes.ts +8 -0
  70. package/src/core/MPFilter.ts +168 -0
  71. package/src/core/MPFilterBehavior.ts +115 -0
  72. package/src/core/MPFloor.ts +170 -0
  73. package/src/core/MPFloorSelectorInterface.ts +63 -0
  74. package/src/core/MPGeometry.ts +91 -0
  75. package/src/core/MPHighlightBehavior.ts +115 -0
  76. package/src/core/MPHighway.ts +14 -0
  77. package/src/core/MPIconPlacement.ts +13 -0
  78. package/src/core/MPIconSize.ts +39 -0
  79. package/src/core/MPLabelGraphic.ts +24 -0
  80. package/src/core/MPLabelPosition.ts +12 -0
  81. package/src/core/MPLabelType.ts +11 -0
  82. package/src/core/MPLocation.ts +440 -0
  83. package/src/core/MPLocationPropertyNames.ts +30 -0
  84. package/src/core/MPLocationSettings.ts +40 -0
  85. package/src/core/MPLocationType.ts +16 -0
  86. package/src/core/MPMapConfig.ts +280 -0
  87. package/src/core/MPMapStyle.ts +57 -0
  88. package/src/core/MPMultiPolygon.ts +218 -0
  89. package/src/core/MPOpeningHours.ts +48 -0
  90. package/src/core/MPPOIType.ts +43 -0
  91. package/src/core/MPPoint.ts +169 -0
  92. package/src/core/MPPolygon.ts +219 -0
  93. package/src/core/MPPositionProviderInterface.ts +45 -0
  94. package/src/core/MPPositionResultInterface.ts +42 -0
  95. package/src/core/MPPropertyData.ts +234 -0
  96. package/src/core/MPQuery.ts +69 -0
  97. package/src/core/MPRoute.ts +105 -0
  98. package/src/core/MPRouteCoordinate.ts +95 -0
  99. package/src/core/MPRouteLeg.ts +158 -0
  100. package/src/core/MPRouteProperty.ts +83 -0
  101. package/src/core/MPRouteStep.ts +186 -0
  102. package/src/core/MPRouteStopIconConfig.ts +82 -0
  103. package/src/core/MPSelectionBehavior.ts +114 -0
  104. package/src/core/MPSelectionMode.ts +4 -0
  105. package/src/core/MPSettings3D.ts +107 -0
  106. package/src/core/MPSize.ts +21 -0
  107. package/src/core/MPSolution.ts +189 -0
  108. package/src/core/MPSolutionConfig.ts +188 -0
  109. package/src/core/MPSolutionDisplayRule.ts +15 -0
  110. package/src/core/MPUserRole.ts +60 -0
  111. package/src/core/MPUserRoleCollection.ts +37 -0
  112. package/src/core/MPUtils.ts +178 -0
  113. package/src/core/MPVenue.ts +294 -0
  114. package/src/core/MPVenueCollection.ts +58 -0
  115. package/src/core/MPVenueInfo.ts +62 -0
  116. package/src/core/MPWeeklyOpeningHours.ts +129 -0
  117. package/src/core/MapControl.ts +961 -0
  118. package/src/core/MapView.tsx +34 -0
  119. package/src/core/MapsIndoors.ts +571 -0
  120. package/src/core/OnBuildingFoundAtCameraTargetListener.ts +17 -0
  121. package/src/core/OnFloorSelectionChangedListener.ts +17 -0
  122. package/src/core/OnFloorUpdateListener.ts +16 -0
  123. package/src/core/OnLegSelectedListener.ts +17 -0
  124. package/src/core/OnLiveLocationUpdateListener.ts +17 -0
  125. package/src/core/OnLocationSelectedListener.ts +17 -0
  126. package/src/core/OnMapClickListener.ts +20 -0
  127. package/src/core/OnMarkerClickListener.ts +17 -0
  128. package/src/core/OnMarkerInfoWindowClickListener.ts +17 -0
  129. package/src/core/OnPositionUpdateListener.ts +17 -0
  130. package/src/core/OnVenueFoundAtCameraTargetListener.ts +17 -0
  131. package/src/core/README.md +3 -0
  132. package/src/core/RouteStopIconConfig.ts +10 -0
@@ -0,0 +1,333 @@
1
+ import MPEntity from "./MPEntity";
2
+ import { MPPoint, MPPolygon, MPFloor, MPBounds, MPDataField, MPPointParams, MPFloorParams } from "../../index";
3
+ import MPBuildingInfo, { MPBuildingInfoParams } from "./MPBuildingInfo";
4
+ import { Platform } from "react-native";
5
+
6
+ /**
7
+ * An entity that contains information about a specific building.
8
+ *
9
+ * @export
10
+ * @class MPBuilding
11
+ * @typedef {MPBuilding}
12
+ * @extends {MPEntity}
13
+ */
14
+ export default class MPBuilding extends MPEntity {
15
+ /**
16
+ * Creates an instance of MPBuilding.
17
+ *
18
+ * @constructor
19
+ * @private
20
+ * @param {string} id The building's ID.
21
+ * @param {string} administrativeId The building's readable ID.
22
+ * @param {string} externalId An ID used to map the building to a customer's ID.
23
+ * @param {string} venueId The ID of the venue this building lies within.
24
+ * @param {MPPoint} anchor The anchor point for the building.
25
+ * @param {MPPolygon} geometry The geometry of the building.
26
+ * @param {Map<number, MPFloor>} _floors A map of the floors inside the building.
27
+ * @param {number} defaultFloor The default floor index for the building.
28
+ * @param {string} address The building's address.
29
+ * @param {?MPBuildingInfo} [buildingInfo] A collection of information about the building.
30
+ */
31
+ private constructor(
32
+ private readonly id: string,
33
+ public readonly administrativeId: string,
34
+ public readonly externalId: string,
35
+ public readonly venueId: string,
36
+ private readonly anchor: MPPoint,
37
+ public readonly geometry: MPPolygon,
38
+ private readonly _floors: Map<number, MPFloor>,
39
+ public readonly defaultFloor: number,
40
+ public readonly address: string,
41
+ private readonly buildingInfo?: MPBuildingInfo,
42
+ ) {
43
+ super("MPBuilding");
44
+ }
45
+
46
+ /**
47
+ * Creator for MPBounds, used to decode JSON from the MapsIndoors SDK.
48
+ *
49
+ * @public
50
+ * @static
51
+ * @param {MPBuildingParams} object
52
+ * @returns {MPBuilding}
53
+ */
54
+ public static create(object: MPBuildingParams): MPBuilding {
55
+ let floors: Map<number, MPFloor> = new Map();
56
+ if (object?.floors !== undefined) {
57
+ floors = new Map(Object.entries(object?.floors).map(([key, value]) => [Number.parseInt(key), MPFloor.create(value as MPFloorParams)]));
58
+ // Object.keys(object?.floors).forEach(key => {
59
+ // floors.set(Number.parseInt(key), MPFloor.create(object?.floors[key] as unknown as MPFloorParams))
60
+ // });
61
+ }
62
+ floors.forEach((value: MPFloor) => {
63
+ value.buildingId = object?.id;
64
+ });
65
+
66
+ var polygon;
67
+
68
+ if(Platform.OS === 'ios') {
69
+ polygon = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.boundingBox?.southwest, object?.boundingBox?.northeast)});
70
+ }else {
71
+ polygon = MPPolygon.create(object?.geometry);
72
+ }
73
+
74
+ return new MPBuilding(
75
+ object?.id,
76
+ object?.administrativeId,
77
+ object?.externalId,
78
+ object?.venueId,
79
+ MPPoint.create(object?.anchor),
80
+ polygon,
81
+ floors,
82
+ object?.defaultFloor,
83
+ object?.address,
84
+ MPBuildingInfo.create(object?.buildingInfo as MPBuildingInfoParams),
85
+ );
86
+ }
87
+
88
+ /**
89
+ * Get the building's id.
90
+ *
91
+ * @public
92
+ * @readonly
93
+ * @type {string}
94
+ */
95
+ public get buildingId(): string {
96
+ return this.id;
97
+ }
98
+
99
+ /**
100
+ * Get the building's bounds.
101
+ *
102
+ * @public
103
+ * @readonly
104
+ * @type {MPBounds}
105
+ */
106
+ public get bounds(): MPBounds {
107
+ return this.geometry.bounds;
108
+ }
109
+
110
+ /**
111
+ * Get the position of the building, this will correspond to the building's anchor point.
112
+ *
113
+ * @public
114
+ * @readonly
115
+ * @type {MPPoint}
116
+ */
117
+ public get position(): MPPoint {
118
+ return this.anchor;
119
+ }
120
+
121
+ /**
122
+ * Overload from MPEntity, will return false.
123
+ *
124
+ * @public
125
+ * @readonly
126
+ * @type {boolean}
127
+ */
128
+ public get isPoint(): boolean {
129
+ return false;
130
+ }
131
+
132
+ /**
133
+ * Get the building's name.
134
+ *
135
+ * @public
136
+ * @readonly
137
+ * @type {string}
138
+ */
139
+ public get name(): string {
140
+ return this.buildingInfo?.name ? this.buildingInfo.name : "";
141
+ }
142
+
143
+ /**
144
+ * Get a list of aliases for the building.
145
+ *
146
+ * @public
147
+ * @readonly
148
+ * @type {string[]}
149
+ */
150
+ public get aliases(): string[] {
151
+ return this.buildingInfo?.aliases ? this.buildingInfo.aliases : [];
152
+ }
153
+
154
+ /**
155
+ * Get the number of {@link MPFloor}s in the building.
156
+ *
157
+ * @public
158
+ * @readonly
159
+ * @type {number}
160
+ */
161
+ public get floorCount(): number {
162
+ return this._floors.size;
163
+ }
164
+
165
+ /**
166
+ * Get a list of the floors in the building.
167
+ *
168
+ * @public
169
+ * @readonly
170
+ * @type {MPFloor[]}
171
+ */
172
+ public get floors(): MPFloor[] {
173
+ return Array.from(this._floors.values());
174
+ }
175
+
176
+ /**
177
+ * Get the default floor index.
178
+ *
179
+ * @public
180
+ * @readonly
181
+ * @type {number}
182
+ */
183
+ public get initialFloorIndex(): number {
184
+ return this.defaultFloor ? this.defaultFloor : this.floors[0].floorIndex ? this.floors[0].floorIndex : 0;
185
+ }
186
+
187
+ /**
188
+ * Check whether the building contains a floor with the {@link floorIndex}.
189
+ *
190
+ * @public
191
+ * @param {number} floorIndex
192
+ * @returns {boolean}
193
+ */
194
+ public hasFloorIndex(floorIndex: number): boolean {
195
+ return this._floors.has(floorIndex);
196
+ }
197
+
198
+ /**
199
+ * Get a floor by its floor index.
200
+ *
201
+ * @public
202
+ * @param {number} floorIndex
203
+ * @returns {MPFloor}
204
+ */
205
+ public getFloorByIndex(floorIndex: number): MPFloor | undefined {
206
+ return this._floors.get(floorIndex);
207
+ }
208
+
209
+ /**
210
+ * Fetch a custom field from the building.
211
+ *
212
+ * @public
213
+ * @param {?string} [key]
214
+ * @returns {(MPDataField | undefined)}
215
+ */
216
+ public getField(key?: string): MPDataField | undefined {
217
+ if (key !== undefined) {
218
+ return this.buildingInfo?.fields?.get(key);
219
+ }
220
+ }
221
+
222
+ /**
223
+ * Check whether the building's geometry contains the point.
224
+ *
225
+ * @public
226
+ * @async
227
+ * @param {MPPoint} point
228
+ * @returns {Promise<boolean>}
229
+ */
230
+ public async contains(point: MPPoint): Promise<boolean> {
231
+ return this.geometry.contains(point);
232
+ }
233
+
234
+
235
+ /**
236
+ * Parses the object to a JSON object that is compatible with the MapsIndoors SDK.
237
+ *
238
+ * @public
239
+ * @returns {MPBuildingParams}
240
+ */
241
+ public toJSON(): MPBuildingParams {
242
+ return {
243
+ "id": this.id,
244
+ "administrativeId": this.administrativeId,
245
+ "externalId": this.externalId,
246
+ "venueId": this.venueId,
247
+ "anchor": this.anchor.toJSON(),
248
+ "buildingInfo": this.buildingInfo,
249
+ "geometry": this.geometry,
250
+ "floors": this._floors,
251
+ "defaultFloor": this.defaultFloor,
252
+ "address": this.address,
253
+ "boundingBox": this.bounds.toJSON()
254
+ }
255
+ }
256
+ }
257
+
258
+ /**
259
+ * Parameter interface for {@link MPBuilding}.
260
+ *
261
+ * @export
262
+ * @interface MPBuildingParams
263
+ * @typedef {MPBuildingParams}
264
+ */
265
+ export interface MPBuildingParams {
266
+ /**
267
+ * The building's ID.
268
+ *
269
+ * @type {string}
270
+ */
271
+ id: string,
272
+ /**
273
+ * The building's readable ID.
274
+ *
275
+ * @type {string}
276
+ */
277
+ administrativeId: string,
278
+ /**
279
+ * An ID used to map the building to a customer's ID.
280
+ *
281
+ * @type {string}
282
+ */
283
+ externalId: string,
284
+ /**
285
+ * The ID of the venue this building lies within.
286
+ *
287
+ * @type {string}
288
+ */
289
+ venueId: string,
290
+ /**
291
+ * The anchor point for the building.
292
+ *
293
+ * @type {MPPointParams}
294
+ */
295
+ anchor: MPPointParams,
296
+ /**
297
+ * The geometry of the building.
298
+ *
299
+ * @type {MPPolygon}
300
+ */
301
+ geometry: MPPolygon | any,
302
+ /**
303
+ * A map of the floors inside the building.
304
+ *
305
+ */
306
+ floors: object,
307
+ /**
308
+ * The default floor index for the building.
309
+ *
310
+ * @type {number}
311
+ */
312
+ defaultFloor: number,
313
+ /**
314
+ * The building's address.
315
+ *
316
+ * @type {string}
317
+ */
318
+ address: string,
319
+ /**
320
+ * A collection of information about the building.
321
+ *
322
+ * @type {?MPBuildingInfo}
323
+ */
324
+ buildingInfo?: MPBuildingInfo,
325
+
326
+ /**
327
+ * A object of two arrays representing coordinates
328
+ * Northeast & Southwest
329
+ *
330
+ * @type {any}
331
+ */
332
+ boundingBox?: any
333
+ }
@@ -0,0 +1,57 @@
1
+ import MPBuilding from "./MPBuilding";
2
+ import MPCollection from "./MPCollection";
3
+
4
+ /**
5
+ * A simple collection holder for buildings.
6
+ *
7
+ * @export
8
+ * @class MPBuildingCollection
9
+ * @typedef {MPBuildingCollection}
10
+ * @extends {MPCollection<MPBuilding>}
11
+ */
12
+ export default class MPBuildingCollection extends MPCollection<MPBuilding> {
13
+ /**
14
+ * A custom map of buildings by their names.
15
+ *
16
+ * @private
17
+ * @type {!Map<String, MPBuilding>}
18
+ */
19
+ private nameMap!: Map<String, MPBuilding>;
20
+
21
+ /**
22
+ * Creates an instance of MPBuildingCollection.
23
+ *
24
+ * @constructor
25
+ * @private
26
+ * @param {MPBuilding[]} buildings A collection of buildings used in MapsIndoors.
27
+ */
28
+ private constructor(buildings: MPBuilding[]) {
29
+ super();
30
+ this.map = new Map(buildings.map((building) => [building.buildingId, building]));
31
+ this.nameMap = new Map(buildings.map((building) => [building.administrativeId.toLowerCase(), building]));
32
+ }
33
+
34
+ /**
35
+ * Get a building by its {@link MPBuilding.administrativeId}.
36
+ *
37
+ * @public
38
+ * @param {string} id
39
+ * @returns {(MPBuilding | undefined)}
40
+ */
41
+ public getBuildingByAdminId(id: string) : MPBuilding | undefined {
42
+ return this.nameMap.get(id.toLowerCase());
43
+ }
44
+
45
+ /**
46
+ * Creator for MPBuildingCollection, used to decode JSON from the MapsIndoors SDK.
47
+ *
48
+ * @public
49
+ * @static
50
+ * @param {?*} [object]
51
+ * @returns {MPBuildingCollection}
52
+ */
53
+ public static create(object?: any) : MPBuildingCollection {
54
+ let buildings: MPBuilding[] = object?.map((building: any) => MPBuilding.create(building));
55
+ return new MPBuildingCollection(buildings);
56
+ }
57
+ }
@@ -0,0 +1,63 @@
1
+ import MPDataField from "./MPDataField";
2
+ import { MPEntityInfo } from "./MPEntityInfo";
3
+
4
+ /**
5
+ * A collection of information about a {@link MPBuilding}.
6
+ *
7
+ * @export
8
+ * @class MPBuildingInfo
9
+ * @typedef {MPBuildingInfo}
10
+ * @extends {MPEntityInfo}
11
+ */
12
+ export default class MPBuildingInfo extends MPEntityInfo {
13
+ /**
14
+ * Creator for MPBuildingInfo, used to decode JSON from the MapsIndoors SDK.
15
+ *
16
+ * @public
17
+ * @static
18
+ * @param {MPBuildingInfoParams} object
19
+ * @returns {MPBuildingInfo}
20
+ */
21
+ public static create(object: MPBuildingInfoParams): MPBuildingInfo {
22
+ return new MPBuildingInfo(
23
+ object?.name,
24
+ object?.aliases,
25
+ object?.fields,
26
+ object?.language,
27
+ );
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Parameter interface for {@link MPBuildingInfo}.
33
+ *
34
+ * @export
35
+ * @interface MPBuildingInfoParams
36
+ * @typedef {MPBuildingInfoParams}
37
+ */
38
+ export interface MPBuildingInfoParams {
39
+ /**
40
+ * The name of the building.
41
+ *
42
+ * @type {string}
43
+ */
44
+ name: string,
45
+ /**
46
+ * An array of aliases used by the building.
47
+ *
48
+ * @type {?string[]}
49
+ */
50
+ aliases?: string[],
51
+ /**
52
+ * A number of data fields on the venue.
53
+ *
54
+ * @type {?Map<string, MPDataField>}
55
+ */
56
+ fields?: Map<string, MPDataField>,
57
+ /**
58
+ * The language the venue currently uses.
59
+ *
60
+ * @type {?string}
61
+ */
62
+ language?: string,
63
+ }
@@ -0,0 +1,17 @@
1
+ import MPCameraEventListener from "../../index"
2
+
3
+ /**
4
+ * Possible events that a {@link MPCameraEventListener} can recieve.
5
+ *
6
+ * @enum {number}
7
+ */
8
+ enum MPCameraEvent {
9
+ finished = 0,
10
+ cancelled = 1,
11
+ moveStartedApiAnimation = 2,
12
+ moveStartedDeveloperAnimation = 3,
13
+ moveStartedGesture = 4,
14
+ onMove = 5,
15
+ moveCancelled = 6,
16
+ idle = 7,
17
+ } export default MPCameraEvent
@@ -0,0 +1,17 @@
1
+ import { MPCameraEvent } from "../../index";
2
+
3
+ /**
4
+ * Listens for camera events, eg. when the Camera starts or stops moving.
5
+ *
6
+ * @export
7
+ * @interface MPCameraEventListener
8
+ * @typedef {MPCameraEventListener}
9
+ */
10
+ export default interface MPCameraEventListener {
11
+ /**
12
+ * When a {@link MPCameraEvent} happens.
13
+ *
14
+ * @param {MPCameraEvent} event
15
+ */
16
+ (event: MPCameraEvent): void;
17
+ }
@@ -0,0 +1,82 @@
1
+ import MPPoint from "./MPPoint";
2
+
3
+ /**
4
+ * A camera position object, used to move the camera to a specific position.
5
+ *
6
+ * @export
7
+ * @class MPCameraPosition
8
+ * @typedef {MPCameraPosition}
9
+ */
10
+ export default class MPCameraPosition {
11
+
12
+
13
+ /**
14
+ * Creates an instance of MPCameraPosition.
15
+ *
16
+ * @constructor
17
+ * @private
18
+ * @param {number} zoom The zoom level of the camera.
19
+ * @param {MPPoint} target The target of the camera.
20
+ * @param {number} tilt The camera's tilt value.
21
+ * @param {number} bearing The camera's heading.
22
+ */
23
+ public constructor(
24
+ public readonly zoom: number,
25
+ public readonly target: MPPoint,
26
+ public readonly tilt: number,
27
+ public readonly bearing: number,
28
+ ) { }
29
+
30
+ /**
31
+ * Creator for MPBuildingCollection, used to decode JSON from the MapsIndoors SDK.
32
+ *
33
+ * @public
34
+ * @static
35
+ * @param {MPCameraPositionParams} object
36
+ * @returns {MPCameraPosition}
37
+ */
38
+ public static create(object: MPCameraPositionParams): MPCameraPosition {
39
+ const target = object.target instanceof MPPoint ? object.target : MPPoint.create(object.target);
40
+
41
+ return new MPCameraPosition(
42
+ object?.zoom,
43
+ target,
44
+ object?.bearing ? object.bearing : 0,
45
+ object?.tilt ? object.tilt : 0,
46
+ );
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Parameter interface for {@link MPCameraPosition}.
52
+ *
53
+ * @export
54
+ * @interface MPCameraPositionParams
55
+ * @typedef {MPCameraPositionParams}
56
+ */
57
+ export interface MPCameraPositionParams {
58
+ /**
59
+ * The zoom level of the camera.
60
+ *
61
+ * @type {number}
62
+ */
63
+ zoom: number,
64
+ /**
65
+ * The target of the camera.
66
+ *
67
+ * @type {MPPoint}
68
+ */
69
+ target: MPPoint | any,
70
+ /**
71
+ * The camera's tilt value.
72
+ *
73
+ * @type {?number}
74
+ */
75
+ tilt?: number,
76
+ /**
77
+ * The camera's heading.
78
+ *
79
+ * @type {?number}
80
+ */
81
+ bearing?: number,
82
+ }