react-native-cesium 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/LICENSE +21 -0
- package/NOTICE +12 -0
- package/README.md +308 -0
- package/ReactNativeCesium.podspec +54 -0
- package/android/CMakeLists.txt +146 -0
- package/android/build.gradle +178 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/assets/cacert.pem +3529 -0
- package/android/src/main/cpp/CesiumBridgeAndroid.cpp +487 -0
- package/android/src/main/cpp/CesiumBridgeAndroid.h +94 -0
- package/android/src/main/cpp/cpp-adapter.cpp +17 -0
- package/android/src/main/cpp/vulkan/VulkanBackend.cpp +1781 -0
- package/android/src/main/cpp/vulkan/VulkanBackend.h +190 -0
- package/android/src/main/cpp/vulkan/shaders/sky.frag +86 -0
- package/android/src/main/cpp/vulkan/shaders/sky.vert +9 -0
- package/android/src/main/cpp/vulkan/shaders/terrain.frag +144 -0
- package/android/src/main/cpp/vulkan/shaders/terrain.vert +25 -0
- package/android/src/main/java/com/margelo/nitro/reactnativecesium/CesiumBridgeJNI.kt +84 -0
- package/android/src/main/java/com/margelo/nitro/reactnativecesium/HybridCesiumView.kt +225 -0
- package/android/src/main/java/com/reactnativecesium/ReactNativeCesiumPackage.kt +28 -0
- package/cpp/engine/CesiumEngine.cpp +413 -0
- package/cpp/engine/CesiumEngine.hpp +90 -0
- package/cpp/engine/DeletionQueue.cpp +28 -0
- package/cpp/engine/DeletionQueue.hpp +28 -0
- package/cpp/engine/GlobeCamera.cpp +181 -0
- package/cpp/engine/GlobeCamera.hpp +64 -0
- package/cpp/engine/GltfToMesh.cpp +154 -0
- package/cpp/engine/GltfToMesh.hpp +20 -0
- package/cpp/engine/ResourcePreparer.cpp +224 -0
- package/cpp/engine/ResourcePreparer.hpp +96 -0
- package/cpp/engine/TaskProcessor.cpp +61 -0
- package/cpp/engine/TaskProcessor.hpp +43 -0
- package/cpp/engine/TileLifecycleManager.cpp +30 -0
- package/cpp/engine/TileLifecycleManager.hpp +25 -0
- package/cpp/fmt/format.h +9 -0
- package/cpp/renderer/IGPUBackend.hpp +22 -0
- package/cpp/renderer/RenderTypes.hpp +112 -0
- package/cpp/renderer/ShaderTypes.hpp +29 -0
- package/example/README.md +43 -0
- package/example/react-native-cesium-example.jpg +0 -0
- package/ios/CesiumBridge.h +55 -0
- package/ios/CesiumBridge.mm +393 -0
- package/ios/HybridCesiumView.swift +299 -0
- package/ios/ReactNativeCesium-umbrella.h +16 -0
- package/ios/metal/MetalBackend.h +82 -0
- package/ios/metal/MetalBackend.mm +839 -0
- package/ios/react_native_cesium_ensure_native.rb +12 -0
- package/ios/react_native_cesium_post_install.rb +30 -0
- package/lib/commonjs/CesiumView.js +13 -0
- package/lib/commonjs/CesiumView.js.map +1 -0
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/cesium-view.nitro.js +6 -0
- package/lib/commonjs/specs/cesium-view.nitro.js.map +1 -0
- package/lib/module/CesiumView.js +9 -0
- package/lib/module/CesiumView.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/specs/cesium-view.nitro.js +4 -0
- package/lib/module/specs/cesium-view.nitro.js.map +1 -0
- package/lib/typescript/src/CesiumView.d.ts +5 -0
- package/lib/typescript/src/CesiumView.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/cesium-view.nitro.d.ts +43 -0
- package/lib/typescript/src/specs/cesium-view.nitro.d.ts.map +1 -0
- package/nitro.json +30 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/ReactNativeCesium+autolinking.cmake +83 -0
- package/nitrogen/generated/android/ReactNativeCesium+autolinking.gradle +27 -0
- package/nitrogen/generated/android/ReactNativeCesiumOnLoad.cpp +58 -0
- package/nitrogen/generated/android/ReactNativeCesiumOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JCameraState.hpp +81 -0
- package/nitrogen/generated/android/c++/JCesiumMetrics.hpp +81 -0
- package/nitrogen/generated/android/c++/JFunc_void_CesiumMetrics.hpp +78 -0
- package/nitrogen/generated/android/c++/JHybridCesiumViewSpec.cpp +178 -0
- package/nitrogen/generated/android/c++/JHybridCesiumViewSpec.hpp +83 -0
- package/nitrogen/generated/android/c++/views/JHybridCesiumViewStateUpdater.cpp +92 -0
- package/nitrogen/generated/android/c++/views/JHybridCesiumViewStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/CameraState.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/CesiumMetrics.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/Func_void_CesiumMetrics.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/HybridCesiumViewSpec.kt +126 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/ReactNativeCesiumOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/views/HybridCesiumViewManager.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/views/HybridCesiumViewStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/ReactNativeCesium+autolinking.rb +60 -0
- package/nitrogen/generated/ios/ReactNativeCesium-Swift-Cxx-Bridge.cpp +57 -0
- package/nitrogen/generated/ios/ReactNativeCesium-Swift-Cxx-Bridge.hpp +164 -0
- package/nitrogen/generated/ios/ReactNativeCesium-Swift-Cxx-Umbrella.hpp +53 -0
- package/nitrogen/generated/ios/ReactNativeCesiumAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ReactNativeCesiumAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridCesiumViewSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCesiumViewSpecSwift.hpp +157 -0
- package/nitrogen/generated/ios/c++/views/HybridCesiumViewComponent.mm +167 -0
- package/nitrogen/generated/ios/swift/CameraState.swift +59 -0
- package/nitrogen/generated/ios/swift/CesiumMetrics.swift +59 -0
- package/nitrogen/generated/ios/swift/Func_void_CameraState.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_CesiumMetrics.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridCesiumViewSpec.swift +65 -0
- package/nitrogen/generated/ios/swift/HybridCesiumViewSpec_cxx.swift +306 -0
- package/nitrogen/generated/shared/c++/CameraState.hpp +107 -0
- package/nitrogen/generated/shared/c++/CesiumMetrics.hpp +107 -0
- package/nitrogen/generated/shared/c++/HybridCesiumViewSpec.cpp +42 -0
- package/nitrogen/generated/shared/c++/HybridCesiumViewSpec.hpp +90 -0
- package/nitrogen/generated/shared/c++/views/HybridCesiumViewComponent.cpp +182 -0
- package/nitrogen/generated/shared/c++/views/HybridCesiumViewComponent.hpp +122 -0
- package/nitrogen/generated/shared/json/CesiumViewConfig.json +19 -0
- package/package.json +140 -0
- package/react-native.config.js +16 -0
- package/scripts/cesium/build.mjs +901 -0
- package/scripts/cesium/clean.mjs +35 -0
- package/scripts/cesium/clone.mjs +32 -0
- package/scripts/cesium/ensure-native.mjs +116 -0
- package/scripts/cesium/vcpkg-ports/zstd/fix-emscripten-and-clang-cl.patch +31 -0
- package/scripts/cesium/vcpkg-ports/zstd/fix-windows-rc-compile.patch +13 -0
- package/scripts/cesium/vcpkg-ports/zstd/no-static-suffix.patch +13 -0
- package/scripts/cesium/vcpkg-ports/zstd/portfile.cmake +77 -0
- package/scripts/cesium/vcpkg-ports/zstd/usage +4 -0
- package/scripts/cesium/vcpkg-ports/zstd/vcpkg.json +23 -0
- package/scripts/cesium/vcpkg-triplets/arm64-ios-simulator.cmake +10 -0
- package/scripts/cesium/vcpkg-triplets/arm64-ios.cmake +14 -0
- package/src/CesiumView.tsx +13 -0
- package/src/index.ts +7 -0
- package/src/specs/cesium-view.nitro.ts +51 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_CesiumMetrics.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include "CesiumMetrics.hpp"
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <NitroModules/JNICallable.hpp>
|
|
16
|
+
#include "JCesiumMetrics.hpp"
|
|
17
|
+
#include <string>
|
|
18
|
+
|
|
19
|
+
namespace margelo::nitro::reactnativecesium {
|
|
20
|
+
|
|
21
|
+
using namespace facebook;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Represents the Java/Kotlin callback `(metrics: CesiumMetrics) -> Unit`.
|
|
25
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
26
|
+
*/
|
|
27
|
+
struct JFunc_void_CesiumMetrics: public jni::JavaClass<JFunc_void_CesiumMetrics> {
|
|
28
|
+
public:
|
|
29
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativecesium/Func_void_CesiumMetrics;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
/**
|
|
33
|
+
* Invokes the function this `JFunc_void_CesiumMetrics` instance holds through JNI.
|
|
34
|
+
*/
|
|
35
|
+
void invoke(const CesiumMetrics& metrics) const {
|
|
36
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JCesiumMetrics> /* metrics */)>("invoke");
|
|
37
|
+
method(self(), JCesiumMetrics::fromCpp(metrics));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* An implementation of Func_void_CesiumMetrics that is backed by a C++ implementation (using `std::function<...>`)
|
|
43
|
+
*/
|
|
44
|
+
class JFunc_void_CesiumMetrics_cxx final: public jni::HybridClass<JFunc_void_CesiumMetrics_cxx, JFunc_void_CesiumMetrics> {
|
|
45
|
+
public:
|
|
46
|
+
static jni::local_ref<JFunc_void_CesiumMetrics::javaobject> fromCpp(const std::function<void(const CesiumMetrics& /* metrics */)>& func) {
|
|
47
|
+
return JFunc_void_CesiumMetrics_cxx::newObjectCxxArgs(func);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
/**
|
|
52
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_CesiumMetrics_cxx` instance holds.
|
|
53
|
+
*/
|
|
54
|
+
void invoke_cxx(jni::alias_ref<JCesiumMetrics> metrics) {
|
|
55
|
+
_func(metrics->toCpp());
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
[[nodiscard]]
|
|
60
|
+
inline const std::function<void(const CesiumMetrics& /* metrics */)>& getFunction() const {
|
|
61
|
+
return _func;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public:
|
|
65
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativecesium/Func_void_CesiumMetrics_cxx;";
|
|
66
|
+
static void registerNatives() {
|
|
67
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_CesiumMetrics_cxx::invoke_cxx)});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
explicit JFunc_void_CesiumMetrics_cxx(const std::function<void(const CesiumMetrics& /* metrics */)>& func): _func(func) { }
|
|
72
|
+
|
|
73
|
+
private:
|
|
74
|
+
friend HybridBase;
|
|
75
|
+
std::function<void(const CesiumMetrics& /* metrics */)> _func;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
} // namespace margelo::nitro::reactnativecesium
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridCesiumViewSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "JHybridCesiumViewSpec.hpp"
|
|
9
|
+
|
|
10
|
+
// Forward declaration of `CameraState` to properly resolve imports.
|
|
11
|
+
namespace margelo::nitro::reactnativecesium { struct CameraState; }
|
|
12
|
+
// Forward declaration of `CesiumMetrics` to properly resolve imports.
|
|
13
|
+
namespace margelo::nitro::reactnativecesium { struct CesiumMetrics; }
|
|
14
|
+
|
|
15
|
+
#include <string>
|
|
16
|
+
#include "CameraState.hpp"
|
|
17
|
+
#include "JCameraState.hpp"
|
|
18
|
+
#include "CesiumMetrics.hpp"
|
|
19
|
+
#include <functional>
|
|
20
|
+
#include <optional>
|
|
21
|
+
#include "JFunc_void_CesiumMetrics.hpp"
|
|
22
|
+
#include <NitroModules/JNICallable.hpp>
|
|
23
|
+
#include "JCesiumMetrics.hpp"
|
|
24
|
+
#include <NitroModules/Promise.hpp>
|
|
25
|
+
#include <NitroModules/JPromise.hpp>
|
|
26
|
+
|
|
27
|
+
namespace margelo::nitro::reactnativecesium {
|
|
28
|
+
|
|
29
|
+
std::shared_ptr<JHybridCesiumViewSpec> JHybridCesiumViewSpec::JavaPart::getJHybridCesiumViewSpec() {
|
|
30
|
+
auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
|
|
31
|
+
auto castHybridObject = std::dynamic_pointer_cast<JHybridCesiumViewSpec>(hybridObject);
|
|
32
|
+
if (castHybridObject == nullptr) [[unlikely]] {
|
|
33
|
+
throw std::runtime_error("Failed to downcast JHybridObject to JHybridCesiumViewSpec!");
|
|
34
|
+
}
|
|
35
|
+
return castHybridObject;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
jni::local_ref<JHybridCesiumViewSpec::CxxPart::jhybriddata> JHybridCesiumViewSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
39
|
+
return makeCxxInstance(jThis);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
std::shared_ptr<JHybridObject> JHybridCesiumViewSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
|
|
43
|
+
auto castJavaPart = jni::dynamic_ref_cast<JHybridCesiumViewSpec::JavaPart>(javaPart);
|
|
44
|
+
if (castJavaPart == nullptr) [[unlikely]] {
|
|
45
|
+
throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridCesiumViewSpec::JavaPart!");
|
|
46
|
+
}
|
|
47
|
+
return std::make_shared<JHybridCesiumViewSpec>(castJavaPart);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
void JHybridCesiumViewSpec::CxxPart::registerNatives() {
|
|
51
|
+
registerHybrid({
|
|
52
|
+
makeNativeMethod("initHybrid", JHybridCesiumViewSpec::CxxPart::initHybrid),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Properties
|
|
57
|
+
std::string JHybridCesiumViewSpec::getIonAccessToken() {
|
|
58
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getIonAccessToken");
|
|
59
|
+
auto __result = method(_javaPart);
|
|
60
|
+
return __result->toStdString();
|
|
61
|
+
}
|
|
62
|
+
void JHybridCesiumViewSpec::setIonAccessToken(const std::string& ionAccessToken) {
|
|
63
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* ionAccessToken */)>("setIonAccessToken");
|
|
64
|
+
method(_javaPart, jni::make_jstring(ionAccessToken));
|
|
65
|
+
}
|
|
66
|
+
double JHybridCesiumViewSpec::getIonAssetId() {
|
|
67
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getIonAssetId");
|
|
68
|
+
auto __result = method(_javaPart);
|
|
69
|
+
return __result;
|
|
70
|
+
}
|
|
71
|
+
void JHybridCesiumViewSpec::setIonAssetId(double ionAssetId) {
|
|
72
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* ionAssetId */)>("setIonAssetId");
|
|
73
|
+
method(_javaPart, ionAssetId);
|
|
74
|
+
}
|
|
75
|
+
CameraState JHybridCesiumViewSpec::getInitialCamera() {
|
|
76
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JCameraState>()>("getInitialCamera");
|
|
77
|
+
auto __result = method(_javaPart);
|
|
78
|
+
return __result->toCpp();
|
|
79
|
+
}
|
|
80
|
+
void JHybridCesiumViewSpec::setInitialCamera(const CameraState& initialCamera) {
|
|
81
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JCameraState> /* initialCamera */)>("setInitialCamera");
|
|
82
|
+
method(_javaPart, JCameraState::fromCpp(initialCamera));
|
|
83
|
+
}
|
|
84
|
+
bool JHybridCesiumViewSpec::getPauseRendering() {
|
|
85
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("getPauseRendering");
|
|
86
|
+
auto __result = method(_javaPart);
|
|
87
|
+
return static_cast<bool>(__result);
|
|
88
|
+
}
|
|
89
|
+
void JHybridCesiumViewSpec::setPauseRendering(bool pauseRendering) {
|
|
90
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jboolean /* pauseRendering */)>("setPauseRendering");
|
|
91
|
+
method(_javaPart, pauseRendering);
|
|
92
|
+
}
|
|
93
|
+
double JHybridCesiumViewSpec::getMaximumScreenSpaceError() {
|
|
94
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getMaximumScreenSpaceError");
|
|
95
|
+
auto __result = method(_javaPart);
|
|
96
|
+
return __result;
|
|
97
|
+
}
|
|
98
|
+
void JHybridCesiumViewSpec::setMaximumScreenSpaceError(double maximumScreenSpaceError) {
|
|
99
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* maximumScreenSpaceError */)>("setMaximumScreenSpaceError");
|
|
100
|
+
method(_javaPart, maximumScreenSpaceError);
|
|
101
|
+
}
|
|
102
|
+
double JHybridCesiumViewSpec::getMaximumSimultaneousTileLoads() {
|
|
103
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getMaximumSimultaneousTileLoads");
|
|
104
|
+
auto __result = method(_javaPart);
|
|
105
|
+
return __result;
|
|
106
|
+
}
|
|
107
|
+
void JHybridCesiumViewSpec::setMaximumSimultaneousTileLoads(double maximumSimultaneousTileLoads) {
|
|
108
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* maximumSimultaneousTileLoads */)>("setMaximumSimultaneousTileLoads");
|
|
109
|
+
method(_javaPart, maximumSimultaneousTileLoads);
|
|
110
|
+
}
|
|
111
|
+
double JHybridCesiumViewSpec::getLoadingDescendantLimit() {
|
|
112
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getLoadingDescendantLimit");
|
|
113
|
+
auto __result = method(_javaPart);
|
|
114
|
+
return __result;
|
|
115
|
+
}
|
|
116
|
+
void JHybridCesiumViewSpec::setLoadingDescendantLimit(double loadingDescendantLimit) {
|
|
117
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* loadingDescendantLimit */)>("setLoadingDescendantLimit");
|
|
118
|
+
method(_javaPart, loadingDescendantLimit);
|
|
119
|
+
}
|
|
120
|
+
double JHybridCesiumViewSpec::getMsaaSampleCount() {
|
|
121
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getMsaaSampleCount");
|
|
122
|
+
auto __result = method(_javaPart);
|
|
123
|
+
return __result;
|
|
124
|
+
}
|
|
125
|
+
void JHybridCesiumViewSpec::setMsaaSampleCount(double msaaSampleCount) {
|
|
126
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* msaaSampleCount */)>("setMsaaSampleCount");
|
|
127
|
+
method(_javaPart, msaaSampleCount);
|
|
128
|
+
}
|
|
129
|
+
double JHybridCesiumViewSpec::getIonImageryAssetId() {
|
|
130
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getIonImageryAssetId");
|
|
131
|
+
auto __result = method(_javaPart);
|
|
132
|
+
return __result;
|
|
133
|
+
}
|
|
134
|
+
void JHybridCesiumViewSpec::setIonImageryAssetId(double ionImageryAssetId) {
|
|
135
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* ionImageryAssetId */)>("setIonImageryAssetId");
|
|
136
|
+
method(_javaPart, ionImageryAssetId);
|
|
137
|
+
}
|
|
138
|
+
std::optional<std::function<void(const CesiumMetrics& /* metrics */)>> JHybridCesiumViewSpec::getOnMetrics() {
|
|
139
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JFunc_void_CesiumMetrics::javaobject>()>("getOnMetrics_cxx");
|
|
140
|
+
auto __result = method(_javaPart);
|
|
141
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(const CesiumMetrics& /* metrics */)> {
|
|
142
|
+
if (__result->isInstanceOf(JFunc_void_CesiumMetrics_cxx::javaClassStatic())) [[likely]] {
|
|
143
|
+
auto downcast = jni::static_ref_cast<JFunc_void_CesiumMetrics_cxx::javaobject>(__result);
|
|
144
|
+
return downcast->cthis()->getFunction();
|
|
145
|
+
} else {
|
|
146
|
+
auto __resultRef = jni::make_global(__result);
|
|
147
|
+
return JNICallable<JFunc_void_CesiumMetrics, void(CesiumMetrics)>(std::move(__resultRef));
|
|
148
|
+
}
|
|
149
|
+
}()) : std::nullopt;
|
|
150
|
+
}
|
|
151
|
+
void JHybridCesiumViewSpec::setOnMetrics(const std::optional<std::function<void(const CesiumMetrics& /* metrics */)>>& onMetrics) {
|
|
152
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_CesiumMetrics::javaobject> /* onMetrics */)>("setOnMetrics_cxx");
|
|
153
|
+
method(_javaPart, onMetrics.has_value() ? JFunc_void_CesiumMetrics_cxx::fromCpp(onMetrics.value()) : nullptr);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Methods
|
|
157
|
+
std::shared_ptr<Promise<CameraState>> JHybridCesiumViewSpec::getCameraState() {
|
|
158
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getCameraState");
|
|
159
|
+
auto __result = method(_javaPart);
|
|
160
|
+
return [&]() {
|
|
161
|
+
auto __promise = Promise<CameraState>::create();
|
|
162
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
163
|
+
auto __result = jni::static_ref_cast<JCameraState>(__boxedResult);
|
|
164
|
+
__promise->resolve(__result->toCpp());
|
|
165
|
+
});
|
|
166
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
167
|
+
jni::JniException __jniError(__throwable);
|
|
168
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
169
|
+
});
|
|
170
|
+
return __promise;
|
|
171
|
+
}();
|
|
172
|
+
}
|
|
173
|
+
void JHybridCesiumViewSpec::setCamera(const CameraState& camera) {
|
|
174
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JCameraState> /* camera */)>("setCamera");
|
|
175
|
+
method(_javaPart, JCameraState::fromCpp(camera));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
} // namespace margelo::nitro::reactnativecesium
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridCesiumViewSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include "HybridCesiumViewSpec.hpp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::reactnativecesium {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
class JHybridCesiumViewSpec: public virtual HybridCesiumViewSpec, public virtual JHybridObject {
|
|
22
|
+
public:
|
|
23
|
+
struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
|
|
24
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativecesium/HybridCesiumViewSpec;";
|
|
25
|
+
std::shared_ptr<JHybridCesiumViewSpec> getJHybridCesiumViewSpec();
|
|
26
|
+
};
|
|
27
|
+
struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
|
|
28
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativecesium/HybridCesiumViewSpec$CxxPart;";
|
|
29
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
30
|
+
static void registerNatives();
|
|
31
|
+
using HybridBase::HybridBase;
|
|
32
|
+
protected:
|
|
33
|
+
std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
explicit JHybridCesiumViewSpec(const jni::local_ref<JHybridCesiumViewSpec::JavaPart>& javaPart):
|
|
38
|
+
HybridObject(HybridCesiumViewSpec::TAG),
|
|
39
|
+
JHybridObject(javaPart),
|
|
40
|
+
_javaPart(jni::make_global(javaPart)) {}
|
|
41
|
+
~JHybridCesiumViewSpec() override {
|
|
42
|
+
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
43
|
+
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
inline const jni::global_ref<JHybridCesiumViewSpec::JavaPart>& getJavaPart() const noexcept {
|
|
48
|
+
return _javaPart;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
// Properties
|
|
53
|
+
std::string getIonAccessToken() override;
|
|
54
|
+
void setIonAccessToken(const std::string& ionAccessToken) override;
|
|
55
|
+
double getIonAssetId() override;
|
|
56
|
+
void setIonAssetId(double ionAssetId) override;
|
|
57
|
+
CameraState getInitialCamera() override;
|
|
58
|
+
void setInitialCamera(const CameraState& initialCamera) override;
|
|
59
|
+
bool getPauseRendering() override;
|
|
60
|
+
void setPauseRendering(bool pauseRendering) override;
|
|
61
|
+
double getMaximumScreenSpaceError() override;
|
|
62
|
+
void setMaximumScreenSpaceError(double maximumScreenSpaceError) override;
|
|
63
|
+
double getMaximumSimultaneousTileLoads() override;
|
|
64
|
+
void setMaximumSimultaneousTileLoads(double maximumSimultaneousTileLoads) override;
|
|
65
|
+
double getLoadingDescendantLimit() override;
|
|
66
|
+
void setLoadingDescendantLimit(double loadingDescendantLimit) override;
|
|
67
|
+
double getMsaaSampleCount() override;
|
|
68
|
+
void setMsaaSampleCount(double msaaSampleCount) override;
|
|
69
|
+
double getIonImageryAssetId() override;
|
|
70
|
+
void setIonImageryAssetId(double ionImageryAssetId) override;
|
|
71
|
+
std::optional<std::function<void(const CesiumMetrics& /* metrics */)>> getOnMetrics() override;
|
|
72
|
+
void setOnMetrics(const std::optional<std::function<void(const CesiumMetrics& /* metrics */)>>& onMetrics) override;
|
|
73
|
+
|
|
74
|
+
public:
|
|
75
|
+
// Methods
|
|
76
|
+
std::shared_ptr<Promise<CameraState>> getCameraState() override;
|
|
77
|
+
void setCamera(const CameraState& camera) override;
|
|
78
|
+
|
|
79
|
+
private:
|
|
80
|
+
jni::global_ref<JHybridCesiumViewSpec::JavaPart> _javaPart;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
} // namespace margelo::nitro::reactnativecesium
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridCesiumViewStateUpdater.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "JHybridCesiumViewStateUpdater.hpp"
|
|
9
|
+
#include "views/HybridCesiumViewComponent.hpp"
|
|
10
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
11
|
+
#include <react/fabric/StateWrapperImpl.h>
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::reactnativecesium::views {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
using ConcreteStateData = react::ConcreteState<HybridCesiumViewState>;
|
|
17
|
+
|
|
18
|
+
void JHybridCesiumViewStateUpdater::updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
19
|
+
jni::alias_ref<JHybridCesiumViewSpec::JavaPart> javaView,
|
|
20
|
+
jni::alias_ref<JStateWrapper::javaobject> stateWrapperInterface) {
|
|
21
|
+
std::shared_ptr<JHybridCesiumViewSpec> hybridView = javaView->getJHybridCesiumViewSpec();
|
|
22
|
+
|
|
23
|
+
// Get concrete StateWrapperImpl from passed StateWrapper interface object
|
|
24
|
+
jobject rawStateWrapper = stateWrapperInterface.get();
|
|
25
|
+
if (!stateWrapperInterface->isInstanceOf(react::StateWrapperImpl::javaClassStatic())) [[unlikely]] {
|
|
26
|
+
throw std::runtime_error("StateWrapper is not a StateWrapperImpl");
|
|
27
|
+
}
|
|
28
|
+
auto stateWrapper = jni::alias_ref<react::StateWrapperImpl::javaobject>{
|
|
29
|
+
static_cast<react::StateWrapperImpl::javaobject>(rawStateWrapper)};
|
|
30
|
+
std::shared_ptr<const react::State> state = stateWrapper->cthis()->getState();
|
|
31
|
+
auto concreteState = std::static_pointer_cast<const ConcreteStateData>(state);
|
|
32
|
+
const HybridCesiumViewState& data = concreteState->getData();
|
|
33
|
+
const std::shared_ptr<HybridCesiumViewProps>& props = data.getProps();
|
|
34
|
+
if (props == nullptr) [[unlikely]] {
|
|
35
|
+
// Props aren't set yet!
|
|
36
|
+
throw std::runtime_error("HybridCesiumViewState's data doesn't contain any props!");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Update all props if they are dirty
|
|
40
|
+
if (props->ionAccessToken.isDirty) {
|
|
41
|
+
hybridView->setIonAccessToken(props->ionAccessToken.value);
|
|
42
|
+
props->ionAccessToken.isDirty = false;
|
|
43
|
+
}
|
|
44
|
+
if (props->ionAssetId.isDirty) {
|
|
45
|
+
hybridView->setIonAssetId(props->ionAssetId.value);
|
|
46
|
+
props->ionAssetId.isDirty = false;
|
|
47
|
+
}
|
|
48
|
+
if (props->initialCamera.isDirty) {
|
|
49
|
+
hybridView->setInitialCamera(props->initialCamera.value);
|
|
50
|
+
props->initialCamera.isDirty = false;
|
|
51
|
+
}
|
|
52
|
+
if (props->pauseRendering.isDirty) {
|
|
53
|
+
hybridView->setPauseRendering(props->pauseRendering.value);
|
|
54
|
+
props->pauseRendering.isDirty = false;
|
|
55
|
+
}
|
|
56
|
+
if (props->maximumScreenSpaceError.isDirty) {
|
|
57
|
+
hybridView->setMaximumScreenSpaceError(props->maximumScreenSpaceError.value);
|
|
58
|
+
props->maximumScreenSpaceError.isDirty = false;
|
|
59
|
+
}
|
|
60
|
+
if (props->maximumSimultaneousTileLoads.isDirty) {
|
|
61
|
+
hybridView->setMaximumSimultaneousTileLoads(props->maximumSimultaneousTileLoads.value);
|
|
62
|
+
props->maximumSimultaneousTileLoads.isDirty = false;
|
|
63
|
+
}
|
|
64
|
+
if (props->loadingDescendantLimit.isDirty) {
|
|
65
|
+
hybridView->setLoadingDescendantLimit(props->loadingDescendantLimit.value);
|
|
66
|
+
props->loadingDescendantLimit.isDirty = false;
|
|
67
|
+
}
|
|
68
|
+
if (props->msaaSampleCount.isDirty) {
|
|
69
|
+
hybridView->setMsaaSampleCount(props->msaaSampleCount.value);
|
|
70
|
+
props->msaaSampleCount.isDirty = false;
|
|
71
|
+
}
|
|
72
|
+
if (props->ionImageryAssetId.isDirty) {
|
|
73
|
+
hybridView->setIonImageryAssetId(props->ionImageryAssetId.value);
|
|
74
|
+
props->ionImageryAssetId.isDirty = false;
|
|
75
|
+
}
|
|
76
|
+
if (props->onMetrics.isDirty) {
|
|
77
|
+
hybridView->setOnMetrics(props->onMetrics.value);
|
|
78
|
+
props->onMetrics.isDirty = false;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Update hybridRef if it changed
|
|
82
|
+
if (props->hybridRef.isDirty) {
|
|
83
|
+
// hybridRef changed - call it with new this
|
|
84
|
+
const auto& maybeFunc = props->hybridRef.value;
|
|
85
|
+
if (maybeFunc.has_value()) {
|
|
86
|
+
maybeFunc.value()(hybridView);
|
|
87
|
+
}
|
|
88
|
+
props->hybridRef.isDirty = false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
} // namespace margelo::nitro::reactnativecesium::views
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridCesiumViewStateUpdater.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#ifndef RN_SERIALIZABLE_STATE
|
|
11
|
+
#error ReactNativeCesium was compiled without the 'RN_SERIALIZABLE_STATE' flag. This flag is required for Nitro Views - set it in your CMakeLists!
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#include <fbjni/fbjni.h>
|
|
15
|
+
#include <react/fabric/CoreComponentsRegistry.h>
|
|
16
|
+
#include <react/fabric/StateWrapperImpl.h>
|
|
17
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
18
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
19
|
+
#include <NitroModules/JStateWrapper.hpp>
|
|
20
|
+
#include "JHybridCesiumViewSpec.hpp"
|
|
21
|
+
#include "views/HybridCesiumViewComponent.hpp"
|
|
22
|
+
|
|
23
|
+
namespace margelo::nitro::reactnativecesium::views {
|
|
24
|
+
|
|
25
|
+
using namespace facebook;
|
|
26
|
+
|
|
27
|
+
class JHybridCesiumViewStateUpdater final: public jni::JavaClass<JHybridCesiumViewStateUpdater> {
|
|
28
|
+
public:
|
|
29
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativecesium/views/HybridCesiumViewStateUpdater;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
static void updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
33
|
+
jni::alias_ref<JHybridCesiumViewSpec::JavaPart> view,
|
|
34
|
+
jni::alias_ref<JStateWrapper::javaobject> stateWrapperInterface);
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
static void registerNatives() {
|
|
38
|
+
// Register JNI calls
|
|
39
|
+
javaClassStatic()->registerNatives({
|
|
40
|
+
makeNativeMethod("updateViewProps", JHybridCesiumViewStateUpdater::updateViewProps),
|
|
41
|
+
});
|
|
42
|
+
// Register React Native view component descriptor
|
|
43
|
+
auto provider = react::concreteComponentDescriptorProvider<HybridCesiumViewComponentDescriptor>();
|
|
44
|
+
auto providerRegistry = react::CoreComponentsRegistry::sharedProviderRegistry();
|
|
45
|
+
providerRegistry->add(provider);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
} // namespace margelo::nitro::reactnativecesium::views
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CameraState.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.reactnativecesium
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "CameraState".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class CameraState(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val latitude: Double,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val longitude: Double,
|
|
26
|
+
@DoNotStrip
|
|
27
|
+
@Keep
|
|
28
|
+
val altitude: Double,
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
val heading: Double,
|
|
32
|
+
@DoNotStrip
|
|
33
|
+
@Keep
|
|
34
|
+
val pitch: Double,
|
|
35
|
+
@DoNotStrip
|
|
36
|
+
@Keep
|
|
37
|
+
val roll: Double,
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
val verticalFovDeg: Double
|
|
41
|
+
) {
|
|
42
|
+
/* primary constructor */
|
|
43
|
+
|
|
44
|
+
companion object {
|
|
45
|
+
/**
|
|
46
|
+
* Constructor called from C++
|
|
47
|
+
*/
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
@Suppress("unused")
|
|
51
|
+
@JvmStatic
|
|
52
|
+
private fun fromCpp(latitude: Double, longitude: Double, altitude: Double, heading: Double, pitch: Double, roll: Double, verticalFovDeg: Double): CameraState {
|
|
53
|
+
return CameraState(latitude, longitude, altitude, heading, pitch, roll, verticalFovDeg)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/CesiumMetrics.kt
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CesiumMetrics.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.reactnativecesium
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "CesiumMetrics".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class CesiumMetrics(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val fps: Double,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val tilesRendered: Double,
|
|
26
|
+
@DoNotStrip
|
|
27
|
+
@Keep
|
|
28
|
+
val tilesLoading: Double,
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
val tilesVisited: Double,
|
|
32
|
+
@DoNotStrip
|
|
33
|
+
@Keep
|
|
34
|
+
val ionTokenConfigured: Boolean,
|
|
35
|
+
@DoNotStrip
|
|
36
|
+
@Keep
|
|
37
|
+
val tilesetReady: Boolean,
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
val creditsPlainText: String
|
|
41
|
+
) {
|
|
42
|
+
/* primary constructor */
|
|
43
|
+
|
|
44
|
+
companion object {
|
|
45
|
+
/**
|
|
46
|
+
* Constructor called from C++
|
|
47
|
+
*/
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
@Suppress("unused")
|
|
51
|
+
@JvmStatic
|
|
52
|
+
private fun fromCpp(fps: Double, tilesRendered: Double, tilesLoading: Double, tilesVisited: Double, ionTokenConfigured: Boolean, tilesetReady: Boolean, creditsPlainText: String): CesiumMetrics {
|
|
53
|
+
return CesiumMetrics(fps, tilesRendered, tilesLoading, tilesVisited, ionTokenConfigured, tilesetReady, creditsPlainText)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_CesiumMetrics.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.reactnativecesium
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents the JavaScript callback `(metrics: struct) => void`.
|
|
18
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
19
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
24
|
+
fun interface Func_void_CesiumMetrics: (CesiumMetrics) -> Unit {
|
|
25
|
+
/**
|
|
26
|
+
* Call the given JS callback.
|
|
27
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
28
|
+
*/
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
override fun invoke(metrics: CesiumMetrics): Unit
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the JavaScript callback `(metrics: struct) => void`.
|
|
36
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
37
|
+
* The callback might be coming from JS.
|
|
38
|
+
*/
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
@Suppress(
|
|
42
|
+
"KotlinJniMissingFunction", "unused",
|
|
43
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
44
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
45
|
+
)
|
|
46
|
+
class Func_void_CesiumMetrics_cxx: Func_void_CesiumMetrics {
|
|
47
|
+
@DoNotStrip
|
|
48
|
+
@Keep
|
|
49
|
+
private val mHybridData: HybridData
|
|
50
|
+
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
private constructor(hybridData: HybridData) {
|
|
54
|
+
mHybridData = hybridData
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
override fun invoke(metrics: CesiumMetrics): Unit
|
|
60
|
+
= invoke_cxx(metrics)
|
|
61
|
+
|
|
62
|
+
@FastNative
|
|
63
|
+
private external fun invoke_cxx(metrics: CesiumMetrics): Unit
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents the JavaScript callback `(metrics: struct) => void`.
|
|
68
|
+
* This is implemented in Java/Kotlin, via a `(CesiumMetrics) -> Unit`.
|
|
69
|
+
* The callback is always coming from native.
|
|
70
|
+
*/
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
+
class Func_void_CesiumMetrics_java(private val function: (CesiumMetrics) -> Unit): Func_void_CesiumMetrics {
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
override fun invoke(metrics: CesiumMetrics): Unit {
|
|
78
|
+
return this.function(metrics)
|
|
79
|
+
}
|
|
80
|
+
}
|