@mapsindoors/react-native-maps-indoors-mapbox 2.1.2 → 2.3.0

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Documentation
4
4
 
5
- Visit [our reference document site](https://app.mapsindoors.com/mapsindoors/reference/react-native/mapbox/2.1.2/index.html) to get an overview of what the MapsIndoors SDK offers.
5
+ Visit [our reference document site](https://app.mapsindoors.com/mapsindoors/reference/react-native/mapbox/2.3.0/index.html) to get an overview of what the MapsIndoors SDK offers.
6
6
 
7
7
  ## Getting started
8
8
 
@@ -93,7 +93,7 @@ dependencies {
93
93
  }
94
94
 
95
95
  implementation 'com.mapbox.maps:android:11.7.0'
96
- implementation 'com.mapspeople.mapsindoors:mapbox-v11:4.8.13'
96
+ implementation 'com.mapspeople.mapsindoors:mapbox-v11:4.10.0'
97
97
  implementation 'com.facebook.react:react-native:+' // From node_modules
98
98
  implementation 'androidx.core:core-ktx:1.3.2'
99
99
  implementation 'com.github.bumptech.glide:glide:4.16.0'
@@ -93,6 +93,10 @@ public class MapsIndoorsViewManager extends ViewGroupManager<MapView> {
93
93
  CompassUtils.getCompass(view).setEnabled(false);
94
94
  }
95
95
  }
96
+
97
+ if (!args.isNull(3)) {
98
+ view.getMapboxMap().loadStyle(args.getString(3));
99
+ }
96
100
  }
97
101
  }
98
102
 
@@ -1,7 +1,5 @@
1
1
  package com.mapsindoorsrn.core;
2
2
 
3
- import android.util.Log;
4
-
5
3
  import androidx.annotation.NonNull;
6
4
 
7
5
  import com.facebook.react.bridge.Promise;
@@ -12,6 +10,7 @@ import com.google.gson.Gson;
12
10
  import com.mapsindoors.core.MPBadgePosition;
13
11
  import com.mapsindoors.core.MPDisplayRule;
14
12
  import com.mapsindoors.core.MPIconPlacement;
13
+ import com.mapsindoors.core.MPLabelPosition;
15
14
  import com.mapsindoors.core.MPIconSize;
16
15
  import com.mapsindoors.core.MPLabelGraphic;
17
16
  import com.mapsindoors.core.MPLabelType;
@@ -1164,13 +1163,55 @@ public class MPDisplayRuleModule extends ReactContextBaseJavaModule {
1164
1163
  }
1165
1164
  }
1166
1165
 
1166
+ @ReactMethod
1167
+ public void getLabelStylePosition(String displayRuleId, final Promise promise) {
1168
+ MPDisplayRule displayRule = getRule(displayRuleId);
1169
+ if (displayRule != null) {
1170
+ promise.resolve(displayRule.getLabelStylePosition() != null ? displayRule.getLabelStylePosition().ordinal() : null);
1171
+ } else {
1172
+ reject(promise, displayRuleId);
1173
+ }
1174
+ }
1175
+
1176
+ @ReactMethod
1177
+ public void setLabelStylePosition(String displayRuleId, Integer position, final Promise promise) {
1178
+ MPDisplayRule displayRule = getRule(displayRuleId);
1179
+ if (displayRule != null) {
1180
+ if (position == -1) {
1181
+ displayRule.setLabelStylePosition(null);
1182
+ }else {
1183
+ MPLabelPosition labelPosition;
1184
+ switch (position) {
1185
+ case 0:
1186
+ labelPosition = MPLabelPosition.TOP;
1187
+ break;
1188
+ case 1:
1189
+ labelPosition = MPLabelPosition.BOTTOM;
1190
+ break;
1191
+ case 2:
1192
+ labelPosition = MPLabelPosition.LEFT;
1193
+ break;
1194
+ case 3:
1195
+ labelPosition = MPLabelPosition.RIGHT;
1196
+ break;
1197
+ default:
1198
+ labelPosition = MPLabelPosition.BOTTOM;
1199
+ break;
1200
+ }
1201
+ displayRule.setLabelStylePosition(labelPosition);
1202
+ }
1203
+ promise.resolve(null);
1204
+ } else {
1205
+ reject(promise, displayRuleId);
1206
+ }
1207
+ }
1208
+
1167
1209
  @ReactMethod
