@mapsindoors/react-native-maps-indoors-mapbox 1.0.8 → 1.1.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.
Files changed (74) hide show
  1. package/README.md +14 -2
  2. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  3. package/android/.gradle/7.4/checksums/md5-checksums.bin +0 -0
  4. package/android/.gradle/7.4/checksums/sha1-checksums.bin +0 -0
  5. package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
  6. package/android/.gradle/7.4/dependencies-accessors/gc.properties +0 -0
  7. package/android/.gradle/7.4/executionHistory/executionHistory.bin +0 -0
  8. package/android/.gradle/7.4/executionHistory/executionHistory.lock +0 -0
  9. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  10. package/android/.gradle/7.4/fileHashes/fileHashes.bin +0 -0
  11. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  12. package/android/.gradle/7.4/fileHashes/resourceHashesCache.bin +0 -0
  13. package/android/.gradle/7.4/gc.properties +0 -0
  14. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  15. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  16. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  17. package/android/.gradle/file-system.probe +0 -0
  18. package/android/.gradle/vcs-1/gc.properties +0 -0
  19. package/android/.idea/compiler.xml +6 -0
  20. package/android/.idea/gradle.xml +19 -0
  21. package/android/.idea/jarRepositories.xml +60 -0
  22. package/android/.idea/misc.xml +9 -0
  23. package/android/.idea/vcs.xml +8 -0
  24. package/android/build.gradle +2 -2
  25. package/android/libs/core-4.3.0.aar +0 -0
  26. package/android/libs/mapbox-4.3.0.aar +0 -0
  27. package/android/local.properties +8 -0
  28. package/android/src/main/AndroidManifest.xml +1 -1
  29. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/MapboxMapView.java +4 -4
  30. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/MapsIndoorsPackage.java +7 -7
  31. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/MapsIndoorsViewManager.java +1 -1
  32. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/DirectionsRendererModule.java +2 -2
  33. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/DirectionsServiceModule.java +24 -2
  34. package/android/src/main/java/com/mapsindoorsrn/core/MPDisplayRuleModule.java +1486 -0
  35. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/MapControlModule.java +32 -5
  36. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/MapsIndoorsModule.java +6 -6
  37. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/RCMapView.java +3 -3
  38. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/UtilsModule.java +11 -2
  39. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/models/Bounds.java +1 -1
  40. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/models/Filter.java +1 -1
  41. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/models/Location.java +1 -1
  42. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/models/MPCameraPosition.java +1 -1
  43. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/models/MPCameraUpdate.java +1 -1
  44. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/models/MPError.java +1 -1
  45. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/models/PositionProvider.java +1 -1
  46. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/models/PositionResult.java +1 -1
  47. package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/models/Query.java +1 -1
  48. package/index.ts +10 -0
  49. package/ios/MapsIndoors.xcodeproj/xcuserdata/timmikkelsen.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  50. package/ios/MapsIndoors.xcworkspace/xcuserdata/timmikkelsen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  51. package/ios/core/DirectionsRendererModule.swift +49 -24
  52. package/ios/core/DirectionsServiceBridge.m +9 -0
  53. package/ios/core/DirectionsServiceModule.swift +25 -0
  54. package/ios/core/MPDisplayRuleBridge.m +198 -1
  55. package/ios/core/MPDisplayRuleModule.swift +603 -33
  56. package/ios/core/MapControlBridge.m +8 -0
  57. package/ios/core/MapControlModule.swift +24 -0
  58. package/ios/core/MapsIndoorsData.swift +6 -1
  59. package/ios/core/UtilsBridge.m +4 -0
  60. package/ios/core/UtilsModule.swift +5 -0
  61. package/package.json +1 -1
  62. package/react-native-maps-indoors-mapbox.podspec +2 -2
  63. package/src/core/MPBadgePosition.ts +12 -0
  64. package/src/core/MPDirectionsService.ts +25 -0
  65. package/src/core/MPDisplayRule.ts +574 -7
  66. package/src/core/MPHighlightBehavior.ts +95 -0
  67. package/src/core/MPIconPlacement.ts +13 -0
  68. package/src/core/MPLabelType.ts +10 -0
  69. package/src/core/MPSolutionConfig.ts +17 -0
  70. package/src/core/MPSolutionDisplayRule.ts +2 -0
  71. package/src/core/MPUtils.ts +12 -0
  72. package/src/core/MapControl.ts +23 -1
  73. package/android/src/main/java/com/reactlibrary/core/MPDisplayRuleModule.java +0 -816
  74. /package/android/src/main/java/com/{reactlibrary → mapsindoorsrn}/core/README.md +0 -0
