@mapsindoors/react-native-maps-indoors-mapbox 2.6.1 → 2.6.2-rc.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.
- package/android/src/main/java/com/mapsindoorsrn/core/DirectionsRendererModule.java +322 -0
- package/android/src/main/java/com/mapsindoorsrn/core/DirectionsServiceModule.java +166 -0
- package/android/src/main/java/com/mapsindoorsrn/core/MPDisplayRuleModule.java +1699 -0
- package/android/src/main/java/com/mapsindoorsrn/core/MapControlModule.java +761 -0
- package/android/src/main/java/com/mapsindoorsrn/core/MapsIndoorsModule.java +410 -0
- package/android/src/main/java/com/mapsindoorsrn/core/RCMapView.java +16 -0
- package/android/src/main/java/com/mapsindoorsrn/core/README.md +3 -0
- package/android/src/main/java/com/mapsindoorsrn/core/UtilsModule.java +227 -0
- package/android/src/main/java/com/mapsindoorsrn/core/models/BitmapStopIconConfig.java +22 -0
- package/android/src/main/java/com/mapsindoorsrn/core/models/Bounds.java +19 -0
- package/android/src/main/java/com/mapsindoorsrn/core/models/Filter.java +77 -0
- package/android/src/main/java/com/mapsindoorsrn/core/models/Location.java +17 -0
- package/android/src/main/java/com/mapsindoorsrn/core/models/MPCameraPosition.java +34 -0
- package/android/src/main/java/com/mapsindoorsrn/core/models/MPCameraUpdate.java +68 -0
- package/android/src/main/java/com/mapsindoorsrn/core/models/MPError.java +38 -0
- package/android/src/main/java/com/mapsindoorsrn/core/models/PositionProvider.java +46 -0
- package/android/src/main/java/com/mapsindoorsrn/core/models/PositionResult.java +117 -0
- package/android/src/main/java/com/mapsindoorsrn/core/models/Query.java +30 -0
- package/android/src/main/java/com/mapsindoorsrn/core/models/RouteStopIconConfigModel.java +35 -0
- package/ios/core/CameraPosition.swift +15 -0
- package/ios/core/CameraUpdate.swift +19 -0
- package/ios/core/CameraUpdateError.swift +11 -0
- package/ios/core/DirectionsRendererBridge.m +59 -0
- package/ios/core/DirectionsRendererModule.swift +359 -0
- package/ios/core/DirectionsServiceBridge.m +55 -0
- package/ios/core/DirectionsServiceModule.swift +186 -0
- package/ios/core/IconStopUrl.swift +17 -0
- package/ios/core/LabelGraphic.swift +15 -0
- package/ios/core/MPDisplayRuleBridge.m +696 -0
- package/ios/core/MPDisplayRuleModule.swift +1704 -0
- package/ios/core/MapControlBridge.m +213 -0
- package/ios/core/MapControlModule.swift +702 -0
- package/ios/core/MapsIndoorsBridge.m +128 -0
- package/ios/core/MapsIndoorsData.swift +288 -0
- package/ios/core/MapsIndoorsModule.swift +363 -0
- package/ios/core/RCMapView.swift +16 -0
- package/ios/core/README.md +3 -0
- package/ios/core/ReactPositionProvider.swift +27 -0
- package/ios/core/RouteIcon.swift +34 -0
- package/ios/core/UtilsBridge.m +73 -0
- package/ios/core/UtilsModule.swift +182 -0
- package/ios/core/helpers.swift +57 -0
- package/package.json +1 -1
- package/src/core/EventNames.ts +21 -0
- package/src/core/MPAdditionalDetail.ts +102 -0
- package/src/core/MPBadgePosition.ts +12 -0
- package/src/core/MPBounds.ts +155 -0
- package/src/core/MPBuilding.ts +333 -0
- package/src/core/MPBuildingCollection.ts +57 -0
- package/src/core/MPBuildingInfo.ts +63 -0
- package/src/core/MPCameraEvent.ts +17 -0
- package/src/core/MPCameraEventListener.ts +17 -0
- package/src/core/MPCameraPosition.ts +82 -0
- package/src/core/MPCameraUpdate.ts +174 -0
- package/src/core/MPCameraViewFitMode.ts +25 -0
- package/src/core/MPCategory.ts +85 -0
- package/src/core/MPCategoryCollection.ts +62 -0
- package/src/core/MPCollection.ts +59 -0
- package/src/core/MPCollisionHandling.ts +12 -0
- package/src/core/MPDailyOpeningHours.ts +67 -0
- package/src/core/MPDataField.ts +69 -0
- package/src/core/MPDetailType.ts +73 -0
- package/src/core/MPDirectionsRenderer.ts +238 -0
- package/src/core/MPDirectionsService.ts +152 -0
- package/src/core/MPDisplayRule.ts +1823 -0
- package/src/core/MPEntity.ts +60 -0
- package/src/core/MPEntityInfo.ts +28 -0
- package/src/core/MPError.ts +122 -0
- package/src/core/MPFeatureTypes.ts +8 -0
- package/src/core/MPFilter.ts +168 -0
- package/src/core/MPFilterBehavior.ts +115 -0
- package/src/core/MPFloor.ts +170 -0
- package/src/core/MPFloorSelectorInterface.ts +63 -0
- package/src/core/MPGeometry.ts +91 -0
- package/src/core/MPHighlightBehavior.ts +115 -0
- package/src/core/MPHighway.ts +14 -0
- package/src/core/MPIconPlacement.ts +13 -0
- package/src/core/MPIconSize.ts +39 -0
- package/src/core/MPLabelGraphic.ts +24 -0
- package/src/core/MPLabelPosition.ts +12 -0
- package/src/core/MPLabelType.ts +11 -0
- package/src/core/MPLocation.ts +440 -0
- package/src/core/MPLocationPropertyNames.ts +30 -0
- package/src/core/MPLocationSettings.ts +40 -0
- package/src/core/MPLocationType.ts +16 -0
- package/src/core/MPMapConfig.ts +280 -0
- package/src/core/MPMapStyle.ts +57 -0
- package/src/core/MPMultiPolygon.ts +218 -0
- package/src/core/MPOpeningHours.ts +48 -0
- package/src/core/MPPOIType.ts +43 -0
- package/src/core/MPPoint.ts +169 -0
- package/src/core/MPPolygon.ts +219 -0
- package/src/core/MPPositionProviderInterface.ts +45 -0
- package/src/core/MPPositionResultInterface.ts +42 -0
- package/src/core/MPPropertyData.ts +234 -0
- package/src/core/MPQuery.ts +69 -0
- package/src/core/MPRoute.ts +105 -0
- package/src/core/MPRouteCoordinate.ts +95 -0
- package/src/core/MPRouteLeg.ts +158 -0
- package/src/core/MPRouteProperty.ts +83 -0
- package/src/core/MPRouteStep.ts +186 -0
- package/src/core/MPRouteStopIconConfig.ts +82 -0
- package/src/core/MPSelectionBehavior.ts +114 -0
- package/src/core/MPSelectionMode.ts +4 -0
- package/src/core/MPSettings3D.ts +107 -0
- package/src/core/MPSize.ts +21 -0
- package/src/core/MPSolution.ts +189 -0
- package/src/core/MPSolutionConfig.ts +188 -0
- package/src/core/MPSolutionDisplayRule.ts +15 -0
- package/src/core/MPUserRole.ts +60 -0
- package/src/core/MPUserRoleCollection.ts +37 -0
- package/src/core/MPUtils.ts +178 -0
- package/src/core/MPVenue.ts +294 -0
- package/src/core/MPVenueCollection.ts +58 -0
- package/src/core/MPVenueInfo.ts +62 -0
- package/src/core/MPWeeklyOpeningHours.ts +129 -0
- package/src/core/MapControl.ts +961 -0
- package/src/core/MapView.tsx +34 -0
- package/src/core/MapsIndoors.ts +571 -0
- package/src/core/OnBuildingFoundAtCameraTargetListener.ts +17 -0
- package/src/core/OnFloorSelectionChangedListener.ts +17 -0
- package/src/core/OnFloorUpdateListener.ts +16 -0
- package/src/core/OnLegSelectedListener.ts +17 -0
- package/src/core/OnLiveLocationUpdateListener.ts +17 -0
- package/src/core/OnLocationSelectedListener.ts +17 -0
- package/src/core/OnMapClickListener.ts +20 -0
- package/src/core/OnMarkerClickListener.ts +17 -0
- package/src/core/OnMarkerInfoWindowClickListener.ts +17 -0
- package/src/core/OnPositionUpdateListener.ts +17 -0
- package/src/core/OnVenueFoundAtCameraTargetListener.ts +17 -0
- package/src/core/README.md +3 -0
- package/src/core/RouteStopIconConfig.ts +10 -0
|
@@ -0,0 +1,440 @@
|
|
|
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
|
+
import MPLocationSettings from "./MPLocationSettings";
|
|
6
|
+
import { MPAdditionalDetail } from "./MPAdditionalDetail";
|
|
7
|
+
import { MPDetailType } from "./MPDetailType";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A MapsIndoors geographical entity. A location can exist anywhere,
|
|
11
|
+
* but it is usually only used inside {@link MPVenue}s and {@link MPBuilding}s.
|
|
12
|
+
*
|
|
13
|
+
* @export
|
|
14
|
+
* @class MPLocation
|
|
15
|
+
* @typedef {MPLocation}
|
|
16
|
+
* @extends {MPEntity}
|
|
17
|
+
*/
|
|
18
|
+
export default class MPLocation extends MPEntity {
|
|
19
|
+
/**
|
|
20
|
+
* The locations bounds
|
|
21
|
+
*
|
|
22
|
+
* @private
|
|
23
|
+
* @type {?MPBounds}
|
|
24
|
+
*/
|
|
25
|
+
public bounds?: MPBounds;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get whether this location's geometry is a {@link MPPoint}.
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
* @readonly
|
|
32
|
+
* @type {boolean}
|
|
33
|
+
*/
|
|
34
|
+
public get isPoint(): boolean {
|
|
35
|
+
return this.geometry instanceof MPPoint;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Get the location's position.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
* @override
|
|
43
|
+
* @readonly
|
|
44
|
+
* @type {MPPoint}
|
|
45
|
+
*/
|
|
46
|
+
public override get position(): MPPoint {
|
|
47
|
+
return this.properties?.anchor ? this.properties.anchor : new MPPoint(0, 0);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Creates an instance of MPLocation.
|
|
52
|
+
*
|
|
53
|
+
* @constructor
|
|
54
|
+
* @private
|
|
55
|
+
* @param {string} id The location's ID.
|
|
56
|
+
* @param {string[]} restrictions An array of restrictions placed on the location.
|
|
57
|
+
* @param {?MPGeometry} [geometry] The geometry of the location.
|
|
58
|
+
* @param {?MPPropertyData} [properties] The location's properties.
|
|
59
|
+
*/
|
|
60
|
+
private constructor(
|
|
61
|
+
readonly id: string,
|
|
62
|
+
readonly restrictions: string[],
|
|
63
|
+
readonly geometry?: MPGeometry,
|
|
64
|
+
private properties?: MPPropertyData,
|
|
65
|
+
) {
|
|
66
|
+
super("MPLocation");
|
|
67
|
+
switch (this.geometry?.type) {
|
|
68
|
+
case MPGeometry.multiPolygon:
|
|
69
|
+
case MPGeometry.polygon: {
|
|
70
|
+
this.bounds = (this.geometry as MPPolygon | MPMultiPolygon).bounds;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
case MPGeometry.point:
|
|
74
|
+
default: {
|
|
75
|
+
this.bounds = new MPBounds(this.position, this.position);
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Creator for MPLocation, used to decode JSON from the MapsIndoors SDK.
|
|
83
|
+
*
|
|
84
|
+
* @public
|
|
85
|
+
* @static
|
|
86
|
+
* @param {?*} [object]
|
|
87
|
+
* @returns {MPLocation}
|
|
88
|
+
*/
|
|
89
|
+
public static create(object?: any): MPLocation {
|
|
90
|
+
// TODO: make sure iOS sends geometry too
|
|
91
|
+
|
|
92
|
+
let geo: MPGeometry | undefined;
|
|
93
|
+
if (object?.geometry) {
|
|
94
|
+
if (Platform.OS === 'ios') {
|
|
95
|
+
switch (object?.geometryType) {
|
|
96
|
+
case MPGeometry.point:
|
|
97
|
+
geo = MPPoint.create(object?.geometry);
|
|
98
|
+
break;
|
|
99
|
+
case MPGeometry.polygon:
|
|
100
|
+
geo = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.southwest, object?.entityBounds?.northeast)});
|
|
101
|
+
break;
|
|
102
|
+
case MPGeometry.multiPolygon:
|
|
103
|
+
geo = MPMultiPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.southwest, object?.entityBounds?.northeast)})
|
|
104
|
+
break;
|
|
105
|
+
default:
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}else {
|
|
109
|
+
switch (object?.geometry?.type) {
|
|
110
|
+
case MPGeometry.point:
|
|
111
|
+
geo = MPPoint.create(object?.geometry);
|
|
112
|
+
break;
|
|
113
|
+
case MPGeometry.polygon:
|
|
114
|
+
geo = MPPolygon.create(object?.geometry);
|
|
115
|
+
break;
|
|
116
|
+
case MPGeometry.multiPolygon:
|
|
117
|
+
geo = MPMultiPolygon.create(object?.geometry);
|
|
118
|
+
break;
|
|
119
|
+
default:
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (object && object.properties && Platform.OS === 'ios') {
|
|
126
|
+
object.properties.locationSettings = object.locationSettings
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return new MPLocation(
|
|
130
|
+
object?.id,
|
|
131
|
+
object?.restrictions,
|
|
132
|
+
geo,
|
|
133
|
+
MPPropertyData.create(object?.properties, object?.id),
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Get the location's name.
|
|
140
|
+
*
|
|
141
|
+
* @public
|
|
142
|
+
* @readonly
|
|
143
|
+
* @type {string}
|
|
144
|
+
*/
|
|
145
|
+
public get name(): string {
|
|
146
|
+
return this.properties?.name!;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Get the location's aliases.
|
|
151
|
+
*
|
|
152
|
+
* @public
|
|
153
|
+
* @readonly
|
|
154
|
+
* @type {string[]}
|
|
155
|
+
*/
|
|
156
|
+
public get aliases(): string[] {
|
|
157
|
+
return this.properties?.aliases!;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Get the location's categories.
|
|
162
|
+
*
|
|
163
|
+
* @public
|
|
164
|
+
* @readonly
|
|
165
|
+
* @type {(string[] | undefined)}
|
|
166
|
+
*/
|
|
167
|
+
public get categories(): string[] | undefined {
|
|
168
|
+
return (this.properties?.categories !== undefined) ?
|
|
169
|
+
Array.from(this.properties!.categories!.values()) :
|
|
170
|
+
undefined;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Get the location's floorIndex.
|
|
175
|
+
*
|
|
176
|
+
* @public
|
|
177
|
+
* @readonly
|
|
178
|
+
* @type {number}
|
|
179
|
+
*/
|
|
180
|
+
public get floorIndex(): number {
|
|
181
|
+
return this.properties?.floor!;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Get the name of the floor the location is on.
|
|
186
|
+
*
|
|
187
|
+
* @public
|
|
188
|
+
* @readonly
|
|
189
|
+
* @type {string}
|
|
190
|
+
*/
|
|
191
|
+
public get floorName(): string {
|
|
192
|
+
return this.properties?.floorName!;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Get the name of the building the location is in.
|
|
197
|
+
*
|
|
198
|
+
* @public
|
|
199
|
+
* @readonly
|
|
200
|
+
* @type {string}
|
|
201
|
+
*/
|
|
202
|
+
public get buildingName(): string {
|
|
203
|
+
return this.properties?.building!;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Get the name of the venue the location is on.
|
|
208
|
+
*
|
|
209
|
+
* @public
|
|
210
|
+
* @readonly
|
|
211
|
+
* @type {string}
|
|
212
|
+
*/
|
|
213
|
+
public get venueName(): string {
|
|
214
|
+
return this.properties?.venue!;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Get the location's type name.
|
|
219
|
+
*
|
|
220
|
+
* @public
|
|
221
|
+
* @readonly
|
|
222
|
+
* @type {string}
|
|
223
|
+
*/
|
|
224
|
+
public get typeName(): string {
|
|
225
|
+
return this.properties?.type!;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Get the location's description.
|
|
230
|
+
*
|
|
231
|
+
* @public
|
|
232
|
+
* @readonly
|
|
233
|
+
* @type {string}
|
|
234
|
+
*/
|
|
235
|
+
public get description(): string {
|
|
236
|
+
return this.properties?.description!;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Get the location's external identifier.
|
|
241
|
+
*
|
|
242
|
+
* @public
|
|
243
|
+
* @readonly
|
|
244
|
+
* @type {string}
|
|
245
|
+
*/
|
|
246
|
+
public get externalId(): string {
|
|
247
|
+
return this.properties?.externalId!;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Get the time location is active from.
|
|
252
|
+
*
|
|
253
|
+
* @public
|
|
254
|
+
* @readonly
|
|
255
|
+
* @type {number}
|
|
256
|
+
*/
|
|
257
|
+
public get activeFrom(): number {
|
|
258
|
+
return this.properties?.activeFrom!;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Get the time location is active to.
|
|
263
|
+
*
|
|
264
|
+
* @public
|
|
265
|
+
* @readonly
|
|
266
|
+
* @type {number}
|
|
267
|
+
*/
|
|
268
|
+
public get activeTo(): number {
|
|
269
|
+
return this.properties?.activeTo!;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Get the URL of the location's icon image.
|
|
274
|
+
*
|
|
275
|
+
* @public
|
|
276
|
+
* @readonly
|
|
277
|
+
* @type {string}
|
|
278
|
+
*/
|
|
279
|
+
public get imageUrl(): string {
|
|
280
|
+
return this.properties?.imageUrl!;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Get whether the location is bookable.
|
|
285
|
+
*
|
|
286
|
+
* @public
|
|
287
|
+
* @returns {boolean}
|
|
288
|
+
*/
|
|
289
|
+
public isBookable(): boolean {
|
|
290
|
+
return this.properties?.bookable ? this.properties.bookable : false;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Set the location's selectable flag.
|
|
295
|
+
*/
|
|
296
|
+
set selectable(selectable: boolean | undefined) {
|
|
297
|
+
if (this.properties?.locationSettings) {
|
|
298
|
+
this.properties.locationSettings.selectable = selectable;
|
|
299
|
+
}else if (this.properties) {
|
|
300
|
+
this.properties.locationSettings = MPLocationSettings.create(this.name, { selectable });
|
|
301
|
+
this.properties.locationSettings.selectable = selectable;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Get the location's selectable flag.
|
|
307
|
+
*/
|
|
308
|
+
get selectable(): boolean | null {
|
|
309
|
+
return this.properties?.locationSettings?.selectable ?? null;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Get the location's basetype.
|
|
314
|
+
*
|
|
315
|
+
* @public
|
|
316
|
+
* @readonly
|
|
317
|
+
* @type {MPLocationType}
|
|
318
|
+
*/
|
|
319
|
+
public get baseType(): MPLocationType {
|
|
320
|
+
switch (this.properties?.type) {
|
|
321
|
+
case "area": {
|
|
322
|
+
return MPLocationType.area;
|
|
323
|
+
}
|
|
324
|
+
case "venue": {
|
|
325
|
+
return MPLocationType.venue;
|
|
326
|
+
}
|
|
327
|
+
case "building": {
|
|
328
|
+
return MPLocationType.building;
|
|
329
|
+
}
|
|
330
|
+
case "room": {
|
|
331
|
+
return MPLocationType.room;
|
|
332
|
+
}
|
|
333
|
+
case "floor": {
|
|
334
|
+
return MPLocationType.floor;
|
|
335
|
+
}
|
|
336
|
+
case "asset": {
|
|
337
|
+
return MPLocationType.asset;
|
|
338
|
+
}
|
|
339
|
+
case "poi":
|
|
340
|
+
default: {
|
|
341
|
+
return MPLocationType.poi;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Get a property of the location.
|
|
348
|
+
*
|
|
349
|
+
* @public
|
|
350
|
+
* @param {MPLocationPropertyNames} key
|
|
351
|
+
* @returns {*}
|
|
352
|
+
*/
|
|
353
|
+
public getProperty(key: MPLocationPropertyNames): any {
|
|
354
|
+
switch (key) {
|
|
355
|
+
case MPLocationPropertyNames.name: {
|
|
356
|
+
return this.properties?.name;
|
|
357
|
+
}
|
|
358
|
+
case MPLocationPropertyNames.aliases: {
|
|
359
|
+
return this.properties?.aliases;
|
|
360
|
+
}
|
|
361
|
+
case MPLocationPropertyNames.categories: {
|
|
362
|
+
return this.properties?.categories;
|
|
363
|
+
}
|
|
364
|
+
case MPLocationPropertyNames.floor: {
|
|
365
|
+
return this.properties?.floor;
|
|
366
|
+
}
|
|
367
|
+
case MPLocationPropertyNames.floorName: {
|
|
368
|
+
return this.properties?.floorName;
|
|
369
|
+
}
|
|
370
|
+
case MPLocationPropertyNames.building: {
|
|
371
|
+
return this.properties?.building;
|
|
372
|
+
}
|
|
373
|
+
case MPLocationPropertyNames.venue: {
|
|
374
|
+
return this.properties?.venue;
|
|
375
|
+
}
|
|
376
|
+
case MPLocationPropertyNames.type: {
|
|
377
|
+
return this.properties?.type;
|
|
378
|
+
}
|
|
379
|
+
case MPLocationPropertyNames.description: {
|
|
380
|
+
return this.properties?.description;
|
|
381
|
+
}
|
|
382
|
+
case MPLocationPropertyNames.roomId:
|
|
383
|
+
case MPLocationPropertyNames.externalId: {
|
|
384
|
+
return this.properties?.externalId;
|
|
385
|
+
}
|
|
386
|
+
case MPLocationPropertyNames.activeFrom: {
|
|
387
|
+
return this.properties?.activeFrom;
|
|
388
|
+
}
|
|
389
|
+
case MPLocationPropertyNames.activeTo: {
|
|
390
|
+
return this.properties?.activeTo;
|
|
391
|
+
}
|
|
392
|
+
case MPLocationPropertyNames.contact: {
|
|
393
|
+
return this.properties?.contact;
|
|
394
|
+
}
|
|
395
|
+
case MPLocationPropertyNames.fields: {
|
|
396
|
+
return this.properties?.fields;
|
|
397
|
+
}
|
|
398
|
+
case MPLocationPropertyNames.imageURL: {
|
|
399
|
+
return this.properties?.imageUrl;
|
|
400
|
+
}
|
|
401
|
+
case MPLocationPropertyNames.locationType: {
|
|
402
|
+
return this.properties?.locationType;
|
|
403
|
+
}
|
|
404
|
+
case MPLocationPropertyNames.anchor: {
|
|
405
|
+
return this.properties?.anchor;
|
|
406
|
+
}
|
|
407
|
+
case MPLocationPropertyNames.bookable: {
|
|
408
|
+
return this.properties?.bookable;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Gets the location's additional details, if any
|
|
415
|
+
* @returns a list of additional details, or null if none were set
|
|
416
|
+
*/
|
|
417
|
+
public getAdditionalDetails(): MPAdditionalDetail[] | null {
|
|
418
|
+
if (this.properties?.additionalDetails) {
|
|
419
|
+
// Return a readonly copy of the array to prevent external modifications
|
|
420
|
+
return [...this.properties.additionalDetails];
|
|
421
|
+
}
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Gets a specific additional detail from the location's additional details
|
|
427
|
+
* @param type the type of the additional detail to get
|
|
428
|
+
* @returns the additional detail of the specified type, or null if it does not exist
|
|
429
|
+
*/
|
|
430
|
+
public getAdditionalDetail(type: MPDetailType): MPAdditionalDetail | null {
|
|
431
|
+
if (this.properties?.additionalDetails) {
|
|
432
|
+
for (const detail of this.properties.additionalDetails) {
|
|
433
|
+
if (detail.detailType.toLowerCase() === type.toLowerCase() ) {
|
|
434
|
+
return detail;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return null;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import MPLocation from "./MPLocation";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enumerated names of properties on {@link MPLocation}s.
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @enum {number}
|
|
8
|
+
*/
|
|
9
|
+
export enum MPLocationPropertyNames {
|
|
10
|
+
name = "name",
|
|
11
|
+
aliases = "aliases",
|
|
12
|
+
categories = "categories",
|
|
13
|
+
floor = "floor",
|
|
14
|
+
floorName = "floorName",
|
|
15
|
+
building = "building",
|
|
16
|
+
venue = "venue",
|
|
17
|
+
//DISPLAY_RULE,
|
|
18
|
+
type = "type",
|
|
19
|
+
description = "description",
|
|
20
|
+
roomId = "roomId",
|
|
21
|
+
externalId = "externalId",
|
|
22
|
+
activeFrom = "activeFrom",
|
|
23
|
+
activeTo = "activeTo",
|
|
24
|
+
contact = "contact",
|
|
25
|
+
fields = "fields",
|
|
26
|
+
imageURL = "imageURL",
|
|
27
|
+
locationType = "locationType",
|
|
28
|
+
anchor = "anchor",
|
|
29
|
+
bookable = "bookable",
|
|
30
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import MPUtils from "./MPUtils";
|
|
2
|
+
|
|
3
|
+
export default class MPLocationSettings {
|
|
4
|
+
/**
|
|
5
|
+
* @constructor
|
|
6
|
+
* @private
|
|
7
|
+
* @param selectable
|
|
8
|
+
*/
|
|
9
|
+
private constructor(
|
|
10
|
+
readonly id: string,
|
|
11
|
+
private _selectable?: boolean,
|
|
12
|
+
) {}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Creator for MPLocationSettings, used to decode JSON from the MapsIndoors SDK.
|
|
16
|
+
*
|
|
17
|
+
* @static
|
|
18
|
+
* @param {MPLocationSettingsParams} object
|
|
19
|
+
* @returns {MPLocationSettings}
|
|
20
|
+
*/
|
|
21
|
+
public static create(id: string, object: MPLocationSettingsParams): MPLocationSettings {
|
|
22
|
+
return new MPLocationSettings(
|
|
23
|
+
id,
|
|
24
|
+
object?.selectable,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
set selectable(selectable: boolean | undefined) {
|
|
29
|
+
this._selectable = selectable;
|
|
30
|
+
MPUtils.setSelectable(this.id, selectable);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get selectable(): boolean | undefined {
|
|
34
|
+
return this._selectable;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface MPLocationSettingsParams {
|
|
39
|
+
selectable?: boolean;
|
|
40
|
+
}
|