1168
1210
  public void setLabelStyleGraphic(String displayRuleId, String graphic, final Promise promise) {
1169
1211
  MPDisplayRule displayRule = getRule(displayRuleId);
1170
1212
  if (displayRule != null) {
1171
1213
  MPLabelGraphic labelGraphic = gson.fromJson(graphic, MPLabelGraphic.class);
1172
1214
  displayRule.setLabelStyleGraphic(labelGraphic);
1173
- Log.i("timtest", "i did a thing");
1174
1215
  promise.resolve(null);
1175
1216
  } else {
1176
1217
  reject(promise, displayRuleId);
@@ -211,4 +211,17 @@ public class UtilsModule extends ReactContextBaseJavaModule {
211
211
 
212
212
  promise.resolve(null);
213
213
  }
214
+
215
+ @ReactMethod
216
+ public void setAutomatedZoomLimit(Double zoomLimit, final Promise promise) {
217
+ MPSolution solution = MapsIndoors.getSolution();
218
+ if (solution != null) {
219
+ if (zoomLimit == -1) {
220
+ solution.getConfig().setAutomatedZoomLimit(null);
221
+ }else {
222
+ solution.getConfig().setAutomatedZoomLimit(zoomLimit);
223
+ }
224
+ }
225
+ promise.resolve(null);
226
+ }
214
227
  }
@@ -20,8 +20,10 @@ class MapsIndoorsViewManager : RCTViewManager {
20
20
  zoom: 2,
21
21
  pitch: 0
22
22
  )
23
+
23
24
  let options = MapInitOptions(cameraOptions: cameraOptions)
24
25
 
26
+
25
27
  mapView = MapView(frame: CGRect(x: 0, y: 0, width: 64, height: 64), mapInitOptions: options)
26
28
 
27
29
 
@@ -30,7 +32,7 @@ class MapsIndoorsViewManager : RCTViewManager {
30
32
  return mapView!
31
33
  }
32
34
 
33
- @objc func create(_ node: NSNumber, nodeAgain: NSNumber, camera: String, showCompass: Bool) {
35
+ @objc func create(_ node: NSNumber, nodeAgain: NSNumber, camera: String, showCompass: Bool, mapboxMapStyle: String?) {
34
36
  let decoder = JSONDecoder()
35
37
 
36
38
  DispatchQueue.main.async {
@@ -45,6 +47,13 @@ class MapsIndoorsViewManager : RCTViewManager {
45
47
  return
46
48
  }
47
49
 
50
+ if mapboxMapStyle != nil {
51
+ DispatchQueue.main.async {
52
+ self.mapView?.mapboxMap.mapStyle = MapStyle(uri: StyleURI(rawValue: mapboxMapStyle!)!)
53
+ }
54
+ }
55
+
56
+
48
57
  DispatchQueue.main.async {
49
58
  var update: CameraOptions
50
59
  if let mapCamera = self.mapView?.mapboxMap.cameraState {
@@ -167,6 +176,9 @@ class MapBoxView: RCMapView {
167
176
  if let showRoadLabels = config["showRoadLabels"] as? Bool {
168
177
  mapConfig.setShowRoadLabels(show: showRoadLabels)
169
178
  }
179
+ if let useMapsIndoorsStyle = config["useDefaultMapsIndoorsStyle"] as? Bool {
180
+ mapConfig.useMapsIndoorsStyle(value: useMapsIndoorsStyle)
181
+ }
170
182
  return mapConfig
171
183
  }
172
184
  }
@@ -7,5 +7,6 @@ RCT_EXTERN_METHOD(requiresMainQueueSetup)
7
7
  RCT_EXTERN_METHOD(create:(nonnull NSNumber) node
8
8
  nodeAgain:(nonnull NSNumber) nodeAgain
9
9
  camera: (NSString*) camera
10
- showCompass: (BOOL) showCompass)
10
+ showCompass: (BOOL) showCompass
11
+ mapboxMapStyle: (NSString*) mapboxMapStyle)
11
12
  @end
@@ -526,6 +526,15 @@ RCT_EXTERN_METHOD(requiresMainQueueSetup)
526
526
  resolver:(RCTPromiseResolveBlock) resolve
527
527
  rejecter:(RCTPromiseRejectBlock) reject)
528
528
 
529
+ RCT_EXTERN_METHOD(getLabelStylePosition: (NSString *) displayRuleId
530
+ resolver:(RCTPromiseResolveBlock) resolve
531
+ rejecter:(RCTPromiseRejectBlock) reject)
532
+
533
+ RCT_EXTERN_METHOD(setLabelStylePosition: (NSString *) displayRuleId
534
+ value:(nonnull NSNumber *) value
535
+ resolver:(RCTPromiseResolveBlock) resolve
536
+ rejecter:(RCTPromiseRejectBlock) reject)
537
+
529
538
  RCT_EXTERN_METHOD(setLabelStyleGraphic: (NSString *) displayRuleId
530
539
  value:(NSString *) value
531
540
  resolver:(RCTPromiseResolveBlock) resolve
@@ -38,6 +38,52 @@ public class MPDisplayRuleModule: NSObject {
38
38
  }
39
39
  }
40
40
 
41
+ private func getIconPlacementIntValue(iconPlacement: MPIconPlacement) -> Int {
42
+ switch(iconPlacement) {
43
+ case .above:
44
+ return 1
45
+ case .below:
46
+ return 2
47
+ case .left:
48
+ return 3
49
+ case .right:
50
+ return 4
51
+ default:
52
+ return 0
53
+ }
54
+ }
55
+
56
+
57
+ private func getLabelPosition(labelPosition: NSNumber) -> MPLabelPosition {
58
+ switch(labelPosition.intValue) {
59
+ case 0:
60
+ return .left
61
+ case 1:
62
+ return .bottom
63
+ case 2:
64
+ return .top
65
+ case 3:
66
+ return .right
67
+ default:
68
+ return .bottom
69
+ }
70
+ }
71
+
72
+ private func getLabelPositionIntValue(labelPosition: MPLabelPosition) -> Int {
73
+ switch(labelPosition) {
74
+ case .left:
75
+ return 0
76
+ case .bottom:
77
+ return 1
78
+ case .top:
79
+ return 2
80
+ case .right:
81
+ return 3
82
+ default:
83
+ return 2
84
+ }
85
+ }
86
+
41
87
  private func getLabelType(labelType: NSNumber) -> MPLabelType {
42
88
  switch(labelType.intValue) {
43
89
  case 0:
@@ -51,6 +97,19 @@ public class MPDisplayRuleModule: NSObject {
51
97
  }
52
98
  }
53
99
 
100
+ private func getLabelTypeIntValue(labelType: MPLabelType) -> Int {
101
+ switch(labelType) {
102
+ case .flat:
103
+ return 0
104
+ case .floating:
105
+ return 1
106
+ case .graphic:
107
+ return 2
108
+ default:
109
+ return 1
110
+ }
111
+ }
112
+
54
113
  private func getBadgePosition(badgePosition: NSNumber) -> MPBadgePosition {
55
114
  switch(badgePosition.intValue) {
56
115
  case 1:
@@ -64,6 +123,19 @@ public class MPDisplayRuleModule: NSObject {
64
123
  }
65
124
  }
66
125
 
126
+ private func getBadgePositionIntValue(badgePosition: MPBadgePosition) -> Int {
127
+ switch(badgePosition) {
128
+ case .bottomRight:
129
+ return 1
130
+ case .topLeft:
131
+ return 2
132
+ case .topRight:
133
+ return 3
134
+ default:
135
+ return 0
136
+ }
137
+ }
138
+
67
139
  private func getTypeRule(typeName: String) -> MPDisplayRuleType? {
68
140
  // TODO: very similar to FLutter code, maybe combine shared functions somewhere
69
141
  switch (typeName) {
@@ -1034,7 +1106,7 @@ public class MPDisplayRuleModule: NSObject {
1034
1106
  return doReject(reject, displayRuleId: displayRuleId)
1035
1107
  }
1036
1108
 
1037
- return resolve(displayRule.badgePosition)
1109
+ return resolve(getBadgePositionIntValue(badgePosition: displayRule.badgePosition ?? MPBadgePosition.bottomLeft))
1038
1110
  }
1039
1111
 
1040
1112
  @objc public func setBadgePosition(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
@@ -1056,7 +1128,7 @@ public class MPDisplayRuleModule: NSObject {
1056
1128
  return doReject(reject, displayRuleId: displayRuleId)
1057
1129
  }
1058
1130
 
1059
- return resolve(displayRule.iconPlacement)
1131
+ return resolve(getIconPlacementIntValue(iconPlacement: displayRule.iconPlacement ?? MPIconPlacement.center))
1060
1132
  }
1061
1133
 
1062
1134
  @objc public func setIconPlacement(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
@@ -1078,7 +1150,7 @@ public class MPDisplayRuleModule: NSObject {
1078
1150
  return doReject(reject, displayRuleId: displayRuleId)
1079
1151
  }
1080
1152
 
1081
- return resolve(displayRule.iconPlacement)
1153
+ return resolve(getLabelTypeIntValue(labelType: displayRule.labelType ?? MPLabelType.floating))
1082
1154
  }
1083
1155
 
1084
1156
  @objc public func setLabelType(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
@@ -1247,6 +1319,26 @@ public class MPDisplayRuleModule: NSObject {
1247
1319
  return resolve(nil)
1248
1320
  }
1249
1321
 
1322
+ @objc public func getLabelStylePosition(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
1323
+ guard let displayRule = getRule(name: displayRuleId) else {
1324
+ return doReject(reject, displayRuleId: displayRuleId)
1325
+ }
1326
+
1327
+ return resolve(getLabelPositionIntValue(labelPosition: displayRule.labelStylePosition))
1328
+ }
1329
+
1330
+ @objc public func setLabelStylePosition(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
1331
+ guard let displayRule = getRule(name: displayRuleId) else {
1332
+ return doReject(reject, displayRuleId: displayRuleId)
1333
+ }
1334
+
1335
+ if (value != -1) {
1336
+ displayRule.labelStylePosition = getLabelPosition(labelPosition: value)
1337
+ }
1338
+
1339
+ return resolve(nil)
1340
+ }
1341
+
1250
1342
  @objc public func setLabelStyleGraphic(_ displayRuleId: String, value: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
1251
1343
  guard let displayRule = getRule(name: displayRuleId) else {
1252
1344
  return doReject(reject, displayRuleId: displayRuleId)
@@ -1604,4 +1696,4 @@ public class MPDisplayRuleModule: NSObject {
1604
1696
  return resolve(nil)
1605
1697
  }
1606
1698
 
1607
- }
1699
+ }
@@ -53,6 +53,9 @@ public class MapControlModule: RCTEventEmitter {
53
53
  return doReject(reject, message: "Unable to initialize Map Control")
54
54
  }
55
55
 
56
+ if let showUserPosition = config["showUserPosition"] as? Bool {
57
+ mapControl.showUserPosition = showUserPosition
58
+ }
56
59
 
57
60
  let mapsIndoorsData = MapsIndoorsData.sharedInstance
58
61
 
@@ -82,6 +85,9 @@ public class MapControlModule: RCTEventEmitter {
82
85
  do {
83
86
  let filter: MPFilter = try fromJSON(filterJSON)
84
87
  let filterBehavior: MPFilterBehavior = try fromJSON(filterBehaviorJSON)
88
+ if filterBehavior.maxZoom == 999 {
89
+ filterBehavior.maxZoom = Double.nan
90
+ }
85
91
 
86
92
  MapsIndoorsData.sharedInstance.mapView?.getMapControl()?.setFilter(filter: filter, behavior: filterBehavior)
87
93
  return resolve(true)
@@ -115,6 +121,10 @@ public class MapControlModule: RCTEventEmitter {
115
121
  let locations: [String] = try fromJSON(locationIdsJSON)
116
122
  let highlightBehavior: MPHighlightBehavior = try fromJSON(highlightBehaviorJSON)
117
123
  let locs = (locations.compactMap{MPMapsIndoors.shared.locationWith(locationId: $0)})
124
+
125
+ if (highlightBehavior.maxZoom == 999) {
126
+ highlightBehavior.maxZoom = Double.nan
127
+ }
118
128
 
119
129
  MapsIndoorsData.sharedInstance.mapView?.getMapControl()?.setHighlight(locations: locs, behavior: highlightBehavior)
120
130
 
@@ -148,8 +158,7 @@ public class MapControlModule: RCTEventEmitter {
148
158
  entityType: String,
149
159
  resolver resolve: @escaping RCTPromiseResolveBlock,
150
160
  rejecter reject: @escaping RCTPromiseRejectBlock) {
151
- var entity: MPEntity
152
-
161
+ var entity: MPEntity? = nil
153
162
  do {
154
163
  switch entityType {
155
164
  case "MPLocation":
@@ -166,7 +175,7 @@ public class MapControlModule: RCTEventEmitter {
166
175
  }
167
176
 
168
177
  DispatchQueue.main.async {
169
- MapsIndoorsData.sharedInstance.mapView?.getMapControl()!.goTo(entity: entity)
178
+ MapsIndoorsData.sharedInstance.mapView?.getMapControl()!.goTo(entity: entity!)
170
179
  return resolve(nil)
171
180
  }
172
181
  } catch let e {
@@ -234,6 +243,9 @@ public class MapControlModule: RCTEventEmitter {
234
243
  do {
235
244
  let location: MPLocationCodable = try fromJSON(locationJSON)
236
245
  let behavior: MPSelectionBehavior = try fromJSON(behaviorJSON)
246
+ if (behavior.maxZoom == 999) {
247
+ behavior.maxZoom = Double.nan
248
+ }
237
249
 
238
250
  Task {
239
251
  let loc = MPMapsIndoors.shared.locationWith(locationId: location.locationId)
@@ -679,4 +691,4 @@ public class MapControlModule: RCTEventEmitter {
679
691
 
680
692
  return resolve(String(data: hiddenFeatures, encoding: String.Encoding.utf8))
681
693
  }
682
- }
694
+ }
@@ -78,21 +78,21 @@ class MapControlDelegate: MPMapControlDelegate, LiveDataDelegate, MPFloorSelecto
78
78
  if (respondToCameraEvents) {
79
79
  sendEvent(event: .cameraEvent, body: ["event": 5])
80
80
  }
81
- return true;
81
+ return false;
82
82
  }
83
83
 
84
84
  func cameraIdle() -> Bool {
85
85
  if (respondToCameraEvents) {
86
86
  sendEvent(event: .cameraEvent, body: ["event": 7])
87
87
  }
88
- return true;
88
+ return false;
89
89
  }
90
90
 
91
91
  func cameraWillMove() -> Bool {
92
92
  if (respondToCameraEvents) {
93
93
  sendEvent(event: .cameraEvent, body: ["event": 5])
94
94
  }
95
- return true;
95
+ return false;
96
96
  }
97
97
 
98
98
  func didTap(coordinate: MPPoint) -> Bool {
@@ -68,4 +68,9 @@
68
68
  value: (BOOL) value
69
69
  resolver:(RCTPromiseResolveBlock) resolve
70
70
  rejecter:(RCTPromiseRejectBlock) reject)
71
+
72
+ RCT_EXTERN_METHOD(setAutomatedZoomLimit: (double) limit
73
+ resolver:(RCTPromiseResolveBlock) resolve
74
+ rejecter:(RCTPromiseRejectBlock) reject)
75
+
71
76
  @end
@@ -169,4 +169,13 @@ public class UtilsModule: NSObject {
169
169
  }
170
170
  return resolve(nil)
171
171
  }
172
+
173
+ @objc public func setAutomatedZoomLimit(_ value: Double, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
174
+ if value == -1 {
175
+ MPMapsIndoors.shared.solution?.config.automatedZoomLimit = nil
176
+ } else {
177
+ MPMapsIndoors.shared.solution?.config.automatedZoomLimit = value
178
+ }
179
+ return resolve(nil)
180
+ }
172
181
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mapsindoors/react-native-maps-indoors-mapbox",
3
3
  "title": "React Native MapsIndoors Mapbox",
4
- "version": "2.1.2",
4
+ "version": "2.3.0",
5
5
  "description": "React Native MapsIndoors component with mapbox",
6
6
  "react-native": "index.ts",
7
7
  "files": [
@@ -24,7 +24,6 @@ Pod::Spec.new do |s|
24
24
  s.requires_arc = true
25
25
 
26
26
  s.dependency "React"
27
- s.dependency "MapsIndoorsMapbox11", "4.6.2"
28
- s.dependency "MapsIndoorsCodable", "4.6.2"
27
+ s.dependency "MapsIndoorsMapbox11", "4.9.1"
28
+ s.dependency "MapsIndoorsCodable", "4.9.1"
29
29
  end
30
-
@@ -66,7 +66,7 @@ export default class MPBuilding extends MPEntity {
66
66
  var polygon;
67
67
 
68
68
  if(Platform.OS === 'ios') {
69
- polygon = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.boundingBox?.northeast, object?.boundingBox?.southwest)});
69
+ polygon = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.boundingBox?.southwest, object?.boundingBox?.northeast)});
70
70
  }else {
71
71
  polygon = MPPolygon.create(object?.geometry);
72
72
  }
@@ -117,7 +117,6 @@ export default class MPBuilding extends MPEntity {
117
117
  public get position(): MPPoint {
118
118
  return this.anchor;
119
119
  }
120
-
121
120
 
122
121
  /**
123
122
  * Overload from MPEntity, will return false.
@@ -4,6 +4,7 @@ import { MPIconPlacement } from './MPIconPlacement';
4
4
  import { MPLabelType } from './MPLabelType';
5
5
  import { MPBadgePosition } from './MPBadgePosition';
6
6
  import MPLabelGraphic from './MPLabelGraphic';
7
+ import { MPLabelPosition } from './MPLabelPosition';
7
8
  const { DisplayRule } = NativeModules;
8
9
 
9
10
 
@@ -1309,6 +1310,27 @@ export default class MPDisplayRule {
1309
1310
  });
1310
1311
  }
1311
1312
 
1313
+ /**
1314
+ * Get the label's position
1315
+ * @returns Promise<MPLabelPosition>
1316
+ */
1317
+ public async getLabelStylePosition(): Promise<MPLabelPosition> {
1318
+ return DisplayRule.getLabelStylePosition(this.id).catch((err: Error) => {
1319
+ return Promise.reject(MPError.create(JSON.parse(err.message)));
1320
+ });
1321
+ }
1322
+
1323
+ /**
1324
+ * Set the label's position
1325
+ * @param position MPLabelPosition
1326
+ * @returns Promise<void>
1327
+ */
1328
+ public async setLabelStylePosition(position: MPLabelPosition): Promise<void> {
1329
+ return DisplayRule.setLabelStylePosition(this.id, position.valueOf()).catch((err: Error) => {
1330
+ return Promise.reject(MPError.create(JSON.parse(err.message)));
1331
+ });
1332
+ }
1333
+
1312
1334
  /**
1313
1335
  * Set the label's Graphic style
1314
1336
  * @param graphicLabel MPLabelGraphic
@@ -1,4 +1,5 @@
1
1
  import MapControl from "../../index";
2
+ import { Platform } from 'react-native';
2
3
 
3
4
  /**
4
5
  * Sets a behavior for the map when calling {@link MapControl#setFilter}.
@@ -26,6 +27,7 @@ export default class MPFilterBehavior {
26
27
  * @param {number} animationDuration How long the camera movement should be animated for, set to 0 disables animation.
27
28
  * @param {boolean} showInfoWindow Whether to open the info window if a single result is returned.
28
29
  * @param {boolean} zoomToFit Whether the filtering is allowed to zoom in/out the camera.
30
+ * @param {number} maxZoom The maximum zoom level to zoom to when zoomToFit is enabled.
29
31
  */
30
32
  private constructor(
31
33
  public allowFloorChange: boolean,
@@ -33,6 +35,7 @@ export default class MPFilterBehavior {
33
35
  public animationDuration: number,
34
36
  public showInfoWindow: boolean,
35
37
  public zoomToFit: boolean,
38
+ public maxZoom?: number
36
39
  ) { }
37
40
 
38
41
  /**
@@ -44,12 +47,23 @@ export default class MPFilterBehavior {
44
47
  * @returns {MPFilterBehavior}
45
48
  */
46
49
  public static create(object?: MPFilterBehaviorParams): MPFilterBehavior {
50
+ if(Platform.OS === 'ios') {
51
+ return new MPFilterBehavior(
52
+ object?.allowFloorChange ?? false,
53
+ object?.moveCamera ?? false,
54
+ object?.animationDuration ?? 0,
55
+ object?.showInfoWindow ?? false,
56
+ object?.zoomToFit ?? true,
57
+ object?.maxZoom ?? 999
58
+ );
59
+ }
47
60
  return new MPFilterBehavior(
48
61
  object?.allowFloorChange ? object.allowFloorChange : false,
49
62
  object?.moveCamera ? object.moveCamera : false,
50
63
  object?.animationDuration ? object.animationDuration : 0,
51
64
  object?.showInfoWindow ? object.showInfoWindow : false,
52
- object?.zoomToFit ? object?.zoomToFit : true
65
+ object?.zoomToFit ? object?.zoomToFit : true,
66
+ object?.maxZoom
53
67
  );
54
68
  };
55
69
  }
@@ -92,4 +106,10 @@ export interface MPFilterBehaviorParams {
92
106
  * @type {?boolean}
93
107
  */
94
108
  zoomToFit?: boolean,
109
+ /**
110
+ * The maximum zoom level to zoom to when zoomToFit is enabled.
111
+ *
112
+ * @type {?number}
113
+ */
114
+ maxZoom?: number
95
115
  }
@@ -61,7 +61,7 @@ export default class MPFloor extends MPEntity {
61
61
  public static create(object: MPFloorParams): MPFloor {
62
62
  var multiPolygon;
63
63
  if (Platform.OS === 'ios') {
64
- multiPolygon = MPMultiPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.northeast, object?.entityBounds?.southwest)});
64
+ multiPolygon = MPMultiPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.southwest, object?.entityBounds?.northeast)});
65
65
  }else {
66
66
  multiPolygon = MPMultiPolygon.create(object?.geometry);
67
67
  }
@@ -1,4 +1,5 @@
1
1
  import MapControl from "../../index";
2
+ import { Platform } from 'react-native';
2
3
 
3
4
  /**
4
5
  * Sets a behavior for the map when calling {@link MapControl#setHighlight}.
@@ -26,6 +27,7 @@ export default class MPHighlightBehavior {
26
27
  * @param {number} animationDuration How long the camera movement should be animated for, set to 0 disables animation.
27
28
  * @param {boolean} showInfoWindow Whether to open the info window if a single result is returned.
28
29
  * @param {boolean} zoomToFit Whether the highlighting is allowed to zoom in/out the camera.
30
+ * @param {number} maxZoom The maximum zoom level to zoom to when zoomToFit is enabled.
29
31
  */
30
32
  private constructor(
31
33
  public allowFloorChange: boolean,
@@ -33,6 +35,7 @@ export default class MPHighlightBehavior {
33
35
  public animationDuration: number,
34
36
  public showInfoWindow: boolean,
35
37
  public zoomToFit: boolean,
38
+ public maxZoom?: number
36
39
  ) { }
37
40
 
38
41
  /**
@@ -44,12 +47,23 @@ export default class MPHighlightBehavior {
44
47
  * @returns {MPFilterBehavior}
45
48
  */
46
49
  public static create(object?: MPHighlightBehaviorParams): MPHighlightBehavior {
50
+ if(Platform.OS === 'ios') {
51
+ return new MPHighlightBehavior(
52
+ object?.allowFloorChange ?? false,
53
+ object?.moveCamera ?? false,
54
+ object?.animationDuration ?? 0,
55
+ object?.showInfoWindow ?? false,
56
+ object?.zoomToFit ?? true,
57
+ object?.maxZoom ?? 999
58
+ );
59
+ }
47
60
  return new MPHighlightBehavior(
48
61
  object?.allowFloorChange ?? false,
49
62
  object?.moveCamera ?? false,
50
63
  object?.animationDuration ?? 0,
51
64
  object?.showInfoWindow ?? false,
52
- object?.zoomToFit ?? true
65
+ object?.zoomToFit ?? true,
66
+ object?.maxZoom
53
67
  );
54
68
  };
55
69
  }
@@ -92,4 +106,10 @@ export interface MPHighlightBehaviorParams {
92
106
  * @type {?boolean}
93
107
  */
94
108
  zoomToFit?: boolean,
109
+ /**
110
+ * The maximum zoom level to zoom to when zoomToFit is enabled.
111
+ *
112
+ * @type {?number}
113
+ */
114
+ maxZoom?: number
95
115
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The possible position of the label, anchored on the icon.
3
+ *
4
+ * @export
5
+ * @enum {number}
6
+ */
7
+ export enum MPLabelPosition {
8
+ left,
9
+ top,
10
+ bottom,
11
+ right
12
+ }
@@ -95,10 +95,10 @@ export default class MPLocation extends MPEntity {
95
95
  geo = MPPoint.create(object?.geometry);
96
96
  break;
97
97
  case MPGeometry.polygon:
98
- geo = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.northeast, object?.entityBounds?.southwest)});
98
+ geo = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.southwest, object?.entityBounds?.northeast)});
99
99
  break;
100
100
  case MPGeometry.multiPolygon:
101
- geo = MPMultiPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.northeast, object?.entityBounds?.southwest)})
101
+ geo = MPMultiPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.entityBounds?.southwest, object?.entityBounds?.northeast)})
102
102
  break;
