@mapsindoors/react-native-maps-indoors-mapbox 1.0.0 → 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 +2 -6
- 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 +6 -2
- package/android/src/main/java/com/reactlibrary/MapsIndoorsPackage.java +3 -1
- package/android/src/main/java/com/reactlibrary/core/MPDisplayRuleModule.java +1 -1
- package/android/src/main/java/com/reactlibrary/core/MapControlModule.java +16 -8
- package/android/src/main/java/com/reactlibrary/core/README.md +90 -1
- package/android/src/main/java/com/reactlibrary/core/UtilsModule.java +11 -10
- package/ios/MapsIndoorsViewManager.swift +3 -1
- package/ios/core/DirectionsRendererBridge.m +8 -4
- package/ios/core/DirectionsRendererModule.swift +73 -33
- package/ios/core/MapControlModule.swift +14 -11
- package/ios/core/MapsIndoorsData.swift +17 -2
- package/ios/core/README.md +89 -1
- package/package.json +1 -1
- package/react-native-maps-indoors-mapbox.podspec +2 -2
- package/src/core/MPBounds.ts +13 -3
- package/src/core/MPBuilding.ts +3 -3
- package/src/core/MPCameraPosition.ts +2 -2
- package/src/core/MPFilterBehavior.ts +5 -5
- package/src/core/MPLocation.ts +2 -2
- package/src/core/MPMultiPolygon.ts +17 -4
- package/src/core/MPPoint.ts +9 -4
- package/src/core/MPPolygon.ts +17 -4
- package/src/core/MPPropertyData.ts +1 -1
- package/src/core/MPSelectionBehavior.ts +5 -5
- package/src/core/MPSolutionConfig.ts +2 -2
- package/src/core/MapControl.ts +4 -1
- package/src/core/README.md +89 -1
package/README.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Getting started
|
|
4
4
|
|
|
5
|
-
`$ npm install react-native-maps-indoors-mapbox`
|
|
5
|
+
`$ npm install @mapsindoors/react-native-maps-indoors-mapbox`
|
|
6
6
|
|
|
7
7
|
### iOS
|
|
8
8
|
|
|
9
9
|
The MapsIndoors SDK requires iOS 13, so make sure that your podfile is configured for iOS 13.
|
|
10
|
-
Add !use_frameworks inside your app target as well.
|
|
10
|
+
Add !use_frameworks inside your app target as well.
|
|
11
11
|
|
|
12
12
|
```pod
|
|
13
13
|
platform :ios, '13.0
|
|
@@ -77,10 +77,6 @@ allprojects {
|
|
|
77
77
|
|
|
78
78
|
## Usage
|
|
79
79
|
|
|
80
|
-
### Reference docs
|
|
81
|
-
|
|
82
|
-
[Reference Documentation](https://app.mapsindoors.com/mapsindoors/reference/react-native/mapbox/1.0.0/index.html)
|
|
83
|
-
|
|
84
80
|
### Showing your map
|
|
85
81
|
|
|
86
82
|
This snippet shows you how to set up MapsIndoors in a React Native application.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -41,5 +41,20 @@
|
|
|
41
41
|
<option name="name" value="maven" />
|
|
42
42
|
<option name="url" value="https://maven.mapsindoors.com/" />
|
|
43
43
|
</remote-repository>
|
|
44
|
+
<remote-repository>
|
|
45
|
+
<option name="id" value="maven3" />
|
|
46
|
+
<option name="name" value="maven3" />
|
|
47
|
+
<option name="url" value="file:$USER_HOME$/React%20Native%20with%20submodules/react-native-mapsindoors-mapbox/node_modules/jsc-android/dist/" />
|
|
48
|
+
</remote-repository>
|
|
49
|
+
<remote-repository>
|
|
50
|
+
<option name="id" value="maven4" />
|
|
51
|
+
<option name="name" value="maven4" />
|
|
52
|
+
<option name="url" value="https://api.mapbox.com/downloads/v2/releases/maven" />
|
|
53
|
+
</remote-repository>
|
|
54
|
+
<remote-repository>
|
|
55
|
+
<option name="id" value="maven2" />
|
|
56
|
+
<option name="name" value="maven2" />
|
|
57
|
+
<option name="url" value="file:$USER_HOME$/React%20Native%20with%20submodules/react-native-mapsindoors-mapbox/node_modules/react-native/android/" />
|
|
58
|
+
</remote-repository>
|
|
44
59
|
</component>
|
|
45
60
|
</project>
|
package/android/.idea/misc.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<project version="4">
|
|
3
3
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
|
4
|
-
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="
|
|
4
|
+
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
|
5
5
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
6
6
|
</component>
|
|
7
7
|
<component name="ProjectType">
|
package/android/.idea/vcs.xml
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<project version="4">
|
|
3
3
|
<component name="VcsDirectoryMappings">
|
|
4
|
-
<mapping directory="$
|
|
4
|
+
<mapping directory="$USER_HOME$" vcs="Git" />
|
|
5
|
+
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
|
5
6
|
</component>
|
|
6
7
|
</project>
|
package/android/build.gradle
CHANGED
|
@@ -92,11 +92,8 @@ dependencies {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
implementation 'com.mapbox.maps:android:10.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
implementation 'com.mapspeople.mapsindoors:mapbox:4.1.8'
|
|
95
|
+
implementation 'com.mapbox.maps:android:10.14.1'
|
|
96
|
+
implementation 'com.mapspeople.mapsindoors:mapbox:4.1.10'
|
|
100
97
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
101
98
|
implementation 'androidx.core:core-ktx:1.3.2'
|
|
102
99
|
}
|
|
@@ -2,6 +2,7 @@ package com.reactlibrary;
|
|
|
2
2
|
|
|
3
3
|
import android.app.Activity;
|
|
4
4
|
import android.graphics.Typeface;
|
|
5
|
+
import android.content.Context;
|
|
5
6
|
|
|
6
7
|
import com.facebook.react.bridge.ReadableMap;
|
|
7
8
|
import com.mapbox.geojson.Point;
|
|
@@ -20,9 +21,11 @@ import com.reactlibrary.core.models.MPCameraUpdate;
|
|
|
20
21
|
|
|
21
22
|
public class MapboxMapView implements RCMapView {
|
|
22
23
|
private MapView mMapView;
|
|
24
|
+
private Context mContext;
|
|
23
25
|
|
|
24
|
-
public MapboxMapView(MapView mapView) {
|
|
26
|
+
public MapboxMapView(MapView mapView, Context context) {
|
|
25
27
|
mMapView = mapView;
|
|
28
|
+
mContext = context;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
@Override
|
|
@@ -93,7 +96,8 @@ public class MapboxMapView implements RCMapView {
|
|
|
93
96
|
Point southWest = Point.fromLngLat(cameraUpdate.bounds.getSouthWest().getLng(), cameraUpdate.bounds.getSouthWest().getLat());
|
|
94
97
|
Point northEast = Point.fromLngLat(cameraUpdate.bounds.getNorthEast().getLng(), cameraUpdate.bounds.getNorthEast().getLat());
|
|
95
98
|
CoordinateBounds coordinateBounds = new CoordinateBounds(southWest, northEast);
|
|
96
|
-
|
|
99
|
+
Double padding = (double) (mContext.getResources().getDisplayMetrics().density * cameraUpdate.padding);
|
|
100
|
+
return mMapView.getMapboxMap().cameraForCoordinateBounds(coordinateBounds, new EdgeInsets(padding, padding, padding, padding), null, null);
|
|
97
101
|
case ZOOM_BY:
|
|
98
102
|
return new CameraOptions.Builder().zoom(mMapView.getMapboxMap().getCameraState().getZoom() + cameraUpdate.zoom).build();
|
|
99
103
|
case ZOOM_TO:
|
|
@@ -23,10 +23,12 @@ import com.reactlibrary.core.UtilsModule;
|
|
|
23
23
|
public class MapsIndoorsPackage implements ReactPackage, OnResultReadyListener {
|
|
24
24
|
private MapControlModule mapControlModule;
|
|
25
25
|
private MapsIndoorsViewManager viewManager;
|
|
26
|
+
private ReactApplicationContext mContext;
|
|
26
27
|
|
|
27
28
|
@NonNull
|
|
28
29
|
@Override
|
|
29
30
|
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
|
|
31
|
+
mContext = reactContext;
|
|
30
32
|
mapControlModule = new MapControlModule(reactContext);
|
|
31
33
|
return Arrays.asList(
|
|
32
34
|
new MapsIndoorsModule(reactContext),
|
|
@@ -46,6 +48,6 @@ public class MapsIndoorsPackage implements ReactPackage, OnResultReadyListener {
|
|
|
46
48
|
|
|
47
49
|
@Override
|
|
48
50
|
public void onResultReady(@Nullable MIError miError) {
|
|
49
|
-
mapControlModule.setView(new MapboxMapView(viewManager.getView()));
|
|
51
|
+
mapControlModule.setView(new MapboxMapView(viewManager.getView(), mContext));
|
|
50
52
|
}
|
|
51
53
|
}
|
|
@@ -649,8 +649,8 @@ public class MPDisplayRuleModule extends ReactContextBaseJavaModule {
|
|
|
649
649
|
MPDisplayRule displayRule = getRule(displayRuleId);
|
|
650
650
|
if (displayRule != null) {
|
|
651
651
|
displayRule.setExtrusionZoomFrom(zoomFrom.floatValue());
|
|
652
|
-
} else {
|
|
653
652
|
promise.resolve(null);
|
|
653
|
+
} else {
|
|
654
654
|
reject(promise, displayRuleId);
|
|
655
655
|
}
|
|
656
656
|
}
|
|
@@ -228,30 +228,35 @@ public class MapControlModule extends ReactContextBaseJavaModule implements MPCa
|
|
|
228
228
|
|
|
229
229
|
@ReactMethod
|
|
230
230
|
public void setMapPadding(int start, int top, int end, int bottom, final Promise promise) {
|
|
231
|
+
double density = mCtx.getResources().getDisplayMetrics().density;
|
|
231
232
|
mCtx.runOnUiQueueThread(() -> {
|
|
232
|
-
mMapControl.setMapPadding(start, top, end, bottom);
|
|
233
|
+
mMapControl.setMapPadding((int)Math.round(start * density), (int)Math.round(top * density), (int)Math.round(end * density), (int) Math.round(bottom * density));
|
|
233
234
|
promise.resolve(null);
|
|
234
235
|
});
|
|
235
236
|
}
|
|
236
237
|
|
|
237
238
|
@ReactMethod
|
|
238
239
|
public void getMapViewPaddingStart(final Promise promise) {
|
|
239
|
-
|
|
240
|
+
double density = mCtx.getResources().getDisplayMetrics().density;
|
|
241
|
+
promise.resolve((int)Math.round(mMapControl.getMapViewPaddingStart()/density));
|
|
240
242
|
}
|
|
241
243
|
|
|
242
244
|
@ReactMethod
|
|
243
245
|
public void getMapViewPaddingTop(final Promise promise) {
|
|
244
|
-
|
|
246
|
+
double density = mCtx.getResources().getDisplayMetrics().density;
|
|
247
|
+
promise.resolve((int)Math.round(mMapControl.getMapViewPaddingTop()/density));
|
|
245
248
|
}
|
|
246
249
|
|
|
247
250
|
@ReactMethod
|
|
248
251
|
public void getMapViewPaddingEnd(final Promise promise) {
|
|
249
|
-
|
|
252
|
+
double density = mCtx.getResources().getDisplayMetrics().density;
|
|
253
|
+
promise.resolve((int)Math.round(mMapControl.getMapViewPaddingEnd()/density));
|
|
250
254
|
}
|
|
251
255
|
|
|
252
256
|
@ReactMethod
|
|
253
257
|
public void getMapViewPaddingBottom(final Promise promise) {
|
|
254
|
-
|
|
258
|
+
double density = mCtx.getResources().getDisplayMetrics().density;
|
|
259
|
+
promise.resolve((int)Math.round(mMapControl.getMapViewPaddingBottom()/density));
|
|
255
260
|
}
|
|
256
261
|
|
|
257
262
|
@ReactMethod
|
|
@@ -313,8 +318,10 @@ public class MapControlModule extends ReactContextBaseJavaModule implements MPCa
|
|
|
313
318
|
|
|
314
319
|
@ReactMethod
|
|
315
320
|
public void hideFloorSelector(boolean hide, final Promise promise) {
|
|
316
|
-
|
|
317
|
-
|
|
321
|
+
mCtx.runOnUiQueueThread(() -> {
|
|
322
|
+
mMapControl.hideFloorSelector(hide);
|
|
323
|
+
promise.resolve(null);
|
|
324
|
+
});
|
|
318
325
|
}
|
|
319
326
|
|
|
320
327
|
@ReactMethod
|
|
@@ -357,7 +364,8 @@ public class MapControlModule extends ReactContextBaseJavaModule implements MPCa
|
|
|
357
364
|
public void animateCamera(String updateString, @Nullable Integer duration, final Promise promise) {
|
|
358
365
|
MPCameraUpdate update = gson.fromJson(updateString, MPCameraUpdate.class);
|
|
359
366
|
mCtx.runOnUiQueueThread(() -> {
|
|
360
|
-
|
|
367
|
+
// we have to parse null as -1 because iOS cannot parse null
|
|
368
|
+
mMapView.animateCamera(update, (duration == - 1 ? null : duration), error -> {
|
|
361
369
|
promise.resolve(null);
|
|
362
370
|
});
|
|
363
371
|
});
|
|
@@ -1,3 +1,92 @@
|
|
|
1
1
|
# react-native-mapsindoors-core-android
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
|
8
|
+
|
|
9
|
+
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
|
10
|
+
|
|
11
|
+
## Add your files
|
|
12
|
+
|
|
13
|
+
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
|
14
|
+
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
cd existing_repo
|
|
18
|
+
git remote add origin https://git.rtx.mapspeople.com/timi/react-native-mapsindoors-core-android.git
|
|
19
|
+
git branch -M main
|
|
20
|
+
git push -uf origin main
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Integrate with your tools
|
|
24
|
+
|
|
25
|
+
- [ ] [Set up project integrations](https://git.rtx.mapspeople.com/timi/react-native-mapsindoors-core-android/-/settings/integrations)
|
|
26
|
+
|
|
27
|
+
## Collaborate with your team
|
|
28
|
+
|
|
29
|
+
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
|
30
|
+
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
|
31
|
+
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
|
32
|
+
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
|
33
|
+
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
|
34
|
+
|
|
35
|
+
## Test and Deploy
|
|
36
|
+
|
|
37
|
+
Use the built-in continuous integration in GitLab.
|
|
38
|
+
|
|
39
|
+
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
|
40
|
+
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
|
41
|
+
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
|
42
|
+
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
|
43
|
+
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
# Editing this README
|
|
48
|
+
|
|
49
|
+
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
|
50
|
+
|
|
51
|
+
## Suggestions for a good README
|
|
52
|
+
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
|
53
|
+
|
|
54
|
+
## Name
|
|
55
|
+
Choose a self-explaining name for your project.
|
|
56
|
+
|
|
57
|
+
## Description
|
|
58
|
+
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
|
59
|
+
|
|
60
|
+
## Badges
|
|
61
|
+
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
|
62
|
+
|
|
63
|
+
## Visuals
|
|
64
|
+
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
|
71
|
+
|
|
72
|
+
## Support
|
|
73
|
+
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
|
74
|
+
|
|
75
|
+
## Roadmap
|
|
76
|
+
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
|
77
|
+
|
|
78
|
+
## Contributing
|
|
79
|
+
State if you are open to contributions and what your requirements are for accepting them.
|
|
80
|
+
|
|
81
|
+
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
|
82
|
+
|
|
83
|
+
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
|
84
|
+
|
|
85
|
+
## Authors and acknowledgment
|
|
86
|
+
Show your appreciation to those who have contributed to the project.
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
For open source projects, say how it is licensed.
|
|
90
|
+
|
|
91
|
+
## Project status
|
|
92
|
+
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
|
@@ -15,6 +15,7 @@ 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
21
|
import com.reactlibrary.core.models.MPError;
|
|
@@ -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;
|
|
@@ -71,7 +71,9 @@ struct MapBoxView: RCMapView {
|
|
|
71
71
|
update = CameraOptions(cameraState: camera)
|
|
72
72
|
update.center = position.target.coordinate
|
|
73
73
|
update.bearing = CLLocationDirection(position.bearing)
|
|
74
|
-
|
|
74
|
+
if (cameraUpdate.zoom != nil) {
|
|
75
|
+
update.zoom = CGFloat(cameraUpdate.zoom!)
|
|
76
|
+
}
|
|
75
77
|
default:
|
|
76
78
|
throw CameraUpdateError.unknownMode(cameraUpdate.mode)
|
|
77
79
|
}
|
|
@@ -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
|