@@ -0,0 +1,1486 @@
1
+ package com.mapsindoorsrn.core;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.facebook.react.bridge.Promise;
6
+ import com.facebook.react.bridge.ReactApplicationContext;
7
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
8
+ import com.facebook.react.bridge.ReactMethod;
9
+ import com.google.gson.Gson;
10
+ import com.mapsindoors.core.MPBadgePosition;
11
+ import com.mapsindoors.core.MPDisplayRule;
12
+ import com.mapsindoors.core.MPIconPlacement;
13
+ import com.mapsindoors.core.MPIconSize;
14
+ import com.mapsindoors.core.MPLabelType;
15
+ import com.mapsindoors.core.MPSolutionDisplayRule;
16
+ import com.mapsindoors.core.MapsIndoors;
17
+ import com.mapsindoors.core.errors.MIError;
18
+ import com.mapsindoors.core.errors.MIErrorEnum;
19
+ import com.mapsindoorsrn.core.models.MPError;
20
+
21
+ public class MPDisplayRuleModule extends ReactContextBaseJavaModule {
22
+ private final Gson gson = new Gson();
23
+
24
+ public MPDisplayRuleModule(@NonNull ReactApplicationContext reactContext) {
25
+ super(reactContext);
26
+ }
27
+
28
+ @NonNull
29
+ @Override
30
+ public String getName() {
31
+ return "DisplayRule";
32
+ }
33
+
34
+ private void reject(Promise promise, String id) {
35
+ promise.reject("DisplayRuleError",
36
+ gson.toJson(MPError.fromMIError(
37
+ new MIError(MIErrorEnum.UNKNOWN_ERROR,
38
+ "The DisplayRule (id: "+ id +") cannot be found"))));
39
+ }
40
+
41
+ private MPDisplayRule getRule(String name) {
42
+ switch (name) {
43
+ case "buildingOutline" : return MapsIndoors.getDisplayRule(MPSolutionDisplayRule.BUILDING_OUTLINE);
44
+ case "selectionHighlight": return MapsIndoors.getDisplayRule(MPSolutionDisplayRule.SELECTION_HIGHLIGHT);
45
+ case "positionIndicator": return MapsIndoors.getDisplayRule(MPSolutionDisplayRule.POSITION_INDICATOR);
46
+ default: return MapsIndoors.getDisplayRule(name);
47
+ }
48
+ }
49
+
50
+ @ReactMethod
51
+ public void isVisible(String displayRuleId, final Promise promise) {
52
+ MPDisplayRule displayRule = getRule(displayRuleId);
53
+ if (displayRule != null) {
54
+ promise.resolve(displayRule.isVisible());
55
+ } else {
56
+ reject(promise, displayRuleId);
57
+ }
58
+ }
59
+
60
+ @ReactMethod
61
+ public void setVisible(String displayRuleId, String isVisible, final Promise promise) {
62
+ MPDisplayRule displayRule = getRule(displayRuleId);
63
+ if (displayRule != null) {
64
+ displayRule.setVisible(Boolean.valueOf(isVisible));
65
+ promise.resolve(null);
66
+ } else {
67
+ reject(promise, displayRuleId);
68
+ }
69
+ }
70
+
71
+ @ReactMethod
72
+ public void isIconVisible(String displayRuleId, final Promise promise) {
73
+ MPDisplayRule displayRule = getRule(displayRuleId);
74
+ if (displayRule != null) {
75
+ promise.resolve(displayRule.isIconVisible());
76
+ } else {
77
+ reject(promise, displayRuleId);
78
+ }
79
+ }
80
+
81
+ @ReactMethod
82
+ public void setIconVisible(String displayRuleId, String iconVisible, final Promise promise) {
83
+ MPDisplayRule displayRule = getRule(displayRuleId);
84
+ if (displayRule != null) {
85
+ displayRule.setIconVisible(Boolean.valueOf(iconVisible));
86
+ promise.resolve(null);
87
+ } else {
88
+ reject(promise, displayRuleId);
89
+ }
90
+ }
91
+
92
+ @ReactMethod
93
+ public void isPolygonVisible(String displayRuleId, final Promise promise) {
94
+ MPDisplayRule displayRule = getRule(displayRuleId);
95
+ if (displayRule != null) {
96
+ promise.resolve(displayRule.isPolygonVisible());
97
+ } else {
98
+ reject(promise, displayRuleId);
99
+ }
100
+ }
101
+
102
+ @ReactMethod
103
+ public void setPolygonVisible(String displayRuleId, String polygonVisible, final Promise promise) {
104
+ MPDisplayRule displayRule = getRule(displayRuleId);
105
+ if (displayRule != null) {
106
+ displayRule.setPolygonVisible(Boolean.valueOf(polygonVisible));
107
+ promise.resolve(null);
108
+ } else {
109
+ reject(promise, displayRuleId);
110
+ }
111
+ }
112
+
113
+ @ReactMethod
114
+ public void isLabelVisible(String displayRuleId, final Promise promise) {
115
+ MPDisplayRule displayRule = getRule(displayRuleId);
116
+ if (displayRule != null) {
117
+ promise.resolve(displayRule.isLabelVisible());
118
+ } else {
119
+ reject(promise, displayRuleId);
120
+ }
121
+ }
122
+
123
+ @ReactMethod
124
+ public void setLabelVisible(String displayRuleId, String labelVisible, final Promise promise) {
125
+ MPDisplayRule displayRule = getRule(displayRuleId);
126
+ if (displayRule != null) {
127
+ displayRule.setLabelVisible(Boolean.valueOf(labelVisible));
128
+ promise.resolve(null);
129
+ } else {
130
+ reject(promise, displayRuleId);
131
+ }
132
+ }
133
+
134
+ @ReactMethod
135
+ public void isModel2DVisible(String displayRuleId, final Promise promise) {
136
+ MPDisplayRule displayRule = getRule(displayRuleId);
137
+ if (displayRule != null) {
138
+ promise.resolve(displayRule.isModel2DVisible());
139
+ } else {
140
+ reject(promise, displayRuleId);
141
+ }
142
+ }
143
+
144
+ @ReactMethod
145
+ public void setModel2DVisible(String displayRuleId, String model2DVisible, final Promise promise) {
146
+ MPDisplayRule displayRule = getRule(displayRuleId);
147
+ if (displayRule != null) {
148
+ displayRule.setModel2DVisible(Boolean.valueOf(model2DVisible));
149
+ promise.resolve(null);
150
+ } else {
151
+ reject(promise, displayRuleId);
152
+ }
153
+ }
154
+
155
+ @ReactMethod
156
+ public void isWallVisible(String displayRuleId, final Promise promise) {
157
+ MPDisplayRule displayRule = getRule(displayRuleId);
158
+ if (displayRule != null) {
159
+ promise.resolve(displayRule.isWallVisible());
160
+ } else {
161
+ reject(promise, displayRuleId);
162
+ }
163
+ }
164
+
165
+ @ReactMethod
166
+ public void setWallVisible(String displayRuleId, String wallVisible, final Promise promise) {
167
+ MPDisplayRule displayRule = getRule(displayRuleId);
168
+ if (displayRule != null) {
169
+ displayRule.setWallVisible(Boolean.valueOf(wallVisible));
170
+ promise.resolve(null);
171
+ } else {
172
+ reject(promise, displayRuleId);
173
+ }
174
+ }
175
+
176
+ @ReactMethod
177
+ public void isExtrusionVisible(String displayRuleId, final Promise promise) {
178
+ MPDisplayRule displayRule = getRule(displayRuleId);
179
+ if (displayRule != null) {
180
+ promise.resolve(displayRule.isExtrusionVisible());
181
+ } else {
182
+ reject(promise, displayRuleId);
183
+ }
184
+ }
185
+
186
+ @ReactMethod
187
+ public void setExtrusionVisible(String displayRuleId, String extrusionVisible, final Promise promise) {
188
+ MPDisplayRule displayRule = getRule(displayRuleId);
189
+ if (displayRule != null) {
190
+ displayRule.setExtrusionVisible(Boolean.valueOf(extrusionVisible));
191
+ promise.resolve(null);
192
+ } else {
193
+ reject(promise, displayRuleId);
194
+ }
195
+ }
196
+
197
+ @ReactMethod
198
+ public void getZoomFrom(String displayRuleId, final Promise promise) {
199
+ MPDisplayRule displayRule = getRule(displayRuleId);
200
+ if (displayRule != null) {
201
+ promise.resolve(displayRule.getZoomFrom());
202
+ } else {
203
+ reject(promise, displayRuleId);
204
+ }
205
+ }
206
+
207
+ @ReactMethod
208
+ public void setZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
209
+ MPDisplayRule displayRule = getRule(displayRuleId);
210
+ if (displayRule != null) {
211
+ if (zoomFrom == -1) {
212
+ displayRule.setZoomFrom(null);
213
+ }else {
214
+ displayRule.setZoomFrom(zoomFrom.floatValue());
215
+ }
216
+ promise.resolve(null);
217
+ } else {
218
+ reject(promise, displayRuleId);
219
+ }
220
+ }
221
+
222
+ @ReactMethod
223
+ public void getZoomTo(String displayRuleId, final Promise promise) {
224
+ MPDisplayRule displayRule = getRule(displayRuleId);
225
+ if (displayRule != null) {
226
+ promise.resolve(displayRule.getZoomTo());
227
+ } else {
228
+ reject(promise, displayRuleId);
229
+ }
230
+ }
231
+
232
+ @ReactMethod
233
+ public void setZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
234
+ MPDisplayRule displayRule = getRule(displayRuleId);
235
+ if (displayRule != null) {
236
+ if (zoomTo == -1) {
237
+ displayRule.setZoomTo(null);
238
+ }else {
239
+ displayRule.setZoomTo(zoomTo.floatValue());
240
+ }
241
+ promise.resolve(null);
242
+ } else {
243
+ reject(promise, displayRuleId);
244
+ }
245
+ }
246
+
247
+ @ReactMethod
248
+ public void getIconUrl(String displayRuleId, final Promise promise) {
249
+ MPDisplayRule displayRule = getRule(displayRuleId);
250
+ if (displayRule != null) {
251
+ promise.resolve(displayRule.getIconUrl());
252
+ } else {
253
+ reject(promise, displayRuleId);
254
+ }
255
+ }
256
+
257
+ @ReactMethod
258
+ public void setIcon(String displayRuleId, String url, final Promise promise) {
259
+ MPDisplayRule displayRule = getRule(displayRuleId);
260
+ if (displayRule != null) {
261
+ displayRule.setIcon(url);
262
+ promise.resolve(null);
263
+ } else {
264
+ reject(promise, displayRuleId);
265
+ }
266
+ }
267
+
268
+ @ReactMethod
269
+ public void getIconSize(String displayRuleId, final Promise promise) {
270
+ MPDisplayRule displayRule = getRule(displayRuleId);
271
+ if (displayRule != null) {
272
+ String iconSizeString = gson.toJson(displayRule.getIconSize());
273
+ promise.resolve(iconSizeString);
274
+ } else {
275
+ reject(promise, displayRuleId);
276
+ }
277
+ }
278
+
279
+ @ReactMethod
280
+ public void setIconSize(String displayRuleId, String iconSizeString, final Promise promise) {
281
+ MPDisplayRule displayRule = getRule(displayRuleId);
282
+ if (displayRule != null) {
283
+ MPIconSize iconSize = gson.fromJson(iconSizeString, MPIconSize.class);
284
+ displayRule.setIconSize(iconSize.getWidth(), iconSize.getHeight());
285
+ promise.resolve(null);
286
+ } else {
287
+ reject(promise, displayRuleId);
288
+ }
289
+ }
290
+
291
+ @ReactMethod
292
+ public void getLabel(String displayRuleId, final Promise promise) {
293
+ MPDisplayRule displayRule = getRule(displayRuleId);
294
+ if (displayRule != null) {
295
+ promise.resolve(displayRule.getLabel());
296
+ } else {
297
+ reject(promise, displayRuleId);
298
+ }
299
+ }
300
+
301
+ @ReactMethod
302
+ public void setLabel(String displayRuleId, String label, final Promise promise) {
303
+ MPDisplayRule displayRule = getRule(displayRuleId);
304
+ if (displayRule != null) {
305
+ displayRule.setLabel(label);
306
+ promise.resolve(null);
307
+ } else {
308
+ reject(promise, displayRuleId);
309
+ }
310
+ }
311
+
312
+ @ReactMethod
313
+ public void getLabelZoomFrom(String displayRuleId, final Promise promise) {
314
+ MPDisplayRule displayRule = getRule(displayRuleId);
315
+ if (displayRule != null) {
316
+ promise.resolve(displayRule.getLabelZoomFrom());
317
+ } else {
318
+ reject(promise, displayRuleId);
319
+ }
320
+ }
321
+
322
+ @ReactMethod
323
+ public void setLabelZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
324
+ MPDisplayRule displayRule = getRule(displayRuleId);
325
+ if (displayRule != null) {
326
+ if (zoomFrom == -1) {
327
+ displayRule.setLabelZoomFrom(null);
328
+ }else {
329
+ displayRule.setLabelZoomFrom(zoomFrom.floatValue());
330
+ }
331
+ promise.resolve(null);
332
+ } else {
333
+ reject(promise, displayRuleId);
334
+ }
335
+ }
336
+
337
+ @ReactMethod
338
+ public void getLabelZoomTo(String displayRuleId, final Promise promise) {
339
+ MPDisplayRule displayRule = getRule(displayRuleId);
340
+ if (displayRule != null) {
341
+ promise.resolve(displayRule.getLabelZoomTo());
342
+ } else {
343
+ reject(promise, displayRuleId);
344
+ }
345
+ }
346
+
347
+ @ReactMethod
348
+ public void setLabelZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
349
+ MPDisplayRule displayRule = getRule(displayRuleId);
350
+ if (displayRule != null) {
351
+ if (zoomTo == -1) {
352
+ displayRule.setLabelZoomTo(null);
353
+ }else {
354
+ displayRule.setLabelZoomTo(zoomTo.floatValue());
355
+ }
356
+ promise.resolve(null);
357
+ } else {
358
+ reject(promise, displayRuleId);
359
+ }
360
+ }
361
+
362
+ @ReactMethod
363
+ public void getLabelMaxWidth(String displayRuleId, final Promise promise) {
364
+ MPDisplayRule displayRule = getRule(displayRuleId);
365
+ if (displayRule != null) {
366
+ promise.resolve(displayRule.getLabelMaxWidth());
367
+ } else {
368
+ reject(promise, displayRuleId);
369
+ }
370
+ }
371
+
372
+ @ReactMethod
373
+ public void setLabelMaxWidth(String displayRuleId, Double labelMaxWidth, final Promise promise) {
374
+ MPDisplayRule displayRule = getRule(displayRuleId);
375
+ if (displayRule != null) {
376
+ if (labelMaxWidth == -1) {
377
+ displayRule.setLabelMaxWidth(null);
378
+ }else {
379
+ displayRule.setLabelMaxWidth(labelMaxWidth.intValue());
380
+ }
381
+ promise.resolve(null);
382
+ } else {
383
+ reject(promise, displayRuleId);
384
+ }
385
+ }
386
+
387
+ @ReactMethod
388
+ public void getPolygonZoomFrom(String displayRuleId, final Promise promise) {
389
+ MPDisplayRule displayRule = getRule(displayRuleId);
390
+ if (displayRule != null) {
391
+ promise.resolve(displayRule.getPolygonZoomFrom());
392
+ } else {
393
+ reject(promise, displayRuleId);
394
+ }
395
+ }
396
+
397
+ @ReactMethod
398
+ public void setPolygonZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
399
+ MPDisplayRule displayRule = getRule(displayRuleId);
400
+ if (displayRule != null) {
401
+ if (zoomFrom == -1) {
402
+ displayRule.setPolygonZoomFrom(null);
403
+ }else {
404
+ displayRule.setPolygonZoomFrom(zoomFrom.floatValue());
405
+ }
406
+ promise.resolve(null);
407
+ } else {
408
+ reject(promise, displayRuleId);
409
+ }
410
+ }
411
+
412
+ @ReactMethod
413
+ public void getPolygonZoomTo(String displayRuleId, final Promise promise) {
414
+ MPDisplayRule displayRule = getRule(displayRuleId);
415
+ if (displayRule != null) {
416
+ promise.resolve(displayRule.getPolygonZoomTo());
417
+ } else {
418
+ reject(promise, displayRuleId);
419
+ }
420
+ }
421
+
422
+ @ReactMethod
423
+ public void setPolygonZoomTo(String displayRuleId, Double polygonZoomTo, final Promise promise) {
424
+ MPDisplayRule displayRule = getRule(displayRuleId);
425
+ if (displayRule != null) {
426
+ if (polygonZoomTo == -1) {
427
+ displayRule.setPolygonZoomTo(null);
428
+ }else {
429
+ displayRule.setPolygonZoomTo(polygonZoomTo.floatValue());
430
+ }
431
+ promise.resolve(null);
432
+ } else {
433
+ reject(promise, displayRuleId);
434
+ }
435
+ }
436
+
437
+ @ReactMethod
438
+ public void getPolygonStrokeWidth(String displayRuleId, final Promise promise) {
439
+ MPDisplayRule displayRule = getRule(displayRuleId);
440
+ if (displayRule != null) {
441
+ promise.resolve(displayRule.getPolygonStrokeWidth());
442
+ } else {
443
+ reject(promise, displayRuleId);
444
+ }
445
+ }
446
+
447
+ @ReactMethod
448
+ public void setPolygonStrokeWidth(String displayRuleId, Double strokeWidth, final Promise promise) {
449
+ MPDisplayRule displayRule = getRule(displayRuleId);
450
+ if (displayRule != null) {
451
+ if (strokeWidth == -1) {
452
+ displayRule.setPolygonStrokeWidth(null);
453
+ }else {
454
+ displayRule.setPolygonStrokeWidth(strokeWidth.floatValue());
455
+ }
456
+ promise.resolve(null);
457
+ } else {
458
+ reject(promise, displayRuleId);
459
+ }
460
+ }
461
+
462
+ @ReactMethod
463
+ public void getPolygonStrokeColor(String displayRuleId, final Promise promise) {
464
+ MPDisplayRule displayRule = getRule(displayRuleId);
465
+ if (displayRule != null) {
466
+ promise.resolve(displayRule.getPolygonStrokeColor());
467
+ } else {
468
+ reject(promise, displayRuleId);
469
+ }
470
+ }
471
+
472
+ @ReactMethod
473
+ public void setPolygonStrokeColor(String displayRuleId, String polygonStrokeColor, final Promise promise) {
474
+ MPDisplayRule displayRule = getRule(displayRuleId);
475
+ if (displayRule != null) {
476
+ displayRule.setPolygonStrokeColor(polygonStrokeColor);
477
+ promise.resolve(null);
478
+ } else {
479
+ reject(promise, displayRuleId);
480
+ }
481
+ }
482
+
483
+ @ReactMethod
484
+ public void getPolygonStrokeOpacity(String displayRuleId, final Promise promise) {
485
+ MPDisplayRule displayRule = getRule(displayRuleId);
486
+ if (displayRule != null) {
487
+ promise.resolve(displayRule.getPolygonStrokeOpacity());
488
+ } else {
489
+ reject(promise, displayRuleId);
490
+ }
491
+ }
492
+
493
+ @ReactMethod
494
+ public void setPolygonStrokeOpacity(String displayRuleId, Double polygonStrokeOpacity, final Promise promise) {
495
+ MPDisplayRule displayRule = getRule(displayRuleId);
496
+ if (displayRule != null) {
497
+ if (polygonStrokeOpacity == -1) {
498
+ displayRule.setPolygonStrokeOpacity(null);
499
+ }else {
500
+ displayRule.setPolygonStrokeOpacity(polygonStrokeOpacity.floatValue());
501
+ }
502
+ promise.resolve(null);
503
+ } else {
504
+ reject(promise, displayRuleId);
505
+ }
506
+ }
507
+
508
+ @ReactMethod
509
+ public void getPolygonFillOpacity(String displayRuleId, final Promise promise) {
510
+ MPDisplayRule displayRule = getRule(displayRuleId);
511
+ if (displayRule != null) {
512
+ promise.resolve(displayRule.getPolygonFillOpacity());
513
+ } else {
514
+ reject(promise, displayRuleId);
515
+ }
516
+ }
517
+
518
+ @ReactMethod
519
+ public void setPolygonFillOpacity(String displayRuleId, Double polygonFillOpacity, final Promise promise) {
520
+ MPDisplayRule displayRule = getRule(displayRuleId);
521
+ if (displayRule != null) {
522
+ if (polygonFillOpacity == -1) {
523
+ displayRule.setPolygonFillOpacity(null);
524
+ }else {
525
+ displayRule.setPolygonFillOpacity(polygonFillOpacity.floatValue());
526
+ }
527
+ promise.resolve(null);
528
+ } else {
529
+ reject(promise, displayRuleId);
530
+ }
531
+ }
532
+
533
+ @ReactMethod
534
+ public void getPolygonFillColor(String displayRuleId, final Promise promise) {
535
+ MPDisplayRule displayRule = getRule(displayRuleId);
536
+ if (displayRule != null) {
537
+ promise.resolve(displayRule.getPolygonFillColor());
538
+ } else {
539
+ reject(promise, displayRuleId);
540
+ }
541
+ }
542
+
543
+ @ReactMethod
544
+ public void setPolygonFillColor(String displayRuleId, String polygonFillColor, final Promise promise) {
545
+ MPDisplayRule displayRule = getRule(displayRuleId);
546
+ if (displayRule != null) {
547
+ displayRule.setPolygonFillColor(polygonFillColor);
548
+ promise.resolve(null);
549
+ } else {
550
+ reject(promise, displayRuleId);
551
+ }
552
+ }
553
+
554
+ @ReactMethod
555
+ public void getWallColor(String displayRuleId, final Promise promise) {
556
+ MPDisplayRule displayRule = getRule(displayRuleId);
557
+ if (displayRule != null) {
558
+ promise.resolve(displayRule.getWallColor());
559
+ } else {
560
+ reject(promise, displayRuleId);
561
+ }
562
+ }
563
+
564
+ @ReactMethod
565
+ public void setWallColor(String displayRuleId, String wallColor, final Promise promise) {
566
+ MPDisplayRule displayRule = getRule(displayRuleId);
567
+ if (displayRule != null) {
568
+ displayRule.setWallColor(wallColor);
569
+ promise.resolve(null);
570
+ } else {
571
+ reject(promise, displayRuleId);
572
+ }
573
+ }
574
+
575
+ @ReactMethod
576
+ public void getWallHeight(String displayRuleId, final Promise promise) {
577
+ MPDisplayRule displayRule = getRule(displayRuleId);
578
+ if (displayRule != null) {
579
+ promise.resolve(displayRule.getWallHeight());
580
+ } else {
581
+ reject(promise, displayRuleId);
582
+ }
583
+ }
584
+
585
+ @ReactMethod
586
+ public void setWallHeight(String displayRuleId, Double wallHeight, final Promise promise) {
587
+ MPDisplayRule displayRule = getRule(displayRuleId);
588
+ if (displayRule != null) {
589
+ if (wallHeight == -1) {
590
+ displayRule.setWallHeight(null);
591
+ }else {
592
+ displayRule.setWallHeight(wallHeight.floatValue());
593
+ }
594
+ promise.resolve(null);
595
+ } else {
596
+ reject(promise, displayRuleId);
597
+ }
598
+ }
599
+
600
+ @ReactMethod
601
+ public void getWallZoomFrom(String displayRuleId, final Promise promise) {
602
+ MPDisplayRule displayRule = getRule(displayRuleId);
603
+ if (displayRule != null) {
604
+ promise.resolve(displayRule.getWallZoomFrom());
605
+ } else {
606
+ reject(promise, displayRuleId);
607
+ }
608
+ }
609
+
610
+ @ReactMethod
611
+ public void setWallZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
612
+ MPDisplayRule displayRule = getRule(displayRuleId);
613
+ if (displayRule != null) {
614
+ if (zoomFrom == -1) {
615
+ displayRule.setWallZoomFrom(null);
616
+ }else {
617
+ displayRule.setWallZoomFrom(zoomFrom.floatValue());
618
+ }
619
+ promise.resolve(null);
620
+ } else {
621
+ reject(promise, displayRuleId);
622
+ }
623
+ }
624
+
625
+ @ReactMethod
626
+ public void getWallZoomTo(String displayRuleId, final Promise promise) {
627
+ MPDisplayRule displayRule = getRule(displayRuleId);
628
+ if (displayRule != null) {
629
+ promise.resolve(displayRule.getWallZoomTo());
630
+ } else {
631
+ reject(promise, displayRuleId);
632
+ }
633
+ }
634
+
635
+ @ReactMethod
636
+ public void setWallZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
637
+ MPDisplayRule displayRule = getRule(displayRuleId);
638
+ if (displayRule != null) {
639
+ if (zoomTo == -1) {
640
+ displayRule.setWallZoomTo(null);
641
+ }else {
642
+ displayRule.setWallZoomTo(zoomTo.floatValue());
643
+ }
644
+ promise.resolve(null);
645
+ } else {
646
+ reject(promise, displayRuleId);
647
+ }
648
+ }
649
+
650
+ @ReactMethod
651
+ public void getExtrusionColor(String displayRuleId, final Promise promise) {
652
+ MPDisplayRule displayRule = getRule(displayRuleId);
653
+ if (displayRule != null) {
654
+ promise.resolve(displayRule.getExtrusionColor());
655
+ } else {
656
+ reject(promise, displayRuleId);
657
+ }
658
+ }
659
+
660
+ @ReactMethod
661
+ public void setExtrusionColor(String displayRuleId, String extrusionColor, final Promise promise) {
662
+ MPDisplayRule displayRule = getRule(displayRuleId);
663
+ if (displayRule != null) {
664
+ displayRule.setExtrusionColor(extrusionColor);
665
+ promise.resolve(null);
666
+ } else {
667
+ reject(promise, displayRuleId);
668
+ }
669
+ }
670
+
671
+ @ReactMethod
672
+ public void getExtrusionHeight(String displayRuleId, final Promise promise) {
673
+ MPDisplayRule displayRule = getRule(displayRuleId);
674
+ if (displayRule != null) {
675
+ promise.resolve(displayRule.getExtrusionHeight());
676
+ } else {
677
+ reject(promise, displayRuleId);
678
+ }
679
+ }
680
+
681
+ @ReactMethod
682
+ public void setExtrusionHeight(String displayRuleId, Double extrusionHeight, final Promise promise) {
683
+ MPDisplayRule displayRule = getRule(displayRuleId);
684
+ if (displayRule != null) {
685
+ if (extrusionHeight == -1) {
686
+ displayRule.setExtrusionHeight(null);
687
+ }else {
688
+ displayRule.setExtrusionHeight(extrusionHeight.floatValue());
689
+ }
690
+ promise.resolve(null);
691
+ } else {
692
+ reject(promise, displayRuleId);
693
+ }
694
+ }
695
+
696
+ @ReactMethod
697
+ public void getExtrusionZoomFrom(String displayRuleId, final Promise promise) {
698
+ MPDisplayRule displayRule = getRule(displayRuleId);
699
+ if (displayRule != null) {
700
+ promise.resolve(displayRule.getExtrusionZoomFrom());
701
+ } else {
702
+ reject(promise, displayRuleId);
703
+ }
704
+ }
705
+
706
+ @ReactMethod
707
+ public void setExtrusionZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
708
+ MPDisplayRule displayRule = getRule(displayRuleId);
709
+ if (displayRule != null) {
710
+ if (zoomFrom == -1) {
711
+ displayRule.setExtrusionZoomFrom(null);
712
+ }else {
713
+ displayRule.setExtrusionZoomFrom(zoomFrom.floatValue());
714
+ }
715
+ promise.resolve(null);
716
+ } else {
717
+ reject(promise, displayRuleId);
718
+ }
719
+ }
720
+
721
+ @ReactMethod
722
+ public void getExtrusionZoomTo(String displayRuleId, final Promise promise) {
723
+ MPDisplayRule displayRule = getRule(displayRuleId);
724
+ if (displayRule != null) {
725
+ promise.resolve(displayRule.getExtrusionZoomTo());
726
+ } else {
727
+ reject(promise, displayRuleId);
728
+ }
729
+ }
730
+
731
+ @ReactMethod
732
+ public void setExtrusionZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
733
+ MPDisplayRule displayRule = getRule(displayRuleId);
734
+ if (displayRule != null) {
735
+ if (zoomTo == -1) {
736
+ displayRule.setWallZoomTo(null);
737
+ }else {
738
+ displayRule.setExtrusionZoomTo(zoomTo.floatValue());
739
+ }
740
+ promise.resolve(null);
741
+ } else {
742
+ reject(promise, displayRuleId);
743
+ }
744
+ }
745
+
746
+ @ReactMethod
747
+ public void getModel2DZoomFrom(String displayRuleId, final Promise promise) {
748
+ MPDisplayRule displayRule = getRule(displayRuleId);
749
+ if (displayRule != null) {
750
+ promise.resolve(displayRule.getModel2DZoomFrom());
751
+ } else {
752
+ reject(promise, displayRuleId);
753
+ }
754
+ }
755
+
756
+ @ReactMethod
757
+ public void setModel2DZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
758
+ MPDisplayRule displayRule = getRule(displayRuleId);
759
+ if (displayRule != null) {
760
+ if (zoomFrom == -1) {
761
+ displayRule.setModel2DZoomFrom(null);
762
+ }else {
763
+ displayRule.setModel2DZoomFrom(zoomFrom.floatValue());
764
+ }
765
+ promise.resolve(null);
766
+ } else {
767
+ reject(promise, displayRuleId);
768
+ }
769
+ }
770
+
771
+ @ReactMethod
772
+ public void getModel2DZoomTo(String displayRuleId, final Promise promise) {
773
+ MPDisplayRule displayRule = getRule(displayRuleId);
774
+ if (displayRule != null) {
775
+ promise.resolve(displayRule.getModel2DZoomTo());
776
+ } else {
777
+ reject(promise, displayRuleId);
778
+ }
779
+ }
780
+
781
+ @ReactMethod
782
+ public void setModel2DZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
783
+ MPDisplayRule displayRule = getRule(displayRuleId);
784
+ if (displayRule != null) {
785
+ if (zoomTo == -1) {
786
+ displayRule.setModel2DZoomTo(null);
787
+ }else {
788
+ displayRule.setModel2DZoomTo(zoomTo.floatValue());
789
+ }
790
+ promise.resolve(null);
791
+ } else {
792
+ reject(promise, displayRuleId);
793
+ }
794
+ }
795
+
796
+ @ReactMethod
797
+ public void getModel2DWidthMeters(String displayRuleId, final Promise promise) {
798
+ MPDisplayRule displayRule = getRule(displayRuleId);
799
+ if (displayRule != null) {
800
+ promise.resolve(displayRule.getModel2DWidthMeters());
801
+ } else {
802
+ reject(promise, displayRuleId);
803
+ }
804
+ }
805
+
806
+ @ReactMethod
807
+ public void setModel2DWidthMeters(String displayRuleId, Double width, final Promise promise) {
808
+ MPDisplayRule displayRule = getRule(displayRuleId);
809
+ if (displayRule != null) {
810
+ if (width == -1) {
811
+ displayRule.setModel2DWidthMeters(null);
812
+ }else {
813
+ displayRule.setModel2DWidthMeters(width);
814
+ }
815
+ promise.resolve(null);
816
+ } else {
817
+ reject(promise, displayRuleId);
818
+ }
819
+ }
820
+
821
+ @ReactMethod
822
+ public void getModel2DHeightMeters(String displayRuleId, final Promise promise) {
823
+ MPDisplayRule displayRule = getRule(displayRuleId);
824
+ if (displayRule != null) {
825
+ promise.resolve(displayRule.getModel2DHeightMeters());
826
+ } else {
827
+ reject(promise, displayRuleId);
828
+ }
829
+ }
830
+
831
+ @ReactMethod
832
+ public void setModel2DHeightMeters(String displayRuleId, Double height, final Promise promise) {
833
+ MPDisplayRule displayRule = getRule(displayRuleId);
834
+ if (displayRule != null) {
835
+ if (height == -1) {
836
+ displayRule.setModel2DHeightMeters(null);
837
+ }else {
838
+ displayRule.setModel2DHeightMeters(height);
839
+ }
840
+ promise.resolve(null);
841
+ } else {
842
+ reject(promise, displayRuleId);
843
+ }
844
+ }
845
+
846
+ @ReactMethod
847
+ public void getModel2DBearing(String displayRuleId, final Promise promise) {
848
+ MPDisplayRule displayRule = getRule(displayRuleId);
849
+ if (displayRule != null) {
850
+ promise.resolve(displayRule.getModel2DBearing());
851
+ } else {
852
+ reject(promise, displayRuleId);
853
+ }
854
+ }
855
+
856
+ @ReactMethod
857
+ public void setModel2DBearing(String displayRuleId, Double bearing, final Promise promise) {
858
+ MPDisplayRule displayRule = getRule(displayRuleId);
859
+ if (displayRule != null) {
860
+ if (bearing == -1) {
861
+ displayRule.setModel2DBearing(null);
862
+ }else {
863
+ displayRule.setModel2DBearing(bearing);
864
+ }
865
+ promise.resolve(null);
866
+ } else {
867
+ reject(promise, displayRuleId);
868
+ }
869
+ }
870
+
871
+ @ReactMethod
872
+ public void getModel2DModel(String displayRuleId, final Promise promise) {
873
+ MPDisplayRule displayRule = getRule(displayRuleId);
874
+ if (displayRule != null) {
875
+ promise.resolve(displayRule.getModel2DModel());
876
+ } else {
877
+ reject(promise, displayRuleId);
878
+ }
879
+ }
880
+
881
+ @ReactMethod
882
+ public void setModel2DModel(String displayRuleId, String model, final Promise promise) {
883
+ MPDisplayRule displayRule = getRule(displayRuleId);
884
+ if (displayRule != null) {
885
+ displayRule.setModel2DModel(model);
886
+ promise.resolve(null);
887
+ } else {
888
+ reject(promise, displayRuleId);
889
+ }
890
+ }
891
+
892
+ @ReactMethod
893
+ public void getIconScale(String displayRuleId, final Promise promise) {
894
+ MPDisplayRule displayRule = getRule(displayRuleId);
895
+ if (displayRule != null) {
896
+ promise.resolve(displayRule.getIconScale());
897
+ } else {
898
+ reject(promise, displayRuleId);
899
+ }
900
+ }
901
+
902
+ @ReactMethod
903
+ public void setIconScale(String displayRuleId, Double scale, final Promise promise) {
904
+ MPDisplayRule displayRule = getRule(displayRuleId);
905
+ if (displayRule != null) {
906
+ if (scale == -1) {
907
+ displayRule.setIconScale(null);
908
+ }else {
909
+ displayRule.setIconScale(scale.floatValue());
910
+ }
911
+ promise.resolve(null);
912
+ } else {
913
+ reject(promise, displayRuleId);
914
+ }
915
+ }
916
+
917
+ @ReactMethod
918
+ public void getIconPlacement(String displayRuleId, final Promise promise) {
919
+ MPDisplayRule displayRule = getRule(displayRuleId);
920
+ if (displayRule != null) {
921
+ promise.resolve(displayRule.getIconPlacement() != null ? displayRule.getIconPlacement().ordinal() : null);
922
+ } else {
923
+ reject(promise, displayRuleId);
924
+ }
925
+ }
926
+
927
+ @ReactMethod
928
+ public void setIconPlacement(String displayRuleId, Integer placement, final Promise promise) {
929
+ MPDisplayRule displayRule = getRule(displayRuleId);
930
+ if (displayRule != null) {
931
+ if (placement == -1) {
932
+ displayRule.setIconPlacement(null);
933
+ }else {
934
+ MPIconPlacement iconPlacement;
935
+ switch (placement) {
936
+ case 1:
937
+ iconPlacement = MPIconPlacement.ABOVE;
938
+ break;
939
+ case 2:
940
+ iconPlacement = MPIconPlacement.BELOW;
941
+ break;
942
+ case 3:
943
+ iconPlacement = MPIconPlacement.LEFT;
944
+ break;
945
+ case 4:
946
+ iconPlacement = MPIconPlacement.RIGHT;
947
+ break;
948
+ default:
949
+ iconPlacement = MPIconPlacement.CENTER;
950
+ break;
951
+ }
952
+ displayRule.setIconPlacement(iconPlacement);
953
+ }
954
+ promise.resolve(null);
955
+ } else {
956
+ reject(promise, displayRuleId);
957
+ }
958
+ }
959
+
960
+ @ReactMethod
961
+ public void getLabelType(String displayRuleId, final Promise promise) {
962
+ MPDisplayRule displayRule = getRule(displayRuleId);
963
+ if (displayRule != null) {
964
+ promise.resolve(displayRule.getLabelType() != null ? displayRule.getLabelType().ordinal() : null);
965
+ } else {
966
+ reject(promise, displayRuleId);
967
+ }
968
+ }
969
+
970
+ @ReactMethod
971
+ public void setLabelType(String displayRuleId, Integer type, final Promise promise) {
972
+ MPDisplayRule displayRule = getRule(displayRuleId);
973
+ if (displayRule != null) {
974
+ if (type == -1) {
975
+ displayRule.setLabelType(null);
976
+ }else {
977
+ MPLabelType labelType;
978
+ switch (type) {
979
+ case 1:
980
+ labelType = MPLabelType.FLAT;
981
+ break;
982
+ default:
983
+ labelType = MPLabelType.FLOATING;
984
+ break;
985
+ }
986
+ displayRule.setLabelType(labelType);
987
+ }
988
+ promise.resolve(null);
989
+ } else {
990
+ reject(promise, displayRuleId);
991
+ }
992
+ }
993
+
994
+ @ReactMethod
995
+ public void getLabelStyleTextSize(String displayRuleId, final Promise promise) {
996
+ MPDisplayRule displayRule = getRule(displayRuleId);
997
+ if (displayRule != null) {
998
+ promise.resolve(displayRule.getLabelStyleTextSize());
999
+ } else {
1000
+ reject(promise, displayRuleId);
1001
+ }
1002
+ }
1003
+
1004
+ @ReactMethod
1005
+ public void setLabelStyleTextSize(String displayRuleId, Double textSize, final Promise promise) {
1006
+ MPDisplayRule displayRule = getRule(displayRuleId);
1007
+ if (displayRule != null) {
1008
+ if (textSize == -1) {
1009
+ displayRule.setLabelStyleTextSize(null);
1010
+ }else {
1011
+ displayRule.setLabelStyleTextSize(textSize.intValue());
1012
+ }
1013
+ promise.resolve(null);
1014
+ } else {
1015
+ reject(promise, displayRuleId);
1016
+ }
1017
+ }
1018
+
1019
+ @ReactMethod
1020
+ public void getLabelStyleTextColor(String displayRuleId, final Promise promise) {
1021
+ MPDisplayRule displayRule = getRule(displayRuleId);
1022
+ if (displayRule != null) {
1023
+ promise.resolve(displayRule.getLabelStyleTextColor());
1024
+ } else {
1025
+ reject(promise, displayRuleId);
1026
+ }
1027
+ }
1028
+
1029
+ @ReactMethod
1030
+ public void setLabelStyleTextColor(String displayRuleId, String color, final Promise promise) {
1031
+ MPDisplayRule displayRule = getRule(displayRuleId);
1032
+ if (displayRule != null) {
1033
+ displayRule.setLabelStyleTextColor(color);
1034
+ promise.resolve(null);
1035
+ } else {
1036
+ reject(promise, displayRuleId);
1037
+ }
1038
+ }
1039
+
1040
+ @ReactMethod
1041
+ public void getLabelStyleTextOpacity(String displayRuleId, final Promise promise) {
1042
+ MPDisplayRule displayRule = getRule(displayRuleId);
1043
+ if (displayRule != null) {
1044
+ promise.resolve(displayRule.getLabelStyleTextOpacity());
1045
+ } else {
1046
+ reject(promise, displayRuleId);
1047
+ }
1048
+ }
1049
+
1050
+ @ReactMethod
1051
+ public void setLabelStyleTextOpacity(String displayRuleId, Double opacity, final Promise promise) {
1052
+ MPDisplayRule displayRule = getRule(displayRuleId);
1053
+ if (displayRule != null) {
1054
+ if (opacity == -1) {
1055
+ displayRule.setLabelStyleTextOpacity(null);
1056
+ }else {
1057
+ displayRule.setLabelStyleTextOpacity(opacity.floatValue());
1058
+ }
1059
+ promise.resolve(null);
1060
+ } else {
1061
+ reject(promise, displayRuleId);
1062
+ }
1063
+ }
1064
+
1065
+ @ReactMethod
1066
+ public void getLabelStyleHaloColor(String displayRuleId, final Promise promise) {
1067
+ MPDisplayRule displayRule = getRule(displayRuleId);
1068
+ if (displayRule != null) {
1069
+ promise.resolve(displayRule.getLabelStyleHaloColor());
1070
+ } else {
1071
+ reject(promise, displayRuleId);
1072
+ }
1073
+ }
1074
+
1075
+ @ReactMethod
1076
+ public void setLabelStyleHaloColor(String displayRuleId, String color, final Promise promise) {
1077
+ MPDisplayRule displayRule = getRule(displayRuleId);
1078
+ if (displayRule != null) {
1079
+ displayRule.setLabelStyleHaloColor(color);
1080
+ promise.resolve(null);
1081
+ } else {
1082
+ reject(promise, displayRuleId);
1083
+ }
1084
+ }
1085
+
1086
+ @ReactMethod
1087
+ public void getLabelStyleHaloWidth(String displayRuleId, final Promise promise) {
1088
+ MPDisplayRule displayRule = getRule(displayRuleId);
1089
+ if (displayRule != null) {
1090
+ promise.resolve(displayRule.getLabelStyleHaloWidth());
1091
+ } else {
1092
+ reject(promise, displayRuleId);
1093
+ }
1094
+ }
1095
+
1096
+ @ReactMethod
1097
+ public void setLabelStyleHaloWidth(String displayRuleId, Double width, final Promise promise) {
1098
+ MPDisplayRule displayRule = getRule(displayRuleId);
1099
+ if (displayRule != null) {
1100
+ if (width == -1) {
1101
+ displayRule.setLabelStyleHaloWidth(null);
1102
+ }else {
1103
+ displayRule.setLabelStyleHaloWidth(width.intValue());
1104
+ }
1105
+ promise.resolve(null);
1106
+ } else {
1107
+ reject(promise, displayRuleId);
1108
+ }
1109
+ }
1110
+
1111
+ @ReactMethod
1112
+ public void getLabelStyleHaloBlur(String displayRuleId, final Promise promise) {
1113
+ MPDisplayRule displayRule = getRule(displayRuleId);
1114
+ if (displayRule != null) {
1115
+ promise.resolve(displayRule.getLabelStyleHaloBlur());
1116
+ } else {
1117
+ reject(promise, displayRuleId);
1118
+ }
1119
+ }
1120
+
1121
+ @ReactMethod
1122
+ public void setLabelStyleHaloBlur(String displayRuleId, Double blur, final Promise promise) {
1123
+ MPDisplayRule displayRule = getRule(displayRuleId);
1124
+ if (displayRule != null) {
1125
+ if (blur == -1) {
1126
+ displayRule.setLabelStyleHaloBlur(null);
1127
+ }else {
1128
+ displayRule.setLabelStyleHaloBlur(blur.intValue());
1129
+ }
1130
+ promise.resolve(null);
1131
+ } else {
1132
+ reject(promise, displayRuleId);
1133
+ }
1134
+ }
1135
+
1136
+ @ReactMethod
1137
+ public void getLabelStyleBearing(String displayRuleId, final Promise promise) {
1138
+ MPDisplayRule displayRule = getRule(displayRuleId);
1139
+ if (displayRule != null) {
1140
+ promise.resolve(displayRule.getLabelStyleBearing());
1141
+ } else {
1142
+ reject(promise, displayRuleId);
1143
+ }
1144
+ }
1145
+
1146
+ @ReactMethod
1147
+ public void setLabelStyleBearing(String displayRuleId, Double bearing, final Promise promise) {
1148
+ MPDisplayRule displayRule = getRule(displayRuleId);
1149
+ if (displayRule != null) {
1150
+ if (bearing == -1) {
1151
+ displayRule.setLabelStyleBearing(null);
1152
+ }else {
1153
+ displayRule.setLabelStyleBearing(bearing.floatValue());
1154
+ }
1155
+ promise.resolve(null);
1156
+ } else {
1157
+ reject(promise, displayRuleId);
1158
+ }
1159
+ }
1160
+
1161
+ @ReactMethod
1162
+ public void getPolygonLightnessFactor(String displayRuleId, final Promise promise) {
1163
+ MPDisplayRule displayRule = getRule(displayRuleId);
1164
+ if (displayRule != null) {
1165
+ promise.resolve(displayRule.getPolygonLightnessFactor());
1166
+ } else {
1167
+ reject(promise, displayRuleId);
1168
+ }
1169
+ }
1170
+
1171
+ @ReactMethod
1172
+ public void setPolygonLightnessFactor(String displayRuleId, Double factor, final Promise promise) {
1173
+ MPDisplayRule displayRule = getRule(displayRuleId);
1174
+ if (displayRule != null) {
1175
+ if (factor == -1) {
1176
+ displayRule.setPolygonLightnessFactor(null);
1177
+ }else {
1178
+ displayRule.setPolygonLightnessFactor(factor.floatValue());
1179
+ }
1180
+ promise.resolve(null);
1181
+ } else {
1182
+ reject(promise, displayRuleId);
1183
+ }
1184
+ }
1185
+
1186
+ @ReactMethod
1187
+ public void getWallLightnessFactor(String displayRuleId, final Promise promise) {
1188
+ MPDisplayRule displayRule = getRule(displayRuleId);
1189
+ if (displayRule != null) {
1190
+ promise.resolve(displayRule.getWallLightnessFactor());
1191
+ } else {
1192
+ reject(promise, displayRuleId);
1193
+ }
1194
+ }
1195
+
1196
+ @ReactMethod
1197
+ public void setWallLightnessFactor(String displayRuleId, Double factor, final Promise promise) {
1198
+ MPDisplayRule displayRule = getRule(displayRuleId);
1199
+ if (displayRule != null) {
1200
+ if (factor == -1) {
1201
+ displayRule.setWallLightnessFactor(null);
1202
+ }else {
1203
+ displayRule.setWallLightnessFactor(factor.floatValue());
1204
+ }
1205
+ promise.resolve(null);
1206
+ } else {
1207
+ reject(promise, displayRuleId);
1208
+ }
1209
+ }
1210
+
1211
+ @ReactMethod
1212
+ public void getExtrusionLightnessFactor(String displayRuleId, final Promise promise) {
1213
+ MPDisplayRule displayRule = getRule(displayRuleId);
1214
+ if (displayRule != null) {
1215
+ promise.resolve(displayRule.getExtrusionLightnessFactor());
1216
+ } else {
1217
+ reject(promise, displayRuleId);
1218
+ }
1219
+ }
1220
+
1221
+ @ReactMethod
1222
+ public void setExtrusionLightnessFactor(String displayRuleId, Double factor, final Promise promise) {
1223
+ MPDisplayRule displayRule = getRule(displayRuleId);
1224
+ if (displayRule != null) {
1225
+ if (factor == -1) {
1226
+ displayRule.setExtrusionLightnessFactor(null);
1227
+ }else {
1228
+ displayRule.setExtrusionLightnessFactor(factor.floatValue());
1229
+ }
1230
+ displayRule.setExtrusionLightnessFactor(factor.floatValue());
1231
+ promise.resolve(null);
1232
+ } else {
1233
+ reject(promise, displayRuleId);
1234
+ }
1235
+ }
1236
+
1237
+ @ReactMethod
1238
+ public void isBadgeVisible(String displayRuleId, final Promise promise) {
1239
+ MPDisplayRule displayRule = getRule(displayRuleId);
1240
+ if (displayRule != null) {
1241
+ promise.resolve(displayRule.isBadgeVisible());
1242
+ } else {
1243
+ reject(promise, displayRuleId);
1244
+ }
1245
+ }
1246
+
1247
+ @ReactMethod
1248
+ public void setBadgeVisible(String displayRuleId, String visible, final Promise promise) {
1249
+ MPDisplayRule displayRule = getRule(displayRuleId);
1250
+ if (displayRule != null) {
1251
+ displayRule.setBadgeVisible(Boolean.valueOf(visible));
1252
+ promise.resolve(null);
1253
+ } else {
1254
+ reject(promise, displayRuleId);
1255
+ }
1256
+ }
1257
+
1258
+ @ReactMethod
1259
+ public void getBadgeZoomFrom(String displayRuleId, final Promise promise) {
1260
+ MPDisplayRule displayRule = getRule(displayRuleId);
1261
+ if (displayRule != null) {
1262
+ promise.resolve(displayRule.getBadgeZoomFrom());
1263
+ } else {
1264
+ reject(promise, displayRuleId);
1265
+ }
1266
+ }
1267
+
1268
+ @ReactMethod
1269
+ public void setBadgeZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
1270
+ MPDisplayRule displayRule = getRule(displayRuleId);
1271
+ if (displayRule != null) {
1272
+ if (zoomFrom == -1) {
1273
+ displayRule.setBadgeZoomFrom(null);
1274
+ }else {
1275
+ displayRule.setBadgeZoomFrom(zoomFrom.floatValue());
1276
+ }
1277
+ displayRule.setBadgeZoomFrom(zoomFrom.floatValue());
1278
+ promise.resolve(null);
1279
+ } else {
1280
+ reject(promise, displayRuleId);
1281
+ }
1282
+ }
1283
+
1284
+ @ReactMethod
1285
+ public void getBadgeZoomTo(String displayRuleId, final Promise promise) {
1286
+ MPDisplayRule displayRule = getRule(displayRuleId);
1287
+ if (displayRule != null) {
1288
+ promise.resolve(displayRule.getBadgeZoomTo());
1289
+ } else {
1290
+ reject(promise, displayRuleId);
1291
+ }
1292
+ }
1293
+
1294
+ @ReactMethod
1295
+ public void setBadgeZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
1296
+ MPDisplayRule displayRule = getRule(displayRuleId);
1297
+ if (displayRule != null) {
1298
+ if (zoomTo == -1) {
1299
+ displayRule.setBadgeZoomTo(null);
1300
+ }else {
1301
+ displayRule.setBadgeZoomTo(zoomTo.floatValue());
1302
+ }
1303
+ promise.resolve(null);
1304
+ } else {
1305
+ reject(promise, displayRuleId);
1306
+ }
1307
+ }
1308
+
1309
+ @ReactMethod
1310
+ public void getBadgeRadius(String displayRuleId, final Promise promise) {
1311
+ MPDisplayRule displayRule = getRule(displayRuleId);
1312
+ if (displayRule != null) {
1313
+ promise.resolve(displayRule.getBadgeRadius());
1314
+ } else {
1315
+ reject(promise, displayRuleId);
1316
+ }
1317
+ }
1318
+
1319
+ @ReactMethod
1320
+ public void setBadgeRadius(String displayRuleId, Double radius, final Promise promise) {
1321
+ MPDisplayRule displayRule = getRule(displayRuleId);
1322
+ if (displayRule != null) {
1323
+ if (radius == -1) {
1324
+ displayRule.setBadgeRadius(null);
1325
+ }else {
1326
+ displayRule.setBadgeRadius(radius.intValue());
1327
+ }
1328
+ promise.resolve(null);
1329
+ } else {
1330
+ reject(promise, displayRuleId);
1331
+ }
1332
+ }
1333
+
1334
+ @ReactMethod
1335
+ public void getBadgeStrokeWidth(String displayRuleId, final Promise promise) {
1336
+ MPDisplayRule displayRule = getRule(displayRuleId);
1337
+ if (displayRule != null) {
1338
+ promise.resolve(displayRule.getBadgeStrokeWidth());
1339
+ } else {
1340
+ reject(promise, displayRuleId);
1341
+ }
1342
+ }
1343
+
1344
+ @ReactMethod
1345
+ public void setBadgeStrokeWidth(String displayRuleId, Double strokeWidth, final Promise promise) {
1346
+ MPDisplayRule displayRule = getRule(displayRuleId);
1347
+ if (displayRule != null) {
1348
+ if (strokeWidth == -1) {
1349
+ displayRule.setBadgeStrokeWidth(null);
1350
+ }else {
1351
+ displayRule.setBadgeStrokeWidth(strokeWidth.floatValue());
1352
+ }
1353
+ promise.resolve(null);
1354
+ } else {
1355
+ reject(promise, displayRuleId);
1356
+ }
1357
+ }
1358
+
1359
+ @ReactMethod
1360
+ public void getBadgeStrokeColor(String displayRuleId, final Promise promise) {
1361
+ MPDisplayRule displayRule = getRule(displayRuleId);
1362
+ if (displayRule != null) {
1363
+ promise.resolve(displayRule.getBadgeStrokeColor());
1364
+ } else {
1365
+ reject(promise, displayRuleId);
1366
+ }
1367
+ }
1368
+
1369
+ @ReactMethod
1370
+ public void setBadgeStrokeColor(String displayRuleId, String color, final Promise promise) {
1371
+ MPDisplayRule displayRule = getRule(displayRuleId);
1372
+ if (displayRule != null) {
1373
+ displayRule.setBadgeStrokeColor(color);
1374
+ promise.resolve(null);
1375
+ } else {
1376
+ reject(promise, displayRuleId);
1377
+ }
1378
+ }
1379
+
1380
+ @ReactMethod
1381
+ public void getBadgeFillColor(String displayRuleId, final Promise promise) {
1382
+ MPDisplayRule displayRule = getRule(displayRuleId);
1383
+ if (displayRule != null) {
1384
+ promise.resolve(displayRule.getBadgeFillColor());
1385
+ } else {
1386
+ reject(promise, displayRuleId);
1387
+ }
1388
+ }
1389
+
1390
+ @ReactMethod
1391
+ public void setBadgeFillColor(String displayRuleId, String color, final Promise promise) {
1392
+ MPDisplayRule displayRule = getRule(displayRuleId);
1393
+ if (displayRule != null) {
1394
+ displayRule.setBadgeFillColor(color);
1395
+ promise.resolve(null);
1396
+ } else {
1397
+ reject(promise, displayRuleId);
1398
+ }
1399
+ }
1400
+
1401
+ @ReactMethod
1402
+ public void getBadgeScale(String displayRuleId, final Promise promise) {
1403
+ MPDisplayRule displayRule = getRule(displayRuleId);
1404
+ if (displayRule != null) {
1405
+ promise.resolve(displayRule.getBadgeScale());
1406
+ } else {
1407
+ reject(promise, displayRuleId);
1408
+ }
1409
+ }
1410
+
1411
+ @ReactMethod
1412
+ public void setBadgeScale(String displayRuleId, Double scale, final Promise promise) {
1413
+ MPDisplayRule displayRule = getRule(displayRuleId);
1414
+ if (displayRule != null) {
1415
+ if (scale == -1) {
1416
+ displayRule.setBadgeScale(null);
1417
+ }else {
1418
+ displayRule.setBadgeScale(scale.floatValue());
1419
+ }
1420
+ promise.resolve(null);
1421
+ } else {
1422
+ reject(promise, displayRuleId);
1423
+ }
1424
+ }
1425
+
1426
+ @ReactMethod
1427
+ public void getBadgePosition(String displayRuleId, final Promise promise) {
1428
+ MPDisplayRule displayRule = getRule(displayRuleId);
1429
+ if (displayRule != null) {
1430
+ MPBadgePosition badgePosition = displayRule.getBadgePosition();
1431
+ if (badgePosition != null) {
1432
+ if (badgePosition.equals(MPBadgePosition.bottomLeft)) {
1433
+ promise.resolve(1);
1434
+ }else if (badgePosition.equals(MPBadgePosition.bottomRight)) {
1435
+ promise.resolve(0);
1436
+ }else if (badgePosition.equals(MPBadgePosition.topLeft)) {
1437
+ promise.resolve(2);
1438
+ }else {
1439
+ promise.resolve(3);
1440
+ }
1441
+ }else {
1442
+ promise.resolve(null);
1443
+ }
1444
+ } else {
1445
+ reject(promise, displayRuleId);
1446
+ }
1447
+ }
1448
+
1449
+ @ReactMethod
1450
+ public void setBadgePosition(String displayRuleId, Integer position, final Promise promise) {
1451
+ MPDisplayRule displayRule = getRule(displayRuleId);
1452
+ if (displayRule != null) {
1453
+ MPBadgePosition badgePosition;
1454
+ switch (position) {
1455
+ case 1:
1456
+ badgePosition = MPBadgePosition.bottomLeft;
1457
+ break;
1458
+ case 2:
1459
+ badgePosition = MPBadgePosition.topLeft;
1460
+ break;
1461
+ case 3:
1462
+ badgePosition = MPBadgePosition.topRight;
1463
+ break;
1464
+ default:
1465
+ badgePosition = MPBadgePosition.bottomRight;
1466
+ break;
1467
+ }
1468
+ displayRule.setBadgePosition(badgePosition);
1469
+ promise.resolve(null);
1470
+ } else {
1471
+ reject(promise, displayRuleId);
1472
+ }
1473
+ }
1474
+
1475
+ @ReactMethod
1476
+ public void reset(String displayRuleId, final Promise promise) {
1477
+ MPDisplayRule displayRule = getRule(displayRuleId);
1478
+ if (displayRule != null) {
1479
+ displayRule.reset();
1480
+ promise.resolve(null);
1481
+ } else {
1482
+ reject(promise, displayRuleId);
1483
+ }
1484
+ }
1485
+
1486
+ }