103
103
  default:
104
104
  break;
@@ -126,6 +126,13 @@ export default class MPMapConfig {
126
126
  */
127
127
  public readonly showRoadLabels?: boolean;
128
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
+
129
136
  /**
130
137
  * Creates an instance of MPMapConfig.
131
138
  *
@@ -147,6 +154,7 @@ export default class MPMapConfig {
147
154
  this.mapsIndoorsTransitionLevel = params.mapsIndoorsTransitionLevel;
148
155
  this.showMapMarkers = params.showMapMarkers;
149
156
  this.showRoadLabels = params.showRoadLabels;
157
+ this.mapboxMapStyle = params.mapboxMapStyle;
150
158
  }
151
159
  }
152
160
 
@@ -262,4 +270,11 @@ export interface MPMapConfigParams {
262
270
  * @type {boolean}
263
271
  */
264
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,
265
280
  }
@@ -139,7 +139,7 @@ export default class MPPoint extends MPGeometry {
139
139
  public toJSON(): MPPointParams {
140
140
  return {
141
141
  type: this.type,
142
- coordinates: [this.longitude, this.latitude, this.floorIndex ? this.floorIndex : 0],
142
+ coordinates: [this.longitude, this.latitude, this.floorIndex ?? 0],
143
143
  };
144
144
  }
145
145
  }
