@mapsindoors/react-native-maps-indoors-mapbox 1.0.2 → 1.0.4

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 (150) hide show
  1. package/LICENSE +10 -10
  2. package/README.md +187 -187
  3. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  4. package/android/.gradle/7.4/checksums/md5-checksums.bin +0 -0
  5. package/android/.gradle/7.4/checksums/sha1-checksums.bin +0 -0
  6. package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +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/fileHashes/fileHashes.bin +0 -0
  10. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  11. package/android/.gradle/7.4/fileHashes/resourceHashesCache.bin +0 -0
  12. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  13. package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
  14. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  15. package/android/.gradle/file-system.probe +0 -0
  16. package/android/.idea/compiler.xml +6 -0
  17. package/android/.idea/gradle.xml +19 -0
  18. package/android/.idea/jarRepositories.xml +60 -0
  19. package/android/.idea/misc.xml +10 -0
  20. package/android/.idea/vcs.xml +7 -0
  21. package/android/README.md +14 -14
  22. package/android/build.gradle +166 -166
  23. package/android/gradle/wrapper/gradle-wrapper.properties +5 -5
  24. package/android/gradle.properties +16 -16
  25. package/android/gradlew +234 -234
  26. package/android/local.properties +8 -0
  27. package/android/src/main/AndroidManifest.xml +6 -6
  28. package/android/src/main/java/com/reactlibrary/MapboxMapView.java +116 -116
  29. package/android/src/main/java/com/reactlibrary/MapsIndoorsPackage.java +53 -53
  30. package/android/src/main/java/com/reactlibrary/MapsIndoorsViewManager.java +119 -119
  31. package/android/src/main/java/com/reactlibrary/core/DirectionsRendererModule.java +218 -208
  32. package/android/src/main/java/com/reactlibrary/core/DirectionsServiceModule.java +130 -130
  33. package/android/src/main/java/com/reactlibrary/core/MPDisplayRuleModule.java +816 -816
  34. package/android/src/main/java/com/reactlibrary/core/MapControlModule.java +638 -628
  35. package/android/src/main/java/com/reactlibrary/core/MapsIndoorsModule.java +327 -327
  36. package/android/src/main/java/com/reactlibrary/core/RCMapView.java +16 -16
  37. package/android/src/main/java/com/reactlibrary/core/README.md +92 -92
  38. package/android/src/main/java/com/reactlibrary/core/UtilsModule.java +166 -166
  39. package/android/src/main/java/com/reactlibrary/core/models/Bounds.java +19 -19
  40. package/android/src/main/java/com/reactlibrary/core/models/Filter.java +77 -77
  41. package/android/src/main/java/com/reactlibrary/core/models/Location.java +17 -17
  42. package/android/src/main/java/com/reactlibrary/core/models/MPCameraPosition.java +34 -34
  43. package/android/src/main/java/com/reactlibrary/core/models/MPCameraUpdate.java +68 -68
  44. package/android/src/main/java/com/reactlibrary/core/models/MPError.java +38 -38
  45. package/android/src/main/java/com/reactlibrary/core/models/PositionProvider.java +46 -46
  46. package/android/src/main/java/com/reactlibrary/core/models/PositionResult.java +117 -117
  47. package/android/src/main/java/com/reactlibrary/core/models/Query.java +30 -30
  48. package/android/src/main/res/values/google_maps_api_key.xml +3 -3
  49. package/android/src/main/res/values/mapbox_api_key.xml +5 -5
  50. package/index.ts +183 -183
  51. package/ios/MapsIndoors.xcodeproj/project.pbxproj +318 -318
  52. package/ios/MapsIndoors.xcworkspace/contents.xcworkspacedata +7 -7
  53. package/ios/MapsIndoors.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
  54. package/ios/MapsIndoorsViewManager.swift +111 -111
  55. package/ios/MapsIndoorsViewManagerBridge.m +9 -9
  56. package/ios/core/CameraPosition.swift +15 -15
  57. package/ios/core/CameraUpdate.swift +19 -19
  58. package/ios/core/CameraUpdateError.swift +11 -11
  59. package/ios/core/DirectionsRendererBridge.m +61 -57
  60. package/ios/core/DirectionsRendererModule.swift +251 -237
  61. package/ios/core/DirectionsServiceBridge.m +46 -46
  62. package/ios/core/DirectionsServiceModule.swift +149 -149
  63. package/ios/core/MPDisplayRuleBridge.m +410 -410
  64. package/ios/core/MPDisplayRuleModule.swift +845 -845
  65. package/ios/core/MapControlBridge.m +184 -178
  66. package/ios/core/MapControlModule.swift +566 -515
  67. package/ios/core/MapsIndoorsBridge.m +116 -116
  68. package/ios/core/MapsIndoorsData.swift +218 -218
  69. package/ios/core/MapsIndoorsModule.swift +296 -296
  70. package/ios/core/RCMapView.swift +14 -14
  71. package/ios/core/README.md +92 -92
  72. package/ios/core/ReactPositionProvider.swift +25 -25
  73. package/ios/core/UtilsBridge.m +63 -63
  74. package/ios/core/UtilsModule.swift +146 -146
  75. package/ios/core/helpers.swift +57 -57
  76. package/ios/react-native-maps-indoors-Bridging-Header.h +6 -6
  77. package/package.json +53 -53
  78. package/react-native-maps-indoors-mapbox.podspec +30 -30
  79. package/src/core/EventNames.ts +20 -20
  80. package/src/core/MPBounds.ts +154 -154
  81. package/src/core/MPBuilding.ts +333 -333
  82. package/src/core/MPBuildingCollection.ts +56 -56
  83. package/src/core/MPBuildingInfo.ts +62 -62
  84. package/src/core/MPCameraEvent.ts +16 -16
  85. package/src/core/MPCameraEventListener.ts +16 -16
  86. package/src/core/MPCameraPosition.ts +82 -82
  87. package/src/core/MPCameraUpdate.ts +174 -174
  88. package/src/core/MPCameraViewFitMode.ts +20 -20
  89. package/src/core/MPCategory.ts +75 -75
  90. package/src/core/MPCategoryCollection.ts +61 -61
  91. package/src/core/MPCollection.ts +58 -58
  92. package/src/core/MPCollisionHandling.ts +11 -11
  93. package/src/core/MPDataField.ts +68 -68
  94. package/src/core/MPDirectionsRenderer.ts +205 -193
  95. package/src/core/MPDirectionsService.ts +118 -118
  96. package/src/core/MPDisplayRule.ts +1027 -1027
  97. package/src/core/MPEntity.ts +59 -59
  98. package/src/core/MPEntityInfo.ts +27 -27
  99. package/src/core/MPError.ts +122 -122
  100. package/src/core/MPFilter.ts +167 -167
  101. package/src/core/MPFilterBehavior.ts +94 -94
  102. package/src/core/MPFloor.ts +169 -169
  103. package/src/core/MPFloorSelectorInterface.ts +62 -62
  104. package/src/core/MPGeometry.ts +90 -90
  105. package/src/core/MPHighway.ts +14 -14
  106. package/src/core/MPIconSize.ts +38 -38
  107. package/src/core/MPLocation.ts +385 -385
  108. package/src/core/MPLocationPropertyNames.ts +29 -29
  109. package/src/core/MPLocationType.ts +15 -15
  110. package/src/core/MPMapConfig.ts +210 -210
  111. package/src/core/MPMapStyle.ts +56 -56
  112. package/src/core/MPMultiPolygon.ts +217 -217
  113. package/src/core/MPPoint.ts +169 -169
  114. package/src/core/MPPolygon.ts +218 -218
  115. package/src/core/MPPositionProviderInterface.ts +44 -44
  116. package/src/core/MPPositionResultInterface.ts +41 -41
  117. package/src/core/MPPropertyData.ts +214 -214
  118. package/src/core/MPQuery.ts +68 -68
  119. package/src/core/MPRoute.ts +94 -94
  120. package/src/core/MPRouteCoordinate.ts +94 -94
  121. package/src/core/MPRouteLeg.ts +127 -127
  122. package/src/core/MPRouteProperty.ts +82 -82
  123. package/src/core/MPRouteStep.ts +176 -176
  124. package/src/core/MPSelectionBehavior.ts +92 -92
  125. package/src/core/MPSettings3D.ts +106 -106
  126. package/src/core/MPSize.ts +20 -20
  127. package/src/core/MPSolution.ts +179 -179
  128. package/src/core/MPSolutionConfig.ts +126 -126
  129. package/src/core/MPSolutionDisplayRule.ts +13 -13
  130. package/src/core/MPUserRole.ts +59 -59
  131. package/src/core/MPUserRoleCollection.ts +36 -36
  132. package/src/core/MPUtils.ts +156 -156
  133. package/src/core/MPVenue.ts +293 -293
  134. package/src/core/MPVenueCollection.ts +57 -57
  135. package/src/core/MPVenueInfo.ts +61 -61
  136. package/src/core/MapControl.ts +882 -864
  137. package/src/core/MapView.tsx +33 -33
  138. package/src/core/MapsIndoors.ts +530 -530
  139. package/src/core/OnBuildingFoundAtCameraTargetListener.ts +16 -16
  140. package/src/core/OnFloorSelectionChangedListener.ts +16 -16
  141. package/src/core/OnFloorUpdateListener.ts +15 -15
  142. package/src/core/OnLegSelectedListener.ts +16 -16
  143. package/src/core/OnLiveLocationUpdateListener.ts +16 -16
  144. package/src/core/OnLocationSelectedListener.ts +16 -16
  145. package/src/core/OnMapClickListener.ts +19 -19
  146. package/src/core/OnMarkerClickListener.ts +16 -16
  147. package/src/core/OnMarkerInfoWindowClickListener.ts +16 -16
  148. package/src/core/OnPositionUpdateListener.ts +16 -16
  149. package/src/core/OnVenueFoundAtCameraTargetListener.ts +16 -16
  150. package/src/core/README.md +92 -92
