react-native-cesium 1.2.3 → 1.2.5
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 +100 -27
- package/android/CMakeLists.txt +1 -2
- package/android/src/main/cpp/CesiumBridgeAndroid.cpp +264 -130
- package/android/src/main/cpp/CesiumBridgeAndroid.h +70 -27
- package/android/src/main/java/com/margelo/nitro/reactnativecesium/CesiumBridgeJNI.kt +68 -44
- package/android/src/main/java/com/margelo/nitro/reactnativecesium/HybridCesiumView.kt +199 -187
- package/cpp/engine/CameraIntegrator.cpp +374 -0
- package/cpp/engine/CameraIntegrator.hpp +146 -0
- package/cpp/engine/EngineTunables.hpp +90 -31
- package/cpp/engine/GlobeCamera.cpp +17 -6
- package/cpp/engine/GlobeCamera.hpp +11 -8
- package/cpp/engine/test/CameraIntegratorTest.cpp +205 -0
- package/cpp/engine/test/build_and_run.sh +27 -0
- package/example/README.md +1 -1
- package/ios/CesiumBridge.h +53 -28
- package/ios/CesiumBridge.mm +172 -86
- package/ios/HybridCesiumView.swift +256 -145
- package/lib/typescript/src/specs/cesium-view.nitro.d.ts +85 -13
- package/lib/typescript/src/specs/cesium-view.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/ReactNativeCesiumOnLoad.cpp +2 -0
- package/nitrogen/generated/android/c++/JFunc_void_CameraState.hpp +77 -0
- package/nitrogen/generated/android/c++/JHybridCesiumViewSpec.cpp +108 -9
- package/nitrogen/generated/android/c++/JHybridCesiumViewSpec.hpp +21 -3
- package/nitrogen/generated/android/c++/views/JHybridCesiumViewStateUpdater.cpp +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/Func_void_CameraState.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/HybridCesiumViewSpec.kt +71 -3
- package/nitrogen/generated/ios/ReactNativeCesium-Swift-Cxx-Bridge.cpp +3 -3
- package/nitrogen/generated/ios/ReactNativeCesium-Swift-Cxx-Bridge.hpp +43 -28
- package/nitrogen/generated/ios/c++/HybridCesiumViewSpecSwift.hpp +89 -9
- package/nitrogen/generated/ios/c++/views/HybridCesiumViewComponent.mm +30 -0
- package/nitrogen/generated/ios/swift/Func_void_CameraState.swift +5 -5
- package/nitrogen/generated/ios/swift/HybridCesiumViewSpec.swift +15 -3
- package/nitrogen/generated/ios/swift/HybridCesiumViewSpec_cxx.swift +242 -16
- package/nitrogen/generated/shared/c++/HybridCesiumViewSpec.cpp +21 -3
- package/nitrogen/generated/shared/c++/HybridCesiumViewSpec.hpp +22 -4
- package/nitrogen/generated/shared/c++/views/HybridCesiumViewComponent.cpp +66 -0
- package/nitrogen/generated/shared/c++/views/HybridCesiumViewComponent.hpp +6 -0
- package/nitrogen/generated/shared/json/CesiumViewConfig.json +6 -0
- package/package.json +1 -1
- package/src/specs/cesium-view.nitro.ts +102 -14
- package/cpp/engine/CameraSmoother.cpp +0 -68
- package/cpp/engine/CameraSmoother.hpp +0 -28
- package/cpp/engine/CameraTargetState.cpp +0 -205
- package/cpp/engine/CameraTargetState.hpp +0 -126
|
@@ -108,40 +108,55 @@ namespace margelo::nitro::reactnativecesium::bridge::swift {
|
|
|
108
108
|
return optional.value();
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
// pragma MARK: std::
|
|
112
|
-
/**
|
|
113
|
-
* Specialized version of `std::shared_ptr<Promise<CameraState>>`.
|
|
114
|
-
*/
|
|
115
|
-
using std__shared_ptr_Promise_CameraState__ = std::shared_ptr<Promise<CameraState>>;
|
|
116
|
-
inline std::shared_ptr<Promise<CameraState>> create_std__shared_ptr_Promise_CameraState__() noexcept {
|
|
117
|
-
return Promise<CameraState>::create();
|
|
118
|
-
}
|
|
119
|
-
inline PromiseHolder<CameraState> wrap_std__shared_ptr_Promise_CameraState__(std::shared_ptr<Promise<CameraState>> promise) noexcept {
|
|
120
|
-
return PromiseHolder<CameraState>(std::move(promise));
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// pragma MARK: std::function<void(const CameraState& /* result */)>
|
|
111
|
+
// pragma MARK: std::function<void(const CameraState& /* camera */)>
|
|
124
112
|
/**
|
|
125
113
|
* Specialized version of `std::function<void(const CameraState&)>`.
|
|
126
114
|
*/
|
|
127
|
-
using Func_void_CameraState = std::function<void(const CameraState& /*
|
|
115
|
+
using Func_void_CameraState = std::function<void(const CameraState& /* camera */)>;
|
|
128
116
|
/**
|
|
129
|
-
* Wrapper class for a `std::function<void(const CameraState& / *
|
|
117
|
+
* Wrapper class for a `std::function<void(const CameraState& / * camera * /)>`, this can be used from Swift.
|
|
130
118
|
*/
|
|
131
119
|
class Func_void_CameraState_Wrapper final {
|
|
132
120
|
public:
|
|
133
|
-
explicit Func_void_CameraState_Wrapper(std::function<void(const CameraState& /*
|
|
134
|
-
inline void call(CameraState
|
|
135
|
-
_function->operator()(
|
|
121
|
+
explicit Func_void_CameraState_Wrapper(std::function<void(const CameraState& /* camera */)>&& func): _function(std::make_unique<std::function<void(const CameraState& /* camera */)>>(std::move(func))) {}
|
|
122
|
+
inline void call(CameraState camera) const noexcept {
|
|
123
|
+
_function->operator()(camera);
|
|
136
124
|
}
|
|
137
125
|
private:
|
|
138
|
-
std::unique_ptr<std::function<void(const CameraState& /*
|
|
126
|
+
std::unique_ptr<std::function<void(const CameraState& /* camera */)>> _function;
|
|
139
127
|
} SWIFT_NONCOPYABLE;
|
|
140
128
|
Func_void_CameraState create_Func_void_CameraState(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
141
129
|
inline Func_void_CameraState_Wrapper wrap_Func_void_CameraState(Func_void_CameraState value) noexcept {
|
|
142
130
|
return Func_void_CameraState_Wrapper(std::move(value));
|
|
143
131
|
}
|
|
144
132
|
|
|
133
|
+
// pragma MARK: std::optional<std::function<void(const CameraState& /* camera */)>>
|
|
134
|
+
/**
|
|
135
|
+
* Specialized version of `std::optional<std::function<void(const CameraState& / * camera * /)>>`.
|
|
136
|
+
*/
|
|
137
|
+
using std__optional_std__function_void_const_CameraState_____camera______ = std::optional<std::function<void(const CameraState& /* camera */)>>;
|
|
138
|
+
inline std::optional<std::function<void(const CameraState& /* camera */)>> create_std__optional_std__function_void_const_CameraState_____camera______(const std::function<void(const CameraState& /* camera */)>& value) noexcept {
|
|
139
|
+
return std::optional<std::function<void(const CameraState& /* camera */)>>(value);
|
|
140
|
+
}
|
|
141
|
+
inline bool has_value_std__optional_std__function_void_const_CameraState_____camera______(const std::optional<std::function<void(const CameraState& /* camera */)>>& optional) noexcept {
|
|
142
|
+
return optional.has_value();
|
|
143
|
+
}
|
|
144
|
+
inline std::function<void(const CameraState& /* camera */)> get_std__optional_std__function_void_const_CameraState_____camera______(const std::optional<std::function<void(const CameraState& /* camera */)>>& optional) noexcept {
|
|
145
|
+
return optional.value();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// pragma MARK: std::shared_ptr<Promise<CameraState>>
|
|
149
|
+
/**
|
|
150
|
+
* Specialized version of `std::shared_ptr<Promise<CameraState>>`.
|
|
151
|
+
*/
|
|
152
|
+
using std__shared_ptr_Promise_CameraState__ = std::shared_ptr<Promise<CameraState>>;
|
|
153
|
+
inline std::shared_ptr<Promise<CameraState>> create_std__shared_ptr_Promise_CameraState__() noexcept {
|
|
154
|
+
return Promise<CameraState>::create();
|
|
155
|
+
}
|
|
156
|
+
inline PromiseHolder<CameraState> wrap_std__shared_ptr_Promise_CameraState__(std::shared_ptr<Promise<CameraState>> promise) noexcept {
|
|
157
|
+
return PromiseHolder<CameraState>(std::move(promise));
|
|
158
|
+
}
|
|
159
|
+
|
|
145
160
|
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
146
161
|
/**
|
|
147
162
|
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
@@ -210,15 +225,6 @@ namespace margelo::nitro::reactnativecesium::bridge::swift {
|
|
|
210
225
|
using std__weak_ptr_HybridCesiumViewSpec_ = std::weak_ptr<HybridCesiumViewSpec>;
|
|
211
226
|
inline std__weak_ptr_HybridCesiumViewSpec_ weakify_std__shared_ptr_HybridCesiumViewSpec_(const std::shared_ptr<HybridCesiumViewSpec>& strong) noexcept { return strong; }
|
|
212
227
|
|
|
213
|
-
// pragma MARK: Result<std::shared_ptr<Promise<CameraState>>>
|
|
214
|
-
using Result_std__shared_ptr_Promise_CameraState___ = Result<std::shared_ptr<Promise<CameraState>>>;
|
|
215
|
-
inline Result_std__shared_ptr_Promise_CameraState___ create_Result_std__shared_ptr_Promise_CameraState___(const std::shared_ptr<Promise<CameraState>>& value) noexcept {
|
|
216
|
-
return Result<std::shared_ptr<Promise<CameraState>>>::withValue(value);
|
|
217
|
-
}
|
|
218
|
-
inline Result_std__shared_ptr_Promise_CameraState___ create_Result_std__shared_ptr_Promise_CameraState___(const std::exception_ptr& error) noexcept {
|
|
219
|
-
return Result<std::shared_ptr<Promise<CameraState>>>::withError(error);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
228
|
// pragma MARK: Result<void>
|
|
223
229
|
using Result_void_ = Result<void>;
|
|
224
230
|
inline Result_void_ create_Result_void_() noexcept {
|
|
@@ -228,6 +234,15 @@ namespace margelo::nitro::reactnativecesium::bridge::swift {
|
|
|
228
234
|
return Result<void>::withError(error);
|
|
229
235
|
}
|
|
230
236
|
|
|
237
|
+
// pragma MARK: Result<std::shared_ptr<Promise<CameraState>>>
|
|
238
|
+
using Result_std__shared_ptr_Promise_CameraState___ = Result<std::shared_ptr<Promise<CameraState>>>;
|
|
239
|
+
inline Result_std__shared_ptr_Promise_CameraState___ create_Result_std__shared_ptr_Promise_CameraState___(const std::shared_ptr<Promise<CameraState>>& value) noexcept {
|
|
240
|
+
return Result<std::shared_ptr<Promise<CameraState>>>::withValue(value);
|
|
241
|
+
}
|
|
242
|
+
inline Result_std__shared_ptr_Promise_CameraState___ create_Result_std__shared_ptr_Promise_CameraState___(const std::exception_ptr& error) noexcept {
|
|
243
|
+
return Result<std::shared_ptr<Promise<CameraState>>>::withError(error);
|
|
244
|
+
}
|
|
245
|
+
|
|
231
246
|
// pragma MARK: Result<std::shared_ptr<Promise<Quaternion>>>
|
|
232
247
|
using Result_std__shared_ptr_Promise_Quaternion___ = Result<std::shared_ptr<Promise<Quaternion>>>;
|
|
233
248
|
inline Result_std__shared_ptr_Promise_Quaternion___ create_Result_std__shared_ptr_Promise_Quaternion___(const std::shared_ptr<Promise<Quaternion>>& value) noexcept {
|
|
@@ -24,8 +24,8 @@ namespace margelo::nitro::reactnativecesium { struct Quaternion; }
|
|
|
24
24
|
#include <optional>
|
|
25
25
|
#include "CesiumMetrics.hpp"
|
|
26
26
|
#include <functional>
|
|
27
|
-
#include <NitroModules/Promise.hpp>
|
|
28
27
|
#include "Quaternion.hpp"
|
|
28
|
+
#include <NitroModules/Promise.hpp>
|
|
29
29
|
|
|
30
30
|
#include "ReactNativeCesium-Swift-Cxx-Umbrella.hpp"
|
|
31
31
|
|
|
@@ -219,6 +219,41 @@ namespace margelo::nitro::reactnativecesium {
|
|
|
219
219
|
inline void setMinAltitudeAboveTerrain(std::optional<double> minAltitudeAboveTerrain) noexcept override {
|
|
220
220
|
_swiftPart.setMinAltitudeAboveTerrain(minAltitudeAboveTerrain);
|
|
221
221
|
}
|
|
222
|
+
inline std::optional<double> getMaxYawRateDegSec() noexcept override {
|
|
223
|
+
auto __result = _swiftPart.getMaxYawRateDegSec();
|
|
224
|
+
return __result;
|
|
225
|
+
}
|
|
226
|
+
inline void setMaxYawRateDegSec(std::optional<double> maxYawRateDegSec) noexcept override {
|
|
227
|
+
_swiftPart.setMaxYawRateDegSec(maxYawRateDegSec);
|
|
228
|
+
}
|
|
229
|
+
inline std::optional<double> getMaxPitchRateDegSec() noexcept override {
|
|
230
|
+
auto __result = _swiftPart.getMaxPitchRateDegSec();
|
|
231
|
+
return __result;
|
|
232
|
+
}
|
|
233
|
+
inline void setMaxPitchRateDegSec(std::optional<double> maxPitchRateDegSec) noexcept override {
|
|
234
|
+
_swiftPart.setMaxPitchRateDegSec(maxPitchRateDegSec);
|
|
235
|
+
}
|
|
236
|
+
inline std::optional<double> getMaxRollRateDegSec() noexcept override {
|
|
237
|
+
auto __result = _swiftPart.getMaxRollRateDegSec();
|
|
238
|
+
return __result;
|
|
239
|
+
}
|
|
240
|
+
inline void setMaxRollRateDegSec(std::optional<double> maxRollRateDegSec) noexcept override {
|
|
241
|
+
_swiftPart.setMaxRollRateDegSec(maxRollRateDegSec);
|
|
242
|
+
}
|
|
243
|
+
inline std::optional<double> getMaxClimbRateMps() noexcept override {
|
|
244
|
+
auto __result = _swiftPart.getMaxClimbRateMps();
|
|
245
|
+
return __result;
|
|
246
|
+
}
|
|
247
|
+
inline void setMaxClimbRateMps(std::optional<double> maxClimbRateMps) noexcept override {
|
|
248
|
+
_swiftPart.setMaxClimbRateMps(maxClimbRateMps);
|
|
249
|
+
}
|
|
250
|
+
inline std::optional<double> getMaxGroundSpeedMps() noexcept override {
|
|
251
|
+
auto __result = _swiftPart.getMaxGroundSpeedMps();
|
|
252
|
+
return __result;
|
|
253
|
+
}
|
|
254
|
+
inline void setMaxGroundSpeedMps(std::optional<double> maxGroundSpeedMps) noexcept override {
|
|
255
|
+
_swiftPart.setMaxGroundSpeedMps(maxGroundSpeedMps);
|
|
256
|
+
}
|
|
222
257
|
inline std::optional<std::function<void(const CesiumMetrics& /* metrics */)>> getOnMetrics() noexcept override {
|
|
223
258
|
auto __result = _swiftPart.getOnMetrics();
|
|
224
259
|
return __result;
|
|
@@ -226,29 +261,74 @@ namespace margelo::nitro::reactnativecesium {
|
|
|
226
261
|
inline void setOnMetrics(const std::optional<std::function<void(const CesiumMetrics& /* metrics */)>>& onMetrics) noexcept override {
|
|
227
262
|
_swiftPart.setOnMetrics(onMetrics);
|
|
228
263
|
}
|
|
264
|
+
inline std::optional<std::function<void(const CameraState& /* camera */)>> getOnActualCamera() noexcept override {
|
|
265
|
+
auto __result = _swiftPart.getOnActualCamera();
|
|
266
|
+
return __result;
|
|
267
|
+
}
|
|
268
|
+
inline void setOnActualCamera(const std::optional<std::function<void(const CameraState& /* camera */)>>& onActualCamera) noexcept override {
|
|
269
|
+
_swiftPart.setOnActualCamera(onActualCamera);
|
|
270
|
+
}
|
|
229
271
|
|
|
230
272
|
public:
|
|
231
273
|
// Methods
|
|
232
|
-
inline
|
|
233
|
-
auto __result = _swiftPart.
|
|
274
|
+
inline void setPosition(double latitude, double longitude) override {
|
|
275
|
+
auto __result = _swiftPart.setPosition(std::forward<decltype(latitude)>(latitude), std::forward<decltype(longitude)>(longitude));
|
|
276
|
+
if (__result.hasError()) [[unlikely]] {
|
|
277
|
+
std::rethrow_exception(__result.error());
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
inline void setAltitude(double altitudeMeters) override {
|
|
281
|
+
auto __result = _swiftPart.setAltitude(std::forward<decltype(altitudeMeters)>(altitudeMeters));
|
|
282
|
+
if (__result.hasError()) [[unlikely]] {
|
|
283
|
+
std::rethrow_exception(__result.error());
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
inline void setHeading(double headingDeg) override {
|
|
287
|
+
auto __result = _swiftPart.setHeading(std::forward<decltype(headingDeg)>(headingDeg));
|
|
288
|
+
if (__result.hasError()) [[unlikely]] {
|
|
289
|
+
std::rethrow_exception(__result.error());
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
inline void setAttitude(double pitchDeg, double rollDeg) override {
|
|
293
|
+
auto __result = _swiftPart.setAttitude(std::forward<decltype(pitchDeg)>(pitchDeg), std::forward<decltype(rollDeg)>(rollDeg));
|
|
294
|
+
if (__result.hasError()) [[unlikely]] {
|
|
295
|
+
std::rethrow_exception(__result.error());
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
inline void setViewCorrection(const Quaternion& q) override {
|
|
299
|
+
auto __result = _swiftPart.setViewCorrection(std::forward<decltype(q)>(q));
|
|
234
300
|
if (__result.hasError()) [[unlikely]] {
|
|
235
301
|
std::rethrow_exception(__result.error());
|
|
236
302
|
}
|
|
237
|
-
auto __value = std::move(__result.value());
|
|
238
|
-
return __value;
|
|
239
303
|
}
|
|
240
|
-
inline void
|
|
241
|
-
auto __result = _swiftPart.
|
|
304
|
+
inline void setVerticalFov(double deg) override {
|
|
305
|
+
auto __result = _swiftPart.setVerticalFov(std::forward<decltype(deg)>(deg));
|
|
242
306
|
if (__result.hasError()) [[unlikely]] {
|
|
243
307
|
std::rethrow_exception(__result.error());
|
|
244
308
|
}
|
|
245
309
|
}
|
|
246
|
-
inline void
|
|
247
|
-
auto __result = _swiftPart.
|
|
310
|
+
inline void teleport(const CameraState& camera) override {
|
|
311
|
+
auto __result = _swiftPart.teleport(std::forward<decltype(camera)>(camera));
|
|
248
312
|
if (__result.hasError()) [[unlikely]] {
|
|
249
313
|
std::rethrow_exception(__result.error());
|
|
250
314
|
}
|
|
251
315
|
}
|
|
316
|
+
inline std::shared_ptr<Promise<CameraState>> getActualCamera() override {
|
|
317
|
+
auto __result = _swiftPart.getActualCamera();
|
|
318
|
+
if (__result.hasError()) [[unlikely]] {
|
|
319
|
+
std::rethrow_exception(__result.error());
|
|
320
|
+
}
|
|
321
|
+
auto __value = std::move(__result.value());
|
|
322
|
+
return __value;
|
|
323
|
+
}
|
|
324
|
+
inline std::shared_ptr<Promise<CameraState>> getDemandCamera() override {
|
|
325
|
+
auto __result = _swiftPart.getDemandCamera();
|
|
326
|
+
if (__result.hasError()) [[unlikely]] {
|
|
327
|
+
std::rethrow_exception(__result.error());
|
|
328
|
+
}
|
|
329
|
+
auto __value = std::move(__result.value());
|
|
330
|
+
return __value;
|
|
331
|
+
}
|
|
252
332
|
inline std::shared_ptr<Promise<Quaternion>> getViewCorrection() override {
|
|
253
333
|
auto __result = _swiftPart.getViewCorrection();
|
|
254
334
|
if (__result.hasError()) [[unlikely]] {
|
|
@@ -189,11 +189,41 @@ using namespace margelo::nitro::reactnativecesium::views;
|
|
|
189
189
|
swiftPart.setMinAltitudeAboveTerrain(newViewProps.minAltitudeAboveTerrain.value);
|
|
190
190
|
newViewProps.minAltitudeAboveTerrain.isDirty = false;
|
|
191
191
|
}
|
|
192
|
+
// maxYawRateDegSec: optional
|
|
193
|
+
if (newViewProps.maxYawRateDegSec.isDirty) {
|
|
194
|
+
swiftPart.setMaxYawRateDegSec(newViewProps.maxYawRateDegSec.value);
|
|
195
|
+
newViewProps.maxYawRateDegSec.isDirty = false;
|
|
196
|
+
}
|
|
197
|
+
// maxPitchRateDegSec: optional
|
|
198
|
+
if (newViewProps.maxPitchRateDegSec.isDirty) {
|
|
199
|
+
swiftPart.setMaxPitchRateDegSec(newViewProps.maxPitchRateDegSec.value);
|
|
200
|
+
newViewProps.maxPitchRateDegSec.isDirty = false;
|
|
201
|
+
}
|
|
202
|
+
// maxRollRateDegSec: optional
|
|
203
|
+
if (newViewProps.maxRollRateDegSec.isDirty) {
|
|
204
|
+
swiftPart.setMaxRollRateDegSec(newViewProps.maxRollRateDegSec.value);
|
|
205
|
+
newViewProps.maxRollRateDegSec.isDirty = false;
|
|
206
|
+
}
|
|
207
|
+
// maxClimbRateMps: optional
|
|
208
|
+
if (newViewProps.maxClimbRateMps.isDirty) {
|
|
209
|
+
swiftPart.setMaxClimbRateMps(newViewProps.maxClimbRateMps.value);
|
|
210
|
+
newViewProps.maxClimbRateMps.isDirty = false;
|
|
211
|
+
}
|
|
212
|
+
// maxGroundSpeedMps: optional
|
|
213
|
+
if (newViewProps.maxGroundSpeedMps.isDirty) {
|
|
214
|
+
swiftPart.setMaxGroundSpeedMps(newViewProps.maxGroundSpeedMps.value);
|
|
215
|
+
newViewProps.maxGroundSpeedMps.isDirty = false;
|
|
216
|
+
}
|
|
192
217
|
// onMetrics: optional
|
|
193
218
|
if (newViewProps.onMetrics.isDirty) {
|
|
194
219
|
swiftPart.setOnMetrics(newViewProps.onMetrics.value);
|
|
195
220
|
newViewProps.onMetrics.isDirty = false;
|
|
196
221
|
}
|
|
222
|
+
// onActualCamera: optional
|
|
223
|
+
if (newViewProps.onActualCamera.isDirty) {
|
|
224
|
+
swiftPart.setOnActualCamera(newViewProps.onActualCamera.value);
|
|
225
|
+
newViewProps.onActualCamera.isDirty = false;
|
|
226
|
+
}
|
|
197
227
|
|
|
198
228
|
swiftPart.afterUpdate();
|
|
199
229
|
|
|
@@ -8,21 +8,21 @@
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Wraps a Swift `(_
|
|
11
|
+
* Wraps a Swift `(_ camera: CameraState) -> Void` as a class.
|
|
12
12
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
13
|
*/
|
|
14
14
|
public final class Func_void_CameraState {
|
|
15
15
|
public typealias bridge = margelo.nitro.reactnativecesium.bridge.swift
|
|
16
16
|
|
|
17
|
-
private let closure: (_
|
|
17
|
+
private let closure: (_ camera: CameraState) -> Void
|
|
18
18
|
|
|
19
|
-
public init(_ closure: @escaping (_
|
|
19
|
+
public init(_ closure: @escaping (_ camera: CameraState) -> Void) {
|
|
20
20
|
self.closure = closure
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
@inline(__always)
|
|
24
|
-
public func call(
|
|
25
|
-
self.closure(
|
|
24
|
+
public func call(camera: CameraState) -> Void {
|
|
25
|
+
self.closure(camera)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -32,12 +32,24 @@ public protocol HybridCesiumViewSpec_protocol: HybridObject, HybridView {
|
|
|
32
32
|
var sqliteCacheMaxRows: Double? { get set }
|
|
33
33
|
var taskProcessorThreads: Double? { get set }
|
|
34
34
|
var minAltitudeAboveTerrain: Double? { get set }
|
|
35
|
+
var maxYawRateDegSec: Double? { get set }
|
|
36
|
+
var maxPitchRateDegSec: Double? { get set }
|
|
37
|
+
var maxRollRateDegSec: Double? { get set }
|
|
38
|
+
var maxClimbRateMps: Double? { get set }
|
|
39
|
+
var maxGroundSpeedMps: Double? { get set }
|
|
35
40
|
var onMetrics: ((_ metrics: CesiumMetrics) -> Void)? { get set }
|
|
41
|
+
var onActualCamera: ((_ camera: CameraState) -> Void)? { get set }
|
|
36
42
|
|
|
37
43
|
// Methods
|
|
38
|
-
func
|
|
39
|
-
func
|
|
40
|
-
func
|
|
44
|
+
func setPosition(latitude: Double, longitude: Double) throws -> Void
|
|
45
|
+
func setAltitude(altitudeMeters: Double) throws -> Void
|
|
46
|
+
func setHeading(headingDeg: Double) throws -> Void
|
|
47
|
+
func setAttitude(pitchDeg: Double, rollDeg: Double) throws -> Void
|
|
48
|
+
func setViewCorrection(q: Quaternion) throws -> Void
|
|
49
|
+
func setVerticalFov(deg: Double) throws -> Void
|
|
50
|
+
func teleport(camera: CameraState) throws -> Void
|
|
51
|
+
func getActualCamera() throws -> Promise<CameraState>
|
|
52
|
+
func getDemandCamera() throws -> Promise<CameraState>
|
|
41
53
|
func getViewCorrection() throws -> Promise<Quaternion>
|
|
42
54
|
}
|
|
43
55
|
|
|
@@ -532,6 +532,126 @@ open class HybridCesiumViewSpec_cxx {
|
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
|
|
535
|
+
public final var maxYawRateDegSec: bridge.std__optional_double_ {
|
|
536
|
+
@inline(__always)
|
|
537
|
+
get {
|
|
538
|
+
return { () -> bridge.std__optional_double_ in
|
|
539
|
+
if let __unwrappedValue = self.__implementation.maxYawRateDegSec {
|
|
540
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
541
|
+
} else {
|
|
542
|
+
return .init()
|
|
543
|
+
}
|
|
544
|
+
}()
|
|
545
|
+
}
|
|
546
|
+
@inline(__always)
|
|
547
|
+
set {
|
|
548
|
+
self.__implementation.maxYawRateDegSec = { () -> Double? in
|
|
549
|
+
if bridge.has_value_std__optional_double_(newValue) {
|
|
550
|
+
let __unwrapped = bridge.get_std__optional_double_(newValue)
|
|
551
|
+
return __unwrapped
|
|
552
|
+
} else {
|
|
553
|
+
return nil
|
|
554
|
+
}
|
|
555
|
+
}()
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
public final var maxPitchRateDegSec: bridge.std__optional_double_ {
|
|
560
|
+
@inline(__always)
|
|
561
|
+
get {
|
|
562
|
+
return { () -> bridge.std__optional_double_ in
|
|
563
|
+
if let __unwrappedValue = self.__implementation.maxPitchRateDegSec {
|
|
564
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
565
|
+
} else {
|
|
566
|
+
return .init()
|
|
567
|
+
}
|
|
568
|
+
}()
|
|
569
|
+
}
|
|
570
|
+
@inline(__always)
|
|
571
|
+
set {
|
|
572
|
+
self.__implementation.maxPitchRateDegSec = { () -> Double? in
|
|
573
|
+
if bridge.has_value_std__optional_double_(newValue) {
|
|
574
|
+
let __unwrapped = bridge.get_std__optional_double_(newValue)
|
|
575
|
+
return __unwrapped
|
|
576
|
+
} else {
|
|
577
|
+
return nil
|
|
578
|
+
}
|
|
579
|
+
}()
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
public final var maxRollRateDegSec: bridge.std__optional_double_ {
|
|
584
|
+
@inline(__always)
|
|
585
|
+
get {
|
|
586
|
+
return { () -> bridge.std__optional_double_ in
|
|
587
|
+
if let __unwrappedValue = self.__implementation.maxRollRateDegSec {
|
|
588
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
589
|
+
} else {
|
|
590
|
+
return .init()
|
|
591
|
+
}
|
|
592
|
+
}()
|
|
593
|
+
}
|
|
594
|
+
@inline(__always)
|
|
595
|
+
set {
|
|
596
|
+
self.__implementation.maxRollRateDegSec = { () -> Double? in
|
|
597
|
+
if bridge.has_value_std__optional_double_(newValue) {
|
|
598
|
+
let __unwrapped = bridge.get_std__optional_double_(newValue)
|
|
599
|
+
return __unwrapped
|
|
600
|
+
} else {
|
|
601
|
+
return nil
|
|
602
|
+
}
|
|
603
|
+
}()
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
public final var maxClimbRateMps: bridge.std__optional_double_ {
|
|
608
|
+
@inline(__always)
|
|
609
|
+
get {
|
|
610
|
+
return { () -> bridge.std__optional_double_ in
|
|
611
|
+
if let __unwrappedValue = self.__implementation.maxClimbRateMps {
|
|
612
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
613
|
+
} else {
|
|
614
|
+
return .init()
|
|
615
|
+
}
|
|
616
|
+
}()
|
|
617
|
+
}
|
|
618
|
+
@inline(__always)
|
|
619
|
+
set {
|
|
620
|
+
self.__implementation.maxClimbRateMps = { () -> Double? in
|
|
621
|
+
if bridge.has_value_std__optional_double_(newValue) {
|
|
622
|
+
let __unwrapped = bridge.get_std__optional_double_(newValue)
|
|
623
|
+
return __unwrapped
|
|
624
|
+
} else {
|
|
625
|
+
return nil
|
|
626
|
+
}
|
|
627
|
+
}()
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
public final var maxGroundSpeedMps: bridge.std__optional_double_ {
|
|
632
|
+
@inline(__always)
|
|
633
|
+
get {
|
|
634
|
+
return { () -> bridge.std__optional_double_ in
|
|
635
|
+
if let __unwrappedValue = self.__implementation.maxGroundSpeedMps {
|
|
636
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
637
|
+
} else {
|
|
638
|
+
return .init()
|
|
639
|
+
}
|
|
640
|
+
}()
|
|
641
|
+
}
|
|
642
|
+
@inline(__always)
|
|
643
|
+
set {
|
|
644
|
+
self.__implementation.maxGroundSpeedMps = { () -> Double? in
|
|
645
|
+
if bridge.has_value_std__optional_double_(newValue) {
|
|
646
|
+
let __unwrapped = bridge.get_std__optional_double_(newValue)
|
|
647
|
+
return __unwrapped
|
|
648
|
+
} else {
|
|
649
|
+
return nil
|
|
650
|
+
}
|
|
651
|
+
}()
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
535
655
|
public final var onMetrics: bridge.std__optional_std__function_void_const_CesiumMetrics_____metrics______ {
|
|
536
656
|
@inline(__always)
|
|
537
657
|
get {
|
|
@@ -563,31 +683,66 @@ open class HybridCesiumViewSpec_cxx {
|
|
|
563
683
|
}()
|
|
564
684
|
}
|
|
565
685
|
}
|
|
686
|
+
|
|
687
|
+
public final var onActualCamera: bridge.std__optional_std__function_void_const_CameraState_____camera______ {
|
|
688
|
+
@inline(__always)
|
|
689
|
+
get {
|
|
690
|
+
return { () -> bridge.std__optional_std__function_void_const_CameraState_____camera______ in
|
|
691
|
+
if let __unwrappedValue = self.__implementation.onActualCamera {
|
|
692
|
+
return bridge.create_std__optional_std__function_void_const_CameraState_____camera______({ () -> bridge.Func_void_CameraState in
|
|
693
|
+
let __closureWrapper = Func_void_CameraState(__unwrappedValue)
|
|
694
|
+
return bridge.create_Func_void_CameraState(__closureWrapper.toUnsafe())
|
|
695
|
+
}())
|
|
696
|
+
} else {
|
|
697
|
+
return .init()
|
|
698
|
+
}
|
|
699
|
+
}()
|
|
700
|
+
}
|
|
701
|
+
@inline(__always)
|
|
702
|
+
set {
|
|
703
|
+
self.__implementation.onActualCamera = { () -> ((_ camera: CameraState) -> Void)? in
|
|
704
|
+
if bridge.has_value_std__optional_std__function_void_const_CameraState_____camera______(newValue) {
|
|
705
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_CameraState_____camera______(newValue)
|
|
706
|
+
return { () -> (CameraState) -> Void in
|
|
707
|
+
let __wrappedFunction = bridge.wrap_Func_void_CameraState(__unwrapped)
|
|
708
|
+
return { (__camera: CameraState) -> Void in
|
|
709
|
+
__wrappedFunction.call(__camera)
|
|
710
|
+
}
|
|
711
|
+
}()
|
|
712
|
+
} else {
|
|
713
|
+
return nil
|
|
714
|
+
}
|
|
715
|
+
}()
|
|
716
|
+
}
|
|
717
|
+
}
|
|
566
718
|
|
|
567
719
|
// Methods
|
|
568
720
|
@inline(__always)
|
|
569
|
-
public final func
|
|
721
|
+
public final func setPosition(latitude: Double, longitude: Double) -> bridge.Result_void_ {
|
|
570
722
|
do {
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
let __promise = bridge.create_std__shared_ptr_Promise_CameraState__()
|
|
574
|
-
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_CameraState__(__promise)
|
|
575
|
-
__result
|
|
576
|
-
.then({ __result in __promiseHolder.resolve(__result) })
|
|
577
|
-
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
578
|
-
return __promise
|
|
579
|
-
}()
|
|
580
|
-
return bridge.create_Result_std__shared_ptr_Promise_CameraState___(__resultCpp)
|
|
723
|
+
try self.__implementation.setPosition(latitude: latitude, longitude: longitude)
|
|
724
|
+
return bridge.create_Result_void_()
|
|
581
725
|
} catch (let __error) {
|
|
582
726
|
let __exceptionPtr = __error.toCpp()
|
|
583
|
-
return bridge.
|
|
727
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
@inline(__always)
|
|
732
|
+
public final func setAltitude(altitudeMeters: Double) -> bridge.Result_void_ {
|
|
733
|
+
do {
|
|
734
|
+
try self.__implementation.setAltitude(altitudeMeters: altitudeMeters)
|
|
735
|
+
return bridge.create_Result_void_()
|
|
736
|
+
} catch (let __error) {
|
|
737
|
+
let __exceptionPtr = __error.toCpp()
|
|
738
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
584
739
|
}
|
|
585
740
|
}
|
|
586
741
|
|
|
587
742
|
@inline(__always)
|
|
588
|
-
public final func
|
|
743
|
+
public final func setHeading(headingDeg: Double) -> bridge.Result_void_ {
|
|
589
744
|
do {
|
|
590
|
-
try self.__implementation.
|
|
745
|
+
try self.__implementation.setHeading(headingDeg: headingDeg)
|
|
591
746
|
return bridge.create_Result_void_()
|
|
592
747
|
} catch (let __error) {
|
|
593
748
|
let __exceptionPtr = __error.toCpp()
|
|
@@ -596,9 +751,9 @@ open class HybridCesiumViewSpec_cxx {
|
|
|
596
751
|
}
|
|
597
752
|
|
|
598
753
|
@inline(__always)
|
|
599
|
-
public final func
|
|
754
|
+
public final func setAttitude(pitchDeg: Double, rollDeg: Double) -> bridge.Result_void_ {
|
|
600
755
|
do {
|
|
601
|
-
try self.__implementation.
|
|
756
|
+
try self.__implementation.setAttitude(pitchDeg: pitchDeg, rollDeg: rollDeg)
|
|
602
757
|
return bridge.create_Result_void_()
|
|
603
758
|
} catch (let __error) {
|
|
604
759
|
let __exceptionPtr = __error.toCpp()
|
|
@@ -606,6 +761,77 @@ open class HybridCesiumViewSpec_cxx {
|
|
|
606
761
|
}
|
|
607
762
|
}
|
|
608
763
|
|
|
764
|
+
@inline(__always)
|
|
765
|
+
public final func setViewCorrection(q: Quaternion) -> bridge.Result_void_ {
|
|
766
|
+
do {
|
|
767
|
+
try self.__implementation.setViewCorrection(q: q)
|
|
768
|
+
return bridge.create_Result_void_()
|
|
769
|
+
} catch (let __error) {
|
|
770
|
+
let __exceptionPtr = __error.toCpp()
|
|
771
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
@inline(__always)
|
|
776
|
+
public final func setVerticalFov(deg: Double) -> bridge.Result_void_ {
|
|
777
|
+
do {
|
|
778
|
+
try self.__implementation.setVerticalFov(deg: deg)
|
|
779
|
+
return bridge.create_Result_void_()
|
|
780
|
+
} catch (let __error) {
|
|
781
|
+
let __exceptionPtr = __error.toCpp()
|
|
782
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
@inline(__always)
|
|
787
|
+
public final func teleport(camera: CameraState) -> bridge.Result_void_ {
|
|
788
|
+
do {
|
|
789
|
+
try self.__implementation.teleport(camera: camera)
|
|
790
|
+
return bridge.create_Result_void_()
|
|
791
|
+
} catch (let __error) {
|
|
792
|
+
let __exceptionPtr = __error.toCpp()
|
|
793
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
@inline(__always)
|
|
798
|
+
public final func getActualCamera() -> bridge.Result_std__shared_ptr_Promise_CameraState___ {
|
|
799
|
+
do {
|
|
800
|
+
let __result = try self.__implementation.getActualCamera()
|
|
801
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_CameraState__ in
|
|
802
|
+
let __promise = bridge.create_std__shared_ptr_Promise_CameraState__()
|
|
803
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_CameraState__(__promise)
|
|
804
|
+
__result
|
|
805
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
806
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
807
|
+
return __promise
|
|
808
|
+
}()
|
|
809
|
+
return bridge.create_Result_std__shared_ptr_Promise_CameraState___(__resultCpp)
|
|
810
|
+
} catch (let __error) {
|
|
811
|
+
let __exceptionPtr = __error.toCpp()
|
|
812
|
+
return bridge.create_Result_std__shared_ptr_Promise_CameraState___(__exceptionPtr)
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
@inline(__always)
|
|
817
|
+
public final func getDemandCamera() -> bridge.Result_std__shared_ptr_Promise_CameraState___ {
|
|
818
|
+
do {
|
|
819
|
+
let __result = try self.__implementation.getDemandCamera()
|
|
820
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_CameraState__ in
|
|
821
|
+
let __promise = bridge.create_std__shared_ptr_Promise_CameraState__()
|
|
822
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_CameraState__(__promise)
|
|
823
|
+
__result
|
|
824
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
825
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
826
|
+
return __promise
|
|
827
|
+
}()
|
|
828
|
+
return bridge.create_Result_std__shared_ptr_Promise_CameraState___(__resultCpp)
|
|
829
|
+
} catch (let __error) {
|
|
830
|
+
let __exceptionPtr = __error.toCpp()
|
|
831
|
+
return bridge.create_Result_std__shared_ptr_Promise_CameraState___(__exceptionPtr)
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
|
|
609
835
|
@inline(__always)
|
|
610
836
|
public final func getViewCorrection() -> bridge.Result_std__shared_ptr_Promise_Quaternion___ {
|
|
611
837
|
do {
|
|
@@ -58,11 +58,29 @@ namespace margelo::nitro::reactnativecesium {
|
|
|
58
58
|
prototype.registerHybridSetter("taskProcessorThreads", &HybridCesiumViewSpec::setTaskProcessorThreads);
|
|
59
59
|
prototype.registerHybridGetter("minAltitudeAboveTerrain", &HybridCesiumViewSpec::getMinAltitudeAboveTerrain);
|
|
60
60
|
prototype.registerHybridSetter("minAltitudeAboveTerrain", &HybridCesiumViewSpec::setMinAltitudeAboveTerrain);
|
|
61
|
+
prototype.registerHybridGetter("maxYawRateDegSec", &HybridCesiumViewSpec::getMaxYawRateDegSec);
|
|
62
|
+
prototype.registerHybridSetter("maxYawRateDegSec", &HybridCesiumViewSpec::setMaxYawRateDegSec);
|
|
63
|
+
prototype.registerHybridGetter("maxPitchRateDegSec", &HybridCesiumViewSpec::getMaxPitchRateDegSec);
|
|
64
|
+
prototype.registerHybridSetter("maxPitchRateDegSec", &HybridCesiumViewSpec::setMaxPitchRateDegSec);
|
|
65
|
+
prototype.registerHybridGetter("maxRollRateDegSec", &HybridCesiumViewSpec::getMaxRollRateDegSec);
|
|
66
|
+
prototype.registerHybridSetter("maxRollRateDegSec", &HybridCesiumViewSpec::setMaxRollRateDegSec);
|
|
67
|
+
prototype.registerHybridGetter("maxClimbRateMps", &HybridCesiumViewSpec::getMaxClimbRateMps);
|
|
68
|
+
prototype.registerHybridSetter("maxClimbRateMps", &HybridCesiumViewSpec::setMaxClimbRateMps);
|
|
69
|
+
prototype.registerHybridGetter("maxGroundSpeedMps", &HybridCesiumViewSpec::getMaxGroundSpeedMps);
|
|
70
|
+
prototype.registerHybridSetter("maxGroundSpeedMps", &HybridCesiumViewSpec::setMaxGroundSpeedMps);
|
|
61
71
|
prototype.registerHybridGetter("onMetrics", &HybridCesiumViewSpec::getOnMetrics);
|
|
62
72
|
prototype.registerHybridSetter("onMetrics", &HybridCesiumViewSpec::setOnMetrics);
|
|
63
|
-
prototype.
|
|
64
|
-
prototype.
|
|
65
|
-
prototype.registerHybridMethod("
|
|
73
|
+
prototype.registerHybridGetter("onActualCamera", &HybridCesiumViewSpec::getOnActualCamera);
|
|
74
|
+
prototype.registerHybridSetter("onActualCamera", &HybridCesiumViewSpec::setOnActualCamera);
|
|
75
|
+
prototype.registerHybridMethod("setPosition", &HybridCesiumViewSpec::setPosition);
|
|
76
|
+
prototype.registerHybridMethod("setAltitude", &HybridCesiumViewSpec::setAltitude);
|
|
77
|
+
prototype.registerHybridMethod("setHeading", &HybridCesiumViewSpec::setHeading);
|
|
78
|
+
prototype.registerHybridMethod("setAttitude", &HybridCesiumViewSpec::setAttitude);
|
|
79
|
+
prototype.registerHybridMethod("setViewCorrection", &HybridCesiumViewSpec::setViewCorrection);
|
|
80
|
+
prototype.registerHybridMethod("setVerticalFov", &HybridCesiumViewSpec::setVerticalFov);
|
|
81
|
+
prototype.registerHybridMethod("teleport", &HybridCesiumViewSpec::teleport);
|
|
82
|
+
prototype.registerHybridMethod("getActualCamera", &HybridCesiumViewSpec::getActualCamera);
|
|
83
|
+
prototype.registerHybridMethod("getDemandCamera", &HybridCesiumViewSpec::getDemandCamera);
|
|
66
84
|
prototype.registerHybridMethod("getViewCorrection", &HybridCesiumViewSpec::getViewCorrection);
|
|
67
85
|
});
|
|
68
86
|
}
|