@@ -1,4 +1,5 @@
1
1
  import MapControl from "../../index";
2
+ import { Platform } from 'react-native';
2
3
 
3
4
  /**
4
5
  * Sets a behavior for the map when calling {@link MapControl#selectLocation}.
@@ -25,6 +26,7 @@ export default class MPSelectionBehavior {
25
26
  * @param {number} animationDuration
26
27
  * @param {boolean} showInfoWindow
27
28
  * @param {boolean} zoomToFit
29
+ * @param {number} maxZoom
28
30
  */
29
31
  private constructor(
30
32
  public allowFloorChange: boolean,
@@ -32,6 +34,7 @@ export default class MPSelectionBehavior {
32
34
  public animationDuration: number,
33
35
  public showInfoWindow: boolean,
34
36
  public zoomToFit: boolean,
37
+ public maxZoom?: number
35
38
  ) { }
36
39
 
37
40
  /**
@@ -42,12 +45,23 @@ export default class MPSelectionBehavior {
42
45
  * @returns {MPSelectionBehavior}
43
46
  */
44
47
  static create(object: MPSelectionBehaviorParams): MPSelectionBehavior {
48
+ if(Platform.OS === 'ios') {
49
+ return new MPSelectionBehavior(
50
+ object?.allowFloorChange ?? false,
51
+ object?.moveCamera ?? false,
52
+ object?.animationDuration ?? 0,
53
+ object?.showInfoWindow ?? false,
54
+ object?.zoomToFit ?? true,
55
+ object?.maxZoom ?? 999
56
+ );
57
+ }
45
58
  return new MPSelectionBehavior(
46
59
  object?.allowFloorChange ?? true,
47
60
  object?.moveCamera ?? true,
48
61
  object?.animationDuration ?? 500,
49
62
  object?.showInfoWindow ?? true,
50
- object?.zoomToFit ?? true
63
+ object?.zoomToFit ?? true,
64
+ object?.maxZoom
51
65
  );
52
66
  }
53
67
  }
