@mapsindoors/react-native-maps-indoors-mapbox 0.0.5-beta
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/LICENSE +11 -0
- package/README.md +178 -0
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/7.4/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.4/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.4/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.4/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/7.4/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/compiler.xml +6 -0
- package/android/.idea/gradle.xml +19 -0
- package/android/.idea/jarRepositories.xml +45 -0
- package/android/.idea/misc.xml +10 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/README.md +14 -0
- package/android/build.gradle +169 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradle.properties +17 -0
- package/android/gradlew +234 -0
- package/android/gradlew.bat +89 -0
- package/android/local.properties +8 -0
- package/android/src/main/AndroidManifest.xml +6 -0
- package/android/src/main/java/com/reactlibrary/DirectionsRendererModule.java +207 -0
- package/android/src/main/java/com/reactlibrary/DirectionsServiceModule.java +130 -0
- package/android/src/main/java/com/reactlibrary/MPDisplayRuleModule.java +816 -0
- package/android/src/main/java/com/reactlibrary/MapControlModule.java +661 -0
- package/android/src/main/java/com/reactlibrary/MapsIndoorsModule.java +327 -0
- package/android/src/main/java/com/reactlibrary/MapsIndoorsPackage.java +46 -0
- package/android/src/main/java/com/reactlibrary/MapsIndoorsViewManager.java +119 -0
- package/android/src/main/java/com/reactlibrary/UtilsModule.java +165 -0
- package/android/src/main/java/com/reactlibrary/models/Bounds.java +19 -0
- package/android/src/main/java/com/reactlibrary/models/Filter.java +77 -0
- package/android/src/main/java/com/reactlibrary/models/Location.java +17 -0
- package/android/src/main/java/com/reactlibrary/models/MPCameraPosition.java +29 -0
- package/android/src/main/java/com/reactlibrary/models/MPCameraUpdate.java +92 -0
- package/android/src/main/java/com/reactlibrary/models/MPError.java +38 -0
- package/android/src/main/java/com/reactlibrary/models/PositionProvider.java +46 -0
- package/android/src/main/java/com/reactlibrary/models/PositionResult.java +117 -0
- package/android/src/main/java/com/reactlibrary/models/Query.java +30 -0
- package/android/src/main/res/values/google_maps_api_key.xml +4 -0
- package/android/src/main/res/values/mapbox_api_key.xml +5 -0
- package/index.ts +184 -0
- package/ios/DirectionsRendererBridge.m +53 -0
- package/ios/DirectionsRendererModule.swift +187 -0
- package/ios/DirectionsServiceBridge.m +46 -0
- package/ios/DirectionsServiceModule.swift +149 -0
- package/ios/MPDisplayRuleBridge.m +410 -0
- package/ios/MPDisplayRuleModule.swift +845 -0
- package/ios/MapControlBridge.m +178 -0
- package/ios/MapControlModule.swift +602 -0
- package/ios/MapsIndoors.xcodeproj/project.pbxproj +318 -0
- package/ios/MapsIndoors.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/MapsIndoors.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/MapsIndoorsBridge.m +98 -0
- package/ios/MapsIndoorsData.swift +203 -0
- package/ios/MapsIndoorsModule.swift +247 -0
- package/ios/MapsIndoorsViewManager.swift +30 -0
- package/ios/MapsIndoorsViewManagerBridge.m +9 -0
- package/ios/ReactPositionProvider.swift +25 -0
- package/ios/UtilsBridge.m +63 -0
- package/ios/UtilsModule.swift +146 -0
- package/ios/helpers.swift +57 -0
- package/ios/react-native-maps-indoors-Bridging-Header.h +6 -0
- package/package.json +52 -0
- package/react-native-maps-indoors-mapbox.podspec +30 -0
- package/src/EventNames.ts +21 -0
- package/src/MPBounds.ts +137 -0
- package/src/MPBuilding.ts +334 -0
- package/src/MPBuildingCollection.ts +57 -0
- package/src/MPBuildingInfo.ts +63 -0
- package/src/MPCameraEvent.ts +17 -0
- package/src/MPCameraEventListener.ts +17 -0
- package/src/MPCameraPosition.ts +83 -0
- package/src/MPCameraUpdate.ts +174 -0
- package/src/MPCameraViewFitMode.ts +21 -0
- package/src/MPCategory.ts +76 -0
- package/src/MPCategoryCollection.ts +62 -0
- package/src/MPCollection.ts +59 -0
- package/src/MPCollisionHandling.ts +12 -0
- package/src/MPDataField.ts +69 -0
- package/src/MPDirectionsRenderer.ts +194 -0
- package/src/MPDirectionsService.ts +119 -0
- package/src/MPDisplayRule.ts +1027 -0
- package/src/MPEntity.ts +60 -0
- package/src/MPEntityInfo.ts +28 -0
- package/src/MPError.ts +122 -0
- package/src/MPFilter.ts +168 -0
- package/src/MPFilterBehavior.ts +95 -0
- package/src/MPFloor.ts +170 -0
- package/src/MPFloorSelectorInterface.ts +63 -0
- package/src/MPGeometry.ts +91 -0
- package/src/MPHighway.ts +14 -0
- package/src/MPIconSize.ts +39 -0
- package/src/MPLocation.ts +386 -0
- package/src/MPLocationPropertyNames.ts +30 -0
- package/src/MPLocationType.ts +16 -0
- package/src/MPMapConfig.ts +211 -0
- package/src/MPMapStyle.ts +57 -0
- package/src/MPMultiPolygon.ts +205 -0
- package/src/MPPoint.ts +165 -0
- package/src/MPPolygon.ts +206 -0
- package/src/MPPositionProviderInterface.ts +45 -0
- package/src/MPPositionResultInterface.ts +42 -0
- package/src/MPPropertyData.ts +215 -0
- package/src/MPQuery.ts +69 -0
- package/src/MPRoute.ts +95 -0
- package/src/MPRouteCoordinate.ts +95 -0
- package/src/MPRouteLeg.ts +128 -0
- package/src/MPRouteProperty.ts +83 -0
- package/src/MPRouteStep.ts +176 -0
- package/src/MPSelectionBehavior.ts +93 -0
- package/src/MPSettings3D.ts +107 -0
- package/src/MPSize.ts +21 -0
- package/src/MPSolution.ts +180 -0
- package/src/MPSolutionConfig.ts +127 -0
- package/src/MPSolutionDisplayRule.ts +13 -0
- package/src/MPUserRole.ts +60 -0
- package/src/MPUserRoleCollection.ts +37 -0
- package/src/MPUtils.ts +157 -0
- package/src/MPVenue.ts +294 -0
- package/src/MPVenueCollection.ts +58 -0
- package/src/MPVenueInfo.ts +62 -0
- package/src/MapControl.ts +861 -0
- package/src/MapView.tsx +34 -0
- package/src/MapsIndoors.ts +530 -0
- package/src/OnBuildingFoundAtCameraTargetListener.ts +17 -0
- package/src/OnFloorSelectionChangedListener.ts +17 -0
- package/src/OnFloorUpdateListener.ts +16 -0
- package/src/OnLegSelectedListener.ts +17 -0
- package/src/OnLiveLocationUpdateListener.ts +17 -0
- package/src/OnLocationSelectedListener.ts +17 -0
- package/src/OnMapClickListener.ts +20 -0
- package/src/OnMarkerClickListener.ts +17 -0
- package/src/OnMarkerInfoWindowClickListener.ts +17 -0
- package/src/OnPositionUpdateListener.ts +17 -0
- package/src/OnVenueFoundAtCameraTargetListener.ts +17 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { MPSolutionConfig } from "../index";
|
|
2
|
+
import MPUtils from "./MPUtils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Governs the topmost settings for a MapsIndoors solution.
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @class MPSolution
|
|
9
|
+
* @typedef {MPSolution}
|
|
10
|
+
*/
|
|
11
|
+
export default class MPSolution {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates an instance of MPSolution.
|
|
15
|
+
*
|
|
16
|
+
* @constructor
|
|
17
|
+
* @private
|
|
18
|
+
* @param {string} id
|
|
19
|
+
* @param {string} name
|
|
20
|
+
* @param {MPSolutionConfig} solutionConfig
|
|
21
|
+
* @param {string} defaultLanguage
|
|
22
|
+
* @param {string[]} availableLanguages
|
|
23
|
+
* @param {string[]} modules
|
|
24
|
+
* @param {?string} [locationTemplates]
|
|
25
|
+
* @param {?string} [customerId]
|
|
26
|
+
* @param {?string} [mapClientUrl]
|
|
27
|
+
*/
|
|
28
|
+
private constructor(
|
|
29
|
+
public readonly id: string,
|
|
30
|
+
public readonly name: string,
|
|
31
|
+
public readonly solutionConfig: MPSolutionConfig,
|
|
32
|
+
public readonly defaultLanguage: string,
|
|
33
|
+
public readonly availableLanguages: string[],
|
|
34
|
+
private readonly modules: string[],
|
|
35
|
+
public readonly locationTemplates?: string,
|
|
36
|
+
public readonly customerId?: string,
|
|
37
|
+
public mapClientUrl?: string,
|
|
38
|
+
) { }
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Creator for MPSolution, used to decode JSON from the MapsIndoors SDK.
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
* @static
|
|
46
|
+
* @param {MPSolutionParams} object
|
|
47
|
+
* @returns {MPSolution}
|
|
48
|
+
*/
|
|
49
|
+
public static create(object: MPSolutionParams): MPSolution {
|
|
50
|
+
return new MPSolution(
|
|
51
|
+
object?.id,
|
|
52
|
+
object?.name,
|
|
53
|
+
MPSolutionConfig.create(object?.solutionConfig),
|
|
54
|
+
object?.defaultLanguage,
|
|
55
|
+
object?.availableLanguages,
|
|
56
|
+
object?.modules,
|
|
57
|
+
object?.locationTemplates,
|
|
58
|
+
object?.customerId,
|
|
59
|
+
object?.mapClientUrl,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Check if the solution supports a language.
|
|
65
|
+
*
|
|
66
|
+
* @public
|
|
67
|
+
* @param {?string} [language]
|
|
68
|
+
* @returns {boolean}
|
|
69
|
+
*/
|
|
70
|
+
public hasLanguage(language?: string): boolean {
|
|
71
|
+
return language ? this.availableLanguages.includes(language) : false;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Check whether the 22nd zoom level is available for select map providers.
|
|
76
|
+
*
|
|
77
|
+
* @public
|
|
78
|
+
* @returns {boolean}
|
|
79
|
+
*/
|
|
80
|
+
public isZoom22Enabled(): boolean {
|
|
81
|
+
return this.modules.includes("z22");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Check whether wall extrusions are available for select map providers.
|
|
86
|
+
*
|
|
87
|
+
* @public
|
|
88
|
+
* @returns {boolean}
|
|
89
|
+
*/
|
|
90
|
+
public is3DWallsEnabled(): boolean {
|
|
91
|
+
return this.modules.includes("3dwalls");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Check whether room extrusions are available for select map providers.
|
|
96
|
+
*
|
|
97
|
+
* @public
|
|
98
|
+
* @returns {boolean}
|
|
99
|
+
*/
|
|
100
|
+
public is3DExtrusionsEnabled(): boolean {
|
|
101
|
+
return this.modules.includes("3dextrusions");
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Parses a venue ID and a location ID to create a mapClientUrl.
|
|
106
|
+
*
|
|
107
|
+
* @public
|
|
108
|
+
* @async
|
|
109
|
+
* @param {string} venueId
|
|
110
|
+
* @param {string} locationId
|
|
111
|
+
* @returns {Promise<string>}
|
|
112
|
+
*/
|
|
113
|
+
public async parseMapClient(venueId: string, locationId: string): Promise<string> {
|
|
114
|
+
return MPUtils.parseMapClientUrl(venueId, locationId);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Parameter interface for {@link MPSolution}.
|
|
120
|
+
*
|
|
121
|
+
* @export
|
|
122
|
+
* @interface MPSolutionParams
|
|
123
|
+
* @typedef {MPSolutionParams}
|
|
124
|
+
*/
|
|
125
|
+
export interface MPSolutionParams {
|
|
126
|
+
/**
|
|
127
|
+
* The solution's ID.
|
|
128
|
+
*
|
|
129
|
+
* @type {string}
|
|
130
|
+
*/
|
|
131
|
+
id: string;
|
|
132
|
+
/**
|
|
133
|
+
* The solution's name.
|
|
134
|
+
*
|
|
135
|
+
* @type {string}
|
|
136
|
+
*/
|
|
137
|
+
name: string;
|
|
138
|
+
/**
|
|
139
|
+
* The solution's configuration object.
|
|
140
|
+
*
|
|
141
|
+
* @type {MPSolutionConfig}
|
|
142
|
+
*/
|
|
143
|
+
solutionConfig: MPSolutionConfig;
|
|
144
|
+
/**
|
|
145
|
+
* The id of the solution in customer systems.
|
|
146
|
+
*
|
|
147
|
+
* @type {?string}
|
|
148
|
+
*/
|
|
149
|
+
customerId?: string;
|
|
150
|
+
/**
|
|
151
|
+
* The solution's default language.
|
|
152
|
+
*
|
|
153
|
+
* @type {string}
|
|
154
|
+
*/
|
|
155
|
+
defaultLanguage: string;
|
|
156
|
+
/**
|
|
157
|
+
* An array of available languages for the solution.
|
|
158
|
+
*
|
|
159
|
+
* @type {string[]}
|
|
160
|
+
*/
|
|
161
|
+
availableLanguages: string[];
|
|
162
|
+
/**
|
|
163
|
+
* The URL used to fetch data from the CMS.
|
|
164
|
+
*
|
|
165
|
+
* @type {?string}
|
|
166
|
+
*/
|
|
167
|
+
mapClientUrl?: string;
|
|
168
|
+
/**
|
|
169
|
+
* The solution's location template.
|
|
170
|
+
*
|
|
171
|
+
* @type {?string}
|
|
172
|
+
*/
|
|
173
|
+
locationTemplates?: string;
|
|
174
|
+
/**
|
|
175
|
+
* An array of modules that define some behaviors of the SDK set through the CMS.
|
|
176
|
+
*
|
|
177
|
+
* @type {string[]}
|
|
178
|
+
*/
|
|
179
|
+
modules: string[];
|
|
180
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { MPCollisionHandling, MPSettings3D } from "../index";
|
|
2
|
+
import MPUtils from "./MPUtils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* An object that governs solution level settings such as:
|
|
6
|
+
* * Marker clustering
|
|
7
|
+
* * Marker collision handling
|
|
8
|
+
* * {@link MPSettings3D}
|
|
9
|
+
*
|
|
10
|
+
* @export
|
|
11
|
+
* @class MPSolutionConfig
|
|
12
|
+
* @typedef {MPSolutionConfig}
|
|
13
|
+
*/
|
|
14
|
+
export default class MPSolutionConfig {
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates an instance of MPSolutionConfig.
|
|
19
|
+
*
|
|
20
|
+
* @constructor
|
|
21
|
+
* @private
|
|
22
|
+
* @param {string} id
|
|
23
|
+
* @param {MPSettings3D} settings3D
|
|
24
|
+
* @param {?boolean} [_enableClustering]
|
|
25
|
+
* @param {?MPCollisionHandling} [_mpCollisionHandling]
|
|
26
|
+
*/
|
|
27
|
+
private constructor(
|
|
28
|
+
public readonly id: string,
|
|
29
|
+
public readonly settings3D: MPSettings3D,
|
|
30
|
+
private _enableClustering?: boolean,
|
|
31
|
+
private _mpCollisionHandling?: MPCollisionHandling,
|
|
32
|
+
) { }
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Creator for MPSolutionConfig, used to decode JSON from the MapsIndoors SDK.
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
* @static
|
|
40
|
+
* @param {MPSolutionConfigParams} object
|
|
41
|
+
* @returns {MPSolutionConfig}
|
|
42
|
+
*/
|
|
43
|
+
public static create(object: MPSolutionConfigParams): MPSolutionConfig {
|
|
44
|
+
return new MPSolutionConfig(
|
|
45
|
+
object?.id,
|
|
46
|
+
MPSettings3D.create(object?.settings3D),
|
|
47
|
+
object?.enableClustering,
|
|
48
|
+
object?.collisionHandling,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Set the type of collisionHandling.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
* @type {*}
|
|
57
|
+
*/
|
|
58
|
+
public set collisionHandling(collisionHandling: MPCollisionHandling) {
|
|
59
|
+
this._mpCollisionHandling = collisionHandling;
|
|
60
|
+
MPUtils.setCollisionHandling(collisionHandling);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Get the type of collisionHandling that is set.
|
|
65
|
+
*
|
|
66
|
+
* @public
|
|
67
|
+
* @type {MPCollisionHandling}
|
|
68
|
+
*/
|
|
69
|
+
public get collisionHandling(): MPCollisionHandling {
|
|
70
|
+
return this._mpCollisionHandling ?? MPCollisionHandling.allowOverlap;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Set whether clustering is enabled.
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
* @type {boolean}
|
|
78
|
+
*/
|
|
79
|
+
public set enableClustering(enable: boolean) {
|
|
80
|
+
this._enableClustering = enable;
|
|
81
|
+
MPUtils.setEnableClustering(enable);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Get whether clustering is enabled.
|
|
86
|
+
*
|
|
87
|
+
* @public
|
|
88
|
+
* @type {boolean}
|
|
89
|
+
*/
|
|
90
|
+
public get enableClustering(): boolean {
|
|
91
|
+
return this._enableClustering ?? true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Parameter interface for {@link MPSolutionConfig}.
|
|
97
|
+
*
|
|
98
|
+
* @export
|
|
99
|
+
* @interface MPSolutionConfigParams
|
|
100
|
+
* @typedef {MPSolutionConfigParams}
|
|
101
|
+
*/
|
|
102
|
+
export interface MPSolutionConfigParams {
|
|
103
|
+
/**
|
|
104
|
+
* The configuration object's ID.
|
|
105
|
+
*
|
|
106
|
+
* @type {string}
|
|
107
|
+
*/
|
|
108
|
+
id: string,
|
|
109
|
+
/**
|
|
110
|
+
* Settings related to 3D rendering.
|
|
111
|
+
*
|
|
112
|
+
* @type {MPSettings3D}
|
|
113
|
+
*/
|
|
114
|
+
settings3D: MPSettings3D,
|
|
115
|
+
/**
|
|
116
|
+
* Clustering setting.
|
|
117
|
+
*
|
|
118
|
+
* @type {?boolean}
|
|
119
|
+
*/
|
|
120
|
+
enableClustering?: boolean,
|
|
121
|
+
/**
|
|
122
|
+
* Collision setting.
|
|
123
|
+
*
|
|
124
|
+
* @type {?MPCollisionHandling}
|
|
125
|
+
*/
|
|
126
|
+
collisionHandling?: MPCollisionHandling,
|
|
127
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MPDisplayRule } from "../index";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Special {@link MPDisplayRule}s that govern specific scenarios
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @enum {number}
|
|
8
|
+
*/
|
|
9
|
+
export enum MPSolutionDisplayRule {
|
|
10
|
+
buildingOutline = "buildingOutline",
|
|
11
|
+
selectionHighlight = "selectionHighlight",
|
|
12
|
+
positionIndicator = "positionIndicator",
|
|
13
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A User Role that allows certain parts of the data to be viewed.
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @class MPUserRole
|
|
6
|
+
* @typedef {MPUserRole}
|
|
7
|
+
*/
|
|
8
|
+
export default class MPUserRole {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of MPUserRole.
|
|
13
|
+
*
|
|
14
|
+
* @constructor
|
|
15
|
+
* @private
|
|
16
|
+
* @param {string} id The id of the user role.
|
|
17
|
+
* @param {string} name The name of the user role.
|
|
18
|
+
*/
|
|
19
|
+
private constructor(
|
|
20
|
+
public readonly id: string,
|
|
21
|
+
public readonly name: string,
|
|
22
|
+
) { }
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Creator for MPUserRole, used to decode JSON from the MapsIndoors SDK.
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
* @static
|
|
29
|
+
* @param {MPUserRoleParams} object
|
|
30
|
+
* @returns {MPUserRole}
|
|
31
|
+
*/
|
|
32
|
+
public static create(object: MPUserRoleParams): MPUserRole {
|
|
33
|
+
return new MPUserRole(
|
|
34
|
+
object?.id,
|
|
35
|
+
object?.name,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Parameter interface for {@link MPUserRole}.
|
|
42
|
+
*
|
|
43
|
+
* @export
|
|
44
|
+
* @interface MPUserRoleParams
|
|
45
|
+
* @typedef {MPUserRoleParams}
|
|
46
|
+
*/
|
|
47
|
+
export interface MPUserRoleParams {
|
|
48
|
+
/**
|
|
49
|
+
* The id of the user role.
|
|
50
|
+
*
|
|
51
|
+
* @type {string}
|
|
52
|
+
*/
|
|
53
|
+
id: string,
|
|
54
|
+
/**
|
|
55
|
+
* The name of the user role.
|
|
56
|
+
*
|
|
57
|
+
* @type {string}
|
|
58
|
+
*/
|
|
59
|
+
name: string,
|
|
60
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import MPCollection from "./MPCollection";
|
|
2
|
+
import MapsIndoors, {MPUserRole} from "../index";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A collection of user role objects fetched from {@link MapsIndoors}. Uses {@link MPUserRole.id} as key.
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @class MPUserRoleCollection
|
|
9
|
+
* @typedef {MPUserRoleCollection}
|
|
10
|
+
* @extends {MPCollection<MPUserRole>}
|
|
11
|
+
*/
|
|
12
|
+
export default class MPUserRoleCollection extends MPCollection<MPUserRole> {
|
|
13
|
+
/**
|
|
14
|
+
* Creates an instance of MPUserRoleCollection.
|
|
15
|
+
*
|
|
16
|
+
* @constructor
|
|
17
|
+
* @private
|
|
18
|
+
* @param {MPUserRole[]} userroles A collection of user roles
|
|
19
|
+
*/
|
|
20
|
+
private constructor(userroles: MPUserRole[]) {
|
|
21
|
+
super();
|
|
22
|
+
this.map = new Map(userroles.map((role) => [role.id, role]));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Creator for MPUserRoleCollection, used to decode JSON from the MapsIndoors SDK.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
* @static
|
|
30
|
+
* @param {?*} [object]
|
|
31
|
+
* @returns {MPUserRoleCollection}
|
|
32
|
+
*/
|
|
33
|
+
public static create(object?: any) : MPUserRoleCollection {
|
|
34
|
+
let userroles: MPUserRole[] = object?.map((venue: any) => MPUserRole.create(venue));
|
|
35
|
+
return new MPUserRoleCollection(userroles);
|
|
36
|
+
}
|
|
37
|
+
}
|
package/src/MPUtils.ts
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
2
|
+
import { MPGeometry, MPPoint, MPCollisionHandling } from '../index';
|
|
3
|
+
const { UtilsModule } = NativeModules;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Internal - Documentation will follow.
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @class MPUtils
|
|
10
|
+
* @typedef {MPUtils}
|
|
11
|
+
*/
|
|
12
|
+
export default class MPUtils {
|
|
13
|
+
/**
|
|
14
|
+
* Creates an instance of MPUtils.
|
|
15
|
+
*
|
|
16
|
+
* @constructor
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
19
|
+
private constructor() { }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Internal - Documentation will follow.
|
|
23
|
+
*
|
|
24
|
+
* @static
|
|
25
|
+
* @async
|
|
26
|
+
* @param {string} venueId
|
|
27
|
+
* @returns {Promise<boolean>}
|
|
28
|
+
*/
|
|
29
|
+
static async venueHasGraph(venueId: string): Promise<boolean> {
|
|
30
|
+
return UtilsModule.venueHasGraph(venueId);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Internal - Documentation will follow.
|
|
35
|
+
*
|
|
36
|
+
* @static
|
|
37
|
+
* @async
|
|
38
|
+
* @param {MPPoint} it
|
|
39
|
+
* @param {MPPoint} other
|
|
40
|
+
* @returns {Promise<number>}
|
|
41
|
+
*/
|
|
42
|
+
static async pointAngleBetween(it: MPPoint, other: MPPoint): Promise<number> {
|
|
43
|
+
return UtilsModule.pointAngleBetween(JSON.stringify(it), JSON.stringify(other));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Internal - Documentation will follow.
|
|
48
|
+
*
|
|
49
|
+
* @static
|
|
50
|
+
* @async
|
|
51
|
+
* @param {MPPoint} it
|
|
52
|
+
* @param {MPPoint} other
|
|
53
|
+
* @returns {Promise<number>}
|
|
54
|
+
*/
|
|
55
|
+
static async pointDistanceTo(it: MPPoint, other: MPPoint): Promise<number> {
|
|
56
|
+
return UtilsModule.pointDistanceTo(JSON.stringify(it), JSON.stringify(other));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Internal - Documentation will follow.
|
|
61
|
+
*
|
|
62
|
+
* @static
|
|
63
|
+
* @async
|
|
64
|
+
* @param {MPPoint} point
|
|
65
|
+
* @param {MPGeometry} geometry
|
|
66
|
+
* @returns {Promise<boolean>}
|
|
67
|
+
*/
|
|
68
|
+
static async geometryIsInside(point: MPPoint, geometry: MPGeometry): Promise<boolean> {
|
|
69
|
+
return UtilsModule.geometryIsInside(JSON.stringify(point), JSON.stringify(geometry));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Internal - Documentation will follow.
|
|
74
|
+
*
|
|
75
|
+
* @static
|
|
76
|
+
* @async
|
|
77
|
+
* @param {MPGeometry} geometry
|
|
78
|
+
* @returns {Promise<number>}
|
|
79
|
+
*/
|
|
80
|
+
static async geometryArea(geometry: MPGeometry): Promise<number> {
|
|
81
|
+
return UtilsModule.geometryArea(JSON.stringify(geometry));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Internal - Documentation will follow.
|
|
86
|
+
*
|
|
87
|
+
* @static
|
|
88
|
+
* @async
|
|
89
|
+
* @param {MPPoint} point
|
|
90
|
+
* @param {MPGeometry} polygon
|
|
91
|
+
* @returns {Promise<number>}
|
|
92
|
+
*/
|
|
93
|
+
static async polygonDistanceToClosestEdge(point: MPPoint, polygon: MPGeometry): Promise<number> {
|
|
94
|
+
return UtilsModule.polygonDistanceToClosestEdge(JSON.stringify(point), JSON.stringify(polygon));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Internal - Documentation will follow.
|
|
99
|
+
*
|
|
100
|
+
* @static
|
|
101
|
+
* @async
|
|
102
|
+
* @param {string} venueId
|
|
103
|
+
* @param {string} locationId
|
|
104
|
+
* @returns {Promise<string>}
|
|
105
|
+
*/
|
|
106
|
+
static async parseMapClientUrl(venueId: string, locationId: string): Promise<string> {
|
|
107
|
+
return UtilsModule.parseMapClientUrl(venueId, locationId);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Internal - Documentation will follow.
|
|
112
|
+
*
|
|
113
|
+
* @static
|
|
114
|
+
* @async
|
|
115
|
+
* @param {MPCollisionHandling} collisionHandling
|
|
116
|
+
* @returns {Promise<void>}
|
|
117
|
+
*/
|
|
118
|
+
static async setCollisionHandling(collisionHandling: MPCollisionHandling): Promise<void> {
|
|
119
|
+
return UtilsModule.setCollisionHandling(collisionHandling.valueOf());
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Internal - Documentation will follow.
|
|
124
|
+
*
|
|
125
|
+
* @static
|
|
126
|
+
* @async
|
|
127
|
+
* @param {boolean} enableClustering
|
|
128
|
+
* @returns {Promise<void>}
|
|
129
|
+
*/
|
|
130
|
+
static async setEnableClustering(enableClustering: boolean): Promise<void> {
|
|
131
|
+
return UtilsModule.enableClustering(enableClustering);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Internal - Documentation will follow.
|
|
136
|
+
*
|
|
137
|
+
* @static
|
|
138
|
+
* @async
|
|
139
|
+
* @param {number} opacity
|
|
140
|
+
* @returns {Promise<void>}
|
|
141
|
+
*/
|
|
142
|
+
static async setExtrusionOpacity(opacity: number): Promise<void> {
|
|
143
|
+
return UtilsModule.setExtrusionOpacity(opacity);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Internal - Documentation will follow.
|
|
148
|
+
*
|
|
149
|
+
* @static
|
|
150
|
+
* @async
|
|
151
|
+
* @param {number} opacity
|
|
152
|
+
* @returns {Promise<void>}
|
|
153
|
+
*/
|
|
154
|
+
static async setWallOpacity(opacity: number): Promise<void> {
|
|
155
|
+
return UtilsModule.setWallOpacity(opacity);
|
|
156
|
+
}
|
|
157
|
+
}
|