@mapsindoors/react-native-maps-indoors-mapbox 1.3.2 → 2.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 +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/app.plugin.js
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
const {
|
|
2
|
+
withProjectBuildGradle,
|
|
3
|
+
withGradleProperties,
|
|
4
|
+
withPlugins,
|
|
5
|
+
withDangerousMod,
|
|
6
|
+
withInfoPlist,
|
|
7
|
+
} = require("@expo/config-plugins");
|
|
8
|
+
|
|
9
|
+
const path = require("path");
|
|
10
|
+
const fs = require("fs");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Plugin to add mapbox api key and access token to mapbox_access_token.xml
|
|
14
|
+
* @param {*} apiKey api key to set
|
|
15
|
+
* @param {*} token access token to set
|
|
16
|
+
* @param {*} config expo project config
|
|
17
|
+
* @returns modified config
|
|
18
|
+
*/
|
|
19
|
+
const withAPIKeys = (token) => (config) => {
|
|
20
|
+
return withDangerousMod(config, [
|
|
21
|
+
"android",
|
|
22
|
+
async (config) => {
|
|
23
|
+
const filePath = path.resolve(
|
|
24
|
+
config.modRequest.projectRoot,
|
|
25
|
+
config.modRequest.platformProjectRoot,
|
|
26
|
+
`app/src/main/res/values`
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
// new file
|
|
30
|
+
const fileName = "mapbox_access_token.xml";
|
|
31
|
+
const content = `<?xml version="1.0" encoding="utf-8"?>
|
|
32
|
+
<resources>
|
|
33
|
+
<string name="mapbox_access_token" translatable="false">${token}</string>
|
|
34
|
+
<string name="mapbox_api_key" translatable="false">${token}</string>
|
|
35
|
+
</resources>`;
|
|
36
|
+
|
|
37
|
+
const newFilePath = path.resolve(filePath, fileName);
|
|
38
|
+
|
|
39
|
+
// create a new file
|
|
40
|
+
if (!fs.existsSync(newFilePath)) {
|
|
41
|
+
fs.writeFileSync(newFilePath, content);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return config;
|
|
45
|
+
},
|
|
46
|
+
]);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Plugin to add mapbox private token to gradle properties
|
|
51
|
+
* @param {*} config expo project config
|
|
52
|
+
* @param {*} token private token to set
|
|
53
|
+
* @returns modified config
|
|
54
|
+
*/
|
|
55
|
+
const withGradleProps = (token) => (config) => {
|
|
56
|
+
return withGradleProperties(config, (modConf) => {
|
|
57
|
+
modConf.modResults.push({
|
|
58
|
+
type: "property",
|
|
59
|
+
key: "MAPBOX_DOWNLOADS_TOKEN",
|
|
60
|
+
value: token,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return modConf;
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Plugin to add mapsindoors maven repository
|
|
69
|
+
* @param {*} config expo project config
|
|
70
|
+
* @returns modified config
|
|
71
|
+
*/
|
|
72
|
+
const withMavenRepo = (config) => {
|
|
73
|
+
return withProjectBuildGradle(config, (modConf) => {
|
|
74
|
+
const content = modConf.modResults.contents.replace(
|
|
75
|
+
"maven { url 'https://www.jitpack.io' }",
|
|
76
|
+
|
|
77
|
+
`maven { url 'https://www.jitpack.io' }
|
|
78
|
+
maven { url 'https://maven.mapsindoors.com/' }
|
|
79
|
+
maven {
|
|
80
|
+
url 'https://api.mapbox.com/downloads/v2/releases/maven'
|
|
81
|
+
authentication {
|
|
82
|
+
basic(BasicAuthentication)
|
|
83
|
+
}
|
|
84
|
+
credentials {
|
|
85
|
+
// Do not change the username below.
|
|
86
|
+
// This should always be 'mapbox' (not your username).
|
|
87
|
+
username = "mapbox"
|
|
88
|
+
// Use the secret token you stored in gradle.properties as the password
|
|
89
|
+
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
|
|
90
|
+
}
|
|
91
|
+
}`
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
modConf.modResults.contents = content;
|
|
95
|
+
return modConf;
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Plugin to add mapsindoors Plist infos
|
|
101
|
+
* @param {*} config expo project config
|
|
102
|
+
* @param {*} token access token to set
|
|
103
|
+
* @returns modified config
|
|
104
|
+
*/
|
|
105
|
+
const withTokenInfoPlist = (token) => (config) => {
|
|
106
|
+
return withInfoPlist(config, (modConf) => {
|
|
107
|
+
modConf.modResults["MBXAccessToken"] = token;
|
|
108
|
+
return modConf;
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Plugin to add mapsindoors user system setup
|
|
114
|
+
* @param {*} token private token to set
|
|
115
|
+
* @param {*} config expo project config
|
|
116
|
+
*/
|
|
117
|
+
const withiOSSecret = (token) => (config) => {
|
|
118
|
+
return withDangerousMod(config, [
|
|
119
|
+
"ios",
|
|
120
|
+
async (modConf) => {
|
|
121
|
+
const home = path.resolve(process.env.HOME);
|
|
122
|
+
const netrc = path.resolve(home, ".netrc");
|
|
123
|
+
|
|
124
|
+
// conf to add
|
|
125
|
+
const conf = `machine api.mapbox.com
|
|
126
|
+
login mapbox
|
|
127
|
+
password ${token}
|
|
128
|
+
`;
|
|
129
|
+
|
|
130
|
+
const exists = fs.existsSync(netrc);
|
|
131
|
+
|
|
132
|
+
if (!exists) {
|
|
133
|
+
// no previous conf, write new one
|
|
134
|
+
fs.writeFileSync(netrc, conf, { flag: "w" });
|
|
135
|
+
fs.chmodSync(netrc, 0o600);
|
|
136
|
+
} else {
|
|
137
|
+
// get content
|
|
138
|
+
let content = fs.readFileSync(netrc, "utf-8");
|
|
139
|
+
const lines = content.split("\n");
|
|
140
|
+
|
|
141
|
+
// check if mapbox conf exist
|
|
142
|
+
const found = lines.findIndex((line) =>
|
|
143
|
+
line.includes("machine api.mapbox.com")
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
if (found >= 0) {
|
|
147
|
+
// remove previous mapbox conf
|
|
148
|
+
content = lines
|
|
149
|
+
.filter((_, idx) => ![found, found + 1, found + 2].includes(idx))
|
|
150
|
+
.join("\n");
|
|
151
|
+
fs.writeFileSync(netrc, content, { flag: "w" });
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// write new conf
|
|
155
|
+
fs.writeFileSync(netrc, conf, { flag: "a+" });
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return modConf;
|
|
159
|
+
},
|
|
160
|
+
]);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Plugin to add podfile script
|
|
165
|
+
* @param {*} config expo project config
|
|
166
|
+
* @returns modified config
|
|
167
|
+
*/
|
|
168
|
+
const withPodfile = (config) => {
|
|
169
|
+
return withDangerousMod(config, [
|
|
170
|
+
"ios",
|
|
171
|
+
(modConf) => {
|
|
172
|
+
const podfile = path.join(
|
|
173
|
+
modConf.modRequest.platformProjectRoot,
|
|
174
|
+
"Podfile"
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
let contents = fs.readFileSync(podfile, "utf-8");
|
|
178
|
+
|
|
179
|
+
contents = contents.replace(
|
|
180
|
+
`post_install do |installer|`,
|
|
181
|
+
`post_install do |installer|\n
|
|
182
|
+
installer.pods_project.targets.each do |target|
|
|
183
|
+
target.build_configurations.each do |config|
|
|
184
|
+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
|
|
185
|
+
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
|
|
186
|
+
end
|
|
187
|
+
end\n`
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
fs.writeFileSync(podfile, contents, "utf8");
|
|
191
|
+
|
|
192
|
+
return modConf;
|
|
193
|
+
},
|
|
194
|
+
]);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Plugin to add podfile linkage script script
|
|
199
|
+
* @param {*} staticPods true if project is build as static, false/undefined if build as dynamic
|
|
200
|
+
* @param {*} config expo project config
|
|
201
|
+
* @returns modified config
|
|
202
|
+
*/
|
|
203
|
+
const withStaticLinkage = (staticPods) => (config) => {
|
|
204
|
+
if (!staticPods) {
|
|
205
|
+
return config;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return withDangerousMod(config, [
|
|
209
|
+
"ios",
|
|
210
|
+
(modConf) => {
|
|
211
|
+
const podfile = path.join(
|
|
212
|
+
modConf.modRequest.platformProjectRoot,
|
|
213
|
+
"Podfile"
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
let contents = fs.readFileSync(podfile, "utf-8");
|
|
217
|
+
|
|
218
|
+
if (!contents.includes("pre_install do |installer|")) {
|
|
219
|
+
// add preinstall script if not present
|
|
220
|
+
contents = contents.replace(
|
|
221
|
+
`post_install do |installer|`,
|
|
222
|
+
`pre_install do |installer|
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
post_install do |installer|`
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// complete script with dynamic linkage for this lib
|
|
230
|
+
contents = contents.replace(
|
|
231
|
+
`pre_install do |installer|`,
|
|
232
|
+
`dynamic_frameworks = ["MapboxMaps", "MapboxCoreMaps", "MapboxCommon", "MapboxMobileEvents", "MapboxDirections", "Polyline", "Turf"]
|
|
233
|
+
|
|
234
|
+
# override default static linkage
|
|
235
|
+
pre_install do |installer|
|
|
236
|
+
installer.pod_targets.each do |pod|
|
|
237
|
+
if dynamic_frameworks.include?(pod.name)
|
|
238
|
+
puts "Overriding the static_framework? method for #{pod.name}"
|
|
239
|
+
def pod.static_framework?;
|
|
240
|
+
false
|
|
241
|
+
end
|
|
242
|
+
def pod.build_type;
|
|
243
|
+
Pod::BuildType.dynamic_framework
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
end`
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
fs.writeFileSync(podfile, contents, "utf8");
|
|
250
|
+
|
|
251
|
+
return modConf;
|
|
252
|
+
},
|
|
253
|
+
]);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Combine Expo configuration and properties
|
|
258
|
+
* @param {*} config expo project config
|
|
259
|
+
* @param {*} {downloadToken} Mapbox download token
|
|
260
|
+
* @param {*} {publicToken} Mapbox public token
|
|
261
|
+
* @returns modified config
|
|
262
|
+
*/
|
|
263
|
+
const withMapsPeopleMapbox = (
|
|
264
|
+
config,
|
|
265
|
+
{ downloadToken, publicToken, staticPods }
|
|
266
|
+
) => {
|
|
267
|
+
const plugins = [
|
|
268
|
+
withGradleProps(downloadToken),
|
|
269
|
+
withAPIKeys(publicToken),
|
|
270
|
+
withMavenRepo,
|
|
271
|
+
withTokenInfoPlist(publicToken),
|
|
272
|
+
withiOSSecret(downloadToken),
|
|
273
|
+
withPodfile,
|
|
274
|
+
withStaticLinkage(staticPods),
|
|
275
|
+
];
|
|
276
|
+
|
|
277
|
+
return withPlugins(config, plugins);
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
module.exports = withMapsPeopleMapbox;
|
package/index.ts
CHANGED
|
@@ -65,6 +65,8 @@ import MPVenueCollection from './src/core/MPVenueCollection';
|
|
|
65
65
|
import MPCategoryCollection from './src/core/MPCategoryCollection';
|
|
66
66
|
import MPUserRoleCollection from './src/core/MPUserRoleCollection';
|
|
67
67
|
import MPRouteStopIconConfig from './src/core/MPRouteStopIconConfig';
|
|
68
|
+
import MPLabelGraphic from './src/core/MPLabelGraphic';
|
|
69
|
+
import MPPOIType from './src/core/MPPOIType';
|
|
68
70
|
import { MPHighway } from './src/core/MPHighway';
|
|
69
71
|
import { MPFloorParams } from './src/core/MPFloor';
|
|
70
72
|
import { MPQueryParams } from './src/core/MPQuery';
|
|
@@ -93,6 +95,10 @@ import { MPRouteCoordinateParams } from './src/core/MPRouteCoordinate';
|
|
|
93
95
|
import { MPHighlightBehaviorParams } from './src/core/MPHighlightBehavior';
|
|
94
96
|
import { RouteStopIconConfig } from './src/core/RouteStopIconConfig';
|
|
95
97
|
import { MPRouteStopIconConfigParams } from './src/core/MPRouteStopIconConfig';
|
|
98
|
+
import { MPPOITypeParams } from './src/core/MPPOIType';
|
|
99
|
+
import { MPSelectionMode } from './src/core/MPSelectionMode';
|
|
100
|
+
import { MPFeatureType } from './src/core/MPFeatureTypes';
|
|
101
|
+
|
|
96
102
|
|
|
97
103
|
import MapView from './src/core/MapView';
|
|
98
104
|
|
|
@@ -150,6 +156,10 @@ export {
|
|
|
150
156
|
MPIconPlacement,
|
|
151
157
|
MPLabelType,
|
|
152
158
|
MPRouteStopIconConfig,
|
|
159
|
+
MPSelectionMode,
|
|
160
|
+
MPFeatureType,
|
|
161
|
+
MPLabelGraphic,
|
|
162
|
+
MPPOIType,
|
|
153
163
|
MapView
|
|
154
164
|
};
|
|
155
165
|
|
|
@@ -196,5 +206,6 @@ export type {
|
|
|
196
206
|
MPSolutionConfigParams,
|
|
197
207
|
MPRouteCoordinateParams,
|
|
198
208
|
MPRouteStopIconConfigParams,
|
|
199
|
-
RouteStopIconConfig
|
|
209
|
+
RouteStopIconConfig,
|
|
210
|
+
MPPOITypeParams
|
|
200
211
|
};
|
|
@@ -11,8 +11,17 @@ class MapsIndoorsViewManager : RCTViewManager {
|
|
|
11
11
|
@objc override static func requiresMainQueueSetup() -> Bool {return false}
|
|
12
12
|
|
|
13
13
|
override func view() -> UIView! {
|
|
14
|
-
|
|
15
|
-
let
|
|
14
|
+
MapboxOptions.accessToken = Bundle.main.object(forInfoDictionaryKey: "MBXAccessToken") as? String ?? ""
|
|
15
|
+
let cameraOptions = CameraOptions(
|
|
16
|
+
center: CLLocationCoordinate2D(latitude: 0, longitude: 0),
|
|
17
|
+
zoom: 2,
|
|
18
|
+
pitch: 0
|
|
19
|
+
)
|
|
20
|
+
let options = MapInitOptions(cameraOptions: cameraOptions)
|
|
21
|
+
|
|
22
|
+
let mapView = MapView(frame: .zero, mapInitOptions: options)
|
|
23
|
+
|
|
24
|
+
|
|
16
25
|
|
|
17
26
|
MapsIndoorsData.sharedInstance.mapView = MapBoxView(mapboxView: mapView)
|
|
18
27
|
return mapView
|
|
@@ -103,8 +112,16 @@ struct MapBoxView: RCMapView {
|
|
|
103
112
|
}
|
|
104
113
|
}
|
|
105
114
|
|
|
106
|
-
func getConfig() -> MPMapConfig {
|
|
107
|
-
|
|
115
|
+
func getConfig(config: NSDictionary) -> MPMapConfig {
|
|
116
|
+
let mapConfig = MPMapConfig(mapBoxView: mapboxView, accessToken: Bundle.main.object(forInfoDictionaryKey: "MBXAccessToken") as? String ?? "")
|
|
117
|
+
if let zoom = config["mapsIndoorsTransitionLevel"] as? NSNumber {
|
|
118
|
+
mapConfig.setMapsIndoorsTransitionLevel(zoom: zoom.intValue)
|
|
119
|
+
}
|
|
120
|
+
if let showMapMarkers = config["showMapMarkers"] as? Bool {
|
|
121
|
+
//Comment in when available
|
|
122
|
+
//mapConfig.showMarkers = showMapMarkers
|
|
123
|
+
}
|
|
124
|
+
return mapConfig
|
|
108
125
|
}
|
|
109
126
|
|
|
110
127
|
}
|
|
@@ -231,6 +231,8 @@ public class DirectionsRendererModule: RCTEventEmitter {
|
|
|
231
231
|
camFitMode = MPCameraViewFitMode.firstStepAligned
|
|
232
232
|
case 2:
|
|
233
233
|
camFitMode = MPCameraViewFitMode.startToEndAligned
|
|
234
|
+
case 3:
|
|
235
|
+
camFitMode = MPCameraViewFitMode.none
|
|
234
236
|
default:
|
|
235
237
|
camFitMode = MPCameraViewFitMode.northAligned
|
|
236
238
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// LabelGraphic.swift
|
|
3
|
+
// react-native-maps-indoors-mapbox
|
|
4
|
+
//
|
|
5
|
+
// Created by Tim Mikkelsen on 29/05/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
struct LabelGraphic: Codable {
|
|
11
|
+
let backgroundImage: String
|
|
12
|
+
let stretchX: [[Int]]
|
|
13
|
+
let stretchY: [[Int]]
|
|
14
|
+
let content: [Int]
|
|
15
|
+
}
|
|
@@ -526,6 +526,15 @@ RCT_EXTERN_METHOD(requiresMainQueueSetup)
|
|
|
526
526
|
resolver:(RCTPromiseResolveBlock) resolve
|
|
527
527
|
rejecter:(RCTPromiseRejectBlock) reject)
|
|
528
528
|
|
|
529
|
+
RCT_EXTERN_METHOD(setLabelStyleGraphic: (NSString *) displayRuleId
|
|
530
|
+
value:(NSString *) value
|
|
531
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
532
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
533
|
+
|
|
534
|
+
RCT_EXTERN_METHOD(getLabelStyleGraphic: (NSString *) displayRuleId
|
|
535
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
536
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
537
|
+
|
|
529
538
|
RCT_EXTERN_METHOD(getPolygonLightnessFactor: (NSString *) displayRuleId
|
|
530
539
|
resolver:(RCTPromiseResolveBlock) resolve
|
|
531
540
|
rejecter:(RCTPromiseRejectBlock) reject)
|
|
@@ -598,6 +607,78 @@ RCT_EXTERN_METHOD(requiresMainQueueSetup)
|
|
|
598
607
|
resolver:(RCTPromiseResolveBlock) resolve
|
|
599
608
|
rejecter:(RCTPromiseRejectBlock) reject)
|
|
600
609
|
|
|
610
|
+
RCT_EXTERN_METHOD(getModel3DModel: (NSString *) displayRuleId
|
|
611
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
612
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
613
|
+
|
|
614
|
+
RCT_EXTERN_METHOD(setModel3DModel: (NSString *) displayRuleId
|
|
615
|
+
value:(NSString *) value
|
|
616
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
617
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
618
|
+
|
|
619
|
+
RCT_EXTERN_METHOD(getModel3DRotationX: (NSString *) displayRuleId
|
|
620
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
621
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
622
|
+
|
|
623
|
+
RCT_EXTERN_METHOD(setModel3DRotationX: (NSString *) displayRuleId
|
|
624
|
+
value:(nonnull NSNumber *) value
|
|
625
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
626
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
627
|
+
|
|
628
|
+
RCT_EXTERN_METHOD(getModel3DRotationY: (NSString *) displayRuleId
|
|
629
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
630
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
631
|
+
|
|
632
|
+
RCT_EXTERN_METHOD(setModel3DRotationY: (NSString *) displayRuleId
|
|
633
|
+
value:(nonnull NSNumber *) value
|
|
634
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
635
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
636
|
+
|
|
637
|
+
RCT_EXTERN_METHOD(getModel3DRotationZ: (NSString *) displayRuleId
|
|
638
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
639
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
640
|
+
|
|
641
|
+
RCT_EXTERN_METHOD(setModel3DRotationZ: (NSString *) displayRuleId
|
|
642
|
+
value:(nonnull NSNumber *) value
|
|
643
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
644
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
645
|
+
|
|
646
|
+
RCT_EXTERN_METHOD(getModel3DScale: (NSString *) displayRuleId
|
|
647
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
648
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
649
|
+
|
|
650
|
+
RCT_EXTERN_METHOD(setModel3DScale: (NSString *) displayRuleId
|
|
651
|
+
value:(nonnull NSNumber *) value
|
|
652
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
653
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
654
|
+
|
|
655
|
+
RCT_EXTERN_METHOD(getModel3DZoomFrom: (NSString *) displayRuleId
|
|
656
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
657
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
658
|
+
|
|
659
|
+
RCT_EXTERN_METHOD(setModel3DZoomFrom: (NSString *) displayRuleId
|
|
660
|
+
value:(nonnull NSNumber *) value
|
|
661
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
662
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
663
|
+
|
|
664
|
+
RCT_EXTERN_METHOD(getModel3DZoomTo: (NSString *) displayRuleId
|
|
665
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
666
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
667
|
+
|
|
668
|
+
RCT_EXTERN_METHOD(setModel3DZoomTo: (NSString *) displayRuleId
|
|
669
|
+
value:(nonnull NSNumber *) value
|
|
670
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
671
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
672
|
+
|
|
673
|
+
RCT_EXTERN_METHOD(isModel3DVisible: (NSString *) displayRuleId
|
|
674
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
675
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
676
|
+
|
|
677
|
+
RCT_EXTERN_METHOD(setModel3DVisible: (NSString *) displayRuleId
|
|
678
|
+
value:(BOOL) value
|
|
679
|
+
resolver:(RCTPromiseResolveBlock) resolve
|
|
680
|
+
rejecter:(RCTPromiseRejectBlock) reject)
|
|
681
|
+
|
|
601
682
|
// Start of tail
|
|
602
683
|
|
|
603
684
|
RCT_EXTERN_METHOD(reset: (NSString *) displayRuleId
|
|
@@ -41,6 +41,10 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
41
41
|
switch(labelType.intValue) {
|
|
42
42
|
case 0:
|
|
43
43
|
return .flat
|
|
44
|
+
case 1:
|
|
45
|
+
return .floating
|
|
46
|
+
case 2:
|
|
47
|
+
return .graphic
|
|
44
48
|
default:
|
|
45
49
|
return .floating
|
|
46
50
|
}
|
|
@@ -1241,6 +1245,37 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1241
1245
|
|
|
1242
1246
|
return resolve(nil)
|
|
1243
1247
|
}
|
|
1248
|
+
|
|
1249
|
+
@objc public func setLabelStyleGraphic(_ displayRuleId: String, value: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1250
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1251
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
guard let labelGraphic = try? JSONDecoder().decode(LabelGraphic.self, from: value.data(using: .utf8)!) else {
|
|
1255
|
+
return doReject(reject, message: "Could not parse label graphic")
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
displayRule.labelStyleGraphicBackgroundImage = labelGraphic.backgroundImage
|
|
1259
|
+
displayRule.labelStyleGraphicStretchX = labelGraphic.stretchX
|
|
1260
|
+
displayRule.labelStyleGraphicStretchY = labelGraphic.stretchY
|
|
1261
|
+
displayRule.labelStyleGraphicContent = labelGraphic.content
|
|
1262
|
+
|
|
1263
|
+
return resolve(nil)
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
@objc public func getLabelStyleGraphic(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1267
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1268
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
let labelGraphic = LabelGraphic(backgroundImage: displayRule.labelStyleGraphicBackgroundImage, stretchX: displayRule.labelStyleGraphicStretchX, stretchY: displayRule.labelStyleGraphicStretchY, content: displayRule.labelStyleGraphicContent)
|
|
1272
|
+
|
|
1273
|
+
guard let graphicJson = try? JSONEncoder().encode(labelGraphic) else {
|
|
1274
|
+
return doReject(reject, message: "Could not encode label graphic")
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
return resolve(String(data: graphicJson, encoding: String.Encoding.utf8))
|
|
1278
|
+
}
|
|
1244
1279
|
|
|
1245
1280
|
@objc public func getPolygonLightnessFactor(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1246
1281
|
guard let displayRule = getRule(name: displayRuleId) else {
|
|
@@ -1400,6 +1435,162 @@ public class MPDisplayRuleModule: NSObject {
|
|
|
1400
1435
|
return resolve(nil)
|
|
1401
1436
|
}
|
|
1402
1437
|
|
|
1438
|
+
@objc public func getModel3DModel(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1439
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1440
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
return resolve(displayRule.model3DModel)
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
@objc public func setModel3DModel(_ displayRuleId: String, value: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1447
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1448
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
displayRule.model3DModel = value
|
|
1452
|
+
|
|
1453
|
+
return resolve(nil)
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
@objc public func getModel3DRotationX(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1457
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1458
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
return resolve(displayRule.model3DRotationX)
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
@objc public func setModel3DRotationX(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1465
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1466
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
if (value != -1) {
|
|
1470
|
+
displayRule.model3DRotationX = value.doubleValue
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
return resolve(nil)
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
@objc public func getModel3DRotationY(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1477
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1478
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
return resolve(displayRule.model3DRotationY)
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
@objc public func setModel3DRotationY(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1485
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1486
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
if (value != -1) {
|
|
1490
|
+
displayRule.model3DRotationY = value.doubleValue
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
return resolve(nil)
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
@objc public func getModel3DRotationZ(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1497
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1498
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
return resolve(displayRule.model3DRotationZ)
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
@objc public func setModel3DRotationZ(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1505
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1506
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
if (value != -1) {
|
|
1510
|
+
displayRule.model3DRotationZ = value.doubleValue
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
return resolve(nil)
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
@objc public func isModel3DVisible(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1517
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1518
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
return resolve(displayRule.model3DVisible)
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
@objc public func setModel3DVisible(_ displayRuleId: String, value: Bool, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1525
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1526
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
displayRule.model3DVisible = value
|
|
1530
|
+
|
|
1531
|
+
return resolve(nil)
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
@objc public func getModel3DZoomFrom(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1535
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1536
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
return resolve(displayRule.model3DZoomFrom)
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
@objc public func setModel3DZoomFrom(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1543
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1544
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
if (value != -1) {
|
|
1548
|
+
displayRule.model3DZoomFrom = value.doubleValue
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
return resolve(nil)
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
@objc public func getModel3DZoomTo(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1555
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1556
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
return resolve(displayRule.model3DZoomTo)
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
@objc public func setModel3DZoomTo(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1563
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1564
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
if (value != -1) {
|
|
1568
|
+
displayRule.model3DZoomTo = value.doubleValue
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
return resolve(nil)
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
@objc public func getModel3DScale(_ displayRuleId: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1575
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1576
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
return resolve(displayRule.model3DScale)
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
@objc public func setModel3DScale(_ displayRuleId: String, value: NSNumber, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|
|
1583
|
+
guard let displayRule = getRule(name: displayRuleId) else {
|
|
1584
|
+
return doReject(reject, displayRuleId: displayRuleId)
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
if (value != -1) {
|
|
1588
|
+
displayRule.model3DScale = value.doubleValue
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
return resolve(nil)
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1403
1594
|
// Start of tail
|
|
1404
1595
|
|
|
1405
1596
|
@objc public func reset(_ displayRuleId: String,resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) {
|