@@ -90,4 +104,11 @@ export interface MPSelectionBehaviorParams {
90
104
  * @type {?boolean}
91
105
  */
92
106
  zoomToFit?: boolean,
107
+
108
+ /**
109
+ * The maximum zoom level to zoom to when zoomToFit is enabled.
110
+ *
111
+ * @type {?number}
112
+ */
113
+ maxZoom?: number
93
114
  }
@@ -24,6 +24,8 @@ export default class MPSolutionConfig {
24
24
  * @param {MPSettings3D} settings3D
25
25
  * @param {?boolean} [_enableClustering]
26
26
  * @param {?MPCollisionHandling} [_mpCollisionHandling]
27
+ * @param {?boolean} [_isNewSelection]
28
+ * @param {?number} [_automatedZoomLimit]
27
29
  */
28
30
  private constructor(
29
31
  public readonly id: string,
@@ -32,6 +34,7 @@ export default class MPSolutionConfig {
32
34
  private _enableClustering?: boolean,
33
35
  private _mpCollisionHandling?: MPCollisionHandling,
34
36
  private _isNewSelection?: boolean,
37
+ private _automatedZoomLimit?: number,
35
38
  ) { }
36
39
 
37
40
 
@@ -51,6 +54,7 @@ export default class MPSolutionConfig {
51
54
  object?.enableClustering,
52
55
  object?.collisionHandling,
53
56
  object?.isNewSelection,
57
+ object?.automatedZoomLimit,
54
58
  );
55
59
  }
56
60
 
@@ -65,6 +69,21 @@ export default class MPSolutionConfig {
65
69
  MPUtils.setCollisionHandling(collisionHandling);
66
70
  }
67
71
 
72
+ /**
73
+ * Set the automated zoom limit.
74
+ *
75
+ * @public
76
+ * @type {number}
77
+ */
78
+ public set automatedZoomLimit(automatedZoomLimit: number) {
79
+ this._automatedZoomLimit = automatedZoomLimit;
80
+ if (automatedZoomLimit == null) {
81
+ MPUtils.setAutomatedZoomLimit(-1);
82
+ }else {
83
+ MPUtils.setAutomatedZoomLimit(automatedZoomLimit);
84
+ }
85
+ }
86
+
68
87
  /**
69
88
  * Get the type of collisionHandling that is set.
70
89
  *
@@ -159,4 +178,11 @@ export interface MPSolutionConfigParams {
159
178
  * @type {MPLocationSettings}
160
179
  */
161
180
  locationSettings: MPLocationSettings,
181
+
182
+ /**
183
+ * Automated zoom limit
184
+ *
185
+ * @type {number}
186
+ */
187
+ automatedZoomLimit?: number,
162
188
  }
