@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,34 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { Platform, UIManager, ViewProps, findNodeHandle, requireNativeComponent } from "react-native";
|
|
4
|
+
import MPCameraPosition from './MPCameraPosition';
|
|
5
|
+
|
|
6
|
+
const createFragment = (viewId: number | null, camera?: MPCameraPosition, showCompass?: boolean, mapboxMapStyle?: String) => {
|
|
7
|
+
let command = (UIManager as any).MapsIndoorsView.Commands.create;
|
|
8
|
+
if (Platform.OS === 'android') {
|
|
9
|
+
command = command.toString();
|
|
10
|
+
}
|
|
11
|
+
UIManager.dispatchViewManagerCommand(
|
|
12
|
+
viewId,
|
|
13
|
+
// we are calling the 'create' command
|
|
14
|
+
command,
|
|
15
|
+
[viewId, JSON.stringify(camera), showCompass, mapboxMapStyle],
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const MapView = ({ style, camera, showCompass, mapboxMapStyle }: { style: any, camera?: MPCameraPosition, showCompass?: boolean, mapboxMapStyle?: string, [key: string]: any }) => {
|
|
20
|
+
const ref = useRef(null);
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const viewId = findNodeHandle(ref.current);
|
|
24
|
+
createFragment(viewId, camera, showCompass !== undefined ? showCompass : true, mapboxMapStyle);
|
|
25
|
+
}, []);
|
|
26
|
+
|
|
27
|
+
return (<MapsIndoorsViewManager
|
|
28
|
+
{...{ style, camera, showCompass, mapboxMapStyle }}
|
|
29
|
+
ref={ref}/>);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const MapsIndoorsViewManager = requireNativeComponent('MapsIndoorsView');
|
|
33
|
+
|
|
34
|
+
export default MapView;
|
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
import {
|
|
3
|
+
MPMapStyle,
|
|
4
|
+
MPLocation, MPSolution, MPVenue, MPQuery, MPFilter,
|
|
5
|
+
MPDisplayRule, MPSolutionDisplayRule, MPPositionProviderInterface,
|
|
6
|
+
MPPositionResultInterface, MPUserRole, MPError, MPCategoryCollection, MPUserRoleCollection
|
|
7
|
+
} from "../../index";
|
|
8
|
+
import MPBuildingCollection from './MPBuildingCollection';
|
|
9
|
+
import MPVenueCollection from './MPVenueCollection';
|
|
10
|
+
|
|
11
|
+
const { MapsIndoorsModule } = NativeModules;
|
|
12
|
+
/**
|
|
13
|
+
* Main class for accessing data in the MapsIndoors SDK.
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @class MapsIndoors
|
|
17
|
+
* @typedef {MapsIndoors}
|
|
18
|
+
*/
|
|
19
|
+
export default class MapsIndoors {
|
|
20
|
+
/**
|
|
21
|
+
* Creates an instance of MapsIndoors.
|
|
22
|
+
*
|
|
23
|
+
* @constructor
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
private constructor() { };
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Loads content from the MapsIndoors solution matching the given API {@link apiKey}.
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
* @static
|
|
33
|
+
* @async
|
|
34
|
+
* @param {String} apiKey The key to the MapsIndoors solution.
|
|
35
|
+
* @param {String[]} [venues=null] An optional list of venueIds as strings.
|
|
36
|
+
* @returns {Promise<void>} If the load fails for any reason, it will reject with a {@link MPError}.
|
|
37
|
+
*/
|
|
38
|
+
public static async load(apiKey: String, venues: String[] = null): Promise<void> {
|
|
39
|
+
return MapsIndoorsModule.loadMapsIndoors(apiKey, venues).catch((err: Error) =>
|
|
40
|
+
Promise.reject(MPError.parse(err))
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Gets the default venue for this solution.
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
* @static
|
|
49
|
+
* @async
|
|
50
|
+
* @returns {Promise<MPVenue | undefined>}
|
|
51
|
+
*/
|
|
52
|
+
public static async getDefaultVenue(): Promise<MPVenue | undefined> {
|
|
53
|
+
return MapsIndoorsModule.getDefaultVenue().then((venueString: string) => {
|
|
54
|
+
let venue = MPVenue.create(JSON.parse(venueString));
|
|
55
|
+
return Promise.resolve(venue);
|
|
56
|
+
}).catch((err: Error) => Promise.reject(MPError.parse(err)));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Gets a collection of all venues for the current solution.
|
|
61
|
+
*
|
|
62
|
+
* @public
|
|
63
|
+
* @static
|
|
64
|
+
* @async
|
|
65
|
+
* @returns {Promise<MPVenueCollection>}
|
|
66
|
+
*/
|
|
67
|
+
public static async getVenues(): Promise<MPVenueCollection> {
|
|
68
|
+
return MapsIndoorsModule.getVenues()
|
|
69
|
+
.catch((err: Error) => {return Promise.reject(MPError.create(MPError.parse(err)))})
|
|
70
|
+
.then((venueString: string) => {
|
|
71
|
+
const venues: MPVenueCollection = MPVenueCollection.create(JSON.parse(venueString));
|
|
72
|
+
return Promise.resolve(venues);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Gets a collection of all building for the current solution.
|
|
78
|
+
*
|
|
79
|
+
* @public
|
|
80
|
+
* @static
|
|
81
|
+
* @async
|
|
82
|
+
* @returns {Promise<MPBuildingCollection>}
|
|
83
|
+
*/
|
|
84
|
+
public static async getBuildings(): Promise<MPBuildingCollection> {
|
|
85
|
+
return MapsIndoorsModule.getBuildings()
|
|
86
|
+
.catch((err: Error) => Promise.reject(MPError.parse(err)))
|
|
87
|
+
.then((buildingString: string) => {
|
|
88
|
+
const buildings: MPBuildingCollection = MPBuildingCollection.create(JSON.parse(buildingString));
|
|
89
|
+
return Promise.resolve(buildings);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Gets a collection of all categories for the current solution.
|
|
95
|
+
*
|
|
96
|
+
* @public
|
|
97
|
+
* @static
|
|
98
|
+
* @async
|
|
99
|
+
* @returns {Promise<MPCategoryCollection>}
|
|
100
|
+
*/
|
|
101
|
+
public static async getCategories(): Promise<MPCategoryCollection> {
|
|
102
|
+
return MapsIndoorsModule.getCategories()
|
|
103
|
+
.catch((err: Error) => Promise.reject(MPError.parse(err)))
|
|
104
|
+
.then((categoryString: string) => {
|
|
105
|
+
const categories: MPCategoryCollection = MPCategoryCollection.create(JSON.parse(categoryString));
|
|
106
|
+
return Promise.resolve(categories);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Gets all locations (a list of {@link MPLocation} objects) for the current solution.
|
|
112
|
+
*
|
|
113
|
+
* @public
|
|
114
|
+
* @static
|
|
115
|
+
* @async
|
|
116
|
+
* @returns {Promise<MPLocation[]>}
|
|
117
|
+
*/
|
|
118
|
+
public static async getLocations(): Promise<MPLocation[]> {
|
|
119
|
+
return MapsIndoorsModule.getLocations()
|
|
120
|
+
.catch((err: Error) => {Promise.reject(MPError.parse(err))})
|
|
121
|
+
.then((locationsString: string) => {
|
|
122
|
+
const locations: MPLocation[] = JSON.parse(locationsString).map((location: any) => MPLocation.create(location));
|
|
123
|
+
return Promise.resolve(locations);
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* {@link disable} SDK event logging through MapsIndoors. No logs will be created or send with this disabled.
|
|
129
|
+
*
|
|
130
|
+
* By default it is enabled. But disabled in the CMS meaning logs will be created but never uploaded.
|
|
131
|
+
*
|
|
132
|
+
* @public
|
|
133
|
+
* @static
|
|
134
|
+
* @async
|
|
135
|
+
* @param {boolean} disable
|
|
136
|
+
* @returns {Promise<void>}
|
|
137
|
+
*/
|
|
138
|
+
public static async disableEventLogging(disable: boolean): Promise<void> {
|
|
139
|
+
return MapsIndoorsModule.disableEventLogging(disable).then(() => Promise.resolve());
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Retrieves the API key that was set when calling {@link load}.
|
|
144
|
+
*
|
|
145
|
+
* Will return empty string if no key has been set.
|
|
146
|
+
*
|
|
147
|
+
* @public
|
|
148
|
+
* @static
|
|
149
|
+
* @async
|
|
150
|
+
* @returns {Promise<string>}
|
|
151
|
+
*/
|
|
152
|
+
public static async getApiKey(): Promise<string> {
|
|
153
|
+
return MapsIndoorsModule.getApiKey();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Returns a list of the current solution's available languages.
|
|
158
|
+
*
|
|
159
|
+
* @public
|
|
160
|
+
* @static
|
|
161
|
+
* @async
|
|
162
|
+
* @returns {Promise<string[]>}
|
|
163
|
+
*/
|
|
164
|
+
public static async getAvailableLanguages(): Promise<string[]> {
|
|
165
|
+
return MapsIndoorsModule.getAvailableLanguages()
|
|
166
|
+
.catch((err: Error) => Promise.reject(MPError.parse(err)));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Returns the default language for the current solution.
|
|
171
|
+
*
|
|
172
|
+
* @public
|
|
173
|
+
* @static
|
|
174
|
+
* @async
|
|
175
|
+
* @returns {Promise<string>}
|
|
176
|
+
*/
|
|
177
|
+
public static async getDefaultLanguage(): Promise<string> {
|
|
178
|
+
return MapsIndoorsModule.getDefaultLanguage();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Gets the language currently used in the SDK.
|
|
183
|
+
*
|
|
184
|
+
* @public
|
|
185
|
+
* @static
|
|
186
|
+
* @async
|
|
187
|
+
* @returns {Promise<string>}
|
|
188
|
+
*/
|
|
189
|
+
public static async getLanguage(): Promise<string> {
|
|
190
|
+
return MapsIndoorsModule.getLanguage();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Retrieves a {@link MPLocation} by its {@link id}.
|
|
195
|
+
*
|
|
196
|
+
* @public
|
|
197
|
+
* @static
|
|
198
|
+
* @async
|
|
199
|
+
* @param {string} id
|
|
200
|
+
* @returns {Promise<MPLocation | undefined>}
|
|
201
|
+
*/
|
|
202
|
+
public static async getLocationById(id: string): Promise<MPLocation | undefined> {
|
|
203
|
+
return MapsIndoorsModule.getLocationById(id).then((locationString: string | undefined | null) => {
|
|
204
|
+
if (locationString) {
|
|
205
|
+
const location: MPLocation = MPLocation.create(JSON.parse(locationString));
|
|
206
|
+
return Promise.resolve(location);
|
|
207
|
+
} else {
|
|
208
|
+
return Promise.resolve(undefined);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Retrieves a list of {@link MPLocation}s by {@link externalIds}.
|
|
215
|
+
*
|
|
216
|
+
* @public
|
|
217
|
+
* @static
|
|
218
|
+
* @async
|
|
219
|
+
* @param {string[]} externalIds
|
|
220
|
+
* @returns {Promise<MPLocation[]>}
|
|
221
|
+
*/
|
|
222
|
+
public static async getLocationsByExternalIds(externalIds: string[]): Promise<MPLocation[]> {
|
|
223
|
+
return MapsIndoorsModule.getLocationsByExternalIds(externalIds).then((locationsString: string) => {
|
|
224
|
+
const locations: MPLocation[] = JSON.parse(locationsString).map((location: any) => MPLocation.create(location));
|
|
225
|
+
return Promise.resolve(locations);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Gets a collection of available map styles.
|
|
231
|
+
*
|
|
232
|
+
* @public
|
|
233
|
+
* @static
|
|
234
|
+
* @async
|
|
235
|
+
* @returns {Promise<MPMapStyle[]>}
|
|
236
|
+
*/
|
|
237
|
+
public static async getMapStyles(): Promise<MPMapStyle[]> {
|
|
238
|
+
return MapsIndoorsModule.getMapStyles().then((mapStylesString: string) => {
|
|
239
|
+
const mapStyles: MPMapStyle[] = JSON.parse(mapStylesString).map((mapStyle: any) => MPMapStyle.create(mapStyle));
|
|
240
|
+
return Promise.resolve(mapStyles);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Gets the {@link MPSolution} for the current loaded api key.
|
|
246
|
+
*
|
|
247
|
+
* @public
|
|
248
|
+
* @static
|
|
249
|
+
* @async
|
|
250
|
+
* @returns {Promise<MPSolution>}
|
|
251
|
+
*/
|
|
252
|
+
public static async getSolution(): Promise<MPSolution> {
|
|
253
|
+
return MapsIndoorsModule.getSolution().then((solutionString: string) => {
|
|
254
|
+
const solution: MPSolution = MPSolution.create(JSON.parse(solutionString));
|
|
255
|
+
return Promise.resolve(solution);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Run a query on all available locations with a query and filter.
|
|
261
|
+
*
|
|
262
|
+
* @public
|
|
263
|
+
* @static
|
|
264
|
+
* @async
|
|
265
|
+
* @param {MPQuery} query
|
|
266
|
+
* @param {MPFilter} filter
|
|
267
|
+
* @returns {Promise<MPLocation[]>}
|
|
268
|
+
*/
|
|
269
|
+
public static async getLocationsAsync(query: MPQuery, filter: MPFilter): Promise<MPLocation[]> {
|
|
270
|
+
return MapsIndoorsModule.getLocationsAsync(JSON.stringify(query), JSON.stringify(filter))
|
|
271
|
+
.then((locationsString: string) => {
|
|
272
|
+
const locations: MPLocation[] = JSON.parse(locationsString).map((location: any) =>
|
|
273
|
+
MPLocation.create(location));
|
|
274
|
+
return Promise.resolve(locations);
|
|
275
|
+
}).catch((err: Error) => Promise.reject(MPError.parse(err)));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Retrieve the display rule for the given {@link location}.
|
|
280
|
+
*
|
|
281
|
+
* Requires that {@link load} has successfully executed.
|
|
282
|
+
*
|
|
283
|
+
* @public
|
|
284
|
+
* @static
|
|
285
|
+
* @async
|
|
286
|
+
* @param {MPLocation} location
|
|
287
|
+
* @returns {Promise<MPDisplayRule | undefined>}
|
|
288
|
+
*/
|
|
289
|
+
public static async getDisplayRuleByLocation(location: MPLocation): Promise<MPDisplayRule | undefined> {
|
|
290
|
+
return MapsIndoorsModule.locationDisplayRuleExists(location.id).then((exists: boolean) => {
|
|
291
|
+
return Promise.resolve(exists ? MPDisplayRule.create({ "id": location.id }) : undefined);
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Retrieve the display rule with a given {@link name}.
|
|
297
|
+
*
|
|
298
|
+
* Requires that {@link load} has successfully executed.
|
|
299
|
+
*
|
|
300
|
+
* @public
|
|
301
|
+
* @static
|
|
302
|
+
* @async
|
|
303
|
+
* @param {string} name The ID of the DisplayRule
|
|
304
|
+
* @returns {Promise<MPDisplayRule>}
|
|
305
|
+
*/
|
|
306
|
+
public static async getDisplayRuleByName(name: string): Promise<MPDisplayRule> {
|
|
307
|
+
return MapsIndoorsModule.displayRuleNameExists(name).then((exists: boolean) => {
|
|
308
|
+
return Promise.resolve(exists ? MPDisplayRule.create({ "id": name }) : undefined);
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Retrieve the main display rule (can be configured in the CMS).
|
|
314
|
+
*
|
|
315
|
+
* Requires that {@link load} has successfully executed.
|
|
316
|
+
*
|
|
317
|
+
* @public
|
|
318
|
+
* @static
|
|
319
|
+
* @async
|
|
320
|
+
* @returns {Promise<MPDisplayRule>}
|
|
321
|
+
*/
|
|
322
|
+
public static async getMainDisplayRule(): Promise<MPDisplayRule> {
|
|
323
|
+
return Promise.resolve(MPDisplayRule.create({"id": "main"}));
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Retrieve the corresponding display rule for the given {@link MPSolutionDisplayRule}.
|
|
328
|
+
*
|
|
329
|
+
* Requires that {@link load} has successfully executed.
|
|
330
|
+
*
|
|
331
|
+
* @public
|
|
332
|
+
* @static
|
|
333
|
+
* @async
|
|
334
|
+
* @param {MPSolutionDisplayRule} solutionDisplayRule
|
|
335
|
+
* @returns {Promise<MPDisplayRule>}
|
|
336
|
+
*/
|
|
337
|
+
public static async getSolutionDisplayRule(solutionDisplayRule: MPSolutionDisplayRule): Promise<MPDisplayRule> {
|
|
338
|
+
return Promise.resolve(MPDisplayRule.create({"id": solutionDisplayRule}));
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Retrieve the default display rule (fallback rule in case the main rule has not loaded/ has errors).
|
|
343
|
+
*
|
|
344
|
+
* @public
|
|
345
|
+
* @static
|
|
346
|
+
* @async
|
|
347
|
+
* @returns {Promise<MPDisplayRule>}
|
|
348
|
+
*/
|
|
349
|
+
public static async getDefaultDisplayRule(): Promise<MPDisplayRule> {
|
|
350
|
+
return Promise.resolve(MPDisplayRule.create({"id": "default"}));
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Set a new position provider, or pass undefined to remove the current one.
|
|
356
|
+
*
|
|
357
|
+
* @public
|
|
358
|
+
* @static
|
|
359
|
+
* @async
|
|
360
|
+
* @param {MPPositionProviderInterface} positonProvider
|
|
361
|
+
* @returns {Promise<void>}
|
|
362
|
+
*/
|
|
363
|
+
public static async setPositionProvider(positonProvider?: MPPositionProviderInterface): Promise<void> {
|
|
364
|
+
if (positonProvider) {
|
|
365
|
+
const positionUpdateListener = (position: MPPositionResultInterface) => {
|
|
366
|
+
if (Platform.OS === 'ios') {
|
|
367
|
+
let obj = {
|
|
368
|
+
coordinate: [position.point.longitude, position.point.latitude, position.floorIndex],
|
|
369
|
+
floorIndex: position.floorIndex,
|
|
370
|
+
bearing: position.bearing,
|
|
371
|
+
accuracy: position.accuracy,
|
|
372
|
+
providerName: position.positionProvider
|
|
373
|
+
}
|
|
374
|
+
MapsIndoorsModule.onPositionUpdate(JSON.stringify(obj));
|
|
375
|
+
}else {
|
|
376
|
+
MapsIndoorsModule.onPositionUpdate(JSON.stringify(position));
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
positonProvider.addOnPositionUpdateListener(positionUpdateListener);
|
|
381
|
+
return MapsIndoorsModule.setPositionProvider(positonProvider.name).then(() => { });
|
|
382
|
+
} else {
|
|
383
|
+
return MapsIndoorsModule.removePositionProvider().then(() => { });
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Gets the User Roles for the current solution.
|
|
389
|
+
*
|
|
390
|
+
* Note that role names are localized.
|
|
391
|
+
*
|
|
392
|
+
* @public
|
|
393
|
+
* @static
|
|
394
|
+
* @async
|
|
395
|
+
* @returns {Promise<MPUserRoleCollection>}
|
|
396
|
+
*/
|
|
397
|
+
public static async getUserRoles(): Promise<MPUserRoleCollection> {
|
|
398
|
+
return MapsIndoorsModule.getUserRoles().then((userRolesString: string) => {
|
|
399
|
+
const userRoles: MPUserRoleCollection = MPUserRoleCollection.create(JSON.parse(userRolesString));
|
|
400
|
+
return Promise.resolve(userRoles);
|
|
401
|
+
}).catch((err: string) => Promise.reject(MPError.create(JSON.parse(err))));
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Checks if there is on device data (embedded/locally stored) available. For this to return true,
|
|
406
|
+
* data has to be available for all solution data types ({@link MPLocation}, {@link MPBuilding}...).
|
|
407
|
+
*
|
|
408
|
+
* Returns true if data is available, otherwise returns false.
|
|
409
|
+
*
|
|
410
|
+
* @public
|
|
411
|
+
* @static
|
|
412
|
+
* @async
|
|
413
|
+
* @returns {Promise<boolean>}
|
|
414
|
+
*/
|
|
415
|
+
public static async checkOfflineDataAvailability(): Promise<boolean> {
|
|
416
|
+
return MapsIndoorsModule.checkOfflineDataAvailability();
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Clears the internal state of MapsIndoors SDK. Any loaded content is purged from memory.
|
|
421
|
+
*
|
|
422
|
+
* Invoke {@link load} to start the SDK anew.
|
|
423
|
+
*
|
|
424
|
+
* @public
|
|
425
|
+
* @static
|
|
426
|
+
* @async
|
|
427
|
+
* @returns {Promise<void>}
|
|
428
|
+
*/
|
|
429
|
+
public static async destroy(): Promise<void> {
|
|
430
|
+
return MapsIndoorsModule.destroy().then(() => { });
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Check if the current API key is valid.
|
|
435
|
+
*
|
|
436
|
+
* @public
|
|
437
|
+
* @static
|
|
438
|
+
* @async
|
|
439
|
+
* @returns {Promise<boolean>}
|
|
440
|
+
*/
|
|
441
|
+
public static async isApiKeyValid(): Promise<boolean> {
|
|
442
|
+
return MapsIndoorsModule.isApiKeyValid();
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Check if {@link load} has been called.
|
|
447
|
+
*
|
|
448
|
+
* @public
|
|
449
|
+
* @static
|
|
450
|
+
* @async
|
|
451
|
+
* @returns {Promise<boolean>}
|
|
452
|
+
*/
|
|
453
|
+
public static async isInitialized(): Promise<boolean> {
|
|
454
|
+
return MapsIndoorsModule.isInitialized();
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Check if the SDK is initialized and ready for use.
|
|
459
|
+
*
|
|
460
|
+
* @public
|
|
461
|
+
* @static
|
|
462
|
+
* @async
|
|
463
|
+
* @returns {Promise<boolean>}
|
|
464
|
+
*/
|
|
465
|
+
public static async isReady(): Promise<boolean> {
|
|
466
|
+
return MapsIndoorsModule.isReady();
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Sets the SDK's internal language.
|
|
471
|
+
*
|
|
472
|
+
* By default, the SDK language can be:
|
|
473
|
+
*
|
|
474
|
+
* * the solution's default language ({@link MPSolutionInfo#getDefaultLanguage()}).
|
|
475
|
+
* * the current device language, if the MapsIndoors data isn't available (ie: first app run without network access).
|
|
476
|
+
*
|
|
477
|
+
* @public
|
|
478
|
+
* @static
|
|
479
|
+
* @async
|
|
480
|
+
* @param {string} language
|
|
481
|
+
* @returns {Promise<boolean>}
|
|
482
|
+
*/
|
|
483
|
+
public static async setLanguage(language: string): Promise<boolean> {
|
|
484
|
+
return MapsIndoorsModule.setLanguage(language);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Main data synchronization method.
|
|
489
|
+
*
|
|
490
|
+
* If not manually invoked, [MapControl.create(config, listener)] will invoke it.
|
|
491
|
+
*
|
|
492
|
+
* @public
|
|
493
|
+
* @static
|
|
494
|
+
* @async
|
|
495
|
+
* @returns {Promise<void>}
|
|
496
|
+
*/
|
|
497
|
+
public static async synchronizeContent(): Promise<void> {
|
|
498
|
+
return MapsIndoorsModule.synchronizeContent().catch((err: Error) => {
|
|
499
|
+
return Promise.reject(MPError.parse(err));
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Applies a list of {@link MPUserRole}s to the SDK which will get the UserRole specific locations..
|
|
505
|
+
*
|
|
506
|
+
* @public
|
|
507
|
+
* @static
|
|
508
|
+
* @async
|
|
509
|
+
* @param {MPUserRole[]} userRoles
|
|
510
|
+
* @returns {Promise<void>}
|
|
511
|
+
*/
|
|
512
|
+
public static async applyUserRoles(userRoles: MPUserRole[]): Promise<void> {
|
|
513
|
+
return MapsIndoorsModule.applyUserRoles(JSON.stringify(userRoles));
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Returns the list of {@link MPUserRole}s that is currently applied.
|
|
518
|
+
*
|
|
519
|
+
* @public
|
|
520
|
+
* @static
|
|
521
|
+
* @async
|
|
522
|
+
* @returns {Promise<MPUserRole[]>}
|
|
523
|
+
*/
|
|
524
|
+
public static async getAppliedUserRoles(): Promise<MPUserRole[]> {
|
|
525
|
+
return MapsIndoorsModule.getAppliedUserRoles().then((userRolesString: string) => {
|
|
526
|
+
const userRoles: MPUserRole[] = JSON.parse(userRolesString).map((userRole: any) => MPUserRole.create(userRole));
|
|
527
|
+
return Promise.resolve(userRoles);
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Add venues to the sync list.
|
|
533
|
+
* @param venues list of venueIds to add to sync.
|
|
534
|
+
* @returns
|
|
535
|
+
*/
|
|
536
|
+
public static async addVenuesToSync(venues: string[]): Promise<void> {
|
|
537
|
+
return MapsIndoorsModule.addVenuesToSync(venues);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Remove venues from the sync list.
|
|
542
|
+
* @param venues List of venueIds to remove from sync.
|
|
543
|
+
* @returns
|
|
544
|
+
*/
|
|
545
|
+
public static async removeVenuesToSync(venues: string[]): Promise<void> {
|
|
546
|
+
return MapsIndoorsModule.removeVenuesToSync(venues);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Get a list of venueIds that are synced.
|
|
551
|
+
* @returns Promise<string[]> A list of venueIds that are synced.
|
|
552
|
+
*/
|
|
553
|
+
public static async getSyncedVenues(): Promise<string[]> {
|
|
554
|
+
return MapsIndoorsModule.getSyncedVenues().then((venues: string[]|null) => {
|
|
555
|
+
if (venues === null || venues === undefined) {
|
|
556
|
+
return [];
|
|
557
|
+
}else {
|
|
558
|
+
return venues;
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Cache all data for the current solution. Including tiles and images if present on the solution.
|
|
565
|
+
* @param apiKey The key to the MapsIndoors solution.
|
|
566
|
+
* @returns Promise<boolean> True if the caching was successful, otherwise false.
|
|
567
|
+
*/
|
|
568
|
+
public static async cacheData(apiKey: String): Promise<boolean> {
|
|
569
|
+
return MapsIndoorsModule.cacheData(apiKey);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MPBuilding } from '../../index';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Listener that is invoked when focus changes to a new building within the camera bounds.
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @interface OnBuildingFoundAtCameraTargetListener
|
|
8
|
+
* @typedef {OnBuildingFoundAtCameraTargetListener}
|
|
9
|
+
*/
|
|
10
|
+
export interface OnBuildingFoundAtCameraTargetListener {
|
|
11
|
+
/**
|
|
12
|
+
* When a building is found, or no building is found at all.
|
|
13
|
+
*
|
|
14
|
+
* @param {?MPBuilding} [building] The new building in focus, if not present, no building is in bounds.
|
|
15
|
+
*/
|
|
16
|
+
(building?: MPBuilding): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MPFloor } from '../../index';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Listener that is invoked when the active floor is changed.
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @interface OnFloorSelectionChangedListener
|
|
8
|
+
* @typedef {OnFloorSelectionChangedListener}
|
|
9
|
+
*/
|
|
10
|
+
export interface OnFloorSelectionChangedListener {
|
|
11
|
+
/**
|
|
12
|
+
* When the floor selection is changed to a new floor.
|
|
13
|
+
*
|
|
14
|
+
* @param {MPFloor} newFloor The new floor.
|
|
15
|
+
*/
|
|
16
|
+
(newFloor: MPFloor): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Listener that is invoked when floor selection changes.
|
|
4
|
+
*
|
|
5
|
+
* @export
|
|
6
|
+
* @interface OnFloorUpdateListener
|
|
7
|
+
* @typedef {OnFloorUpdateListener}
|
|
8
|
+
*/
|
|
9
|
+
export interface OnFloorUpdateListener {
|
|
10
|
+
/**
|
|
11
|
+
* When the current floor changes.
|
|
12
|
+
*
|
|
13
|
+
* @param {number} floor The new floor.
|
|
14
|
+
*/
|
|
15
|
+
(floor: number): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {MPRouteLeg} from '../../index';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Listener that is invoked during directions when a {@link MPRouteLeg} is selected.
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @interface OnLegSelectedListener
|
|
8
|
+
* @typedef {OnLegSelectedListener}
|
|
9
|
+
*/
|
|
10
|
+
export interface OnLegSelectedListener {
|
|
11
|
+
/**
|
|
12
|
+
* when a new leg index is selected.
|
|
13
|
+
*
|
|
14
|
+
* @param {number} legIndex The selected leg index.
|
|
15
|
+
*/
|
|
16
|
+
(legIndex: number): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import MPLocation from "./MPLocation";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Listener that is invoked when a location receives a livedata update.
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @interface OnLiveLocationUpdateListener
|
|
8
|
+
* @typedef {OnLiveLocationUpdateListener}
|
|
9
|
+
*/
|
|
10
|
+
export interface OnLiveLocationUpdateListener {
|
|
11
|
+
/**
|
|
12
|
+
* When a location recieves an update for the subscribed livdata domain.
|
|
13
|
+
*
|
|
14
|
+
* @param {MPLocation} location The location that has received a livedata update.
|
|
15
|
+
*/
|
|
16
|
+
(location: MPLocation): void;
|
|
17
|
+
}
|