@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.
- 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,280 @@
|
|
|
1
|
+
import { MPFloorSelectorInterface, MapControl } from "../../index";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This configuration object is used when creating a new {@link MapControl} instance.
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @class MPMapConfig
|
|
8
|
+
* @typedef {MPMapConfig}
|
|
9
|
+
*/
|
|
10
|
+
export default class MPMapConfig {
|
|
11
|
+
/**
|
|
12
|
+
* Whether to use the default map styling used by MapsIndoors, true by default.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
* @readonly
|
|
16
|
+
* @type {boolean}
|
|
17
|
+
*/
|
|
18
|
+
public readonly useDefaultMapsIndoorsStyle: boolean
|
|
19
|
+
/**
|
|
20
|
+
* The name of the typeface family to use on the map (the typeface must be supported on the native platform).
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
* @readonly
|
|
24
|
+
* @type {?string}
|
|
25
|
+
*/
|
|
26
|
+
public readonly typeface?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The color of the label text (a Hex color String (#1f1f1f))
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
* @readonly
|
|
32
|
+
* @type {?string}
|
|
33
|
+
*/
|
|
34
|
+
public readonly color?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Whether to show a white shadow behind the text to make it more readable.
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
* @readonly
|
|
40
|
+
* @type {?boolean}
|
|
41
|
+
*/
|
|
42
|
+
public readonly showHalo?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Changes the text size of the maps marker labels.
|
|
45
|
+
*
|
|
46
|
+
* The size is in dense pixels (DP).
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
* @readonly
|
|
50
|
+
* @type {?number}
|
|
51
|
+
*/
|
|
52
|
+
public readonly textSize?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Enable/Disable showing the floor selector.
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
* @readonly
|
|
58
|
+
* @type {?boolean}
|
|
59
|
+
*/
|
|
60
|
+
public readonly showFloorSelector?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Enables/Disables the info window on user-selected locations.
|
|
63
|
+
*
|
|
64
|
+
* The info window is shown by default when the user selects a location (by tapping on it).
|
|
65
|
+
*
|
|
66
|
+
* @public
|
|
67
|
+
* @readonly
|
|
68
|
+
* @type {?boolean}
|
|
69
|
+
*/
|
|
70
|
+
public readonly showInfoWindowOnClick?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Renders the positioning puck (blue dot) at the last known user position on the map.
|
|
73
|
+
*
|
|
74
|
+
* @public
|
|
75
|
+
* @readonly
|
|
76
|
+
* @type {?boolean}
|
|
77
|
+
*/
|
|
78
|
+
public readonly showUserPosition?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Enable fade-in effect on MapsIndoors tiles.
|
|
81
|
+
* Changes will be reflected on the map upon changing floors.
|
|
82
|
+
*
|
|
83
|
+
* Default behavior is enabled fade-in.
|
|
84
|
+
*
|
|
85
|
+
* @public
|
|
86
|
+
* @readonly
|
|
87
|
+
* @type {?boolean}
|
|
88
|
+
*/
|
|
89
|
+
public readonly enableTileFadeIn?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Replaces the default FloorSelector with a custom one.
|
|
92
|
+
*
|
|
93
|
+
* @public
|
|
94
|
+
* @readonly
|
|
95
|
+
* @type {?MPFloorSelectorInterface}
|
|
96
|
+
*/
|
|
97
|
+
public readonly floorSelector?: MPFloorSelectorInterface;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The zoom level at which the map should transition to MapsIndoors tiles. Mapbox specific.
|
|
101
|
+
*
|
|
102
|
+
* The default value is 17.
|
|
103
|
+
* @public
|
|
104
|
+
* @readonly
|
|
105
|
+
* @type {?number}
|
|
106
|
+
*/
|
|
107
|
+
public readonly mapsIndoorsTransitionLevel?: number;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Whether to show the mapbox markers on the map. Includes POI's and Places.
|
|
111
|
+
* Mapbox specific
|
|
112
|
+
* The default value is undefined, and enables/disables based on the transition zoom level.
|
|
113
|
+
* @public
|
|
114
|
+
* @readonly
|
|
115
|
+
* @type {?boolean}
|
|
116
|
+
*/
|
|
117
|
+
public readonly showMapMarkers?: boolean;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Whether to show the road labels on the map.
|
|
121
|
+
* Mapbox specific
|
|
122
|
+
* The default value is undefined, and enables/disables based on the transition zoom level.
|
|
123
|
+
* @public
|
|
124
|
+
* @readonly
|
|
125
|
+
* @type {?boolean}
|
|
126
|
+
*/
|
|
127
|
+
public readonly showRoadLabels?: boolean;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Set a specific map style for Mapbox
|
|
131
|
+
* Mapbox specific
|
|
132
|
+
* The default value is undefined, and uses the default style. useDefaultMapsIndoorsStyle should be false for this to take effect.
|
|
133
|
+
*/
|
|
134
|
+
public mapboxMapStyle?: string;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Creates an instance of MPMapConfig.
|
|
138
|
+
*
|
|
139
|
+
* @constructor
|
|
140
|
+
* @public
|
|
141
|
+
* @param {MPMapConfigParams} params
|
|
142
|
+
*/
|
|
143
|
+
public constructor(params: MPMapConfigParams) {
|
|
144
|
+
this.useDefaultMapsIndoorsStyle = params.useDefaultMapsIndoorsStyle;
|
|
145
|
+
this.typeface = params.mapLabelFont?.typeface;
|
|
146
|
+
this.color = params.mapLabelFont?.color;
|
|
147
|
+
this.showHalo = params.mapLabelFont?.showHalo;
|
|
148
|
+
this.textSize = params.textSize;
|
|
149
|
+
this.showFloorSelector = params.showFloorSelector;
|
|
150
|
+
this.showInfoWindowOnClick = params.showInfoWindowOnClick;
|
|
151
|
+
this.showUserPosition = params.showUserPosition;
|
|
152
|
+
this.enableTileFadeIn = params.enableTileFadeIn;
|
|
153
|
+
this.floorSelector = params.floorSelector;
|
|
154
|
+
this.mapsIndoorsTransitionLevel = params.mapsIndoorsTransitionLevel;
|
|
155
|
+
this.showMapMarkers = params.showMapMarkers;
|
|
156
|
+
this.showRoadLabels = params.showRoadLabels;
|
|
157
|
+
this.mapboxMapStyle = params.mapboxMapStyle;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Collection of label apperance settigns
|
|
163
|
+
*
|
|
164
|
+
* @export
|
|
165
|
+
* @interface MapLabelFont
|
|
166
|
+
* @typedef {MapLabelFont}
|
|
167
|
+
*/
|
|
168
|
+
export interface MapLabelFont {
|
|
169
|
+
/**
|
|
170
|
+
* The name of the typeface family to use on the map (the typeface must be supported on the native platform).
|
|
171
|
+
*
|
|
172
|
+
* @type {string}
|
|
173
|
+
*/
|
|
174
|
+
typeface: string,
|
|
175
|
+
/**
|
|
176
|
+
* The color of the label text (a Hex color String (#1f1f1f))
|
|
177
|
+
*
|
|
178
|
+
* @type {string}
|
|
179
|
+
*/
|
|
180
|
+
color: string,
|
|
181
|
+
/**
|
|
182
|
+
* Whether to show a white shadow behind the text to make it more readable.
|
|
183
|
+
*
|
|
184
|
+
* @type {boolean}
|
|
185
|
+
*/
|
|
186
|
+
showHalo: boolean,
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Parameter interface for {@link MPMapConfig}.
|
|
191
|
+
*
|
|
192
|
+
* @export
|
|
193
|
+
* @interface MPMapConfigParams
|
|
194
|
+
* @typedef {MPMapConfigParams}
|
|
195
|
+
*/
|
|
196
|
+
export interface MPMapConfigParams {
|
|
197
|
+
/**
|
|
198
|
+
* Whether to use the default map styling used by MapsIndoors, true by default.
|
|
199
|
+
*
|
|
200
|
+
* @type {boolean}
|
|
201
|
+
*/
|
|
202
|
+
useDefaultMapsIndoorsStyle: boolean,
|
|
203
|
+
/**
|
|
204
|
+
* A map label configuration object.
|
|
205
|
+
*
|
|
206
|
+
* @type {?MapLabelFont}
|
|
207
|
+
*/
|
|
208
|
+
mapLabelFont?: MapLabelFont,
|
|
209
|
+
/**
|
|
210
|
+
* Changes the text size of the maps marker labels.
|
|
211
|
+
*
|
|
212
|
+
* The size is in dense pixels (DP).
|
|
213
|
+
*
|
|
214
|
+
* @type {?number}
|
|
215
|
+
*/
|
|
216
|
+
textSize?: number,
|
|
217
|
+
/**
|
|
218
|
+
* Enable/Disable showing the floor selector.
|
|
219
|
+
*
|
|
220
|
+
* @type {?boolean}
|
|
221
|
+
*/
|
|
222
|
+
showFloorSelector?: boolean,
|
|
223
|
+
/**
|
|
224
|
+
* Enables/Disables the info window on user-selected locations.
|
|
225
|
+
*
|
|
226
|
+
* The info window is shown by default when the user selects a location (by tapping on it).
|
|
227
|
+
*
|
|
228
|
+
* @type {?boolean}
|
|
229
|
+
*/
|
|
230
|
+
showInfoWindowOnClick?: boolean,
|
|
231
|
+
/**
|
|
232
|
+
* Renders the positioning puck (blue dot) at the last known user position on the map.
|
|
233
|
+
*
|
|
234
|
+
* @type {?boolean}
|
|
235
|
+
*/
|
|
236
|
+
showUserPosition?: boolean,
|
|
237
|
+
/**
|
|
238
|
+
* Enable fade-in effect on MapsIndoors tiles.
|
|
239
|
+
* Changes will be reflected on the map upon changing floors.
|
|
240
|
+
*
|
|
241
|
+
* Default behavior is enabled fade-in.
|
|
242
|
+
*
|
|
243
|
+
* @type {?boolean}
|
|
244
|
+
*/
|
|
245
|
+
enableTileFadeIn?: boolean,
|
|
246
|
+
/**
|
|
247
|
+
* Replaces the default FloorSelector with a custom one.
|
|
248
|
+
*
|
|
249
|
+
* @type {?MPFloorSelectorInterface}
|
|
250
|
+
*/
|
|
251
|
+
floorSelector?: MPFloorSelectorInterface,
|
|
252
|
+
/**
|
|
253
|
+
* The zoom level at which the map should transition to MapsIndoors tiles. Mapbox specific.
|
|
254
|
+
*
|
|
255
|
+
* The default value is 17.
|
|
256
|
+
* @type {?number}
|
|
257
|
+
*/
|
|
258
|
+
mapsIndoorsTransitionLevel?: number,
|
|
259
|
+
/**
|
|
260
|
+
* Whether to show the mapbox markers on the map. Includes POI's and Places.
|
|
261
|
+
* Mapbox specific
|
|
262
|
+
* The default value is undefined, and enables/disables based on the transition zoom level.
|
|
263
|
+
* @type {?boolean}
|
|
264
|
+
*/
|
|
265
|
+
showMapMarkers?: boolean,
|
|
266
|
+
/**
|
|
267
|
+
* Whether to show the road labels on the map.
|
|
268
|
+
* Mapbox specific
|
|
269
|
+
* The default value is undefined, and enables/disables based on the transition zoom level.
|
|
270
|
+
* @type {boolean}
|
|
271
|
+
*/
|
|
272
|
+
showRoadLabels?: boolean,
|
|
273
|
+
/**
|
|
274
|
+
* Set a specific map style for Mapbox
|
|
275
|
+
* Mapbox specific
|
|
276
|
+
* The default value is undefined, and uses the default style. useDefaultMapsIndoorsStyle should be false for this to take effect.
|
|
277
|
+
* @type {string}
|
|
278
|
+
*/
|
|
279
|
+
mapboxMapStyle?: string,
|
|
280
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import MPVenue from "./MPVenue";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A tileset used by a specific {@link MPVenue}.
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @class MPMapStyle
|
|
8
|
+
* @typedef {MPMapStyle}
|
|
9
|
+
*/
|
|
10
|
+
export default class MPMapStyle {
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of MPMapStyle.
|
|
13
|
+
*
|
|
14
|
+
* @constructor
|
|
15
|
+
* @private
|
|
16
|
+
* @param {string} folder The folder the style is saved in.
|
|
17
|
+
* @param {string} displayName The name of the style.
|
|
18
|
+
*/
|
|
19
|
+
private constructor(
|
|
20
|
+
public readonly folder: string,
|
|
21
|
+
public readonly displayName: string
|
|
22
|
+
) { }
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Creator for MPMapStyle, used to decode JSON from the MapsIndoors SDK.
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
* @static
|
|
29
|
+
* @param {MPMapStyleParams} object
|
|
30
|
+
* @returns {MPMapStyle}
|
|
31
|
+
*/
|
|
32
|
+
public static create(object: MPMapStyleParams): MPMapStyle {
|
|
33
|
+
return new MPMapStyle(object?.folder, object?.displayName);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Parameter interface for {@link MPMapStyle}.
|
|
39
|
+
*
|
|
40
|
+
* @export
|
|
41
|
+
* @interface MPMapStyleParams
|
|
42
|
+
* @typedef {MPMapStyleParams}
|
|
43
|
+
*/
|
|
44
|
+
export interface MPMapStyleParams {
|
|
45
|
+
/**
|
|
46
|
+
* The folder the style is saved in.
|
|
47
|
+
*
|
|
48
|
+
* @type {string}
|
|
49
|
+
*/
|
|
50
|
+
folder: string,
|
|
51
|
+
/**
|
|
52
|
+
* The name of the style.
|
|
53
|
+
*
|
|
54
|
+
* @type {string}
|
|
55
|
+
*/
|
|
56
|
+
displayName: string,
|
|
57
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { MPPoint, MPGeometry, MPPolygon, MPBounds } from "../../index";
|
|
2
|
+
import MPUtils from "./MPUtils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A multiPolygon is a collection of {@link MPPolygon}s that combine
|
|
6
|
+
* to form a single geographical area with multiple bodies.
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @class MPMultiPolygon
|
|
10
|
+
* @typedef {MPMultiPolygon}
|
|
11
|
+
* @extends {MPGeometry}
|
|
12
|
+
*/
|
|
13
|
+
export default class MPMultiPolygon extends MPGeometry {
|
|
14
|
+
/**
|
|
15
|
+
* bounds cache.
|
|
16
|
+
*
|
|
17
|
+
* @private
|
|
18
|
+
* @type {?MPBounds}
|
|
19
|
+
*/
|
|
20
|
+
private _bounds?: MPBounds;
|
|
21
|
+
/**
|
|
22
|
+
* area cache.
|
|
23
|
+
*
|
|
24
|
+
* @private
|
|
25
|
+
* @type {?number}
|
|
26
|
+
*/
|
|
27
|
+
private _area?: number;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Creates an instance of MPMultiPolygon.
|
|
31
|
+
*
|
|
32
|
+
* @constructor
|
|
33
|
+
* @private
|
|
34
|
+
* @param {number[][][][]} _coordinates
|
|
35
|
+
* @param {number[]} _bbox
|
|
36
|
+
*/
|
|
37
|
+
private constructor(
|
|
38
|
+
private _coordinates: number[][][][],
|
|
39
|
+
private _bbox: number[]
|
|
40
|
+
) {
|
|
41
|
+
super();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Update the polygon's bounding box, the bounding box must be in
|
|
46
|
+
* [GeoJson format]{@link https://stevage.github.io/geojson-spec/#section-5}
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
* @type {{}}
|
|
50
|
+
*/
|
|
51
|
+
public set bbox(box: number[]) {
|
|
52
|
+
this._bbox = box;
|
|
53
|
+
this.clearCache();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get the polygon's bounding box, the bounding box is in
|
|
58
|
+
* [GeoJson format]{@link https://stevage.github.io/geojson-spec/#section-5}
|
|
59
|
+
*
|
|
60
|
+
* @public
|
|
61
|
+
* @type {number[]}
|
|
62
|
+
*/
|
|
63
|
+
public get bbox(): number[] {
|
|
64
|
+
return this._bbox;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Update the coordinates list for the polygon, the coordinates must be in
|
|
69
|
+
* [GeoJSON format]{@link https://stevage.github.io/geojson-spec/#section-3.1.7}
|
|
70
|
+
*
|
|
71
|
+
* @public
|
|
72
|
+
* @type {number[][][][]}
|
|
73
|
+
*/
|
|
74
|
+
public set coordinates(coordinates: number[][][][]) {
|
|
75
|
+
this._coordinates = coordinates;
|
|
76
|
+
this.clearCache();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Get the coordinates as a collection in
|
|
81
|
+
* [GeoJSON format]{@link https://stevage.github.io/geojson-spec/#section-3.1.7}.
|
|
82
|
+
*
|
|
83
|
+
* @public
|
|
84
|
+
* @type {number[][][][]}
|
|
85
|
+
*/
|
|
86
|
+
public get coordinates(): number[][][][] {
|
|
87
|
+
return this._coordinates;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get the polygon's bounds. If {@link bbox} is present then that will be used.
|
|
92
|
+
*
|
|
93
|
+
* @public
|
|
94
|
+
* @readonly
|
|
95
|
+
* @type {MPBounds}
|
|
96
|
+
*/
|
|
97
|
+
public get bounds(): MPBounds {
|
|
98
|
+
if (this._bounds == undefined) {
|
|
99
|
+
this._bounds = MPBounds.fromBBox(this._bbox);
|
|
100
|
+
}
|
|
101
|
+
return this._bounds;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Get the polygon's area, this is the combined area of all the polygons in the multi-polygon.
|
|
106
|
+
*
|
|
107
|
+
* @public
|
|
108
|
+
* @async
|
|
109
|
+
* @returns {Promise<number>}
|
|
110
|
+
*/
|
|
111
|
+
public async getArea(): Promise<number> {
|
|
112
|
+
if (this._area == undefined) {
|
|
113
|
+
this._area = await MPUtils.geometryArea(this);
|
|
114
|
+
}
|
|
115
|
+
return Promise.resolve(this._area);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Creator for MPMultiPolygon, used to decode JSON from the MapsIndoors SDK.
|
|
121
|
+
*
|
|
122
|
+
* @public
|
|
123
|
+
* @static
|
|
124
|
+
* @param {MPMultiPolygonParams} object
|
|
125
|
+
* @returns {MPMultiPolygon}
|
|
126
|
+
*/
|
|
127
|
+
public static create(object: MPMultiPolygonParams): MPMultiPolygon {
|
|
128
|
+
return new MPMultiPolygon(object?.coordinates, object?.bbox);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Calculates the squared distance from the point to the closest edge in the polygon.
|
|
133
|
+
*
|
|
134
|
+
* @public
|
|
135
|
+
* @async
|
|
136
|
+
* @param {MPPoint} point
|
|
137
|
+
* @returns {Promise<number>}
|
|
138
|
+
*/
|
|
139
|
+
public async distanceToClosestEdge(point: MPPoint): Promise<number> {
|
|
140
|
+
return MPUtils.polygonDistanceToClosestEdge(point, this);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Get the position of the polygon, which is roughly its center.
|
|
145
|
+
*
|
|
146
|
+
* @public
|
|
147
|
+
* @readonly
|
|
148
|
+
* @type {MPPoint}
|
|
149
|
+
*/
|
|
150
|
+
public get position(): MPPoint {
|
|
151
|
+
return this.bounds.center;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Get the type of the polygon. see {@link MPGeometry#multiPolygon}
|
|
155
|
+
*
|
|
156
|
+
* @public
|
|
157
|
+
* @readonly
|
|
158
|
+
* @type {string}
|
|
159
|
+
*/
|
|
160
|
+
public get type(): string {
|
|
161
|
+
return MPGeometry.multiPolygon;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Clears area and bounds cache due to geometry recalculation.
|
|
166
|
+
*
|
|
167
|
+
* @private
|
|
168
|
+
*/
|
|
169
|
+
private clearCache() {
|
|
170
|
+
this._area = undefined;
|
|
171
|
+
this._bounds = undefined;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Parses the object to a JSON object that is compatible with the MapsIndoors SDK.
|
|
177
|
+
*
|
|
178
|
+
* @public
|
|
179
|
+
* @returns {MPMultiPolygonParams}
|
|
180
|
+
*/
|
|
181
|
+
public toJSON(): MPMultiPolygonParams {
|
|
182
|
+
return {
|
|
183
|
+
type: this.type,
|
|
184
|
+
coordinates: this._coordinates,
|
|
185
|
+
bbox: this._bbox,
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Parameter interface for {@link MPMultiPolygon}.
|
|
193
|
+
*
|
|
194
|
+
* @export
|
|
195
|
+
* @interface MPMultiPolygonParams
|
|
196
|
+
* @typedef {MPMultiPolygonParams}
|
|
197
|
+
*/
|
|
198
|
+
export interface MPMultiPolygonParams {
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* the type of the geometry, leave this blank as it is just used to parse the geometry to JSON
|
|
202
|
+
*
|
|
203
|
+
* @type {string}
|
|
204
|
+
*/
|
|
205
|
+
type?: string,
|
|
206
|
+
/**
|
|
207
|
+
* Geometry, as specified in the [GeoJSON format]{@link https://stevage.github.io/geojson-spec/#section-3.1.7}.
|
|
208
|
+
*
|
|
209
|
+
* @type {number[][][][]}
|
|
210
|
+
*/
|
|
211
|
+
coordinates: number[][][][],
|
|
212
|
+
/**
|
|
213
|
+
* bounding box, as specified in the [GeoJson format]{@link https://stevage.github.io/geojson-spec/#section-5}.
|
|
214
|
+
*
|
|
215
|
+
* @type {number[]}
|
|
216
|
+
*/
|
|
217
|
+
bbox?: number[],
|
|
218
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { MPWeeklyOpeningHours } from './MPWeeklyOpeningHours';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents the opening hours for a location.
|
|
5
|
+
*/
|
|
6
|
+
export class MPOpeningHours {
|
|
7
|
+
/**
|
|
8
|
+
* The standard opening hours for the location.
|
|
9
|
+
*/
|
|
10
|
+
private _standardOpeningHours: MPWeeklyOpeningHours | null = null;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Gets the standard opening hours for the location.
|
|
14
|
+
*/
|
|
15
|
+
get standardOpeningHours(): MPWeeklyOpeningHours | null {
|
|
16
|
+
return this._standardOpeningHours;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Creates an instance of MPOpeningHours from a JSON object.
|
|
21
|
+
*/
|
|
22
|
+
static fromJson(json: any): MPOpeningHours {
|
|
23
|
+
const openingHours = new MPOpeningHours();
|
|
24
|
+
openingHours._standardOpeningHours = json.standardOpeningHours || null;
|
|
25
|
+
return openingHours;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Converts the instance to a JSON object.
|
|
30
|
+
* This is useful for serialization.
|
|
31
|
+
*/
|
|
32
|
+
toJson(): any {
|
|
33
|
+
return {
|
|
34
|
+
standardOpeningHours: this._standardOpeningHours,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Returns a string representation of the opening hours.
|
|
40
|
+
* @returns String representation of the standard opening hours or a default message
|
|
41
|
+
*/
|
|
42
|
+
toString(): string {
|
|
43
|
+
if (this._standardOpeningHours && typeof this._standardOpeningHours.toString === 'function') {
|
|
44
|
+
return this._standardOpeningHours.toString();
|
|
45
|
+
}
|
|
46
|
+
return "No standard opening hours available";
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import MPLocationSettings from "./MPLocationSettings";
|
|
2
|
+
|
|
3
|
+
export default class MPPOIType {
|
|
4
|
+
private constructor(
|
|
5
|
+
public readonly name: string,
|
|
6
|
+
public readonly translatedName: string,
|
|
7
|
+
private locationSettings?: MPLocationSettings,
|
|
8
|
+
) { }
|
|
9
|
+
|
|
10
|
+
public static create(object: MPPOITypeParams): MPPOIType {
|
|
11
|
+
return new MPPOIType(
|
|
12
|
+
object.name,
|
|
13
|
+
object.translatedName,
|
|
14
|
+
object.locationSettings ? MPLocationSettings.create(object.name, object.locationSettings) : undefined,
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Set the selectable flag for the POI type.
|
|
20
|
+
*/
|
|
21
|
+
set selectable(selectable: boolean | null) {
|
|
22
|
+
if (this.locationSettings) {
|
|
23
|
+
this.locationSettings.selectable = selectable;
|
|
24
|
+
}else {
|
|
25
|
+
this.locationSettings = MPLocationSettings.create(this.name, { selectable });
|
|
26
|
+
this.locationSettings.selectable = selectable;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get the selectable flag for the POI type.
|
|
32
|
+
*/
|
|
33
|
+
get selectable(): boolean | null {
|
|
34
|
+
return this.locationSettings?.selectable ?? null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface MPPOITypeParams {
|
|
40
|
+
name: string;
|
|
41
|
+
translatedName: string;
|
|
42
|
+
locationSettings?: MPLocationSettings;
|
|
43
|
+
}
|