@mapsindoors/react-native-maps-indoors-mapbox 1.3.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -1
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.idea/compiler.xml +1 -1
- package/android/.idea/gradle.xml +1 -1
- package/android/.idea/misc.xml +2 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/mapsindoorsrn/MapboxMapView.java +12 -2
- package/android/src/main/java/com/mapsindoorsrn/MapsIndoorsViewManager.java +5 -1
- package/android/src/main/java/com/mapsindoorsrn/core/DirectionsRendererModule.java +3 -0
- package/android/src/main/java/com/mapsindoorsrn/core/MPDisplayRuleModule.java +172 -0
- package/android/src/main/java/com/mapsindoorsrn/core/MapControlModule.java +80 -0
- package/android/src/main/java/com/mapsindoorsrn/core/UtilsModule.java +39 -0
- package/app.plugin.js +280 -0
- package/index.ts +12 -1
- package/ios/MapsIndoorsViewManager.swift +21 -4
- package/ios/core/DirectionsRendererModule.swift +2 -0
- package/ios/core/LabelGraphic.swift +15 -0
- package/ios/core/MPDisplayRuleBridge.m +81 -0
- package/ios/core/MPDisplayRuleModule.swift +191 -0
- package/ios/core/MapControlBridge.m +21 -0
- package/ios/core/MapControlModule.swift +83 -1
- package/ios/core/RCMapView.swift +1 -1
- package/ios/core/UtilsBridge.m +4 -0
- package/ios/core/UtilsModule.swift +21 -0
- package/package.json +3 -2
- package/react-native-maps-indoors-mapbox.podspec +2 -2
- package/src/core/MPCameraViewFitMode.ts +4 -0
- package/src/core/MPDirectionsRenderer.ts +6 -1
- package/src/core/MPDisplayRule.ts +296 -89
- package/src/core/MPFeatureTypes.ts +8 -0
- package/src/core/MPLabelGraphic.ts +24 -0
- package/src/core/MPLabelType.ts +1 -0
- package/src/core/MPLocation.ts +20 -0
- package/src/core/MPLocationSettings.ts +40 -0
- package/src/core/MPMapConfig.ts +36 -0
- package/src/core/MPPOIType.ts +43 -0
- package/src/core/MPPropertyData.ts +10 -1
- package/src/core/MPSelectionMode.ts +4 -0
- package/src/core/MPSolution.ts +9 -0
- package/src/core/MPSolutionConfig.ts +18 -0
- package/src/core/MPUtils.ts +5 -0
- package/src/core/MapControl.ts +54 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Documentation
|
|
4
4
|
|
|
5
|
-
Visit [our reference document site](https://app.mapsindoors.com/mapsindoors/reference/react-native/mapbox/
|
|
5
|
+
Visit [our reference document site](https://app.mapsindoors.com/mapsindoors/reference/react-native/mapbox/2.0.0/index.html) to get an overview of what the MapsIndoors SDK offers.
|
|
6
6
|
|
|
7
7
|
## Getting started
|
|
8
8
|
|
|
@@ -92,6 +92,53 @@ allprojects {
|
|
|
92
92
|
}
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
### Expo
|
|
96
|
+
|
|
97
|
+
This library implements native modules and can't be used with ExpoGO, developments build is required [Delopment Builds](https://docs.expo.dev/develop/development-builds/introduction/)
|
|
98
|
+
|
|
99
|
+
To build and run correctly, the native ios linkage required to being set as dynamic.
|
|
100
|
+
Project configuration can be done with the expo module expo-build-properties.
|
|
101
|
+
|
|
102
|
+
with npx :
|
|
103
|
+
`$ npx expo install expo-build-properties`
|
|
104
|
+
|
|
105
|
+
with npm :
|
|
106
|
+
`$ npm install expo-build-properties`
|
|
107
|
+
|
|
108
|
+
with yarn :
|
|
109
|
+
`$ yarn add expo-build-properties`
|
|
110
|
+
|
|
111
|
+
This library includes an expo plugin to support native integration.
|
|
112
|
+
To enable it, you need to add the configuration in your expo configuration.
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
// app.json
|
|
116
|
+
|
|
117
|
+
{
|
|
118
|
+
"expo": {
|
|
119
|
+
// ... your configuration
|
|
120
|
+
"plugins": [
|
|
121
|
+
[
|
|
122
|
+
"expo-build-properties",
|
|
123
|
+
{
|
|
124
|
+
"ios": {
|
|
125
|
+
"deploymentTarget": "14.0"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
[
|
|
130
|
+
"@mapsindoors/react-native-maps-indoors-mapbox/app.plugin.js", // plugin ref
|
|
131
|
+
{
|
|
132
|
+
"publicToken": "PUBLIC_TOKEN", // your map public token
|
|
133
|
+
"downloadToken": "DOWNLOAD_TOKEN", // your download token
|
|
134
|
+
"staticPods": true // OPTIONAL, add if your project use static linkage for pods (ex: "useFrameworks": "static" with expo-build-properties)
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
95
142
|
## Usage
|
|
96
143
|
|
|
97
144
|
### Showing your map
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/.idea/gradle.xml
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<option name="testRunner" value="GRADLE" />
|
|
8
8
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
9
9
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
10
|
-
<option name="gradleJvm" value="
|
|
10
|
+
<option name="gradleJvm" value="1.8" />
|
|
11
11
|
<option name="modules">
|
|
12
12
|
<set>
|
|
13
13
|
<option value="$PROJECT_DIR$" />
|
package/android/.idea/misc.xml
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
1
2
|
<project version="4">
|
|
2
3
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
|
3
|
-
<component name="ProjectRootManager" version="2" languageLevel="
|
|
4
|
+
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
|
4
5
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
5
6
|
</component>
|
|
6
7
|
<component name="ProjectType">
|
package/android/build.gradle
CHANGED
|
@@ -92,8 +92,8 @@ dependencies {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
implementation 'com.mapbox.maps:android:
|
|
96
|
-
implementation 'com.mapspeople.mapsindoors:mapbox:4.8.
|
|
95
|
+
implementation 'com.mapbox.maps:android:11.4.0'
|
|
96
|
+
implementation 'com.mapspeople.mapsindoors:mapbox-v11:4.8.5'
|
|
97
97
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
98
98
|
implementation 'androidx.core:core-ktx:1.3.2'
|
|
99
99
|
implementation 'com.github.bumptech.glide:glide:4.16.0'
|
|
@@ -19,6 +19,9 @@ import com.mapsindoorsrn.core.RCMapView;
|
|
|
19
19
|
import com.mapsindoorsrn.core.models.MPCameraPosition;
|
|
20
20
|
import com.mapsindoorsrn.core.models.MPCameraUpdate;
|
|
21
21
|
|
|
22
|
+
import java.util.Arrays;
|
|
23
|
+
import java.util.Collections;
|
|
24
|
+
|
|
22
25
|
public class MapboxMapView implements RCMapView {
|
|
23
26
|
private MapView mMapView;
|
|
24
27
|
private Context mContext;
|
|
@@ -80,6 +83,13 @@ public class MapboxMapView implements RCMapView {
|
|
|
80
83
|
config.setTileFadeInEnabled(configMap.getBoolean("enableTileFadeIn"));
|
|
81
84
|
}
|
|
82
85
|
|
|
86
|
+
if (configMap.hasKey("mapsIndoorsTransitionLevel")) {
|
|
87
|
+
config.setMapsIndoorsTransitionLevel(configMap.getInt("mapsIndoorsTransitionLevel"));
|
|
88
|
+
}
|
|
89
|
+
if (configMap.hasKey("showMapMarkers")) {
|
|
90
|
+
config.showMapMarkers(configMap.getBoolean("showMapMarkers"));
|
|
91
|
+
}
|
|
92
|
+
|
|
83
93
|
return config.build();
|
|
84
94
|
}
|
|
85
95
|
|
|
@@ -95,9 +105,9 @@ public class MapboxMapView implements RCMapView {
|
|
|
95
105
|
case FROM_BOUNDS:
|
|
96
106
|
Point southWest = Point.fromLngLat(cameraUpdate.bounds.getSouthWest().getLng(), cameraUpdate.bounds.getSouthWest().getLat());
|
|
97
107
|
Point northEast = Point.fromLngLat(cameraUpdate.bounds.getNorthEast().getLng(), cameraUpdate.bounds.getNorthEast().getLat());
|
|
98
|
-
CoordinateBounds coordinateBounds = new CoordinateBounds(southWest, northEast);
|
|
99
108
|
Double padding = (double) (mContext.getResources().getDisplayMetrics().density * cameraUpdate.padding);
|
|
100
|
-
|
|
109
|
+
CameraOptions cameraOptions = new CameraOptions.Builder().build();
|
|
110
|
+
return mMapView.getMapboxMap().cameraForCoordinates(Arrays.asList(southWest,northEast), cameraOptions, new EdgeInsets(padding, padding, padding, padding), null, null);
|
|
101
111
|
case ZOOM_BY:
|
|
102
112
|
return new CameraOptions.Builder().zoom(mMapView.getMapboxMap().getCameraState().getZoom() + cameraUpdate.zoom).build();
|
|
103
113
|
case ZOOM_TO:
|
|
@@ -14,6 +14,9 @@ import com.facebook.react.common.MapBuilder;
|
|
|
14
14
|
import com.facebook.react.uimanager.ThemedReactContext;
|
|
15
15
|
import com.facebook.react.uimanager.ViewGroupManager;
|
|
16
16
|
import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
|
17
|
+
import com.mapbox.maps.CameraOptions;
|
|
18
|
+
import com.mapbox.maps.MapInitOptions;
|
|
19
|
+
import com.mapbox.maps.MapOptions;
|
|
17
20
|
import com.mapbox.maps.MapView;
|
|
18
21
|
import com.mapsindoors.core.OnResultReadyListener;
|
|
19
22
|
|
|
@@ -45,7 +48,8 @@ public class MapsIndoorsViewManager extends ViewGroupManager<MapView> {
|
|
|
45
48
|
@NonNull
|
|
46
49
|
@Override
|
|
47
50
|
protected MapView createViewInstance(@NonNull ThemedReactContext reactContext) {
|
|
48
|
-
|
|
51
|
+
MapInitOptions options = new MapInitOptions(reactContext, MapInitOptions.Companion.getDefaultMapOptions(reactContext), MapInitOptions.Companion.getDefaultPluginList(), new CameraOptions.Builder().pitch(0.0).build());
|
|
52
|
+
view = new MapView(reactContext, options);
|
|
49
53
|
return view;
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -162,6 +162,9 @@ public class DirectionsRendererModule extends ReactContextBaseJavaModule impleme
|
|
|
162
162
|
case 2:
|
|
163
163
|
mode = MPCameraViewFitMode.START_TO_END_ALIGNED;
|
|
164
164
|
break;
|
|
165
|
+
case 3:
|
|
166
|
+
mode = MPCameraViewFitMode.NONE;
|
|
167
|
+
break;
|
|
165
168
|
default:
|
|
166
169
|
mode = null;
|
|
167
170
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
package com.mapsindoorsrn.core;
|
|
2
2
|
|
|
3
|
+
import android.util.Log;
|
|
4
|
+
|
|
3
5
|
import androidx.annotation.NonNull;
|
|
4
6
|
|
|
5
7
|
import com.facebook.react.bridge.Promise;
|
|
@@ -11,6 +13,7 @@ import com.mapsindoors.core.MPBadgePosition;
|
|
|
11
13
|
import com.mapsindoors.core.MPDisplayRule;
|
|
12
14
|
import com.mapsindoors.core.MPIconPlacement;
|
|
13
15
|
import com.mapsindoors.core.MPIconSize;
|
|
16
|
+
import com.mapsindoors.core.MPLabelGraphic;
|
|
14
17
|
import com.mapsindoors.core.MPLabelType;
|
|
15
18
|
import com.mapsindoors.core.MPSolutionDisplayRule;
|
|
16
19
|
import com.mapsindoors.core.MapsIndoors;
|
|
@@ -979,6 +982,9 @@ public class MPDisplayRuleModule extends ReactContextBaseJavaModule {
|
|
|
979
982
|
case 1:
|
|
980
983
|
labelType = MPLabelType.FLAT;
|
|
981
984
|
break;
|
|
985
|
+
case 2:
|
|
986
|
+
labelType = MPLabelType.GRAPHIC;
|
|
987
|
+
break;
|
|
982
988
|
default:
|
|
983
989
|
labelType = MPLabelType.FLOATING;
|
|
984
990
|
break;
|
|
@@ -1158,6 +1164,30 @@ public class MPDisplayRuleModule extends ReactContextBaseJavaModule {
|
|
|
1158
1164
|
}
|
|
1159
1165
|
}
|
|
1160
1166
|
|
|
1167
|
+
@ReactMethod
|
|
1168
|
+
public void setLabelStyleGraphic(String displayRuleId, String graphic, final Promise promise) {
|
|
1169
|
+
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
1170
|
+
if (displayRule != null) {
|
|
1171
|
+
MPLabelGraphic labelGraphic = gson.fromJson(graphic, MPLabelGraphic.class);
|
|
1172
|
+
displayRule.setLabelStyleGraphic(labelGraphic);
|
|
1173
|
+
Log.i("timtest", "i did a thing");
|
|
1174
|
+
promise.resolve(null);
|
|
1175
|
+
} else {
|
|
1176
|
+
reject(promise, displayRuleId);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
@ReactMethod
|
|
1181
|
+
public void getLabelStyleGraphic(String displayRuleId, final Promise promise) {
|
|
1182
|
+
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
1183
|
+
if (displayRule != null) {
|
|
1184
|
+
String labelGraphicString = gson.toJson(displayRule.getLabelStyleGraphic());
|
|
1185
|
+
promise.resolve(labelGraphicString);
|
|
1186
|
+
} else {
|
|
1187
|
+
reject(promise, displayRuleId);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1161
1191
|
@ReactMethod
|
|
1162
1192
|
public void getPolygonLightnessFactor(String displayRuleId, final Promise promise) {
|
|
1163
1193
|
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
@@ -1472,6 +1502,148 @@ public class MPDisplayRuleModule extends ReactContextBaseJavaModule {
|
|
|
1472
1502
|
}
|
|
1473
1503
|
}
|
|
1474
1504
|
|
|
1505
|
+
@ReactMethod
|
|
1506
|
+
public void getModel3DModel(String displayRuleId, final Promise promise) {
|
|
1507
|
+
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
1508
|
+
if (displayRule != null) {
|
|
1509
|
+
promise.resolve(displayRule.getModel3DModel());
|
|
1510
|
+
} else {
|
|
1511
|
+
reject(promise, displayRuleId);
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
@ReactMethod
|
|
1516
|
+
public void setModel3DModel(String displayRuleId, String model, final Promise promise) {
|
|
1517
|
+
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
1518
|
+
if (displayRule != null) {
|
|
1519
|
+
displayRule.setModel3DModel(model);
|
|
1520
|
+
promise.resolve(null);
|
|
1521
|
+
} else {
|
|
1522
|
+
reject(promise, displayRuleId);
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
@ReactMethod
|
|
1527
|
+
public void getModel3DRotationX(String displayRuleId, final Promise promise) {
|
|
1528
|
+
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
1529
|
+
if (displayRule != null) {
|
|
1530
|
+
promise.resolve(displayRule.getModel3DRotationX());
|
|
1531
|
+
} else {
|
|
1532
|
+
reject(promise, displayRuleId);
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
@ReactMethod
|
|
1537
|
+
public void setModel3DRotationX(String displayRuleId, Double rotationX, final Promise promise) {
|
|
1538
|
+
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
1539
|
+
if (displayRule != null) {
|
|
1540
|
+
if (rotationX == -1) {
|
|
1541
|
+
displayRule.setModel3DRotationX(null);
|
|
1542
|
+
}else {
|
|
1543
|
+
displayRule.setModel3DRotationX(rotationX.floatValue());
|
|
1544
|
+
}
|
|
1545
|
+
promise.resolve(null);
|
|
1546
|
+
} else {
|
|
1547
|
+
reject(promise, displayRuleId);
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
@ReactMethod
|
|
1552
|
+
public void getModel3DRotationY(String displayRuleId, final Promise promise) {
|
|
1553
|
+
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
1554
|
+
if (displayRule != null) {
|
|
1555
|
+
promise.resolve(displayRule.getModel3DRotationY());
|
|
1556
|
+
} else {
|
|
1557
|
+
reject(promise, displayRuleId);
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
@ReactMethod
|
|
1562
|
+
public void setModel3DRotationY(String displayRuleId, Double rotationY, final Promise promise) {
|
|
1563
|
+
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
1564
|
+
if (displayRule != null) {
|
|
1565
|
+
if (rotationY == -1) {
|
|
1566
|
+
displayRule.setModel3DRotationY(null);
|
|
1567
|
+
}else {
|
|
1568
|
+
displayRule.setModel3DRotationY(rotationY.floatValue());
|
|
1569
|
+
}
|
|
1570
|
+
promise.resolve(null);
|
|
1571
|
+
} else {
|
|
1572
|
+
reject(promise, displayRuleId);
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
@ReactMethod
|
|
1577
|
+
public void getModel3DRotationZ(String displayRuleId, final Promise promise) {
|
|
1578
|
+
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
1579
|
+
if (displayRule != null) {
|
|
1580
|
+
promise.resolve(displayRule.getModel3DRotationZ());
|
|
1581
|
+
} else {
|
|
1582
|
+
reject(promise, displayRuleId);
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
@ReactMethod
|
|
1587
|
+
public void setModel3DRotationZ(String displayRuleId, Double rotationZ, final Promise promise) {
|
|
1588
|
+
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
1589
|
+
if (displayRule != null) {
|
|
1590
|
+
if (rotationZ == -1) {
|
|
1591
|
+
displayRule.setModel3DRotationZ(null);
|
|
1592
|
+
}else {
|
|
1593
|
+
displayRule.setModel3DRotationZ(rotationZ.floatValue());
|
|
1594
|
+
}
|
|
1595
|
+
promise.resolve(null);
|
|
1596
|
+
} else {
|
|
1597
|
+
reject(promise, displayRuleId);
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
@ReactMethod
|
|
1602
|
+
public void getModel3DScale(String displayRuleId, final Promise promise) {
|
|
1603
|
+
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
1604
|
+
if (displayRule != null) {
|
|
1605
|
+
promise.resolve(displayRule.getModel3DScale());
|
|
1606
|
+
} else {
|
|
1607
|
+
reject(promise, displayRuleId);
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
@ReactMethod
|
|
1612
|
+
public void setModel3DScale(String displayRuleId, Double scale, final Promise promise) {
|
|
1613
|
+
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
1614
|
+
if (displayRule != null) {
|
|
1615
|
+
if (scale == -1) {
|
|
1616
|
+
displayRule.setModel3DScale(null);
|
|
1617
|
+
}else {
|
|
1618
|
+
displayRule.setModel3DScale(scale.floatValue());
|
|
1619
|
+
}
|
|
1620
|
+
promise.resolve(null);
|
|
1621
|
+
} else {
|
|
1622
|
+
reject(promise, displayRuleId);
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
@ReactMethod
|
|
1627
|
+
public void isModel3DVisible(String displayRuleId, final Promise promise) {
|
|
1628
|
+
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
1629
|
+
if (displayRule != null) {
|
|
1630
|
+
promise.resolve(displayRule.isModel3DVisible());
|
|
1631
|
+
} else {
|
|
1632
|
+
reject(promise, displayRuleId);
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
@ReactMethod
|
|
1637
|
+
public void setModel3DVisible(String displayRuleId, String visible, final Promise promise) {
|
|
1638
|
+
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
1639
|
+
if (displayRule != null) {
|
|
1640
|
+
displayRule.setModel3DVisible(Boolean.valueOf(visible));
|
|
1641
|
+
promise.resolve(null);
|
|
1642
|
+
} else {
|
|
1643
|
+
reject(promise, displayRuleId);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1475
1647
|
@ReactMethod
|
|
1476
1648
|
public void reset(String displayRuleId, final Promise promise) {
|
|
1477
1649
|
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
@@ -17,6 +17,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
|
17
17
|
import com.google.gson.Gson;
|
|
18
18
|
import com.google.gson.reflect.TypeToken;
|
|
19
19
|
import com.mapsindoors.core.MPBuilding;
|
|
20
|
+
import com.mapsindoors.core.MPFeatureType;
|
|
20
21
|
import com.mapsindoors.core.MPFilter;
|
|
21
22
|
import com.mapsindoors.core.MPFilterBehavior;
|
|
22
23
|
import com.mapsindoors.core.MPFloor;
|
|
@@ -26,6 +27,7 @@ import com.mapsindoors.core.MPIMapConfig;
|
|
|
26
27
|
import com.mapsindoors.core.MPLocation;
|
|
27
28
|
import com.mapsindoors.core.MPPoint;
|
|
28
29
|
import com.mapsindoors.core.MPSelectionBehavior;
|
|
30
|
+
import com.mapsindoors.core.MPSelectionMode;
|
|
29
31
|
import com.mapsindoors.core.MPVenue;
|
|
30
32
|
import com.mapsindoors.core.MapControl;
|
|
31
33
|
import com.mapsindoors.core.MapsIndoors;
|
|
@@ -538,6 +540,84 @@ public class MapControlModule extends ReactContextBaseJavaModule implements MPCa
|
|
|
538
540
|
}
|
|
539
541
|
}
|
|
540
542
|
|
|
543
|
+
@ReactMethod
|
|
544
|
+
public void setBuildingSelectionMode(Double selectionMode, final Promise promise) {
|
|
545
|
+
switch (selectionMode.intValue()) {
|
|
546
|
+
case 0:
|
|
547
|
+
mMapControl.setBuildingSelectionMode(MPSelectionMode.MANUAL);
|
|
548
|
+
break;
|
|
549
|
+
case 1:
|
|
550
|
+
mMapControl.setBuildingSelectionMode(MPSelectionMode.AUTOMATIC);
|
|
551
|
+
break;
|
|
552
|
+
}
|
|
553
|
+
promise.resolve(null);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
@ReactMethod
|
|
557
|
+
public void getBuildingSelectionMode(final Promise promise) {
|
|
558
|
+
promise.resolve(mMapControl.getBuildingSelectionMode().ordinal());
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
@ReactMethod
|
|
562
|
+
public void setFloorSelectionMode(Double selectionMode, final Promise promise) {
|
|
563
|
+
switch (selectionMode.intValue()) {
|
|
564
|
+
case 0:
|
|
565
|
+
mMapControl.setFloorSelectionMode(MPSelectionMode.MANUAL);
|
|
566
|
+
break;
|
|
567
|
+
case 1:
|
|
568
|
+
mMapControl.setFloorSelectionMode(MPSelectionMode.AUTOMATIC);
|
|
569
|
+
break;
|
|
570
|
+
}
|
|
571
|
+
promise.resolve(null);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
@ReactMethod
|
|
575
|
+
public void getFloorSelectionMode(final Promise promise) {
|
|
576
|
+
promise.resolve(mMapControl.getFloorSelectionMode().ordinal());
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
@ReactMethod
|
|
580
|
+
public void setHiddenFeatures(String featuresString, final Promise promise) {
|
|
581
|
+
List<Integer> featureStrings = gson.fromJson(featuresString, new TypeToken<List<Integer>>() {}.getType());
|
|
582
|
+
List<MPFeatureType> features = new ArrayList<>();
|
|
583
|
+
for (Integer feature : featureStrings) {
|
|
584
|
+
switch (feature) {
|
|
585
|
+
case 1:
|
|
586
|
+
features.add(MPFeatureType.WALLS_2D);
|
|
587
|
+
break;
|
|
588
|
+
case 3:
|
|
589
|
+
features.add(MPFeatureType.WALLS_3D);
|
|
590
|
+
break;
|
|
591
|
+
case 0:
|
|
592
|
+
features.add(MPFeatureType.MODEL_2D);
|
|
593
|
+
break;
|
|
594
|
+
case 2:
|
|
595
|
+
features.add(MPFeatureType.MODEL_3D);
|
|
596
|
+
break;
|
|
597
|
+
case 4:
|
|
598
|
+
features.add(MPFeatureType.EXTRUSION_3D);
|
|
599
|
+
break;
|
|
600
|
+
case 5:
|
|
601
|
+
features.add(MPFeatureType.EXTRUDED_BUILDINGS);
|
|
602
|
+
break;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
getCurrentActivity().runOnUiThread(()-> {
|
|
606
|
+
mMapControl.setHiddenFeatures(features);
|
|
607
|
+
promise.resolve(null);
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
@ReactMethod
|
|
612
|
+
public void getHiddenFeatures(final Promise promise) {
|
|
613
|
+
List<MPFeatureType> features = mMapControl.getHiddenFeatures();
|
|
614
|
+
List<Integer> featureStrings = new ArrayList<>();
|
|
615
|
+
for (MPFeatureType feature : features) {
|
|
616
|
+
featureStrings.add(feature.ordinal());
|
|
617
|
+
}
|
|
618
|
+
promise.resolve(gson.toJson(featureStrings));
|
|
619
|
+
}
|
|
620
|
+
|
|
541
621
|
@Override
|
|
542
622
|
public void onFloorUpdate(@Nullable MPBuilding building, int floorIndex) {
|
|
543
623
|
WritableMap params = Arguments.createMap();
|
|
@@ -9,7 +9,10 @@ import com.facebook.react.bridge.ReactMethod;
|
|
|
9
9
|
import com.google.gson.Gson;
|
|
10
10
|
import com.mapsindoors.core.MPCollisionHandling;
|
|
11
11
|
import com.mapsindoors.core.MPGeometry;
|
|
12
|
+
import com.mapsindoors.core.MPLocation;
|
|
13
|
+
import com.mapsindoors.core.MPLocationSettings;
|
|
12
14
|
import com.mapsindoors.core.MPMultiPolygonGeometry;
|
|
15
|
+
import com.mapsindoors.core.MPPOIType;
|
|
13
16
|
import com.mapsindoors.core.MPPoint;
|
|
14
17
|
import com.mapsindoors.core.MPPolygonGeometry;
|
|
15
18
|
import com.mapsindoors.core.MPSolution;
|
|
@@ -20,6 +23,8 @@ import com.mapsindoors.core.errors.MIError;
|
|
|
20
23
|
import com.mapsindoors.core.errors.MIErrorEnum;
|
|
21
24
|
import com.mapsindoorsrn.core.models.MPError;
|
|
22
25
|
|
|
26
|
+
import java.util.Locale;
|
|
27
|
+
|
|
23
28
|
public class UtilsModule extends ReactContextBaseJavaModule {
|
|
24
29
|
|
|
25
30
|
private final Gson gson = new Gson();
|
|
@@ -172,4 +177,38 @@ public class UtilsModule extends ReactContextBaseJavaModule {
|
|
|
172
177
|
}
|
|
173
178
|
promise.resolve(null);
|
|
174
179
|
}
|
|
180
|
+
|
|
181
|
+
@ReactMethod
|
|
182
|
+
public void setSelectable(String id, boolean selectable, final Promise promise) {
|
|
183
|
+
MPSolution solution = MapsIndoors.getSolution();
|
|
184
|
+
if (solution != null) {
|
|
185
|
+
if (id.equals("solution")) {
|
|
186
|
+
solution.getConfig().getLocationSettings().setSelectable(selectable);
|
|
187
|
+
} else {
|
|
188
|
+
MPLocation location = MapsIndoors.getLocationById(id);
|
|
189
|
+
if (location != null) {
|
|
190
|
+
if (location.getLocationSettings() == null) {
|
|
191
|
+
location.setLocationSettings(new MPLocationSettings(selectable));
|
|
192
|
+
}else {
|
|
193
|
+
location.getLocationSettings().setSelectable(selectable);
|
|
194
|
+
}
|
|
195
|
+
}else {
|
|
196
|
+
for (MPPOIType type : solution.getTypes()) {
|
|
197
|
+
if (type.getName().equals(id.toLowerCase(Locale.ROOT))) {
|
|
198
|
+
if (type.getLocationSettings() == null) {
|
|
199
|
+
type.setLocationSettings(new MPLocationSettings(selectable));
|
|
200
|
+
}else {
|
|
201
|
+
type.getLocationSettings().setSelectable(selectable);
|
|
202
|
+
}
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
reject(promise, new MIError(MIErrorEnum.UNKNOWN_ERROR, "Solution is null, MapsIndoors needs to be loaded before setting selectable"));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
promise.resolve(null);
|
|
213
|
+
}
|
|
175
214
|
}
|