@mapsindoors/react-native-maps-indoors-mapbox 0.0.5-beta → 1.0.1
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 +7 -2
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/7.4/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.idea/jarRepositories.xml +15 -0
- package/android/.idea/misc.xml +1 -1
- package/android/.idea/vcs.xml +2 -1
- package/android/build.gradle +2 -5
- package/android/src/main/java/com/reactlibrary/MapboxMapView.java +116 -0
- package/android/src/main/java/com/reactlibrary/MapsIndoorsPackage.java +9 -2
- package/android/src/main/java/com/reactlibrary/{DirectionsRendererModule.java → core/DirectionsRendererModule.java} +3 -2
- package/android/src/main/java/com/reactlibrary/{DirectionsServiceModule.java → core/DirectionsServiceModule.java} +1 -1
- package/android/src/main/java/com/reactlibrary/{MPDisplayRuleModule.java → core/MPDisplayRuleModule.java} +3 -3
- package/android/src/main/java/com/reactlibrary/{MapControlModule.java → core/MapControlModule.java} +31 -64
- package/android/src/main/java/com/reactlibrary/{MapsIndoorsModule.java → core/MapsIndoorsModule.java} +6 -6
- package/android/src/main/java/com/reactlibrary/core/RCMapView.java +16 -0
- package/android/src/main/java/com/reactlibrary/core/README.md +92 -0
- package/android/src/main/java/com/reactlibrary/{UtilsModule.java → core/UtilsModule.java} +13 -12
- package/android/src/main/java/com/reactlibrary/{models → core/models}/Bounds.java +1 -1
- package/android/src/main/java/com/reactlibrary/{models → core/models}/Filter.java +1 -1
- package/android/src/main/java/com/reactlibrary/{models → core/models}/Location.java +1 -1
- package/android/src/main/java/com/reactlibrary/{models → core/models}/MPCameraPosition.java +12 -7
- package/android/src/main/java/com/reactlibrary/core/models/MPCameraUpdate.java +68 -0
- package/android/src/main/java/com/reactlibrary/{models → core/models}/MPError.java +1 -1
- package/android/src/main/java/com/reactlibrary/{models → core/models}/PositionProvider.java +1 -1
- package/android/src/main/java/com/reactlibrary/{models → core/models}/PositionResult.java +1 -1
- package/android/src/main/java/com/reactlibrary/{models → core/models}/Query.java +1 -1
- package/index.ts +88 -89
- package/ios/MapsIndoorsViewManager.swift +90 -9
- package/ios/core/CameraPosition.swift +15 -0
- package/ios/core/CameraUpdate.swift +19 -0
- package/ios/core/CameraUpdateError.swift +11 -0
- package/ios/{DirectionsRendererBridge.m → core/DirectionsRendererBridge.m} +9 -5
- package/ios/{DirectionsRendererModule.swift → core/DirectionsRendererModule.swift} +89 -39
- package/ios/{MapControlModule.swift → core/MapControlModule.swift} +21 -108
- package/ios/{MapsIndoorsBridge.m → core/MapsIndoorsBridge.m} +18 -0
- package/ios/{MapsIndoorsData.swift → core/MapsIndoorsData.swift} +19 -4
- package/ios/{MapsIndoorsModule.swift → core/MapsIndoorsModule.swift} +50 -1
- package/ios/core/RCMapView.swift +14 -0
- package/ios/core/README.md +92 -0
- package/ios/{UtilsModule.swift → core/UtilsModule.swift} +4 -4
- package/package.json +6 -5
- package/react-native-maps-indoors-mapbox.podspec +2 -2
- package/src/{MPBounds.ts → core/MPBounds.ts} +25 -7
- package/src/{MPBuilding.ts → core/MPBuilding.ts} +4 -4
- package/src/{MPCameraEvent.ts → core/MPCameraEvent.ts} +1 -1
- package/src/{MPCameraEventListener.ts → core/MPCameraEventListener.ts} +1 -1
- package/src/{MPCameraPosition.ts → core/MPCameraPosition.ts} +2 -3
- package/src/{MPCategory.ts → core/MPCategory.ts} +1 -1
- package/src/{MPDirectionsRenderer.ts → core/MPDirectionsRenderer.ts} +4 -4
- package/src/{MPDirectionsService.ts → core/MPDirectionsService.ts} +1 -1
- package/src/{MPDisplayRule.ts → core/MPDisplayRule.ts} +1 -1
- package/src/{MPEntity.ts → core/MPEntity.ts} +1 -1
- package/src/{MPEntityInfo.ts → core/MPEntityInfo.ts} +1 -1
- package/src/{MPFilter.ts → core/MPFilter.ts} +1 -1
- package/src/{MPFilterBehavior.ts → core/MPFilterBehavior.ts} +6 -6
- package/src/{MPFloor.ts → core/MPFloor.ts} +1 -1
- package/src/{MPFloorSelectorInterface.ts → core/MPFloorSelectorInterface.ts} +1 -1
- package/src/{MPLocation.ts → core/MPLocation.ts} +3 -3
- package/src/{MPMapConfig.ts → core/MPMapConfig.ts} +1 -1
- package/src/{MPMultiPolygon.ts → core/MPMultiPolygon.ts} +18 -5
- package/src/{MPPoint.ts → core/MPPoint.ts} +14 -10
- package/src/{MPPolygon.ts → core/MPPolygon.ts} +18 -5
- package/src/{MPPositionProviderInterface.ts → core/MPPositionProviderInterface.ts} +1 -1
- package/src/{MPPositionResultInterface.ts → core/MPPositionResultInterface.ts} +1 -1
- package/src/{MPPropertyData.ts → core/MPPropertyData.ts} +2 -2
- package/src/{MPQuery.ts → core/MPQuery.ts} +1 -1
- package/src/{MPRoute.ts → core/MPRoute.ts} +1 -1
- package/src/{MPRouteCoordinate.ts → core/MPRouteCoordinate.ts} +1 -1
- package/src/{MPRouteLeg.ts → core/MPRouteLeg.ts} +1 -1
- package/src/{MPRouteStep.ts → core/MPRouteStep.ts} +1 -1
- package/src/{MPSelectionBehavior.ts → core/MPSelectionBehavior.ts} +6 -6
- package/src/{MPSettings3D.ts → core/MPSettings3D.ts} +1 -1
- package/src/{MPSolution.ts → core/MPSolution.ts} +1 -1
- package/src/{MPSolutionConfig.ts → core/MPSolutionConfig.ts} +3 -3
- package/src/{MPSolutionDisplayRule.ts → core/MPSolutionDisplayRule.ts} +1 -1
- package/src/{MPUserRoleCollection.ts → core/MPUserRoleCollection.ts} +1 -1
- package/src/{MPUtils.ts → core/MPUtils.ts} +1 -1
- package/src/{MPVenue.ts → core/MPVenue.ts} +1 -1
- package/src/{MapControl.ts → core/MapControl.ts} +5 -2
- package/src/{MapsIndoors.ts → core/MapsIndoors.ts} +1 -1
- package/src/{OnBuildingFoundAtCameraTargetListener.ts → core/OnBuildingFoundAtCameraTargetListener.ts} +1 -1
- package/src/{OnFloorSelectionChangedListener.ts → core/OnFloorSelectionChangedListener.ts} +1 -1
- package/src/{OnLegSelectedListener.ts → core/OnLegSelectedListener.ts} +1 -1
- package/src/{OnLocationSelectedListener.ts → core/OnLocationSelectedListener.ts} +1 -1
- package/src/{OnMapClickListener.ts → core/OnMapClickListener.ts} +1 -1
- package/src/{OnMarkerClickListener.ts → core/OnMarkerClickListener.ts} +1 -1
- package/src/{OnMarkerInfoWindowClickListener.ts → core/OnMarkerInfoWindowClickListener.ts} +1 -1
- package/src/{OnPositionUpdateListener.ts → core/OnPositionUpdateListener.ts} +1 -1
- package/src/{OnVenueFoundAtCameraTargetListener.ts → core/OnVenueFoundAtCameraTargetListener.ts} +1 -1
- package/src/core/README.md +92 -0
- package/android/src/main/java/com/reactlibrary/models/MPCameraUpdate.java +0 -92
- /package/ios/{DirectionsServiceBridge.m → core/DirectionsServiceBridge.m} +0 -0
- /package/ios/{DirectionsServiceModule.swift → core/DirectionsServiceModule.swift} +0 -0
- /package/ios/{MPDisplayRuleBridge.m → core/MPDisplayRuleBridge.m} +0 -0
- /package/ios/{MPDisplayRuleModule.swift → core/MPDisplayRuleModule.swift} +0 -0
- /package/ios/{MapControlBridge.m → core/MapControlBridge.m} +0 -0
- /package/ios/{ReactPositionProvider.swift → core/ReactPositionProvider.swift} +0 -0
- /package/ios/{UtilsBridge.m → core/UtilsBridge.m} +0 -0
- /package/ios/{helpers.swift → core/helpers.swift} +0 -0
- /package/src/{EventNames.ts → core/EventNames.ts} +0 -0
- /package/src/{MPBuildingCollection.ts → core/MPBuildingCollection.ts} +0 -0
- /package/src/{MPBuildingInfo.ts → core/MPBuildingInfo.ts} +0 -0
- /package/src/{MPCameraUpdate.ts → core/MPCameraUpdate.ts} +0 -0
- /package/src/{MPCameraViewFitMode.ts → core/MPCameraViewFitMode.ts} +0 -0
- /package/src/{MPCategoryCollection.ts → core/MPCategoryCollection.ts} +0 -0
- /package/src/{MPCollection.ts → core/MPCollection.ts} +0 -0
- /package/src/{MPCollisionHandling.ts → core/MPCollisionHandling.ts} +0 -0
- /package/src/{MPDataField.ts → core/MPDataField.ts} +0 -0
- /package/src/{MPError.ts → core/MPError.ts} +0 -0
- /package/src/{MPGeometry.ts → core/MPGeometry.ts} +0 -0
- /package/src/{MPHighway.ts → core/MPHighway.ts} +0 -0
- /package/src/{MPIconSize.ts → core/MPIconSize.ts} +0 -0
- /package/src/{MPLocationPropertyNames.ts → core/MPLocationPropertyNames.ts} +0 -0
- /package/src/{MPLocationType.ts → core/MPLocationType.ts} +0 -0
- /package/src/{MPMapStyle.ts → core/MPMapStyle.ts} +0 -0
- /package/src/{MPRouteProperty.ts → core/MPRouteProperty.ts} +0 -0
- /package/src/{MPSize.ts → core/MPSize.ts} +0 -0
- /package/src/{MPUserRole.ts → core/MPUserRole.ts} +0 -0
- /package/src/{MPVenueCollection.ts → core/MPVenueCollection.ts} +0 -0
- /package/src/{MPVenueInfo.ts → core/MPVenueInfo.ts} +0 -0
- /package/src/{MapView.tsx → core/MapView.tsx} +0 -0
- /package/src/{OnFloorUpdateListener.ts → core/OnFloorUpdateListener.ts} +0 -0
- /package/src/{OnLiveLocationUpdateListener.ts → core/OnLiveLocationUpdateListener.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.reactlibrary;
|
|
1
|
+
package com.reactlibrary.core;
|
|
2
2
|
|
|
3
3
|
import androidx.annotation.NonNull;
|
|
4
4
|
|
|
@@ -15,9 +15,10 @@ import com.mapsindoors.core.MPPolygonGeometry;
|
|
|
15
15
|
import com.mapsindoors.core.MPSolution;
|
|
16
16
|
import com.mapsindoors.core.MPVenue;
|
|
17
17
|
import com.mapsindoors.core.MapsIndoors;
|
|
18
|
+
import com.mapsindoors.core.MPJsonParser;
|
|
18
19
|
import com.mapsindoors.core.errors.MIError;
|
|
19
20
|
import com.mapsindoors.core.errors.MIErrorEnum;
|
|
20
|
-
import com.reactlibrary.models.MPError;
|
|
21
|
+
import com.reactlibrary.core.models.MPError;
|
|
21
22
|
|
|
22
23
|
public class UtilsModule extends ReactContextBaseJavaModule {
|
|
23
24
|
|
|
@@ -54,8 +55,8 @@ public class UtilsModule extends ReactContextBaseJavaModule {
|
|
|
54
55
|
|
|
55
56
|
@ReactMethod
|
|
56
57
|
public void pointAngleBetween(String point1, String point2, final Promise promise) {
|
|
57
|
-
MPPoint it =
|
|
58
|
-
MPPoint other =
|
|
58
|
+
MPPoint it = MPJsonParser.parse(point1, MPPoint.class);
|
|
59
|
+
MPPoint other = MPJsonParser.parse(point2, MPPoint.class);
|
|
59
60
|
|
|
60
61
|
if (it != null && other != null) {
|
|
61
62
|
promise.resolve(it.angleBetween(other));
|
|
@@ -66,8 +67,8 @@ public class UtilsModule extends ReactContextBaseJavaModule {
|
|
|
66
67
|
|
|
67
68
|
@ReactMethod
|
|
68
69
|
public void pointDistanceTo(String point1, String point2, final Promise promise) {
|
|
69
|
-
MPPoint it =
|
|
70
|
-
MPPoint other =
|
|
70
|
+
MPPoint it = MPJsonParser.parse(point1, MPPoint.class);
|
|
71
|
+
MPPoint other = MPJsonParser.parse(point2, MPPoint.class);
|
|
71
72
|
|
|
72
73
|
if (it != null && other != null) {
|
|
73
74
|
promise.resolve(it.distanceTo(other));
|
|
@@ -78,8 +79,8 @@ public class UtilsModule extends ReactContextBaseJavaModule {
|
|
|
78
79
|
|
|
79
80
|
@ReactMethod
|
|
80
81
|
public void geometryIsInside(String pointString, String geometryString, final Promise promise) {
|
|
81
|
-
MPPoint point =
|
|
82
|
-
MPGeometry geometry =
|
|
82
|
+
MPPoint point = MPJsonParser.parse(pointString, MPPoint.class);
|
|
83
|
+
MPGeometry geometry = MPJsonParser.parse(geometryString, MPGeometry.class);
|
|
83
84
|
if (point != null && geometry != null) {
|
|
84
85
|
promise.resolve(geometry.isInside(point.getLatLng()));
|
|
85
86
|
} else {
|
|
@@ -89,7 +90,7 @@ public class UtilsModule extends ReactContextBaseJavaModule {
|
|
|
89
90
|
|
|
90
91
|
@ReactMethod
|
|
91
92
|
public void geometryArea(String geometryString, final Promise promise) {
|
|
92
|
-
MPGeometry geometry =
|
|
93
|
+
MPGeometry geometry = MPJsonParser.parse(geometryString, MPGeometry.class);
|
|
93
94
|
if (geometry != null) {
|
|
94
95
|
promise.resolve(geometry.getArea());
|
|
95
96
|
} else {
|
|
@@ -98,9 +99,9 @@ public class UtilsModule extends ReactContextBaseJavaModule {
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
@ReactMethod
|
|
101
|
-
public void
|
|
102
|
-
MPPoint point =
|
|
103
|
-
MPGeometry geometry =
|
|
102
|
+
public void polygonDistanceToClosestEdge(String pointString, String geometryString, final Promise promise) {
|
|
103
|
+
MPPoint point = MPJsonParser.parse(pointString, MPPoint.class);
|
|
104
|
+
MPGeometry geometry = MPJsonParser.parse(geometryString, MPGeometry.class);
|
|
104
105
|
if (geometry != null && point != null) {
|
|
105
106
|
if (MPGeometry.POLYGON.equals(geometry.getType()) ) {
|
|
106
107
|
MPPolygonGeometry polygonGeometry = (MPPolygonGeometry) geometry;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
package com.reactlibrary.models;
|
|
1
|
+
package com.reactlibrary.core.models;
|
|
2
2
|
|
|
3
3
|
import androidx.annotation.NonNull;
|
|
4
4
|
import com.google.gson.annotations.SerializedName;
|
|
5
|
-
import com.mapbox.maps.CameraState;
|
|
6
5
|
import com.mapsindoors.core.MPPoint;
|
|
7
6
|
|
|
8
7
|
import javax.annotation.Nullable;
|
|
@@ -10,20 +9,26 @@ import javax.annotation.Nullable;
|
|
|
10
9
|
public class MPCameraPosition {
|
|
11
10
|
@SerializedName("zoom")
|
|
12
11
|
@Nullable
|
|
12
|
+
public
|
|
13
13
|
Float zoom;
|
|
14
14
|
@SerializedName("tilt")
|
|
15
15
|
@Nullable
|
|
16
|
+
public
|
|
16
17
|
Float tilt;
|
|
17
18
|
@SerializedName("bearing")
|
|
18
19
|
@Nullable
|
|
20
|
+
public
|
|
19
21
|
Float bearing;
|
|
20
22
|
@SerializedName("target")
|
|
21
23
|
@NonNull
|
|
24
|
+
public
|
|
22
25
|
MPPoint target;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
|
|
27
|
+
public MPCameraPosition(float zoom, float tilt, float bearing, MPPoint target) {
|
|
28
|
+
this.zoom = zoom;
|
|
29
|
+
this.tilt = tilt;
|
|
30
|
+
this.bearing = bearing;
|
|
31
|
+
this.target = target;
|
|
28
32
|
}
|
|
33
|
+
|
|
29
34
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
package com.reactlibrary.core.models;
|
|
2
|
+
|
|
3
|
+
import com.google.gson.annotations.SerializedName;
|
|
4
|
+
import com.mapsindoors.core.MPPoint;
|
|
5
|
+
|
|
6
|
+
public class MPCameraUpdate {
|
|
7
|
+
@SerializedName("mode")
|
|
8
|
+
String modeString;
|
|
9
|
+
@SerializedName("point")
|
|
10
|
+
public
|
|
11
|
+
MPPoint point;
|
|
12
|
+
@SerializedName("bounds")
|
|
13
|
+
public
|
|
14
|
+
Bounds bounds;
|
|
15
|
+
@SerializedName("padding")
|
|
16
|
+
public
|
|
17
|
+
Integer padding;
|
|
18
|
+
@SerializedName("width")
|
|
19
|
+
public
|
|
20
|
+
Integer width;
|
|
21
|
+
@SerializedName("height")
|
|
22
|
+
public
|
|
23
|
+
Integer height;
|
|
24
|
+
@SerializedName("zoom")
|
|
25
|
+
public
|
|
26
|
+
Float zoom;
|
|
27
|
+
@SerializedName("position")
|
|
28
|
+
public
|
|
29
|
+
MPCameraPosition position;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
public CameraUpdateMode getMode() {
|
|
33
|
+
return CameraUpdateMode.fromString(modeString);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
public enum CameraUpdateMode {
|
|
40
|
+
FROM_POINT("fromPoint"),
|
|
41
|
+
FROM_BOUNDS("fromBounds"),
|
|
42
|
+
ZOOM_BY("zoomBy"),
|
|
43
|
+
ZOOM_TO("zoomTo"),
|
|
44
|
+
FROM_CAMERA_POSITION("fromCameraPosition");
|
|
45
|
+
final String mode;
|
|
46
|
+
CameraUpdateMode(String mode) {
|
|
47
|
+
this.mode = mode;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public static CameraUpdateMode fromString(String value) {
|
|
51
|
+
switch (value) {
|
|
52
|
+
case "fromPoint":
|
|
53
|
+
return FROM_POINT;
|
|
54
|
+
case "fromBounds":
|
|
55
|
+
return FROM_BOUNDS;
|
|
56
|
+
case "zoomBy":
|
|
57
|
+
return ZOOM_BY;
|
|
58
|
+
case "zoomTo":
|
|
59
|
+
return ZOOM_TO;
|
|
60
|
+
case "fromCameraPosition":
|
|
61
|
+
return FROM_CAMERA_POSITION;
|
|
62
|
+
default:
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
}
|
package/index.ts
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import MPGeometry from './src/MPGeometry';
|
|
2
|
-
import MPPoint from './src/MPPoint';
|
|
3
|
-
import MPEntity from './src/MPEntity';
|
|
4
|
-
import MPVenue from './src/MPVenue';
|
|
5
|
-
import MPFloor from './src/MPFloor';
|
|
6
|
-
import MPQuery from './src/MPQuery';
|
|
7
|
-
import MPError from './src/MPError';
|
|
8
|
-
import MPFilter from './src/MPFilter';
|
|
9
|
-
import MPBounds from './src/MPBounds';
|
|
10
|
-
import { MPLocationType } from './src/MPLocationType';
|
|
11
|
-
import { MPLocationPropertyNames } from './src/MPLocationPropertyNames';
|
|
12
|
-
import MPPolygon from './src/MPPolygon';
|
|
13
|
-
import MPMapStyle from './src/MPMapStyle';
|
|
14
|
-
import MPBuilding from './src/MPBuilding';
|
|
15
|
-
import MPLocation from './src/MPLocation';
|
|
16
|
-
import MPCategory from './src/MPCategory';
|
|
17
|
-
import MapControl from './src/MapControl';
|
|
18
|
-
import MPIconSize from './src/MPIconSize';
|
|
19
|
-
import MPUserRole from './src/MPUserRole';
|
|
20
|
-
import MPSolution from './src/MPSolution';
|
|
21
|
-
import MapsIndoors from './src/MapsIndoors';
|
|
22
|
-
import MPVenueInfo from './src/MPVenueInfo';
|
|
23
|
-
import MPDataField from './src/MPDataField';
|
|
24
|
-
import MPMapConfig from './src/MPMapConfig';
|
|
25
|
-
import MPSettings3D from './src/MPSettings3D';
|
|
26
|
-
import MPDisplayRule from './src/MPDisplayRule';
|
|
27
|
-
import MPCameraEvent from './src/MPCameraEvent';
|
|
28
|
-
import MPCameraUpdate from './src/MPCameraUpdate';
|
|
29
|
-
import MPMultiPolygon from './src/MPMultiPolygon';
|
|
30
|
-
import MPRoute from './src/MPRoute';
|
|
31
|
-
import MPRouteCoordinate from './src/MPRouteCoordinate';
|
|
32
|
-
import MPRouteLeg from './src/MPRouteLeg';
|
|
33
|
-
import MPRouteStep from './src/MPRouteStep';
|
|
34
|
-
import MPRouteProperty from './src/MPRouteProperty';
|
|
35
|
-
import MPDirectionsRenderer from './src/MPDirectionsRenderer';
|
|
36
|
-
import MPDirectionsService from './src/MPDirectionsService';
|
|
37
|
-
import { MPCameraViewFitMode } from './src/MPCameraViewFitMode';
|
|
38
|
-
import MPCameraPosition from './src/MPCameraPosition';
|
|
39
|
-
import MPFilterBehavior from './src/MPFilterBehavior';
|
|
40
|
-
import MPSolutionConfig from './src/MPSolutionConfig';
|
|
41
|
-
import { OnMapClickListener } from './src/OnMapClickListener';
|
|
42
|
-
import MPSelectionBehavior from './src/MPSelectionBehavior';
|
|
43
|
-
import { MPCollisionHandling } from './src/MPCollisionHandling';
|
|
44
|
-
import { MPSolutionDisplayRule } from './src/MPSolutionDisplayRule';
|
|
45
|
-
import MPCameraEventListener from './src/MPCameraEventListener';
|
|
46
|
-
import { OnFloorUpdateListener } from './src/OnFloorUpdateListener';
|
|
47
|
-
import { OnMarkerClickListener } from './src/OnMarkerClickListener';
|
|
48
|
-
import { OnPositionUpdateListener } from './src/OnPositionUpdateListener';
|
|
49
|
-
import { MPFloorSelectorInterface } from './src/MPFloorSelectorInterface';
|
|
50
|
-
import { MPPositionResultInterface } from './src/MPPositionResultInterface';
|
|
51
|
-
import { OnLocationSelectedListener } from './src/OnLocationSelectedListener';
|
|
52
|
-
import { MPPositionProviderInterface } from './src/MPPositionProviderInterface';
|
|
53
|
-
import { OnLiveLocationUpdateListener } from './src/OnLiveLocationUpdateListener';
|
|
54
|
-
import { OnMarkerInfoWindowClickListener } from './src/OnMarkerInfoWindowClickListener';
|
|
55
|
-
import { OnFloorSelectionChangedListener } from './src/OnFloorSelectionChangedListener';
|
|
56
|
-
import { OnVenueFoundAtCameraTargetListener } from './src/OnVenueFoundAtCameraTargetListener';
|
|
57
|
-
import { OnBuildingFoundAtCameraTargetListener } from './src/OnBuildingFoundAtCameraTargetListener';
|
|
58
|
-
import { OnLegSelectedListener } from './src/OnLegSelectedListener';
|
|
59
|
-
import MPBuildingCollection from './src/MPBuildingCollection';
|
|
60
|
-
import MPVenueCollection from './src/MPVenueCollection';
|
|
61
|
-
import MPCategoryCollection from './src/MPCategoryCollection';
|
|
62
|
-
import MPUserRoleCollection from './src/MPUserRoleCollection';
|
|
63
|
-
import { MPHighway } from './src/MPHighway';
|
|
64
|
-
import { MPFloorParams } from './src/MPFloor';
|
|
65
|
-
import { MPQueryParams } from './src/MPQuery';
|
|
66
|
-
import { MPRouteParams } from './src/MPRoute';
|
|
67
|
-
import { MPVenueParams } from './src/MPVenue';
|
|
68
|
-
import { MPPointParams } from './src/MPPoint';
|
|
69
|
-
import { MPBoundsParams } from './src/MPBounds';
|
|
70
|
-
import { MPFilterParams } from './src/MPFilter';
|
|
71
|
-
import { MPPolygonParams } from './src/MPPolygon';
|
|
72
|
-
import { MPBuildingParams } from './src/MPBuilding';
|
|
73
|
-
import { MPCategoryParams } from './src/MPCategory';
|
|
74
|
-
import { MPMapStyleParams } from './src/MPMapStyle';
|
|
75
|
-
import { MPRouteLegParams } from './src/MPRouteLeg';
|
|
76
|
-
import { MPSolutionParams } from './src/MPSolution';
|
|
77
|
-
import { MPUserRoleParams } from './src/MPUserRole';
|
|
78
|
-
import { MPDataFieldParams } from './src/MPDataField';
|
|
79
|
-
import { MPMapConfigParams } from './src/MPMapConfig';
|
|
80
|
-
import { MPRouteStepParams } from './src/MPRouteStep';
|
|
81
|
-
import { MPVenueInfoParams } from './src/MPVenueInfo';
|
|
82
|
-
import { MPMultiPolygonParams } from './src/MPMultiPolygon';
|
|
83
|
-
import { MPRoutePropertyParams } from './src/MPRouteProperty';
|
|
84
|
-
import { MPCameraPositionParams } from './src/MPCameraPosition';
|
|
85
|
-
import { MPFilterBehaviorParams } from './src/MPFilterBehavior';
|
|
86
|
-
import { MPSolutionConfigParams } from './src/MPSolutionConfig';
|
|
87
|
-
import { MPRouteCoordinateParams } from './src/MPRouteCoordinate';
|
|
88
|
-
import MapView from './src/MapView';
|
|
1
|
+
import MPGeometry from './src/core/MPGeometry';
|
|
2
|
+
import MPPoint from './src/core/MPPoint';
|
|
3
|
+
import MPEntity from './src/core/MPEntity';
|
|
4
|
+
import MPVenue from './src/core/MPVenue';
|
|
5
|
+
import MPFloor from './src/core/MPFloor';
|
|
6
|
+
import MPQuery from './src/core/MPQuery';
|
|
7
|
+
import MPError from './src/core/MPError';
|
|
8
|
+
import MPFilter from './src/core/MPFilter';
|
|
9
|
+
import MPBounds from './src/core/MPBounds';
|
|
10
|
+
import { MPLocationType } from './src/core/MPLocationType';
|
|
11
|
+
import { MPLocationPropertyNames } from './src/core/MPLocationPropertyNames';
|
|
12
|
+
import MPPolygon from './src/core/MPPolygon';
|
|
13
|
+
import MPMapStyle from './src/core/MPMapStyle';
|
|
14
|
+
import MPBuilding from './src/core/MPBuilding';
|
|
15
|
+
import MPLocation from './src/core/MPLocation';
|
|
16
|
+
import MPCategory from './src/core/MPCategory';
|
|
17
|
+
import MapControl from './src/core/MapControl';
|
|
18
|
+
import MPIconSize from './src/core/MPIconSize';
|
|
19
|
+
import MPUserRole from './src/core/MPUserRole';
|
|
20
|
+
import MPSolution from './src/core/MPSolution';
|
|
21
|
+
import MapsIndoors from './src/core/MapsIndoors';
|
|
22
|
+
import MPVenueInfo from './src/core/MPVenueInfo';
|
|
23
|
+
import MPDataField from './src/core/MPDataField';
|
|
24
|
+
import MPMapConfig from './src/core/MPMapConfig';
|
|
25
|
+
import MPSettings3D from './src/core/MPSettings3D';
|
|
26
|
+
import MPDisplayRule from './src/core/MPDisplayRule';
|
|
27
|
+
import MPCameraEvent from './src/core/MPCameraEvent';
|
|
28
|
+
import MPCameraUpdate from './src/core/MPCameraUpdate';
|
|
29
|
+
import MPMultiPolygon from './src/core/MPMultiPolygon';
|
|
30
|
+
import MPRoute from './src/core/MPRoute';
|
|
31
|
+
import MPRouteCoordinate from './src/core/MPRouteCoordinate';
|
|
32
|
+
import MPRouteLeg from './src/core/MPRouteLeg';
|
|
33
|
+
import MPRouteStep from './src/core/MPRouteStep';
|
|
34
|
+
import MPRouteProperty from './src/core/MPRouteProperty';
|
|
35
|
+
import MPDirectionsRenderer from './src/core/MPDirectionsRenderer';
|
|
36
|
+
import MPDirectionsService from './src/core/MPDirectionsService';
|
|
37
|
+
import { MPCameraViewFitMode } from './src/core/MPCameraViewFitMode';
|
|
38
|
+
import MPCameraPosition from './src/core/MPCameraPosition';
|
|
39
|
+
import MPFilterBehavior from './src/core/MPFilterBehavior';
|
|
40
|
+
import MPSolutionConfig from './src/core/MPSolutionConfig';
|
|
41
|
+
import { OnMapClickListener } from './src/core/OnMapClickListener';
|
|
42
|
+
import MPSelectionBehavior from './src/core/MPSelectionBehavior';
|
|
43
|
+
import { MPCollisionHandling } from './src/core/MPCollisionHandling';
|
|
44
|
+
import { MPSolutionDisplayRule } from './src/core/MPSolutionDisplayRule';
|
|
45
|
+
import MPCameraEventListener from './src/core/MPCameraEventListener';
|
|
46
|
+
import { OnFloorUpdateListener } from './src/core/OnFloorUpdateListener';
|
|
47
|
+
import { OnMarkerClickListener } from './src/core/OnMarkerClickListener';
|
|
48
|
+
import { OnPositionUpdateListener } from './src/core/OnPositionUpdateListener';
|
|
49
|
+
import { MPFloorSelectorInterface } from './src/core/MPFloorSelectorInterface';
|
|
50
|
+
import { MPPositionResultInterface } from './src/core/MPPositionResultInterface';
|
|
51
|
+
import { OnLocationSelectedListener } from './src/core/OnLocationSelectedListener';
|
|
52
|
+
import { MPPositionProviderInterface } from './src/core/MPPositionProviderInterface';
|
|
53
|
+
import { OnLiveLocationUpdateListener } from './src/core/OnLiveLocationUpdateListener';
|
|
54
|
+
import { OnMarkerInfoWindowClickListener } from './src/core/OnMarkerInfoWindowClickListener';
|
|
55
|
+
import { OnFloorSelectionChangedListener } from './src/core/OnFloorSelectionChangedListener';
|
|
56
|
+
import { OnVenueFoundAtCameraTargetListener } from './src/core/OnVenueFoundAtCameraTargetListener';
|
|
57
|
+
import { OnBuildingFoundAtCameraTargetListener } from './src/core/OnBuildingFoundAtCameraTargetListener';
|
|
58
|
+
import { OnLegSelectedListener } from './src/core/OnLegSelectedListener';
|
|
59
|
+
import MPBuildingCollection from './src/core/MPBuildingCollection';
|
|
60
|
+
import MPVenueCollection from './src/core/MPVenueCollection';
|
|
61
|
+
import MPCategoryCollection from './src/core/MPCategoryCollection';
|
|
62
|
+
import MPUserRoleCollection from './src/core/MPUserRoleCollection';
|
|
63
|
+
import { MPHighway } from './src/core/MPHighway';
|
|
64
|
+
import { MPFloorParams } from './src/core/MPFloor';
|
|
65
|
+
import { MPQueryParams } from './src/core/MPQuery';
|
|
66
|
+
import { MPRouteParams } from './src/core/MPRoute';
|
|
67
|
+
import { MPVenueParams } from './src/core/MPVenue';
|
|
68
|
+
import { MPPointParams } from './src/core/MPPoint';
|
|
69
|
+
import { MPBoundsParams } from './src/core/MPBounds';
|
|
70
|
+
import { MPFilterParams } from './src/core/MPFilter';
|
|
71
|
+
import { MPPolygonParams } from './src/core/MPPolygon';
|
|
72
|
+
import { MPBuildingParams } from './src/core/MPBuilding';
|
|
73
|
+
import { MPCategoryParams } from './src/core/MPCategory';
|
|
74
|
+
import { MPMapStyleParams } from './src/core/MPMapStyle';
|
|
75
|
+
import { MPRouteLegParams } from './src/core/MPRouteLeg';
|
|
76
|
+
import { MPSolutionParams } from './src/core/MPSolution';
|
|
77
|
+
import { MPUserRoleParams } from './src/core/MPUserRole';
|
|
78
|
+
import { MPDataFieldParams } from './src/core/MPDataField';
|
|
79
|
+
import { MPMapConfigParams } from './src/core/MPMapConfig';
|
|
80
|
+
import { MPRouteStepParams } from './src/core/MPRouteStep';
|
|
81
|
+
import { MPVenueInfoParams } from './src/core/MPVenueInfo';
|
|
82
|
+
import { MPMultiPolygonParams } from './src/core/MPMultiPolygon';
|
|
83
|
+
import { MPRoutePropertyParams } from './src/core/MPRouteProperty';
|
|
84
|
+
import { MPCameraPositionParams } from './src/core/MPCameraPosition';
|
|
85
|
+
import { MPFilterBehaviorParams } from './src/core/MPFilterBehavior';
|
|
86
|
+
import { MPSolutionConfigParams } from './src/core/MPSolutionConfig';
|
|
87
|
+
import { MPRouteCoordinateParams } from './src/core/MPRouteCoordinate';
|
|
88
|
+
import MapView from './src/core/MapView';
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
export default MapsIndoors;
|
|
@@ -181,4 +181,3 @@ export type {
|
|
|
181
181
|
MPSolutionConfigParams,
|
|
182
182
|
MPRouteCoordinateParams
|
|
183
183
|
};
|
|
184
|
-
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
import React
|
|
3
3
|
|
|
4
|
+
import MapsIndoors
|
|
4
5
|
import MapsIndoorsCore
|
|
5
6
|
import MapsIndoorsMapbox
|
|
6
7
|
import MapboxMaps
|
|
@@ -9,22 +10,102 @@ import MapboxMaps
|
|
|
9
10
|
class MapsIndoorsViewManager : RCTViewManager {
|
|
10
11
|
@objc override static func requiresMainQueueSetup() -> Bool {return false}
|
|
11
12
|
|
|
12
|
-
//private var mcListener: ??? MPMapControlReadyListener
|
|
13
|
-
|
|
14
13
|
override func view() -> UIView! {
|
|
15
14
|
let mapInitOptions = MapInitOptions(resourceOptions: ResourceOptions(accessToken: Bundle.main.object(forInfoDictionaryKey: "MBXAccessToken") as? String ?? ""))
|
|
16
15
|
let mapView = MapView(frame: .zero, mapInitOptions: mapInitOptions)
|
|
17
16
|
|
|
18
|
-
MapsIndoorsData.sharedInstance.mapView = mapView
|
|
17
|
+
MapsIndoorsData.sharedInstance.mapView = MapBoxView(mapboxView: mapView)
|
|
19
18
|
return mapView
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
// createMapFragment in java
|
|
23
21
|
@objc func create(_ node: NSNumber, nodeAgain: NSNumber) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
struct MapBoxView: RCMapView {
|
|
26
|
+
|
|
27
|
+
private let mapboxView: MapView
|
|
28
|
+
|
|
29
|
+
init(mapboxView: MapView) {
|
|
30
|
+
self.mapboxView = mapboxView
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private func makeCameraUpdate(cameraUpdate: CameraUpdate) throws -> CameraOptions {
|
|
34
|
+
var update: CameraOptions
|
|
35
|
+
|
|
36
|
+
switch cameraUpdate.mode {
|
|
37
|
+
case "fromPoint":
|
|
38
|
+
guard let point = cameraUpdate.point else {
|
|
39
|
+
throw CameraUpdateError.missingField("fromPoint", "point")
|
|
40
|
+
}
|
|
41
|
+
let camera = mapboxView.mapboxMap.cameraState
|
|
42
|
+
|
|
43
|
+
update = CameraOptions(cameraState: camera)
|
|
44
|
+
update.center = point.coordinate
|
|
45
|
+
case "fromBounds":
|
|
46
|
+
guard let bounds = cameraUpdate.bounds else {
|
|
47
|
+
throw CameraUpdateError.missingField("fromBounds", "bounds")
|
|
48
|
+
}
|
|
49
|
+
let camera = mapboxView.mapboxMap.cameraState
|
|
50
|
+
|
|
51
|
+
let camerabounds = CameraBoundsOptions(bounds: CoordinateBounds(southwest: bounds.southWest, northeast: bounds.northEast))
|
|
52
|
+
|
|
53
|
+
update = CameraOptions(cameraState: camera)
|
|
54
|
+
update.center = camerabounds.bounds?.center
|
|
55
|
+
case "zoomBy":
|
|
56
|
+
let camera = mapboxView.mapboxMap.cameraState
|
|
57
|
+
|
|
58
|
+
update = CameraOptions(cameraState: camera)
|
|
59
|
+
update.zoom = CGFloat(cameraUpdate.zoom!)
|
|
60
|
+
case "zoomTo":
|
|
61
|
+
let camera = mapboxView.mapboxMap.cameraState
|
|
62
|
+
|
|
63
|
+
update = CameraOptions(cameraState: camera)
|
|
64
|
+
update.zoom = CGFloat(cameraUpdate.zoom!)
|
|
65
|
+
case "fromCameraPosition":
|
|
66
|
+
guard let position = cameraUpdate.position else {
|
|
67
|
+
throw CameraUpdateError.missingField("fromCameraPosition", "position")
|
|
68
|
+
}
|
|
69
|
+
let camera = mapboxView.mapboxMap.cameraState
|
|
70
|
+
|
|
71
|
+
update = CameraOptions(cameraState: camera)
|
|
72
|
+
update.center = position.target.coordinate
|
|
73
|
+
update.bearing = CLLocationDirection(position.bearing)
|
|
74
|
+
if (cameraUpdate.zoom != nil) {
|
|
75
|
+
update.zoom = CGFloat(cameraUpdate.zoom!)
|
|
76
|
+
}
|
|
77
|
+
default:
|
|
78
|
+
throw CameraUpdateError.unknownMode(cameraUpdate.mode)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return update
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
func animateCamera(cameraUpdate: CameraUpdate, duration: Int) throws {
|
|
85
|
+
let cameraOption: CameraOptions
|
|
86
|
+
|
|
87
|
+
cameraOption = try makeCameraUpdate(cameraUpdate: cameraUpdate)
|
|
88
|
+
|
|
89
|
+
DispatchQueue.main.async {
|
|
90
|
+
if (duration != 0) {
|
|
91
|
+
mapboxView.mapboxMap.setCamera(to: cameraOption)
|
|
92
|
+
} else {
|
|
93
|
+
mapboxView.mapboxMap.setCamera(to: cameraOption)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
func moveCamera(cameraUpdate: CameraUpdate) throws {
|
|
99
|
+
let cameraOption: CameraOptions
|
|
100
|
+
|
|
101
|
+
cameraOption = try makeCameraUpdate(cameraUpdate: cameraUpdate)
|
|
102
|
+
|
|
103
|
+
DispatchQueue.main.async {
|
|
104
|
+
mapboxView.mapboxMap.setCamera(to: cameraOption)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
func getConfig() -> MPMapConfig {
|
|
109
|
+
return MPMapConfig(mapBoxView: mapboxView, accessToken: Bundle.main.object(forInfoDictionaryKey: "MBXAccessToken") as? String ?? "")
|
|
29
110
|
}
|
|
30
111
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CameraPosition.swift
|
|
3
|
+
// react-native-maps-indoors-mapbox
|
|
4
|
+
//
|
|
5
|
+
// Created by Tim Mikkelsen on 14/06/2023.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MapsIndoors
|
|
9
|
+
|
|
10
|
+
public struct CameraPosition: Codable {
|
|
11
|
+
let zoom: Float
|
|
12
|
+
let tilt: Float // TODO: this is called viewingAngle in MPCameraPosition(Codable)
|
|
13
|
+
let bearing: Float
|
|
14
|
+
let target: MPPoint
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CameraUpdate.swift
|
|
3
|
+
// react-native-maps-indoors-mapbox
|
|
4
|
+
//
|
|
5
|
+
// Created by Tim Mikkelsen on 14/06/2023.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MapsIndoors
|
|
9
|
+
|
|
10
|
+
public struct CameraUpdate: Codable {
|
|
11
|
+
let position: CameraPosition?
|
|
12
|
+
let mode: String
|
|
13
|
+
let point: MPPoint?
|
|
14
|
+
let bounds: MPGeoBounds?
|
|
15
|
+
let padding: Int?
|
|
16
|
+
let width: Int?
|
|
17
|
+
let height: Int?
|
|
18
|
+
let zoom: Float?
|
|
19
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
#import <React/RCTBridgeModule.h>
|
|
9
9
|
#import <React/RCTEventEmitter.h>
|
|
10
10
|
|
|
11
|
-
@interface RCT_EXTERN_MODULE(DirectionsRenderer,
|
|
11
|
+
@interface RCT_EXTERN_MODULE(DirectionsRenderer, RCTEventEmitter)
|
|
12
12
|
|
|
13
13
|
RCT_EXTERN_METHOD(requiresMainQueueSetup)
|
|
14
14
|
|
|
@@ -28,13 +28,11 @@
|
|
|
28
28
|
resolver:(RCTPromiseResolveBlock) resolve
|
|
29
29
|
rejecter:(RCTPromiseRejectBlock) reject)
|
|
30
30
|
|
|
31
|
-
RCT_EXTERN_METHOD(
|
|
32
|
-
repeated:(BOOL): repeated
|
|
33
|
-
duration :(nonnull NSNumber *) duration
|
|
31
|
+
RCT_EXTERN_METHOD(setCameraViewFitMode: (nonnull NSNumber *) cameraFitMode
|
|
34
32
|
resolver:(RCTPromiseResolveBlock) resolve
|
|
35
33
|
rejecter:(RCTPromiseRejectBlock) reject)
|
|
36
34
|
|
|
37
|
-
RCT_EXTERN_METHOD(
|
|
35
|
+
RCT_EXTERN_METHOD(setCameraAnimationDuration: (nonnull NSNumber *) duration
|
|
38
36
|
resolver:(RCTPromiseResolveBlock) resolve
|
|
39
37
|
rejecter:(RCTPromiseRejectBlock) reject)
|
|
40
38
|
|
|
@@ -50,4 +48,10 @@
|
|
|
50
48
|
resolver:(RCTPromiseResolveBlock) resolve
|
|
51
49
|
rejecter:(RCTPromiseRejectBlock) reject)
|
|
52
50
|
|
|
51
|
+
RCT_EXTERN_METHOD(setAnimatedPolyline: (BOOL) animated
|
|
52
|
+
repeated:(BOOL) repeated
|
|
53
|
+
duration:(nonnull NSNumber *) duration
|
|
54
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
55
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
56
|
+
|
|
53
57
|
@end
|