@@ -170,5 +170,9 @@ export default class MPUtils {
170
170
  static async setSelectable(id: string, selectable: boolean): Promise<void> {
171
171
  return UtilsModule.setSelectable(id, selectable);
172
172
  }
173
-
173
+
174
+ static async setAutomatedZoomLimit(automatedZoomLimit?: number): Promise<void> {
175
+ return UtilsModule.setAutomatedZoomLimit(automatedZoomLimit);
176
+ }
177
+
174
178
  }
@@ -58,7 +58,7 @@ export default class MPVenue extends MPEntity {
58
58
  var polygon;
59
59
 
60
60
  if (Platform.OS === 'ios') {
61
- polygon = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.bbox?.northeast, object?.bbox?.southwest)});
61
+ polygon = MPPolygon.create({coordinates: object?.geometry, bbox: [].concat(object?.bbox?.southwest, object?.bbox?.northeast)});
62
62
  }else {
63
63
  polygon = MPPolygon.create(object?.geometry);
64
64
  }
@@ -316,8 +316,11 @@ export default class MapControl {
316
316
  * @param {MPEntity} entity The entity to move to.
317
317
  * @returns {Promise<void>}
318
318
  */
319
- public async goTo(entity: MPEntity): Promise<void> {
320
- return MapControlModule.goTo(JSON.stringify(entity), entity.type).then(() => {});
319
+ public async goTo(entity: MPEntity, maxZoom?: number): Promise<void> {
320
+ if (maxZoom) {
321
+ return MapControlModule.goTo(JSON.stringify(entity), entity.type, maxZoom);
322
+ }
323
+ return MapControlModule.goTo(JSON.stringify(entity), entity.type);
321
324
  }
322
325
 
323
326
  /**
@@ -3,7 +3,7 @@ import { useEffect, useRef } from 'react';
3
3
  import { Platform, UIManager, findNodeHandle, requireNativeComponent } from "react-native";
4
4
  import MPCameraPosition from './MPCameraPosition';
5
5
 
6
- const createFragment = (viewId: number | null, camera?: MPCameraPosition, showCompass?: boolean) => {
6
+ const createFragment = (viewId: number | null, camera?: MPCameraPosition, showCompass?: boolean, mapboxMapStyle?: String) => {
7
7
  let command = (UIManager as any).MapsIndoorsView.Commands.create;
8
8
  if (Platform.OS === 'android') {
9
9
  command = command.toString();
@@ -12,23 +12,24 @@ const createFragment = (viewId: number | null, camera?: MPCameraPosition, showCo
12
12
  viewId,
13
13
  // we are calling the 'create' command
14
14
  command,
15
- [viewId, JSON.stringify(camera), showCompass],
15
+ [viewId, JSON.stringify(camera), showCompass, mapboxMapStyle],
16
16
  );
17
17
  }
18
18
 
19
- const MapView = ({ style, camera, showCompass }: { style: any, camera?: MPCameraPosition, showCompass?: boolean}) => {
19
+ const MapView = ({ style, camera, showCompass, mapboxMapStyle }: { style: any, camera?: MPCameraPosition, showCompass?: boolean, mapboxMapStyle?: string}) => {
20
20
  const ref = useRef(null);
21
21
 
22
22
  useEffect(() => {
23
23
  const viewId = findNodeHandle(ref.current);
24
- createFragment(viewId, camera, showCompass !== undefined ? showCompass : true);
24
+ createFragment(viewId, camera, showCompass !== undefined ? showCompass : true, mapboxMapStyle);
25
25
  }, []);
26
26
 
27
27
  return (<MapsIndoorsViewManager
28
28
  style={style}
29
29
  ref={ref}
30
30
  camera={camera}
31
- showCompass={showCompass} />);
31
+ showCompass={showCompass}
32
+ mapboxMapStyle={mapboxMapStyle} />);
32
33
  }
33
34
 
34
35
  const MapsIndoorsViewManager = requireNativeComponent('MapsIndoorsView');