@@ -1,816 +1,816 @@
1
- package com.reactlibrary.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.MPDisplayRule;
11
- import com.mapsindoors.core.MPIconSize;
12
- import com.mapsindoors.core.MPSolutionDisplayRule;
13
- import com.mapsindoors.core.MapsIndoors;
14
- import com.mapsindoors.core.errors.MIError;
15
- import com.mapsindoors.core.errors.MIErrorEnum;
16
- import com.reactlibrary.core.models.MPError;
17
-
18
- public class MPDisplayRuleModule extends ReactContextBaseJavaModule {
19
- private final Gson gson = new Gson();
20
-
21
- public MPDisplayRuleModule(@NonNull ReactApplicationContext reactContext) {
22
- super(reactContext);
23
- }
24
-
25
- @NonNull
26
- @Override
27
- public String getName() {
28
- return "DisplayRule";
29
- }
30
-
31
- private void reject(Promise promise, String id) {
32
- promise.reject("DisplayRuleError",
33
- gson.toJson(MPError.fromMIError(
34
- new MIError(MIErrorEnum.UNKNOWN_ERROR,
35
- "The DisplayRule (id: "+ id +") cannot be found"))));
36
- }
37
-
38
- private MPDisplayRule getRule(String name) {
39
- switch (name) {
40
- case "buildingOutline" : return MapsIndoors.getDisplayRule(MPSolutionDisplayRule.BUILDING_OUTLINE);
41
- case "selectionHighlight": return MapsIndoors.getDisplayRule(MPSolutionDisplayRule.SELECTION_HIGHLIGHT);
42
- case "positionIndicator": return MapsIndoors.getDisplayRule(MPSolutionDisplayRule.POSITION_INDICATOR);
43
- default: return MapsIndoors.getDisplayRule(name);
44
- }
45
- }
46
-
47
- @ReactMethod
48
- public void isVisible(String displayRuleId, final Promise promise) {
49
- MPDisplayRule displayRule = getRule(displayRuleId);
50
- if (displayRule != null) {
51
- promise.resolve(displayRule.isVisible());
52
- } else {
53
- reject(promise, displayRuleId);
54
- }
55
- }
56
-
57
- @ReactMethod
58
- public void setVisible(String displayRuleId, boolean isVisible, final Promise promise) {
59
- MPDisplayRule displayRule = getRule(displayRuleId);
60
- if (displayRule != null) {
61
- displayRule.setVisible(isVisible);
62
- promise.resolve(null);
63
- } else {
64
- reject(promise, displayRuleId);
65
- }
66
- }
67
-
68
- @ReactMethod
69
- public void isIconVisible(String displayRuleId, final Promise promise) {
70
- MPDisplayRule displayRule = getRule(displayRuleId);
71
- if (displayRule != null) {
72
- promise.resolve(displayRule.isIconVisible());
73
- } else {
74
- reject(promise, displayRuleId);
75
- }
76
- }
77
-
78
- @ReactMethod
79
- public void setIconVisible(String displayRuleId, boolean iconVisible, final Promise promise) {
80
- MPDisplayRule displayRule = getRule(displayRuleId);
81
- if (displayRule != null) {
82
- displayRule.setIconVisible(iconVisible);
83
- promise.resolve(null);
84
- } else {
85
- reject(promise, displayRuleId);
86
- }
87
- }
88
-
89
- @ReactMethod
90
- public void isPolygonVisible(String displayRuleId, final Promise promise) {
91
- MPDisplayRule displayRule = getRule(displayRuleId);
92
- if (displayRule != null) {
93
- promise.resolve(displayRule.isPolygonVisible());
94
- } else {
95
- reject(promise, displayRuleId);
96
- }
97
- }
98
-
99
- @ReactMethod
100
- public void setPolygonVisible(String displayRuleId, boolean polygonVisible, final Promise promise) {
101
- MPDisplayRule displayRule = getRule(displayRuleId);
102
- if (displayRule != null) {
103
- displayRule.setPolygonVisible(polygonVisible);
104
- promise.resolve(null);
105
- } else {
106
- reject(promise, displayRuleId);
107
- }
108
- }
109
-
110
- @ReactMethod
111
- public void isLabelVisible(String displayRuleId, final Promise promise) {
112
- MPDisplayRule displayRule = getRule(displayRuleId);
113
- if (displayRule != null) {
114
- promise.resolve(displayRule.isLabelVisible());
115
- } else {
116
- reject(promise, displayRuleId);
117
- }
118
- }
119
-
120
- @ReactMethod
121
- public void setLabelVisible(String displayRuleId, boolean labelVisible, final Promise promise) {
122
- MPDisplayRule displayRule = getRule(displayRuleId);
123
- if (displayRule != null) {
124
- displayRule.setLabelVisible(labelVisible);
125
- promise.resolve(null);
126
- } else {
127
- reject(promise, displayRuleId);
128
- }
129
- }
130
-
131
- @ReactMethod
132
- public void isModel2DVisible(String displayRuleId, final Promise promise) {
133
- MPDisplayRule displayRule = getRule(displayRuleId);
134
- if (displayRule != null) {
135
- promise.resolve(displayRule.isModel2DVisible());
136
- } else {
137
- reject(promise, displayRuleId);
138
- }
139
- }
140
-
141
- @ReactMethod
142
- public void setModel2DVisible(String displayRuleId, boolean model2DVisible, final Promise promise) {
143
- MPDisplayRule displayRule = getRule(displayRuleId);
144
- if (displayRule != null) {
145
- displayRule.setModel2DVisible(model2DVisible);
146
- promise.resolve(null);
147
- } else {
148
- reject(promise, displayRuleId);
149
- }
150
- }
151
-
152
- @ReactMethod
153
- public void isWallVisible(String displayRuleId, final Promise promise) {
154
- MPDisplayRule displayRule = getRule(displayRuleId);
155
- if (displayRule != null) {
156
- promise.resolve(displayRule.isWallVisible());
157
- } else {
158
- reject(promise, displayRuleId);
159
- }
160
- }
161
-
162
- @ReactMethod
163
- public void setWallVisible(String displayRuleId, boolean wallVisible, final Promise promise) {
164
- MPDisplayRule displayRule = getRule(displayRuleId);
165
- if (displayRule != null) {
166
- displayRule.setWallVisible(wallVisible);
167
- promise.resolve(null);
168
- } else {
169
- reject(promise, displayRuleId);
170
- }
171
- }
172
-
173
- @ReactMethod
174
- public void isExtrusionVisible(String displayRuleId, final Promise promise) {
175
- MPDisplayRule displayRule = getRule(displayRuleId);
176
- if (displayRule != null) {
177
- promise.resolve(displayRule.isExtrusionVisible());
178
- } else {
179
- reject(promise, displayRuleId);
180
- }
181
- }
182
-
183
- @ReactMethod
184
- public void setExtrusionVisible(String displayRuleId, boolean extrusionVisible, final Promise promise) {
185
- MPDisplayRule displayRule = getRule(displayRuleId);
186
- if (displayRule != null) {
187
- displayRule.setExtrusionVisible(extrusionVisible);
188
- promise.resolve(null);
189
- } else {
190
- reject(promise, displayRuleId);
191
- }
192
- }
193
-
194
- @ReactMethod
195
- public void getZoomFrom(String displayRuleId, final Promise promise) {
196
- MPDisplayRule displayRule = getRule(displayRuleId);
197
- if (displayRule != null) {
198
- promise.resolve(displayRule.getZoomFrom());
199
- } else {
200
- reject(promise, displayRuleId);
201
- }
202
- }
203
-
204
- @ReactMethod
205
- public void setZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
206
- MPDisplayRule displayRule = getRule(displayRuleId);
207
- if (displayRule != null) {
208
- displayRule.setZoomFrom(zoomFrom.floatValue());
209
- promise.resolve(null);
210
- } else {
211
- reject(promise, displayRuleId);
212
- }
213
- }
214
-
215
- @ReactMethod
216
- public void getZoomTo(String displayRuleId, final Promise promise) {
217
- MPDisplayRule displayRule = getRule(displayRuleId);
218
- if (displayRule != null) {
219
- promise.resolve(displayRule.getZoomTo());
220
- } else {
221
- reject(promise, displayRuleId);
222
- }
223
- }
224
-
225
- @ReactMethod
226
- public void setZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
227
- MPDisplayRule displayRule = getRule(displayRuleId);
228
- if (displayRule != null) {
229
- displayRule.setZoomTo(zoomTo.floatValue());
230
- promise.resolve(null);
231
- } else {
232
- reject(promise, displayRuleId);
233
- }
234
- }
235
-
236
- @ReactMethod
237
- public void getIconUrl(String displayRuleId, final Promise promise) {
238
- MPDisplayRule displayRule = getRule(displayRuleId);
239
- if (displayRule != null) {
240
- promise.resolve(displayRule.getIconUrl());
241
- } else {
242
- reject(promise, displayRuleId);
243
- }
244
- }
245
-
246
- @ReactMethod
247
- public void setIcon(String displayRuleId, String url, final Promise promise) {
248
- MPDisplayRule displayRule = getRule(displayRuleId);
249
- if (displayRule != null) {
250
- displayRule.setIcon(url);
251
- promise.resolve(null);
252
- } else {
253
- reject(promise, displayRuleId);
254
- }
255
- }
256
-
257
- @ReactMethod
258
- public void getIconSize(String displayRuleId, final Promise promise) {
259
- MPDisplayRule displayRule = getRule(displayRuleId);
260
- if (displayRule != null) {
261
- String iconSizeString = gson.toJson(displayRule.getIconSize());
262
- promise.resolve(iconSizeString);
263
- } else {
264
- reject(promise, displayRuleId);
265
- }
266
- }
267
-
268
- @ReactMethod
269
- public void setIconSize(String displayRuleId, String iconSizeString, final Promise promise) {
270
- MPDisplayRule displayRule = getRule(displayRuleId);
271
- if (displayRule != null) {
272
- MPIconSize iconSize = gson.fromJson(iconSizeString, MPIconSize.class);
273
- displayRule.setIconSize(iconSize.getWidth(), iconSize.getHeight());
274
- promise.resolve(null);
275
- } else {
276
- reject(promise, displayRuleId);
277
- }
278
- }
279
-
280
- @ReactMethod
281
- public void getLabel(String displayRuleId, final Promise promise) {
282
- MPDisplayRule displayRule = getRule(displayRuleId);
283
- if (displayRule != null) {
284
- promise.resolve(displayRule.getLabel());
285
- } else {
286
- reject(promise, displayRuleId);
287
- }
288
- }
289
-
290
- @ReactMethod
291
- public void setLabel(String displayRuleId, String label, final Promise promise) {
292
- MPDisplayRule displayRule = getRule(displayRuleId);
293
- if (displayRule != null) {
294
- displayRule.setLabel(label);
295
- promise.resolve(null);
296
- } else {
297
- reject(promise, displayRuleId);
298
- }
299
- }
300
-
301
- @ReactMethod
302
- public void getLabelZoomFrom(String displayRuleId, final Promise promise) {
303
- MPDisplayRule displayRule = getRule(displayRuleId);
304
- if (displayRule != null) {
305
- promise.resolve(displayRule.getLabelZoomFrom());
306
- } else {
307
- reject(promise, displayRuleId);
308
- }
309
- }
310
-
311
- @ReactMethod
312
- public void setLabelZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
313
- MPDisplayRule displayRule = getRule(displayRuleId);
314
- if (displayRule != null) {
315
- displayRule.setLabelZoomFrom(zoomFrom.floatValue());
316
- promise.resolve(null);
317
- } else {
318
- reject(promise, displayRuleId);
319
- }
320
- }
321
-
322
- @ReactMethod
323
- public void getLabelZoomTo(String displayRuleId, final Promise promise) {
324
- MPDisplayRule displayRule = getRule(displayRuleId);
325
- if (displayRule != null) {
326
- promise.resolve(displayRule.getLabelZoomTo());
327
- } else {
328
- reject(promise, displayRuleId);
329
- }
330
- }
331
-
332
- @ReactMethod
333
- public void setLabelZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
334
- MPDisplayRule displayRule = getRule(displayRuleId);
335
- if (displayRule != null) {
336
- displayRule.setLabelZoomTo(zoomTo.floatValue());
337
- promise.resolve(null);
338
- } else {
339
- reject(promise, displayRuleId);
340
- }
341
- }
342
-
343
- @ReactMethod
344
- public void getLabelMaxWidth(String displayRuleId, final Promise promise) {
345
- MPDisplayRule displayRule = getRule(displayRuleId);
346
- if (displayRule != null) {
347
- promise.resolve(displayRule.getLabelMaxWidth());
348
- } else {
349
- reject(promise, displayRuleId);
350
- }
351
- }
352
-
353
- @ReactMethod
354
- public void setLabelMaxWidth(String displayRuleId, Double labelMaxWidth, final Promise promise) {
355
- MPDisplayRule displayRule = getRule(displayRuleId);
356
- if (displayRule != null) {
357
- displayRule.setLabelMaxWidth(labelMaxWidth.intValue());
358
- promise.resolve(null);
359
- } else {
360
- reject(promise, displayRuleId);
361
- }
362
- }
363
-
364
- @ReactMethod
365
- public void getPolygonZoomFrom(String displayRuleId, final Promise promise) {
366
- MPDisplayRule displayRule = getRule(displayRuleId);
367
- if (displayRule != null) {
368
- promise.resolve(displayRule.getPolygonZoomFrom());
369
- } else {
370
- reject(promise, displayRuleId);
371
- }
372
- }
373
-
374
- @ReactMethod
375
- public void setPolygonZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
376
- MPDisplayRule displayRule = getRule(displayRuleId);
377
- if (displayRule != null) {
378
- displayRule.setPolygonZoomFrom(zoomFrom.floatValue());
379
- promise.resolve(null);
380
- } else {
381
- reject(promise, displayRuleId);
382
- }
383
- }
384
-
385
- @ReactMethod
386
- public void getPolygonZoomTo(String displayRuleId, final Promise promise) {
387
- MPDisplayRule displayRule = getRule(displayRuleId);
388
- if (displayRule != null) {
389
- promise.resolve(displayRule.getPolygonZoomTo());
390
- } else {
391
- reject(promise, displayRuleId);
392
- }
393
- }
394
-
395
- @ReactMethod
396
- public void setPolygonZoomTo(String displayRuleId, Double polygonZoomTo, final Promise promise) {
397
- MPDisplayRule displayRule = getRule(displayRuleId);
398
- if (displayRule != null) {
399
- displayRule.setPolygonZoomTo(polygonZoomTo.floatValue());
400
- promise.resolve(null);
401
- } else {
402
- reject(promise, displayRuleId);
403
- }
404
- }
405
-
406
- @ReactMethod
407
- public void getPolygonStrokeWidth(String displayRuleId, final Promise promise) {
408
- MPDisplayRule displayRule = getRule(displayRuleId);
409
- if (displayRule != null) {
410
- promise.resolve(displayRule.getPolygonStrokeWidth());
411
- } else {
412
- reject(promise, displayRuleId);
413
- }
414
- }
415
-
416
- @ReactMethod
417
- public void setPolygonStrokeWidth(String displayRuleId, Double strokeWidth, final Promise promise) {
418
- MPDisplayRule displayRule = getRule(displayRuleId);
419
- if (displayRule != null) {
420
- displayRule.setPolygonStrokeWidth(strokeWidth.floatValue());
421
- promise.resolve(null);
422
- } else {
423
- reject(promise, displayRuleId);
424
- }
425
- }
426
-
427
- @ReactMethod
428
- public void getPolygonStrokeColor(String displayRuleId, final Promise promise) {
429
- MPDisplayRule displayRule = getRule(displayRuleId);
430
- if (displayRule != null) {
431
- promise.resolve(displayRule.getPolygonStrokeColor());
432
- } else {
433
- reject(promise, displayRuleId);
434
- }
435
- }
436
-
437
- @ReactMethod
438
- public void setPolygonStrokeColor(String displayRuleId, String polygonStrokeColor, final Promise promise) {
439
- MPDisplayRule displayRule = getRule(displayRuleId);
440
- if (displayRule != null) {
441
- displayRule.setPolygonStrokeColor(polygonStrokeColor);
442
- promise.resolve(null);
443
- } else {
444
- reject(promise, displayRuleId);
445
- }
446
- }
447
-
448
- @ReactMethod
449
- public void getPolygonStrokeOpacity(String displayRuleId, final Promise promise) {
450
- MPDisplayRule displayRule = getRule(displayRuleId);
451
- if (displayRule != null) {
452
- promise.resolve(displayRule.getPolygonStrokeOpacity());
453
- } else {
454
- reject(promise, displayRuleId);
455
- }
456
- }
457
-
458
- @ReactMethod
459
- public void setPolygonStrokeOpacity(String displayRuleId, Double polygonStrokeOpacity, final Promise promise) {
460
- MPDisplayRule displayRule = getRule(displayRuleId);
461
- if (displayRule != null) {
462
- displayRule.setPolygonStrokeOpacity(polygonStrokeOpacity.floatValue());
463
- promise.resolve(null);
464
- } else {
465
- reject(promise, displayRuleId);
466
- }
467
- }
468
-
469
- @ReactMethod
470
- public void getPolygonFillOpacity(String displayRuleId, final Promise promise) {
471
- MPDisplayRule displayRule = getRule(displayRuleId);
472
- if (displayRule != null) {
473
- promise.resolve(displayRule.getPolygonFillOpacity());
474
- } else {
475
- reject(promise, displayRuleId);
476
- }
477
- }
478
-
479
- @ReactMethod
480
- public void setPolygonFillOpacity(String displayRuleId, Double polygonFillOpacity, final Promise promise) {
481
- MPDisplayRule displayRule = getRule(displayRuleId);
482
- if (displayRule != null) {
483
- displayRule.setPolygonFillOpacity(polygonFillOpacity.floatValue());
484
- promise.resolve(null);
485
- } else {
486
- reject(promise, displayRuleId);
487
- }
488
- }
489
-
490
- @ReactMethod
491
- public void getPolygonFillColor(String displayRuleId, final Promise promise) {
492
- MPDisplayRule displayRule = getRule(displayRuleId);
493
- if (displayRule != null) {
494
- promise.resolve(displayRule.getPolygonFillColor());
495
- } else {
496
- reject(promise, displayRuleId);
497
- }
498
- }
499
-
500
- @ReactMethod
501
- public void setPolygonFillColor(String displayRuleId, String polygonFillColor, final Promise promise) {
502
- MPDisplayRule displayRule = getRule(displayRuleId);
503
- if (displayRule != null) {
504
- displayRule.setPolygonFillColor(polygonFillColor);
505
- promise.resolve(null);
506
- } else {
507
- reject(promise, displayRuleId);
508
- }
509
- }
510
-
511
- @ReactMethod
512
- public void getWallColor(String displayRuleId, final Promise promise) {
513
- MPDisplayRule displayRule = getRule(displayRuleId);
514
- if (displayRule != null) {
515
- promise.resolve(displayRule.getWallColor());
516
- } else {
517
- reject(promise, displayRuleId);
518
- }
519
- }
520
-
521
- @ReactMethod
522
- public void setWallColor(String displayRuleId, String wallColor, final Promise promise) {
523
- MPDisplayRule displayRule = getRule(displayRuleId);
524
- if (displayRule != null) {
525
- displayRule.setWallColor(wallColor);
526
- promise.resolve(null);
527
- } else {
528
- reject(promise, displayRuleId);
529
- }
530
- }
531
-
532
- @ReactMethod
533
- public void getWallHeight(String displayRuleId, final Promise promise) {
534
- MPDisplayRule displayRule = getRule(displayRuleId);
535
- if (displayRule != null) {
536
- promise.resolve(displayRule.getWallHeight());
537
- } else {
538
- reject(promise, displayRuleId);
539
- }
540
- }
541
-
542
- @ReactMethod
543
- public void setWallHeight(String displayRuleId, Double wallHeight, final Promise promise) {
544
- MPDisplayRule displayRule = getRule(displayRuleId);
545
- if (displayRule != null) {
546
- displayRule.setWallHeight(wallHeight.floatValue());
547
- promise.resolve(null);
548
- } else {
549
- reject(promise, displayRuleId);
550
- }
551
- }
552
-
553
- @ReactMethod
554
- public void getWallZoomFrom(String displayRuleId, final Promise promise) {
555
- MPDisplayRule displayRule = getRule(displayRuleId);
556
- if (displayRule != null) {
557
- promise.resolve(displayRule.getWallZoomFrom());
558
- } else {
559
- reject(promise, displayRuleId);
560
- }
561
- }
562
-
563
- @ReactMethod
564
- public void setWallZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
565
- MPDisplayRule displayRule = getRule(displayRuleId);
566
- if (displayRule != null) {
567
- displayRule.setWallZoomFrom(zoomFrom.floatValue());
568
- promise.resolve(null);
569
- } else {
570
- reject(promise, displayRuleId);
571
- }
572
- }
573
-
574
- @ReactMethod
575
- public void getWallZoomTo(String displayRuleId, final Promise promise) {
576
- MPDisplayRule displayRule = getRule(displayRuleId);
577
- if (displayRule != null) {
578
- promise.resolve(displayRule.getWallZoomTo());
579
- } else {
580
- reject(promise, displayRuleId);
581
- }
582
- }
583
-
584
- @ReactMethod
585
- public void setWallZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
586
- MPDisplayRule displayRule = getRule(displayRuleId);
587
- if (displayRule != null) {
588
- displayRule.setWallZoomTo(zoomTo.floatValue());
589
- promise.resolve(null);
590
- } else {
591
- reject(promise, displayRuleId);
592
- }
593
- }
594
-
595
- @ReactMethod
596
- public void getExtrusionColor(String displayRuleId, final Promise promise) {
597
- MPDisplayRule displayRule = getRule(displayRuleId);
598
- if (displayRule != null) {
599
- promise.resolve(displayRule.getExtrusionColor());
600
- } else {
601
- reject(promise, displayRuleId);
602
- }
603
- }
604
-
605
- @ReactMethod
606
- public void setExtrusionColor(String displayRuleId, String extrusionColor, final Promise promise) {
607
- MPDisplayRule displayRule = getRule(displayRuleId);
608
- if (displayRule != null) {
609
- displayRule.setExtrusionColor(extrusionColor);
610
- promise.resolve(null);
611
- } else {
612
- reject(promise, displayRuleId);
613
- }
614
- }
615
-
616
- @ReactMethod
617
- public void getExtrusionHeight(String displayRuleId, final Promise promise) {
618
- MPDisplayRule displayRule = getRule(displayRuleId);
619
- if (displayRule != null) {
620
- promise.resolve(displayRule.getExtrusionHeight());
621
- } else {
622
- reject(promise, displayRuleId);
623
- }
624
- }
625
-
626
- @ReactMethod
627
- public void setExtrusionHeight(String displayRuleId, Double extrusionHeight, final Promise promise) {
628
- MPDisplayRule displayRule = getRule(displayRuleId);
629
- if (displayRule != null) {
630
- displayRule.setExtrusionHeight(extrusionHeight.floatValue());
631
- promise.resolve(null);
632
- } else {
633
- reject(promise, displayRuleId);
634
- }
635
- }
636
-
637
- @ReactMethod
638
- public void getExtrusionZoomFrom(String displayRuleId, final Promise promise) {
639
- MPDisplayRule displayRule = getRule(displayRuleId);
640
- if (displayRule != null) {
641
- promise.resolve(displayRule.getExtrusionZoomFrom());
642
- } else {
643
- reject(promise, displayRuleId);
644
- }
645
- }
646
-
647
- @ReactMethod
648
- public void setExtrusionZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
649
- MPDisplayRule displayRule = getRule(displayRuleId);
650
- if (displayRule != null) {
651
- displayRule.setExtrusionZoomFrom(zoomFrom.floatValue());
652
- promise.resolve(null);
653
- } else {
654
- reject(promise, displayRuleId);
655
- }
656
- }
657
-
658
- @ReactMethod
659
- public void getExtrusionZoomTo(String displayRuleId, final Promise promise) {
660
- MPDisplayRule displayRule = getRule(displayRuleId);
661
- if (displayRule != null) {
662
- promise.resolve(displayRule.getExtrusionZoomTo());
663
- } else {
664
- reject(promise, displayRuleId);
665
- }
666
- }
667
-
668
- @ReactMethod
669
- public void setExtrusionZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
670
- MPDisplayRule displayRule = getRule(displayRuleId);
671
- if (displayRule != null) {
672
- displayRule.setExtrusionZoomTo(zoomTo.floatValue());
673
- promise.resolve(null);
674
- } else {
675
- reject(promise, displayRuleId);
676
- }
677
- }
678
-
679
- @ReactMethod
680
- public void getModel2DZoomFrom(String displayRuleId, final Promise promise) {
681
- MPDisplayRule displayRule = getRule(displayRuleId);
682
- if (displayRule != null) {
683
- promise.resolve(displayRule.getModel2DZoomFrom());
684
- } else {
685
- reject(promise, displayRuleId);
686
- }
687
- }
688
-
689
- @ReactMethod
690
- public void setModel2DZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
691
- MPDisplayRule displayRule = getRule(displayRuleId);
692
- if (displayRule != null) {
693
- displayRule.setModel2DZoomFrom(zoomFrom.floatValue());
694
- promise.resolve(null);
695
- } else {
696
- reject(promise, displayRuleId);
697
- }
698
- }
699
-
700
- @ReactMethod
701
- public void getModel2DZoomTo(String displayRuleId, final Promise promise) {
702
- MPDisplayRule displayRule = getRule(displayRuleId);
703
- if (displayRule != null) {
704
- promise.resolve(displayRule.getModel2DZoomTo());
705
- } else {
706
- reject(promise, displayRuleId);
707
- }
708
- }
709
-
710
- @ReactMethod
711
- public void setModel2DZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
712
- MPDisplayRule displayRule = getRule(displayRuleId);
713
- if (displayRule != null) {
714
- displayRule.setModel2DZoomTo(zoomTo.floatValue());
715
- promise.resolve(null);
716
- } else {
717
- reject(promise, displayRuleId);
718
- }
719
- }
720
-
721
- @ReactMethod
722
- public void getModel2DWidthMeters(String displayRuleId, final Promise promise) {
723
- MPDisplayRule displayRule = getRule(displayRuleId);
724
- if (displayRule != null) {
725
- promise.resolve(displayRule.getModel2DWidthMeters());
726
- } else {
727
- reject(promise, displayRuleId);
728
- }
729
- }
730
-
731
- @ReactMethod
732
- public void setModel2DWidthMeters(String displayRuleId, Double width, final Promise promise) {
733
- MPDisplayRule displayRule = getRule(displayRuleId);
734
- if (displayRule != null) {
735
- displayRule.setModel2DWidthMeters(width);
736
- promise.resolve(null);
737
- } else {
738
- reject(promise, displayRuleId);
739
- }
740
- }
741
-
742
- @ReactMethod
743
- public void getModel2DHeightMeters(String displayRuleId, final Promise promise) {
744
- MPDisplayRule displayRule = getRule(displayRuleId);
745
- if (displayRule != null) {
746
- promise.resolve(displayRule.getModel2DHeightMeters());
747
- } else {
748
- reject(promise, displayRuleId);
749
- }
750
- }
751
-
752
- @ReactMethod
753
- public void setModel2DHeightMeters(String displayRuleId, Double height, final Promise promise) {
754
- MPDisplayRule displayRule = getRule(displayRuleId);
755
- if (displayRule != null) {
756
- displayRule.setModel2DHeightMeters(height);
757
- promise.resolve(null);
758
- } else {
759
- reject(promise, displayRuleId);
760
- }
761
- }
762
-
763
- @ReactMethod
764
- public void getModel2DBearing(String displayRuleId, final Promise promise) {
765
- MPDisplayRule displayRule = getRule(displayRuleId);
766
- if (displayRule != null) {
767
- promise.resolve(displayRule.getModel2DBearing());
768
- } else {
769
- reject(promise, displayRuleId);
770
- }
771
- }
772
-
773
- @ReactMethod
774
- public void setModel2DBearing(String displayRuleId, Double bearing, final Promise promise) {
775
- MPDisplayRule displayRule = getRule(displayRuleId);
776
- if (displayRule != null) {
777
- displayRule.setModel2DBearing(bearing);
778
- promise.resolve(null);
779
- } else {
780
- reject(promise, displayRuleId);
781
- }
782
- }
783
-
784
- @ReactMethod
785
- public void getModel2DModel(String displayRuleId, final Promise promise) {
786
- MPDisplayRule displayRule = getRule(displayRuleId);
787
- if (displayRule != null) {
788
- promise.resolve(displayRule.getModel2DModel());
789
- } else {
790
- reject(promise, displayRuleId);
791
- }
792
- }
793
-
794
- @ReactMethod
795
- public void setModel2DModel(String displayRuleId, String model, final Promise promise) {
796
- MPDisplayRule displayRule = getRule(displayRuleId);
797
- if (displayRule != null) {
798
- displayRule.setModel2DModel(model);
799
- promise.resolve(null);
800
- } else {
801
- reject(promise, displayRuleId);
802
- }
803
- }
804
-
805
- @ReactMethod
806
- public void reset(String displayRuleId, final Promise promise) {
807
- MPDisplayRule displayRule = getRule(displayRuleId);
808
- if (displayRule != null) {
809
- displayRule.reset();
810
- promise.resolve(null);
811
- } else {
812
- reject(promise, displayRuleId);
813
- }
814
- }
815
-
816
- }
1
+ package com.reactlibrary.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.MPDisplayRule;
11
+ import com.mapsindoors.core.MPIconSize;
12
+ import com.mapsindoors.core.MPSolutionDisplayRule;
13
+ import com.mapsindoors.core.MapsIndoors;
14
+ import com.mapsindoors.core.errors.MIError;
15
+ import com.mapsindoors.core.errors.MIErrorEnum;
16
+ import com.reactlibrary.core.models.MPError;
17
+
18
+ public class MPDisplayRuleModule extends ReactContextBaseJavaModule {
19
+ private final Gson gson = new Gson();
20
+
21
+ public MPDisplayRuleModule(@NonNull ReactApplicationContext reactContext) {
22
+ super(reactContext);
23
+ }
24
+
25
+ @NonNull
26
+ @Override
27
+ public String getName() {
28
+ return "DisplayRule";
29
+ }
30
+
31
+ private void reject(Promise promise, String id) {
32
+ promise.reject("DisplayRuleError",
33
+ gson.toJson(MPError.fromMIError(
34
+ new MIError(MIErrorEnum.UNKNOWN_ERROR,
35
+ "The DisplayRule (id: "+ id +") cannot be found"))));
36
+ }
37
+
38
+ private MPDisplayRule getRule(String name) {
39
+ switch (name) {
40
+ case "buildingOutline" : return MapsIndoors.getDisplayRule(MPSolutionDisplayRule.BUILDING_OUTLINE);
41
+ case "selectionHighlight": return MapsIndoors.getDisplayRule(MPSolutionDisplayRule.SELECTION_HIGHLIGHT);
42
+ case "positionIndicator": return MapsIndoors.getDisplayRule(MPSolutionDisplayRule.POSITION_INDICATOR);
43
+ default: return MapsIndoors.getDisplayRule(name);
44
+ }
45
+ }
46
+
47
+ @ReactMethod
48
+ public void isVisible(String displayRuleId, final Promise promise) {
49
+ MPDisplayRule displayRule = getRule(displayRuleId);
50
+ if (displayRule != null) {
51
+ promise.resolve(displayRule.isVisible());
52
+ } else {
53
+ reject(promise, displayRuleId);
54
+ }
55
+ }
56
+
57
+ @ReactMethod
58
+ public void setVisible(String displayRuleId, boolean isVisible, final Promise promise) {
59
+ MPDisplayRule displayRule = getRule(displayRuleId);
60
+ if (displayRule != null) {
61
+ displayRule.setVisible(isVisible);
62
+ promise.resolve(null);
63
+ } else {
64
+ reject(promise, displayRuleId);
65
+ }
66
+ }
67
+
68
+ @ReactMethod
69
+ public void isIconVisible(String displayRuleId, final Promise promise) {
70
+ MPDisplayRule displayRule = getRule(displayRuleId);
71
+ if (displayRule != null) {
72
+ promise.resolve(displayRule.isIconVisible());
73
+ } else {
74
+ reject(promise, displayRuleId);
75
+ }
76
+ }
77
+
78
+ @ReactMethod
79
+ public void setIconVisible(String displayRuleId, boolean iconVisible, final Promise promise) {
80
+ MPDisplayRule displayRule = getRule(displayRuleId);
81
+ if (displayRule != null) {
82
+ displayRule.setIconVisible(iconVisible);
83
+ promise.resolve(null);
84
+ } else {
85
+ reject(promise, displayRuleId);
86
+ }
87
+ }
88
+
89
+ @ReactMethod
90
+ public void isPolygonVisible(String displayRuleId, final Promise promise) {
91
+ MPDisplayRule displayRule = getRule(displayRuleId);
92
+ if (displayRule != null) {
93
+ promise.resolve(displayRule.isPolygonVisible());
94
+ } else {
95
+ reject(promise, displayRuleId);
96
+ }
97
+ }
98
+
99
+ @ReactMethod
100
+ public void setPolygonVisible(String displayRuleId, boolean polygonVisible, final Promise promise) {
101
+ MPDisplayRule displayRule = getRule(displayRuleId);
102
+ if (displayRule != null) {
103
+ displayRule.setPolygonVisible(polygonVisible);
104
+ promise.resolve(null);
105
+ } else {
106
+ reject(promise, displayRuleId);
107
+ }
108
+ }
109
+
110
+ @ReactMethod
111
+ public void isLabelVisible(String displayRuleId, final Promise promise) {
112
+ MPDisplayRule displayRule = getRule(displayRuleId);
113
+ if (displayRule != null) {
114
+ promise.resolve(displayRule.isLabelVisible());
115
+ } else {
116
+ reject(promise, displayRuleId);
117
+ }
118
+ }
119
+
120
+ @ReactMethod
121
+ public void setLabelVisible(String displayRuleId, boolean labelVisible, final Promise promise) {
122
+ MPDisplayRule displayRule = getRule(displayRuleId);
123
+ if (displayRule != null) {
124
+ displayRule.setLabelVisible(labelVisible);
125
+ promise.resolve(null);
126
+ } else {
127
+ reject(promise, displayRuleId);
128
+ }
129
+ }
130
+
131
+ @ReactMethod
132
+ public void isModel2DVisible(String displayRuleId, final Promise promise) {
133
+ MPDisplayRule displayRule = getRule(displayRuleId);
134
+ if (displayRule != null) {
135
+ promise.resolve(displayRule.isModel2DVisible());
136
+ } else {
137
+ reject(promise, displayRuleId);
138
+ }
139
+ }
140
+
141
+ @ReactMethod
142
+ public void setModel2DVisible(String displayRuleId, boolean model2DVisible, final Promise promise) {
143
+ MPDisplayRule displayRule = getRule(displayRuleId);
144
+ if (displayRule != null) {
145
+ displayRule.setModel2DVisible(model2DVisible);
146
+ promise.resolve(null);
147
+ } else {
148
+ reject(promise, displayRuleId);
149
+ }
150
+ }
151
+
152
+ @ReactMethod
153
+ public void isWallVisible(String displayRuleId, final Promise promise) {
154
+ MPDisplayRule displayRule = getRule(displayRuleId);
155
+ if (displayRule != null) {
156
+ promise.resolve(displayRule.isWallVisible());
157
+ } else {
158
+ reject(promise, displayRuleId);
159
+ }
160
+ }
161
+
162
+ @ReactMethod
163
+ public void setWallVisible(String displayRuleId, boolean wallVisible, final Promise promise) {
164
+ MPDisplayRule displayRule = getRule(displayRuleId);
165
+ if (displayRule != null) {
166
+ displayRule.setWallVisible(wallVisible);
167
+ promise.resolve(null);
168
+ } else {
169
+ reject(promise, displayRuleId);
170
+ }
171
+ }
172
+
173
+ @ReactMethod
174
+ public void isExtrusionVisible(String displayRuleId, final Promise promise) {
175
+ MPDisplayRule displayRule = getRule(displayRuleId);
176
+ if (displayRule != null) {
177
+ promise.resolve(displayRule.isExtrusionVisible());
178
+ } else {
179
+ reject(promise, displayRuleId);
180
+ }
181
+ }
182
+
183
+ @ReactMethod
184
+ public void setExtrusionVisible(String displayRuleId, boolean extrusionVisible, final Promise promise) {
185
+ MPDisplayRule displayRule = getRule(displayRuleId);
186
+ if (displayRule != null) {
187
+ displayRule.setExtrusionVisible(extrusionVisible);
188
+ promise.resolve(null);
189
+ } else {
190
+ reject(promise, displayRuleId);
191
+ }
192
+ }
193
+
194
+ @ReactMethod
195
+ public void getZoomFrom(String displayRuleId, final Promise promise) {
196
+ MPDisplayRule displayRule = getRule(displayRuleId);
197
+ if (displayRule != null) {
198
+ promise.resolve(displayRule.getZoomFrom());
199
+ } else {
200
+ reject(promise, displayRuleId);
201
+ }
202
+ }
203
+
204
+ @ReactMethod
205
+ public void setZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
206
+ MPDisplayRule displayRule = getRule(displayRuleId);
207
+ if (displayRule != null) {
208
+ displayRule.setZoomFrom(zoomFrom.floatValue());
209
+ promise.resolve(null);
210
+ } else {
211
+ reject(promise, displayRuleId);
212
+ }
213
+ }
214
+
215
+ @ReactMethod
216
+ public void getZoomTo(String displayRuleId, final Promise promise) {
217
+ MPDisplayRule displayRule = getRule(displayRuleId);
218
+ if (displayRule != null) {
219
+ promise.resolve(displayRule.getZoomTo());
220
+ } else {
221
+ reject(promise, displayRuleId);
222
+ }
223
+ }
224
+
225
+ @ReactMethod
226
+ public void setZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
227
+ MPDisplayRule displayRule = getRule(displayRuleId);
228
+ if (displayRule != null) {
229
+ displayRule.setZoomTo(zoomTo.floatValue());
230
+ promise.resolve(null);
231
+ } else {
232
+ reject(promise, displayRuleId);
233
+ }
234
+ }
235
+
236
+ @ReactMethod
237
+ public void getIconUrl(String displayRuleId, final Promise promise) {
238
+ MPDisplayRule displayRule = getRule(displayRuleId);
239
+ if (displayRule != null) {
240
+ promise.resolve(displayRule.getIconUrl());
241
+ } else {
242
+ reject(promise, displayRuleId);
243
+ }
244
+ }
245
+
246
+ @ReactMethod
247
+ public void setIcon(String displayRuleId, String url, final Promise promise) {
248
+ MPDisplayRule displayRule = getRule(displayRuleId);
249
+ if (displayRule != null) {
250
+ displayRule.setIcon(url);
251
+ promise.resolve(null);
252
+ } else {
253
+ reject(promise, displayRuleId);
254
+ }
255
+ }
256
+
257
+ @ReactMethod
258
+ public void getIconSize(String displayRuleId, final Promise promise) {
259
+ MPDisplayRule displayRule = getRule(displayRuleId);
260
+ if (displayRule != null) {
261
+ String iconSizeString = gson.toJson(displayRule.getIconSize());
262
+ promise.resolve(iconSizeString);
263
+ } else {
264
+ reject(promise, displayRuleId);
265
+ }
266
+ }
267
+
268
+ @ReactMethod
269
+ public void setIconSize(String displayRuleId, String iconSizeString, final Promise promise) {
270
+ MPDisplayRule displayRule = getRule(displayRuleId);
271
+ if (displayRule != null) {
272
+ MPIconSize iconSize = gson.fromJson(iconSizeString, MPIconSize.class);
273
+ displayRule.setIconSize(iconSize.getWidth(), iconSize.getHeight());
274
+ promise.resolve(null);
275
+ } else {
276
+ reject(promise, displayRuleId);
277
+ }
278
+ }
279
+
280
+ @ReactMethod
281
+ public void getLabel(String displayRuleId, final Promise promise) {
282
+ MPDisplayRule displayRule = getRule(displayRuleId);
283
+ if (displayRule != null) {
284
+ promise.resolve(displayRule.getLabel());
285
+ } else {
286
+ reject(promise, displayRuleId);
287
+ }
288
+ }
289
+
290
+ @ReactMethod
291
+ public void setLabel(String displayRuleId, String label, final Promise promise) {
292
+ MPDisplayRule displayRule = getRule(displayRuleId);
293
+ if (displayRule != null) {
294
+ displayRule.setLabel(label);
295
+ promise.resolve(null);
296
+ } else {
297
+ reject(promise, displayRuleId);
298
+ }
299
+ }
300
+
301
+ @ReactMethod
302
+ public void getLabelZoomFrom(String displayRuleId, final Promise promise) {
303
+ MPDisplayRule displayRule = getRule(displayRuleId);
304
+ if (displayRule != null) {
305
+ promise.resolve(displayRule.getLabelZoomFrom());
306
+ } else {
307
+ reject(promise, displayRuleId);
308
+ }
309
+ }
310
+
311
+ @ReactMethod
312
+ public void setLabelZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
313
+ MPDisplayRule displayRule = getRule(displayRuleId);
314
+ if (displayRule != null) {
315
+ displayRule.setLabelZoomFrom(zoomFrom.floatValue());
316
+ promise.resolve(null);
317
+ } else {
318
+ reject(promise, displayRuleId);
319
+ }
320
+ }
321
+
322
+ @ReactMethod
323
+ public void getLabelZoomTo(String displayRuleId, final Promise promise) {
324
+ MPDisplayRule displayRule = getRule(displayRuleId);
325
+ if (displayRule != null) {
326
+ promise.resolve(displayRule.getLabelZoomTo());
327
+ } else {
328
+ reject(promise, displayRuleId);
329
+ }
330
+ }
331
+
332
+ @ReactMethod
333
+ public void setLabelZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
334
+ MPDisplayRule displayRule = getRule(displayRuleId);
335
+ if (displayRule != null) {
336
+ displayRule.setLabelZoomTo(zoomTo.floatValue());
337
+ promise.resolve(null);
338
+ } else {
339
+ reject(promise, displayRuleId);
340
+ }
341
+ }
342
+
343
+ @ReactMethod
344
+ public void getLabelMaxWidth(String displayRuleId, final Promise promise) {
345
+ MPDisplayRule displayRule = getRule(displayRuleId);
346
+ if (displayRule != null) {
347
+ promise.resolve(displayRule.getLabelMaxWidth());
348
+ } else {
349
+ reject(promise, displayRuleId);
350
+ }
351
+ }
352
+
353
+ @ReactMethod
354
+ public void setLabelMaxWidth(String displayRuleId, Double labelMaxWidth, final Promise promise) {
355
+ MPDisplayRule displayRule = getRule(displayRuleId);
356
+ if (displayRule != null) {
357
+ displayRule.setLabelMaxWidth(labelMaxWidth.intValue());
358
+ promise.resolve(null);
359
+ } else {
360
+ reject(promise, displayRuleId);
361
+ }
362
+ }
363
+
364
+ @ReactMethod
365
+ public void getPolygonZoomFrom(String displayRuleId, final Promise promise) {
366
+ MPDisplayRule displayRule = getRule(displayRuleId);
367
+ if (displayRule != null) {
368
+ promise.resolve(displayRule.getPolygonZoomFrom());
369
+ } else {
370
+ reject(promise, displayRuleId);
371
+ }
372
+ }
373
+
374
+ @ReactMethod
375
+ public void setPolygonZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
376
+ MPDisplayRule displayRule = getRule(displayRuleId);
377
+ if (displayRule != null) {
378
+ displayRule.setPolygonZoomFrom(zoomFrom.floatValue());
379
+ promise.resolve(null);
380
+ } else {
381
+ reject(promise, displayRuleId);
382
+ }
383
+ }
384
+
385
+ @ReactMethod
386
+ public void getPolygonZoomTo(String displayRuleId, final Promise promise) {
387
+ MPDisplayRule displayRule = getRule(displayRuleId);
388
+ if (displayRule != null) {
389
+ promise.resolve(displayRule.getPolygonZoomTo());
390
+ } else {
391
+ reject(promise, displayRuleId);
392
+ }
393
+ }
394
+
395
+ @ReactMethod
396
+ public void setPolygonZoomTo(String displayRuleId, Double polygonZoomTo, final Promise promise) {
397
+ MPDisplayRule displayRule = getRule(displayRuleId);
398
+ if (displayRule != null) {
399
+ displayRule.setPolygonZoomTo(polygonZoomTo.floatValue());
400
+ promise.resolve(null);
401
+ } else {
402
+ reject(promise, displayRuleId);
403
+ }
404
+ }
405
+
406
+ @ReactMethod
407
+ public void getPolygonStrokeWidth(String displayRuleId, final Promise promise) {
408
+ MPDisplayRule displayRule = getRule(displayRuleId);
409
+ if (displayRule != null) {
410
+ promise.resolve(displayRule.getPolygonStrokeWidth());
411
+ } else {
412
+ reject(promise, displayRuleId);
413
+ }
414
+ }
415
+
416
+ @ReactMethod
417
+ public void setPolygonStrokeWidth(String displayRuleId, Double strokeWidth, final Promise promise) {
418
+ MPDisplayRule displayRule = getRule(displayRuleId);
419
+ if (displayRule != null) {
420
+ displayRule.setPolygonStrokeWidth(strokeWidth.floatValue());
421
+ promise.resolve(null);
422
+ } else {
423
+ reject(promise, displayRuleId);
424
+ }
425
+ }
426
+
427
+ @ReactMethod
428
+ public void getPolygonStrokeColor(String displayRuleId, final Promise promise) {
429
+ MPDisplayRule displayRule = getRule(displayRuleId);
430
+ if (displayRule != null) {
431
+ promise.resolve(displayRule.getPolygonStrokeColor());
432
+ } else {
433
+ reject(promise, displayRuleId);
434
+ }
435
+ }
436
+
437
+ @ReactMethod
438
+ public void setPolygonStrokeColor(String displayRuleId, String polygonStrokeColor, final Promise promise) {
439
+ MPDisplayRule displayRule = getRule(displayRuleId);
440
+ if (displayRule != null) {
441
+ displayRule.setPolygonStrokeColor(polygonStrokeColor);
442
+ promise.resolve(null);
443
+ } else {
444
+ reject(promise, displayRuleId);
445
+ }
446
+ }
447
+
448
+ @ReactMethod
449
+ public void getPolygonStrokeOpacity(String displayRuleId, final Promise promise) {
450
+ MPDisplayRule displayRule = getRule(displayRuleId);
451
+ if (displayRule != null) {
452
+ promise.resolve(displayRule.getPolygonStrokeOpacity());
453
+ } else {
454
+ reject(promise, displayRuleId);
455
+ }
456
+ }
457
+
458
+ @ReactMethod
459
+ public void setPolygonStrokeOpacity(String displayRuleId, Double polygonStrokeOpacity, final Promise promise) {
460
+ MPDisplayRule displayRule = getRule(displayRuleId);
461
+ if (displayRule != null) {
462
+ displayRule.setPolygonStrokeOpacity(polygonStrokeOpacity.floatValue());
463
+ promise.resolve(null);
464
+ } else {
465
+ reject(promise, displayRuleId);
466
+ }
467
+ }
468
+
469
+ @ReactMethod
470
+ public void getPolygonFillOpacity(String displayRuleId, final Promise promise) {
471
+ MPDisplayRule displayRule = getRule(displayRuleId);
472
+ if (displayRule != null) {
473
+ promise.resolve(displayRule.getPolygonFillOpacity());
474
+ } else {
475
+ reject(promise, displayRuleId);
476
+ }
477
+ }
478
+
479
+ @ReactMethod
480
+ public void setPolygonFillOpacity(String displayRuleId, Double polygonFillOpacity, final Promise promise) {
481
+ MPDisplayRule displayRule = getRule(displayRuleId);
482
+ if (displayRule != null) {
483
+ displayRule.setPolygonFillOpacity(polygonFillOpacity.floatValue());
484
+ promise.resolve(null);
485
+ } else {
486
+ reject(promise, displayRuleId);
487
+ }
488
+ }
489
+
490
+ @ReactMethod
491
+ public void getPolygonFillColor(String displayRuleId, final Promise promise) {
492
+ MPDisplayRule displayRule = getRule(displayRuleId);
493
+ if (displayRule != null) {
494
+ promise.resolve(displayRule.getPolygonFillColor());
495
+ } else {
496
+ reject(promise, displayRuleId);
497
+ }
498
+ }
499
+
500
+ @ReactMethod
501
+ public void setPolygonFillColor(String displayRuleId, String polygonFillColor, final Promise promise) {
502
+ MPDisplayRule displayRule = getRule(displayRuleId);
503
+ if (displayRule != null) {
504
+ displayRule.setPolygonFillColor(polygonFillColor);
505
+ promise.resolve(null);
506
+ } else {
507
+ reject(promise, displayRuleId);
508
+ }
509
+ }
510
+
511
+ @ReactMethod
512
+ public void getWallColor(String displayRuleId, final Promise promise) {
513
+ MPDisplayRule displayRule = getRule(displayRuleId);
514
+ if (displayRule != null) {
515
+ promise.resolve(displayRule.getWallColor());
516
+ } else {
517
+ reject(promise, displayRuleId);
518
+ }
519
+ }
520
+
521
+ @ReactMethod
522
+ public void setWallColor(String displayRuleId, String wallColor, final Promise promise) {
523
+ MPDisplayRule displayRule = getRule(displayRuleId);
524
+ if (displayRule != null) {
525
+ displayRule.setWallColor(wallColor);
526
+ promise.resolve(null);
527
+ } else {
528
+ reject(promise, displayRuleId);
529
+ }
530
+ }
531
+
532
+ @ReactMethod
533
+ public void getWallHeight(String displayRuleId, final Promise promise) {
534
+ MPDisplayRule displayRule = getRule(displayRuleId);
535
+ if (displayRule != null) {
536
+ promise.resolve(displayRule.getWallHeight());
537
+ } else {
538
+ reject(promise, displayRuleId);
539
+ }
540
+ }
541
+
542
+ @ReactMethod
543
+ public void setWallHeight(String displayRuleId, Double wallHeight, final Promise promise) {
544
+ MPDisplayRule displayRule = getRule(displayRuleId);
545
+ if (displayRule != null) {
546
+ displayRule.setWallHeight(wallHeight.floatValue());
547
+ promise.resolve(null);
548
+ } else {
549
+ reject(promise, displayRuleId);
550
+ }
551
+ }
552
+
553
+ @ReactMethod
554
+ public void getWallZoomFrom(String displayRuleId, final Promise promise) {
555
+ MPDisplayRule displayRule = getRule(displayRuleId);
556
+ if (displayRule != null) {
557
+ promise.resolve(displayRule.getWallZoomFrom());
558
+ } else {
559
+ reject(promise, displayRuleId);
560
+ }
561
+ }
562
+
563
+ @ReactMethod
564
+ public void setWallZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
565
+ MPDisplayRule displayRule = getRule(displayRuleId);
566
+ if (displayRule != null) {
567
+ displayRule.setWallZoomFrom(zoomFrom.floatValue());
568
+ promise.resolve(null);
569
+ } else {
570
+ reject(promise, displayRuleId);
571
+ }
572
+ }
573
+
574
+ @ReactMethod
575
+ public void getWallZoomTo(String displayRuleId, final Promise promise) {
576
+ MPDisplayRule displayRule = getRule(displayRuleId);
577
+ if (displayRule != null) {
578
+ promise.resolve(displayRule.getWallZoomTo());
579
+ } else {
580
+ reject(promise, displayRuleId);
581
+ }
582
+ }
583
+
584
+ @ReactMethod
585
+ public void setWallZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
586
+ MPDisplayRule displayRule = getRule(displayRuleId);
587
+ if (displayRule != null) {
588
+ displayRule.setWallZoomTo(zoomTo.floatValue());
589
+ promise.resolve(null);
590
+ } else {
591
+ reject(promise, displayRuleId);
592
+ }
593
+ }
594
+
595
+ @ReactMethod
596
+ public void getExtrusionColor(String displayRuleId, final Promise promise) {
597
+ MPDisplayRule displayRule = getRule(displayRuleId);
598
+ if (displayRule != null) {
599
+ promise.resolve(displayRule.getExtrusionColor());
600
+ } else {
601
+ reject(promise, displayRuleId);
602
+ }
603
+ }
604
+
605
+ @ReactMethod
606
+ public void setExtrusionColor(String displayRuleId, String extrusionColor, final Promise promise) {
607
+ MPDisplayRule displayRule = getRule(displayRuleId);
608
+ if (displayRule != null) {
609
+ displayRule.setExtrusionColor(extrusionColor);
610
+ promise.resolve(null);
611
+ } else {
612
+ reject(promise, displayRuleId);
613
+ }
614
+ }
615
+
616
+ @ReactMethod
617
+ public void getExtrusionHeight(String displayRuleId, final Promise promise) {
618
+ MPDisplayRule displayRule = getRule(displayRuleId);
619
+ if (displayRule != null) {
620
+ promise.resolve(displayRule.getExtrusionHeight());
621
+ } else {
622
+ reject(promise, displayRuleId);
623
+ }
624
+ }
625
+
626
+ @ReactMethod
627
+ public void setExtrusionHeight(String displayRuleId, Double extrusionHeight, final Promise promise) {
628
+ MPDisplayRule displayRule = getRule(displayRuleId);
629
+ if (displayRule != null) {
630
+ displayRule.setExtrusionHeight(extrusionHeight.floatValue());
631
+ promise.resolve(null);
632
+ } else {
633
+ reject(promise, displayRuleId);
634
+ }
635
+ }
636
+
637
+ @ReactMethod
638
+ public void getExtrusionZoomFrom(String displayRuleId, final Promise promise) {
639
+ MPDisplayRule displayRule = getRule(displayRuleId);
640
+ if (displayRule != null) {
641
+ promise.resolve(displayRule.getExtrusionZoomFrom());
642
+ } else {
643
+ reject(promise, displayRuleId);
644
+ }
645
+ }
646
+
647
+ @ReactMethod
648
+ public void setExtrusionZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
649
+ MPDisplayRule displayRule = getRule(displayRuleId);
650
+ if (displayRule != null) {
651
+ displayRule.setExtrusionZoomFrom(zoomFrom.floatValue());
652
+ promise.resolve(null);
653
+ } else {
654
+ reject(promise, displayRuleId);
655
+ }
656
+ }
657
+
658
+ @ReactMethod
659
+ public void getExtrusionZoomTo(String displayRuleId, final Promise promise) {
660
+ MPDisplayRule displayRule = getRule(displayRuleId);
661
+ if (displayRule != null) {
662
+ promise.resolve(displayRule.getExtrusionZoomTo());
663
+ } else {
664
+ reject(promise, displayRuleId);
665
+ }
666
+ }
667
+
668
+ @ReactMethod
669
+ public void setExtrusionZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
670
+ MPDisplayRule displayRule = getRule(displayRuleId);
671
+ if (displayRule != null) {
672
+ displayRule.setExtrusionZoomTo(zoomTo.floatValue());
673
+ promise.resolve(null);
674
+ } else {
675
+ reject(promise, displayRuleId);
676
+ }
677
+ }
678
+
679
+ @ReactMethod
680
+ public void getModel2DZoomFrom(String displayRuleId, final Promise promise) {
681
+ MPDisplayRule displayRule = getRule(displayRuleId);
682
+ if (displayRule != null) {
683
+ promise.resolve(displayRule.getModel2DZoomFrom());
684
+ } else {
685
+ reject(promise, displayRuleId);
686
+ }
687
+ }
688
+
689
+ @ReactMethod
690
+ public void setModel2DZoomFrom(String displayRuleId, Double zoomFrom, final Promise promise) {
691
+ MPDisplayRule displayRule = getRule(displayRuleId);
692
+ if (displayRule != null) {
693
+ displayRule.setModel2DZoomFrom(zoomFrom.floatValue());
694
+ promise.resolve(null);
695
+ } else {
696
+ reject(promise, displayRuleId);
697
+ }
698
+ }
699
+
700
+ @ReactMethod
701
+ public void getModel2DZoomTo(String displayRuleId, final Promise promise) {
702
+ MPDisplayRule displayRule = getRule(displayRuleId);
703
+ if (displayRule != null) {
704
+ promise.resolve(displayRule.getModel2DZoomTo());
705
+ } else {
706
+ reject(promise, displayRuleId);
707
+ }
708
+ }
709
+
710
+ @ReactMethod
711
+ public void setModel2DZoomTo(String displayRuleId, Double zoomTo, final Promise promise) {
712
+ MPDisplayRule displayRule = getRule(displayRuleId);
713
+ if (displayRule != null) {
714
+ displayRule.setModel2DZoomTo(zoomTo.floatValue());
715
+ promise.resolve(null);
716
+ } else {
717
+ reject(promise, displayRuleId);
718
+ }
719
+ }
720
+
721
+ @ReactMethod
722
+ public void getModel2DWidthMeters(String displayRuleId, final Promise promise) {
723
+ MPDisplayRule displayRule = getRule(displayRuleId);
724
+ if (displayRule != null) {
725
+ promise.resolve(displayRule.getModel2DWidthMeters());
726
+ } else {
727
+ reject(promise, displayRuleId);
728
+ }
729
+ }
730
+
731
+ @ReactMethod
732
+ public void setModel2DWidthMeters(String displayRuleId, Double width, final Promise promise) {
733
+ MPDisplayRule displayRule = getRule(displayRuleId);
734
+ if (displayRule != null) {
735
+ displayRule.setModel2DWidthMeters(width);
736
+ promise.resolve(null);
737
+ } else {
738
+ reject(promise, displayRuleId);
739
+ }
740
+ }
741
+
742
+ @ReactMethod
743
+ public void getModel2DHeightMeters(String displayRuleId, final Promise promise) {
744
+ MPDisplayRule displayRule = getRule(displayRuleId);
745
+ if (displayRule != null) {
746
+ promise.resolve(displayRule.getModel2DHeightMeters());
747
+ } else {
748
+ reject(promise, displayRuleId);
749
+ }
750
+ }
751
+
752
+ @ReactMethod
753
+ public void setModel2DHeightMeters(String displayRuleId, Double height, final Promise promise) {
754
+ MPDisplayRule displayRule = getRule(displayRuleId);
755
+ if (displayRule != null) {
756
+ displayRule.setModel2DHeightMeters(height);
757
+ promise.resolve(null);
758
+ } else {
759
+ reject(promise, displayRuleId);
760
+ }
761
+ }
762
+
763
+ @ReactMethod
764
+ public void getModel2DBearing(String displayRuleId, final Promise promise) {
765
+ MPDisplayRule displayRule = getRule(displayRuleId);
766
+ if (displayRule != null) {
767
+ promise.resolve(displayRule.getModel2DBearing());
768
+ } else {
769
+ reject(promise, displayRuleId);
770
+ }
771
+ }
772
+
773
+ @ReactMethod
774
+ public void setModel2DBearing(String displayRuleId, Double bearing, final Promise promise) {
775
+ MPDisplayRule displayRule = getRule(displayRuleId);
776
+ if (displayRule != null) {
777
+ displayRule.setModel2DBearing(bearing);
778
+ promise.resolve(null);
779
+ } else {
780
+ reject(promise, displayRuleId);
781
+ }
782
+ }
783
+
784
+ @ReactMethod
785
+ public void getModel2DModel(String displayRuleId, final Promise promise) {
786
+ MPDisplayRule displayRule = getRule(displayRuleId);
787
+ if (displayRule != null) {
788
+ promise.resolve(displayRule.getModel2DModel());
789
+ } else {
790
+ reject(promise, displayRuleId);
791
+ }
792
+ }
793
+
794
+ @ReactMethod
795
+ public void setModel2DModel(String displayRuleId, String model, final Promise promise) {
796
+ MPDisplayRule displayRule = getRule(displayRuleId);
797
+ if (displayRule != null) {
798
+ displayRule.setModel2DModel(model);
799
+ promise.resolve(null);
800
+ } else {
801
+ reject(promise, displayRuleId);
802
+ }
803
+ }
804
+
805
+ @ReactMethod
806
+ public void reset(String displayRuleId, final Promise promise) {
807
+ MPDisplayRule displayRule = getRule(displayRuleId);
808
+ if (displayRule != null) {
809
+ displayRule.reset();
810
+ promise.resolve(null);
811
+ } else {
812
+ reject(promise, displayRuleId);
813
+ }
814
+ }
815
+
816
+ }