core: rename mbgl namespace to mln (#4487)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Bart Louwers
2026-08-14 23:25:20 +02:00
committed by GitHub
parent 836b862984
commit 550f64be22
1970 changed files with 8931 additions and 8967 deletions

View File

@@ -8,10 +8,10 @@
#include <cassert>
namespace mbgl {
namespace mln {
namespace android {
class AndroidGLRenderableResource final : public mbgl::gl::RenderableResource {
class AndroidGLRenderableResource final : public mln::gl::RenderableResource {
public:
AndroidGLRenderableResource(AndroidGLRendererBackend& backend_)
: backend(backend_) {}
@@ -35,7 +35,7 @@ private:
AndroidGLRendererBackend::AndroidGLRendererBackend()
: gl::RendererBackend(gfx::ContextMode::Unique),
mbgl::gfx::Renderable({64, 64}, std::make_unique<AndroidGLRenderableResource>(*this)) {}
mln::gfx::Renderable({64, 64}, std::make_unique<AndroidGLRenderableResource>(*this)) {}
AndroidGLRendererBackend::~AndroidGLRendererBackend() = default;
@@ -70,15 +70,15 @@ void AndroidGLRendererBackend::markContextLost() {
}
} // namespace android
} // namespace mbgl
} // namespace mln
namespace mbgl {
namespace mln {
namespace gfx {
template <>
std::unique_ptr<android::AndroidRendererBackend> Backend::Create<mbgl::gfx::Backend::Type::OpenGL>(ANativeWindow*) {
std::unique_ptr<android::AndroidRendererBackend> Backend::Create<mln::gfx::Backend::Type::OpenGL>(ANativeWindow*) {
return std::make_unique<android::AndroidGLRendererBackend>();
}
} // namespace gfx
} // namespace mbgl
} // namespace mln

View File

@@ -4,17 +4,17 @@
#include <mbgl/gl/renderer_backend.hpp>
#include "android_renderer_backend.hpp"
namespace mbgl {
namespace mln {
namespace android {
class AndroidGLRendererBackend : public AndroidRendererBackend,
public gl::RendererBackend,
public mbgl::gfx::Renderable {
public mln::gfx::Renderable {
public:
AndroidGLRendererBackend();
~AndroidGLRendererBackend() override;
mbgl::gfx::RendererBackend& getImpl() override { return *this; }
mln::gfx::RendererBackend& getImpl() override { return *this; }
void updateViewPort() override;
@@ -24,9 +24,9 @@ public:
void resizeFramebuffer(int width, int height) override;
PremultipliedImage readFramebuffer() override;
// mbgl::gfx::RendererBackend implementation
// mln::gfx::RendererBackend implementation
public:
mbgl::gfx::Renderable& getDefaultRenderable() override { return *this; }
mln::gfx::Renderable& getDefaultRenderable() override { return *this; }
protected:
void activate() override {
@@ -36,11 +36,11 @@ protected:
// no-op
}
// mbgl::gl::RendererBackend implementation
// mln::gl::RendererBackend implementation
protected:
mbgl::gl::ProcAddress getExtensionFunctionPointer(const char*) override;
mln::gl::ProcAddress getExtensionFunctionPointer(const char*) override;
void updateAssumedState() override;
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,7 +1,7 @@
#include "android_renderer_backend.hpp"
#include <cassert>
namespace mbgl {
namespace mln {
namespace android {
void AndroidRendererBackend::updateViewPort() {}
@@ -19,4 +19,4 @@ void AndroidRendererBackend::setSwapBehavior(gfx::Renderable::SwapBehaviour swap
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -7,7 +7,7 @@
#include <android/native_window.h>
namespace mbgl {
namespace mln {
namespace android {
class AndroidRendererBackend {
@@ -18,9 +18,9 @@ public:
virtual ~AndroidRendererBackend() = default;
static std::unique_ptr<AndroidRendererBackend> Create(ANativeWindow* window) {
return mbgl::gfx::Backend::Create<AndroidRendererBackend, ANativeWindow*>(window);
return mln::gfx::Backend::Create<AndroidRendererBackend, ANativeWindow*>(window);
}
virtual mbgl::gfx::RendererBackend& getImpl() = 0;
virtual mln::gfx::RendererBackend& getImpl() = 0;
virtual void updateViewPort();
@@ -42,4 +42,4 @@ protected:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -14,7 +14,7 @@
#include "android_renderer_backend.hpp"
#include "attach_env.hpp"
namespace mbgl {
namespace mln {
namespace android {
// Forwards RendererObserver signals to the given
@@ -58,33 +58,33 @@ public:
delegate.invoke(&RendererObserver::onSymbolError, message);
}
void onPreCompileShader(mbgl::shaders::BuiltIn id,
mbgl::gfx::Backend::Type type,
void onPreCompileShader(mln::shaders::BuiltIn id,
mln::gfx::Backend::Type type,
const std::string& additionalDefines) override {
delegate.invoke(&RendererObserver::onPreCompileShader, id, type, additionalDefines);
}
void onPostCompileShader(mbgl::shaders::BuiltIn id,
mbgl::gfx::Backend::Type type,
void onPostCompileShader(mln::shaders::BuiltIn id,
mln::gfx::Backend::Type type,
const std::string& additionalDefines) override {
delegate.invoke(&RendererObserver::onPostCompileShader, id, type, additionalDefines);
}
void onShaderCompileFailed(mbgl::shaders::BuiltIn id,
mbgl::gfx::Backend::Type type,
void onShaderCompileFailed(mln::shaders::BuiltIn id,
mln::gfx::Backend::Type type,
const std::string& additionalDefines) override {
delegate.invoke(&RendererObserver::onShaderCompileFailed, id, type, additionalDefines);
}
void onGlyphsLoaded(const mbgl::FontStack& stack, const mbgl::GlyphRange& range) override {
void onGlyphsLoaded(const mln::FontStack& stack, const mln::GlyphRange& range) override {
delegate.invoke(&RendererObserver::onGlyphsLoaded, stack, range);
}
void onGlyphsError(const mbgl::FontStack& stack, const mbgl::GlyphRange& range, std::exception_ptr ex) override {
void onGlyphsError(const mln::FontStack& stack, const mln::GlyphRange& range, std::exception_ptr ex) override {
delegate.invoke(&RendererObserver::onGlyphsError, stack, range, ex);
}
void onGlyphsRequested(const mbgl::FontStack& stack, const mbgl::GlyphRange& range) override {
void onGlyphsRequested(const mln::FontStack& stack, const mln::GlyphRange& range) override {
delegate.invoke(&RendererObserver::onGlyphsRequested, stack, range);
}
@@ -243,11 +243,11 @@ FeatureExtensionValue AndroidRendererFrontend::queryFeatureExtensions(
const Feature& feature,
const std::string& extension,
const std::string& extensionField,
const std::optional<std::map<std::string, mbgl::Value>>& args) const {
const std::optional<std::map<std::string, mln::Value>>& args) const {
return mapRenderer.actor()
.ask(&Renderer::queryFeatureExtensions, sourceID, feature, extension, extensionField, args)
.get();
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -16,7 +16,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
class RenderedQueryOptions;
class SourceQueryOptions;
@@ -71,7 +71,7 @@ public:
const Feature& feature,
const std::string& extension,
const std::string& extensionField,
const std::optional<std::map<std::string, mbgl::Value>>& args) const;
const std::optional<std::map<std::string, mln::Value>>& args) const;
// Memory
void setTileCacheEnabled(bool);
@@ -86,4 +86,4 @@ private:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -7,10 +7,10 @@
#include <cassert>
#include <vulkan/vulkan_android.h>
namespace mbgl {
namespace mln {
namespace android {
class AndroidVulkanRenderableResource final : public mbgl::vulkan::SurfaceRenderableResource {
class AndroidVulkanRenderableResource final : public mln::vulkan::SurfaceRenderableResource {
public:
AndroidVulkanRenderableResource(AndroidVulkanRendererBackend& backend_)
: SurfaceRenderableResource(backend_) {}
@@ -71,7 +71,7 @@ void AndroidVulkanRendererBackend::destroySurface() {
}
std::vector<const char*> AndroidVulkanRendererBackend::getInstanceExtensions() {
auto extensions = mbgl::vulkan::RendererBackend::getInstanceExtensions();
auto extensions = mln::vulkan::RendererBackend::getInstanceExtensions();
extensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
extensions.push_back(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME);
return extensions;
@@ -104,16 +104,16 @@ PremultipliedImage AndroidVulkanRendererBackend::readFramebuffer() {
}
} // namespace android
} // namespace mbgl
} // namespace mln
namespace mbgl {
namespace mln {
namespace gfx {
template <>
std::unique_ptr<android::AndroidRendererBackend> Backend::Create<mbgl::gfx::Backend::Type::Vulkan>(
std::unique_ptr<android::AndroidRendererBackend> Backend::Create<mln::gfx::Backend::Type::Vulkan>(
ANativeWindow* window) {
return std::make_unique<android::AndroidVulkanRendererBackend>(window);
}
} // namespace gfx
} // namespace mbgl
} // namespace mln

View File

@@ -5,7 +5,7 @@
#include "android_renderer_backend.hpp"
#include <android/native_window.h>
namespace mbgl {
namespace mln {
namespace android {
class AndroidVulkanRendererBackend : public AndroidRendererBackend,
@@ -19,7 +19,7 @@ public:
bool createSurface(ANativeWindow* window) override;
void destroySurface() override;
mbgl::gfx::RendererBackend& getImpl() override { return *this; }
mln::gfx::RendererBackend& getImpl() override { return *this; }
std::vector<const char*> getInstanceExtensions() override;
@@ -27,9 +27,9 @@ public:
void enableFramebufferRead(bool value) override;
PremultipliedImage readFramebuffer() override;
// mbgl::gfx::RendererBackend implementation
// mln::gfx::RendererBackend implementation
public:
mbgl::gfx::Renderable& getDefaultRenderable() override { return *this; }
mln::gfx::Renderable& getDefaultRenderable() override { return *this; }
protected:
void activate() override {
@@ -46,4 +46,4 @@ protected:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -67,7 +67,7 @@ static void startStderrToLogcat() {
}
#endif
namespace mbgl {
namespace mln {
namespace android {
#if MLN_WEBGPU_IMPL_DAWN
@@ -113,7 +113,7 @@ public:
void swap() override { backend.markNeedsPresent(); }
const mbgl::webgpu::RendererBackend& getBackend() const override { return backend; }
const mln::webgpu::RendererBackend& getBackend() const override { return backend; }
const WGPUCommandEncoder& getCommandEncoder() const override {
assert(false);
@@ -565,7 +565,7 @@ PremultipliedImage AndroidWebGPURendererBackend::readFramebuffer() {
return {fbSize, std::move(data)};
}
mbgl::Scoped scopedCleanup([stagingBuffer]() {
mln::Scoped scopedCleanup([stagingBuffer]() {
wgpuBufferUnmap(stagingBuffer);
wgpuBufferRelease(stagingBuffer);
});
@@ -758,21 +758,21 @@ void* AndroidWebGPURendererBackend::getDepthStencilView() {
return impl->depthStencilView;
}
mbgl::Size AndroidWebGPURendererBackend::getFramebufferSize() const {
mln::Size AndroidWebGPURendererBackend::getFramebufferSize() const {
return impl->framebufferSize;
}
} // namespace android
} // namespace mbgl
} // namespace mln
namespace mbgl {
namespace mln {
namespace gfx {
template <>
std::unique_ptr<android::AndroidRendererBackend> Backend::Create<mbgl::gfx::Backend::Type::WebGPU>(
std::unique_ptr<android::AndroidRendererBackend> Backend::Create<mln::gfx::Backend::Type::WebGPU>(
ANativeWindow* window) {
return std::make_unique<android::AndroidWebGPURendererBackend>(window);
}
} // namespace gfx
} // namespace mbgl
} // namespace mln

View File

@@ -9,7 +9,7 @@
#include <wgpu.h>
#endif
namespace mbgl {
namespace mln {
namespace android {
class AndroidWebGPURendererBackend : public AndroidRendererBackend,
@@ -20,17 +20,17 @@ public:
~AndroidWebGPURendererBackend() override;
ANativeWindow* getWindow() { return window; }
mbgl::gfx::RendererBackend& getImpl() override { return *this; }
mln::gfx::RendererBackend& getImpl() override { return *this; }
void resizeFramebuffer(int width, int height) override;
PremultipliedImage readFramebuffer() override;
public:
mbgl::gfx::Renderable& getDefaultRenderable() override { return *this; }
mln::gfx::Renderable& getDefaultRenderable() override { return *this; }
void* getCurrentTextureView() override;
void* getDepthStencilView() override;
mbgl::Size getFramebufferSize() const override;
mln::Size getFramebufferSize() const override;
void presentSurface();
void markNeedsPresent();
@@ -50,4 +50,4 @@ private:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,9 +1,9 @@
#include "marker.hpp"
namespace mbgl {
namespace mln {
namespace android {
mbgl::Point<double> Marker::getPosition(jni::JNIEnv& env, const jni::Object<Marker>& marker) {
mln::Point<double> Marker::getPosition(jni::JNIEnv& env, const jni::Object<Marker>& marker) {
static auto& javaClass = jni::Class<Marker>::Singleton(env);
static auto positionField = javaClass.GetField<jni::Object<LatLng>>(env, "position");
return LatLng::getGeometry(env, marker.Get(env, positionField));
@@ -20,4 +20,4 @@ void Marker::registerNative(jni::JNIEnv& env) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -7,14 +7,14 @@
#include "../geometry/lat_lng.hpp"
namespace mbgl {
namespace mln {
namespace android {
class Marker : private mbgl::util::noncopyable {
class Marker : private mln::util::noncopyable {
public:
static constexpr auto Name() { return "org/maplibre/android/annotations/Marker"; };
static mbgl::Point<double> getPosition(jni::JNIEnv&, const jni::Object<Marker>&);
static mln::Point<double> getPosition(jni::JNIEnv&, const jni::Object<Marker>&);
static std::string getIconId(jni::JNIEnv&, const jni::Object<Marker>&);
@@ -22,4 +22,4 @@ public:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -6,10 +6,10 @@
#include "../geometry/lat_lng.hpp"
#include "../java/util.hpp"
namespace mbgl {
namespace mln {
namespace android {
class MultiPoint : protected mbgl::util::noncopyable {
class MultiPoint : protected mln::util::noncopyable {
protected:
template <class Geometry>
static Geometry toGeometry(JNIEnv& env, const jni::Object<java::util::List>& pointsList) {
@@ -29,4 +29,4 @@ protected:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -2,10 +2,10 @@
#include "../conversion/color.hpp"
namespace mbgl {
namespace mln {
namespace android {
mbgl::FillAnnotation Polygon::toAnnotation(jni::JNIEnv& env, const jni::Object<Polygon>& polygon) {
mln::FillAnnotation Polygon::toAnnotation(jni::JNIEnv& env, const jni::Object<Polygon>& polygon) {
static auto& javaClass = jni::Class<Polygon>::Singleton(env);
static auto points = javaClass.GetField<jni::Object<java::util::List>>(env, "points");
static auto holes = javaClass.GetField<jni::Object<java::util::List>>(env, "holes");
@@ -13,19 +13,19 @@ mbgl::FillAnnotation Polygon::toAnnotation(jni::JNIEnv& env, const jni::Object<P
static auto fillColor = javaClass.GetField<int>(env, "fillColor");
static auto strokeColor = javaClass.GetField<int>(env, "strokeColor");
mbgl::Polygon<double> geometry{MultiPoint::toGeometry<mbgl::LinearRing<double>>(env, polygon.Get(env, points))};
mln::Polygon<double> geometry{MultiPoint::toGeometry<mln::LinearRing<double>>(env, polygon.Get(env, points))};
auto jHoleListsArray = java::util::List::toArray<java::util::List>(env, polygon.Get(env, holes));
std::size_t jHoleListsSize = jHoleListsArray.Length(env);
for (std::size_t i = 0; i < jHoleListsSize; i++) {
geometry.push_back(MultiPoint::toGeometry<mbgl::LinearRing<double>>(env, jHoleListsArray.Get(env, i)));
geometry.push_back(MultiPoint::toGeometry<mln::LinearRing<double>>(env, jHoleListsArray.Get(env, i)));
}
mbgl::FillAnnotation annotation{geometry};
mln::FillAnnotation annotation{geometry};
annotation.opacity = polygon.Get(env, alpha);
annotation.color = *conversion::convert<mbgl::Color>(env, polygon.Get(env, fillColor));
annotation.outlineColor = *conversion::convert<mbgl::Color>(env, polygon.Get(env, strokeColor));
annotation.color = *conversion::convert<mln::Color>(env, polygon.Get(env, fillColor));
annotation.outlineColor = *conversion::convert<mln::Color>(env, polygon.Get(env, strokeColor));
return annotation;
}
@@ -35,4 +35,4 @@ void Polygon::registerNative(jni::JNIEnv& env) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,17 +4,17 @@
#include "multi_point.hpp"
namespace mbgl {
namespace mln {
namespace android {
class Polygon : private MultiPoint {
public:
static constexpr auto Name() { return "org/maplibre/android/annotations/Polygon"; };
static mbgl::FillAnnotation toAnnotation(jni::JNIEnv&, const jni::Object<Polygon>&);
static mln::FillAnnotation toAnnotation(jni::JNIEnv&, const jni::Object<Polygon>&);
static void registerNative(jni::JNIEnv&);
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -2,20 +2,20 @@
#include "../conversion/color.hpp"
namespace mbgl {
namespace mln {
namespace android {
mbgl::LineAnnotation Polyline::toAnnotation(jni::JNIEnv& env, const jni::Object<Polyline>& polyline) {
mln::LineAnnotation Polyline::toAnnotation(jni::JNIEnv& env, const jni::Object<Polyline>& polyline) {
static auto& javaClass = jni::Class<Polyline>::Singleton(env);
static auto points = javaClass.GetField<jni::Object<java::util::List>>(env, "points");
static auto alpha = javaClass.GetField<float>(env, "alpha");
static auto color = javaClass.GetField<int>(env, "color");
static auto width = javaClass.GetField<float>(env, "width");
mbgl::LineAnnotation annotation{MultiPoint::toGeometry<mbgl::LineString<double>>(env, polyline.Get(env, points))};
mln::LineAnnotation annotation{MultiPoint::toGeometry<mln::LineString<double>>(env, polyline.Get(env, points))};
annotation.opacity = polyline.Get(env, alpha);
annotation.color = *conversion::convert<mbgl::Color>(env, polyline.Get(env, color));
annotation.color = *conversion::convert<mln::Color>(env, polyline.Get(env, color));
annotation.width = polyline.Get(env, width);
return annotation;
@@ -26,4 +26,4 @@ void Polyline::registerNative(jni::JNIEnv& env) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,17 +4,17 @@
#include "multi_point.hpp"
namespace mbgl {
namespace mln {
namespace android {
class Polyline : private MultiPoint {
public:
static constexpr auto Name() { return "org/maplibre/android/annotations/Polyline"; };
static mbgl::LineAnnotation toAnnotation(jni::JNIEnv&, const jni::Object<Polyline>&);
static mln::LineAnnotation toAnnotation(jni::JNIEnv&, const jni::Object<Polyline>&);
static void registerNative(jni::JNIEnv&);
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,6 +1,6 @@
#pragma once
namespace mbgl {
namespace mln {
namespace android {
class AssetManager {
@@ -9,4 +9,4 @@ public:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -12,7 +12,7 @@
#include <android/asset_manager.h>
#include <android/asset_manager_jni.h>
namespace mbgl {
namespace mln {
class AssetManagerFileSource::Impl {
public:
@@ -26,7 +26,7 @@ public:
void request(const std::string& url, ActorRef<FileSourceRequest> req) {
// Note: AssetManager already prepends "assets" to the filename.
const std::string path = mbgl::util::percentDecode(url.substr(8));
const std::string path = mln::util::percentDecode(url.substr(8));
Response response;
@@ -79,7 +79,7 @@ std::unique_ptr<AsyncRequest> AssetManagerFileSource::request(const Resource& re
}
bool AssetManagerFileSource::canRequest(const Resource& resource) const {
return 0 == resource.url.rfind(mbgl::util::ASSET_PROTOCOL, 0);
return 0 == resource.url.rfind(mln::util::ASSET_PROTOCOL, 0);
}
void AssetManagerFileSource::setResourceOptions(ResourceOptions options) {
@@ -98,4 +98,4 @@ ClientOptions AssetManagerFileSource::getClientOptions() {
return impl->actor().ask(&Impl::getClientOptions).get();
}
} // namespace mbgl
} // namespace mln

View File

@@ -8,7 +8,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace util {
template <typename T>
@@ -39,4 +39,4 @@ private:
std::unique_ptr<util::Thread<Impl>> impl;
};
} // namespace mbgl
} // namespace mln

View File

@@ -5,7 +5,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
/**
@@ -37,4 +37,4 @@ void ConnectivityListener::registerNative(jni::JNIEnv& env) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,10 +4,10 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
class ConnectivityListener : private mbgl::util::noncopyable {
class ConnectivityListener : private mln::util::noncopyable {
public:
static constexpr auto Name() { return "org/maplibre/android/net/NativeConnectivityListener"; };
@@ -24,4 +24,4 @@ public:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,7 +1,7 @@
#include "collection.hpp"
#include "constant.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace conversion {
@@ -29,4 +29,4 @@ jni::Local<jni::Array<jni::String>> toArray(JNIEnv& env, const std::vector<std::
} // namespace conversion
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -6,7 +6,7 @@
#include <vector>
namespace mbgl {
namespace mln {
namespace android {
namespace conversion {
@@ -15,4 +15,4 @@ jni::Local<jni::Array<jni::String>> toArray(JNIEnv& env, const std::vector<std::
} // namespace conversion
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,17 +1,17 @@
#include "color.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace conversion {
Result<mbgl::Color> Converter<mbgl::Color, int>::operator()(jni::JNIEnv&, const int& color) const {
Result<mln::Color> Converter<mln::Color, int>::operator()(jni::JNIEnv&, const int& color) const {
float r = (color >> 16) & 0xFF;
float g = (color >> 8) & 0xFF;
float b = (color) & 0xFF;
float a = (color >> 24) & 0xFF;
return {mbgl::Color(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f)};
return {mln::Color(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f)};
}
} // namespace conversion
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,15 +4,15 @@
#include <mbgl/util/color.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace conversion {
template <>
struct Converter<mbgl::Color, int> {
Result<mbgl::Color> operator()(jni::JNIEnv&, const int& color) const;
struct Converter<mln::Color, int> {
Result<mln::Color> operator()(jni::JNIEnv&, const int& color) const;
};
} // namespace conversion
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -5,7 +5,7 @@
#include <mbgl/style/conversion/stringify.hpp>
#include <mbgl/util/string.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace conversion {
@@ -117,11 +117,11 @@ Result<jni::Local<jni::Object<>>> Converter<jni::Local<jni::Object<>>, style::ex
return jni::Make<jni::String>(env, value.id());
}
Result<jni::Local<jni::Object<>>> Converter<jni::Local<jni::Object<>>, mbgl::style::Rotation>::operator()(
jni::JNIEnv& env, const mbgl::style::Rotation& value) const {
Result<jni::Local<jni::Object<>>> Converter<jni::Local<jni::Object<>>, mln::style::Rotation>::operator()(
jni::JNIEnv& env, const mln::style::Rotation& value) const {
return jni::Box(env, value.getAngle());
}
} // namespace conversion
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -17,7 +17,7 @@
#include <vector>
#include <mbgl/style/rotation.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace conversion {
@@ -140,10 +140,10 @@ struct Converter<jni::Local<jni::Object<>>, style::expression::Image> {
};
template <>
struct Converter<jni::Local<jni::Object<>>, mbgl::style::Rotation> {
Result<jni::Local<jni::Object<>>> operator()(jni::JNIEnv& env, const mbgl::style::Rotation& value) const;
struct Converter<jni::Local<jni::Object<>>, mln::style::Rotation> {
Result<jni::Local<jni::Object<>>> operator()(jni::JNIEnv& env, const mln::style::Rotation& value) const;
};
} // namespace conversion
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -6,7 +6,7 @@
#include <string>
namespace mbgl {
namespace mln {
namespace android {
namespace conversion {
@@ -47,4 +47,4 @@ Result<T> convert(jni::JNIEnv& env, const V& value, Args&&... args) {
} // namespace conversion
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -15,7 +15,7 @@
#include "asset_manager_file_source.hpp"
namespace mbgl {
namespace mln {
namespace android {
// FileSource //
@@ -28,11 +28,11 @@ FileSource::FileSource(jni::JNIEnv& _env,
std::string path = jni::Make<std::string>(_env, _cachePath);
mapbox::sqlite::setTempPath(path);
mbgl::FileSourceManager::get()->registerFileSourceFactory(
mbgl::FileSourceType::Asset,
[](const mbgl::ResourceOptions& resourceOptions, const mbgl::ClientOptions& clientOptions) {
mln::FileSourceManager::get()->registerFileSourceFactory(
mln::FileSourceType::Asset,
[](const mln::ResourceOptions& resourceOptions, const mln::ClientOptions& clientOptions) {
auto env{android::AttachEnv()};
std::unique_ptr<mbgl::FileSource> assetFileSource;
std::unique_ptr<mln::FileSource> assetFileSource;
if (android::MapLibre::hasInstance(*env)) {
auto assetManager = android::MapLibre::getAssetManager(*env);
assetFileSource = std::make_unique<AssetManagerFileSource>(
@@ -48,12 +48,12 @@ FileSource::FileSource(jni::JNIEnv& _env,
// Create a core file sources
// TODO: Split Android FileSource API to smaller interfaces
resourceLoader = mbgl::FileSourceManager::get()->getFileSource(
mbgl::FileSourceType::ResourceLoader, resourceOptions, clientOptions);
databaseSource = std::static_pointer_cast<mbgl::DatabaseFileSource>(std::shared_ptr<mbgl::FileSource>(
mbgl::FileSourceManager::get()->getFileSource(mbgl::FileSourceType::Database, resourceOptions, clientOptions)));
onlineSource = mbgl::FileSourceManager::get()->getFileSource(
mbgl::FileSourceType::Network, resourceOptions, clientOptions);
resourceLoader = mln::FileSourceManager::get()->getFileSource(
mln::FileSourceType::ResourceLoader, resourceOptions, clientOptions);
databaseSource = std::static_pointer_cast<mln::DatabaseFileSource>(std::shared_ptr<mln::FileSource>(
mln::FileSourceManager::get()->getFileSource(mln::FileSourceType::Database, resourceOptions, clientOptions)));
onlineSource = mln::FileSourceManager::get()->getFileSource(
mln::FileSourceType::Network, resourceOptions, clientOptions);
}
FileSource::~FileSource() {}
@@ -67,7 +67,7 @@ void FileSource::setTileServerOptions(jni::JNIEnv& _env, const jni::Object<TileS
}
jni::Local<jni::String> FileSource::getApiKey(jni::JNIEnv& env) {
if (auto* token = onlineSource->getProperty(mbgl::API_KEY_KEY).getString()) {
if (auto* token = onlineSource->getProperty(mln::API_KEY_KEY).getString()) {
return jni::Make<jni::String>(env, *token);
}
@@ -77,7 +77,7 @@ jni::Local<jni::String> FileSource::getApiKey(jni::JNIEnv& env) {
void FileSource::setApiKey(jni::JNIEnv& env, const jni::String& token) {
if (onlineSource) {
onlineSource->setProperty(mbgl::API_KEY_KEY, token ? jni::Make<std::string>(env, token) : "");
onlineSource->setProperty(mln::API_KEY_KEY, token ? jni::Make<std::string>(env, token) : "");
} else {
ThrowNew(env, jni::FindClass(env, "java/lang/IllegalStateException"), "Online functionality is disabled.");
}
@@ -85,14 +85,14 @@ void FileSource::setApiKey(jni::JNIEnv& env, const jni::String& token) {
void FileSource::setAPIBaseUrl(jni::JNIEnv& env, const jni::String& url) {
if (onlineSource) {
onlineSource->setProperty(mbgl::API_BASE_URL_KEY, jni::Make<std::string>(env, url));
onlineSource->setProperty(mln::API_BASE_URL_KEY, jni::Make<std::string>(env, url));
} else {
ThrowNew(env, jni::FindClass(env, "java/lang/IllegalStateException"), "Online functionality is disabled.");
}
}
jni::Local<jni::String> FileSource::getAPIBaseUrl(jni::JNIEnv& env) {
if (auto* url = onlineSource->getProperty(mbgl::API_BASE_URL_KEY).getString()) {
if (auto* url = onlineSource->getProperty(mln::API_BASE_URL_KEY).getString()) {
return jni::Make<jni::String>(env, std::string(*url));
}
@@ -119,7 +119,7 @@ void FileSource::setResourceTransform(jni::JNIEnv& env,
// is converted to a std::function, which requires copyability
// of its captured variables.
[callback = std::make_shared<decltype(global)>(std::move(global))](
mbgl::Resource::Kind kind, const std::string& url_, ResourceTransform::FinishedCallback cb) {
mln::Resource::Kind kind, const std::string& url_, ResourceTransform::FinishedCallback cb) {
android::UniqueEnv _env = android::AttachEnv();
cb(FileSource::ResourceTransformCallback::onURL(*_env, *callback, int(kind), url_));
});
@@ -196,8 +196,8 @@ FileSource* FileSource::getNativePeer(jni::JNIEnv& env, const jni::Object<FileSo
return reinterpret_cast<FileSource*>(jFileSource.Get(env, field));
}
mbgl::ResourceOptions FileSource::getSharedResourceOptions(jni::JNIEnv& env,
const jni::Object<FileSource>& jFileSource) {
mln::ResourceOptions FileSource::getSharedResourceOptions(jni::JNIEnv& env,
const jni::Object<FileSource>& jFileSource) {
FileSource* fileSource = FileSource::getNativePeer(env, jFileSource);
// Core could be compiled without support for any sources.
if (fileSource) {
@@ -207,7 +207,7 @@ mbgl::ResourceOptions FileSource::getSharedResourceOptions(jni::JNIEnv& env,
return {};
}
mbgl::ClientOptions FileSource::getSharedClientOptions(jni::JNIEnv& env, const jni::Object<FileSource>& jFileSource) {
mln::ClientOptions FileSource::getSharedClientOptions(jni::JNIEnv& env, const jni::Object<FileSource>& jFileSource) {
FileSource* fileSource = FileSource::getNativePeer(env, jFileSource);
// Core could be compiled without support for any sources.
if (fileSource) {
@@ -281,4 +281,4 @@ std::string FileSource::ResourceTransformCallback::onURL(
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -11,7 +11,7 @@
#include "util/tile_server_options.hpp"
namespace mbgl {
namespace mln {
template <typename T>
class Actor;
@@ -81,23 +81,23 @@ public:
static FileSource* getNativePeer(jni::JNIEnv&, const jni::Object<FileSource>&);
static mbgl::ResourceOptions getSharedResourceOptions(jni::JNIEnv&, const jni::Object<FileSource>&);
static mln::ResourceOptions getSharedResourceOptions(jni::JNIEnv&, const jni::Object<FileSource>&);
static mbgl::ClientOptions getSharedClientOptions(jni::JNIEnv&, const jni::Object<FileSource>&);
static mln::ClientOptions getSharedClientOptions(jni::JNIEnv&, const jni::Object<FileSource>&);
static void registerNative(jni::JNIEnv&);
private:
const std::string DATABASE_FILE = "/mbgl-offline.db";
std::optional<int> activationCounter;
mbgl::ResourceOptions resourceOptions;
mbgl::ClientOptions clientOptions;
mln::ResourceOptions resourceOptions;
mln::ClientOptions clientOptions;
std::unique_ptr<Actor<ResourceTransform::TransformCallback>> resourceTransform;
std::function<void()> pathChangeCallback;
std::shared_ptr<mbgl::DatabaseFileSource> databaseSource;
std::shared_ptr<mbgl::FileSource> onlineSource;
std::shared_ptr<mbgl::FileSource> resourceLoader;
std::shared_ptr<mln::DatabaseFileSource> databaseSource;
std::shared_ptr<mln::FileSource> onlineSource;
std::shared_ptr<mln::FileSource> resourceLoader;
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,13 +4,13 @@
#include <mbgl/util/string.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
using namespace gson;
mbgl::GeoJSONFeature Feature::convert(jni::JNIEnv& env, const jni::Object<Feature>& jFeature) {
mln::GeoJSONFeature Feature::convert(jni::JNIEnv& env, const jni::Object<Feature>& jFeature) {
static auto& javaClass = jni::Class<Feature>::Singleton(env);
static auto id = javaClass.GetMethod<jni::String()>(env, "id");
static auto geometry = javaClass.GetMethod<jni::Object<Geometry>()>(env, "geometry");
@@ -20,9 +20,9 @@ mbgl::GeoJSONFeature Feature::convert(jni::JNIEnv& env, const jni::Object<Featur
using mbid = mapbox::feature::identifier;
return mbgl::GeoJSONFeature{Geometry::convert(env, jFeature.Call(env, geometry)),
JsonObject::convert(env, jFeature.Call(env, properties)),
jId ? mbid{jni::Make<std::string>(env, jId)} : mbid{mapbox::feature::null_value}};
return mln::GeoJSONFeature{Geometry::convert(env, jFeature.Call(env, geometry)),
JsonObject::convert(env, jFeature.Call(env, properties)),
jId ? mbid{jni::Make<std::string>(env, jId)} : mbid{mapbox::feature::null_value}};
}
/**
@@ -42,34 +42,33 @@ public:
std::string operator()(const mapbox::feature::null_value_t&) const { return {}; }
};
jni::Local<jni::Object<Feature>> convertFeature(jni::JNIEnv& env, const mbgl::GeoJSONFeature& value) {
jni::Local<jni::Object<Feature>> convertFeature(jni::JNIEnv& env, const mln::GeoJSONFeature& value) {
static auto& javaClass = jni::Class<Feature>::Singleton(env);
static auto method =
javaClass.GetStaticMethod<jni::Object<Feature>(jni::Object<Geometry>, jni::Object<JsonObject>, jni::String)>(
env, "fromGeometry");
return javaClass.Call(
env,
method,
Geometry::New(env, value.geometry),
JsonObject::New(env, value.properties),
jni::Make<jni::String>(env,
value.id.is<mbgl::NullValue>() ? std::string{} : value.id.match(FeatureIdVisitor())));
return javaClass.Call(env,
method,
Geometry::New(env, value.geometry),
JsonObject::New(env, value.properties),
jni::Make<jni::String>(
env, value.id.is<mln::NullValue>() ? std::string{} : value.id.match(FeatureIdVisitor())));
}
jni::Local<jni::Array<jni::Object<Feature>>> Feature::convert(jni::JNIEnv& env,
const std::vector<mbgl::Feature>& value) {
const std::vector<mln::Feature>& value) {
auto features = jni::Array<jni::Object<Feature>>::New(env, value.size());
for (size_t i = 0; i < value.size(); ++i) {
features.Set(env, i, convertFeature(env, static_cast<mbgl::GeoJSONFeature>(value.at(i))));
features.Set(env, i, convertFeature(env, static_cast<mln::GeoJSONFeature>(value.at(i))));
}
return features;
}
jni::Local<jni::Array<jni::Object<Feature>>> Feature::convert(jni::JNIEnv& env,
const std::vector<mbgl::GeoJSONFeature>& value) {
const std::vector<mln::GeoJSONFeature>& value) {
auto features = jni::Array<jni::Object<Feature>>::New(env, value.size());
for (size_t i = 0; i < value.size(); ++i) {
@@ -85,4 +84,4 @@ void Feature::registerNative(jni::JNIEnv& env) {
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,7 +4,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
@@ -12,13 +12,13 @@ class Feature {
public:
static constexpr auto Name() { return "org/maplibre/geojson/Feature"; };
static mbgl::GeoJSONFeature convert(jni::JNIEnv&, const jni::Object<Feature>&);
static jni::Local<jni::Array<jni::Object<Feature>>> convert(jni::JNIEnv&, const std::vector<mbgl::Feature>&);
static jni::Local<jni::Array<jni::Object<Feature>>> convert(jni::JNIEnv&, const std::vector<mbgl::GeoJSONFeature>&);
static mln::GeoJSONFeature convert(jni::JNIEnv&, const jni::Object<Feature>&);
static jni::Local<jni::Array<jni::Object<Feature>>> convert(jni::JNIEnv&, const std::vector<mln::Feature>&);
static jni::Local<jni::Array<jni::Object<Feature>>> convert(jni::JNIEnv&, const std::vector<mln::GeoJSONFeature>&);
static void registerNative(jni::JNIEnv&);
};
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -2,13 +2,12 @@
#include "feature.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
mbgl::FeatureCollection FeatureCollection::convert(jni::JNIEnv& env,
const jni::Object<FeatureCollection>& jCollection) {
auto collection = mbgl::FeatureCollection();
mln::FeatureCollection FeatureCollection::convert(jni::JNIEnv& env, const jni::Object<FeatureCollection>& jCollection) {
auto collection = mln::FeatureCollection();
if (jCollection) {
auto jFeatureList = FeatureCollection::features(env, jCollection);
@@ -36,4 +35,4 @@ void FeatureCollection::registerNative(jni::JNIEnv& env) {
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -6,7 +6,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
@@ -14,7 +14,7 @@ class FeatureCollection {
public:
static constexpr auto Name() { return "org/maplibre/geojson/FeatureCollection"; };
static mbgl::FeatureCollection convert(jni::JNIEnv&, const jni::Object<FeatureCollection>&);
static mln::FeatureCollection convert(jni::JNIEnv&, const jni::Object<FeatureCollection>&);
static jni::Local<jni::Object<java::util::List>> features(jni::JNIEnv&, const jni::Object<FeatureCollection>&);
@@ -23,4 +23,4 @@ public:
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -10,7 +10,7 @@
#include <string>
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
@@ -21,32 +21,32 @@ class GeometryEvaluator {
public:
jni::JNIEnv &env;
jni::Local<jni::Object<Geometry>> operator()(const mbgl::EmptyGeometry &) const {
jni::Local<jni::Object<Geometry>> operator()(const mln::EmptyGeometry &) const {
// FIXME: mapbox-java needs to have its own Empty type.
return GeometryCollection::New(env, {});
}
jni::Local<jni::Object<Geometry>> operator()(const mbgl::Point<double> &geometry) const {
jni::Local<jni::Object<Geometry>> operator()(const mln::Point<double> &geometry) const {
return Point::New(env, geometry);
}
jni::Local<jni::Object<Geometry>> operator()(const mbgl::LineString<double> &geometry) const {
jni::Local<jni::Object<Geometry>> operator()(const mln::LineString<double> &geometry) const {
return LineString::New(env, geometry);
}
jni::Local<jni::Object<Geometry>> operator()(const mbgl::MultiLineString<double> &geometry) const {
jni::Local<jni::Object<Geometry>> operator()(const mln::MultiLineString<double> &geometry) const {
return MultiLineString::New(env, geometry);
}
jni::Local<jni::Object<Geometry>> operator()(const mbgl::MultiPoint<double> &geometry) const {
jni::Local<jni::Object<Geometry>> operator()(const mln::MultiPoint<double> &geometry) const {
return MultiPoint::New(env, geometry);
}
jni::Local<jni::Object<Geometry>> operator()(const mbgl::Polygon<double> &geometry) const {
jni::Local<jni::Object<Geometry>> operator()(const mln::Polygon<double> &geometry) const {
return Polygon::New(env, geometry);
}
jni::Local<jni::Object<Geometry>> operator()(const mbgl::MultiPolygon<double> &geometry) const {
jni::Local<jni::Object<Geometry>> operator()(const mln::MultiPolygon<double> &geometry) const {
return MultiPolygon::New(env, geometry);
}
@@ -55,12 +55,12 @@ public:
}
};
jni::Local<jni::Object<Geometry>> Geometry::New(jni::JNIEnv &env, mbgl::Geometry<double> geometry) {
jni::Local<jni::Object<Geometry>> Geometry::New(jni::JNIEnv &env, mln::Geometry<double> geometry) {
GeometryEvaluator evaluator{env};
return mbgl::Geometry<double>::visit(geometry, evaluator);
return mln::Geometry<double>::visit(geometry, evaluator);
}
mbgl::Geometry<double> Geometry::convert(jni::JNIEnv &env, const jni::Object<Geometry> &jGeometry) {
mln::Geometry<double> Geometry::convert(jni::JNIEnv &env, const jni::Object<Geometry> &jGeometry) {
auto type = Geometry::getType(env, jGeometry);
if (type == Point::Type()) {
return {Point::convert(env, jni::Cast(env, jni::Class<Point>::Singleton(env), jGeometry))};
@@ -94,4 +94,4 @@ void Geometry::registerNative(jni::JNIEnv &env) {
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -6,7 +6,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
@@ -14,9 +14,9 @@ class Geometry {
public:
static constexpr auto Name() { return "org/maplibre/geojson/Geometry"; };
static jni::Local<jni::Object<Geometry>> New(jni::JNIEnv&, mbgl::Geometry<double>);
static jni::Local<jni::Object<Geometry>> New(jni::JNIEnv&, mln::Geometry<double>);
static mbgl::Geometry<double> convert(jni::JNIEnv&, const jni::Object<Geometry>&);
static mln::Geometry<double> convert(jni::JNIEnv&, const jni::Object<Geometry>&);
static std::string getType(jni::JNIEnv&, const jni::Object<Geometry>&);
@@ -25,4 +25,4 @@ public:
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,7 +1,7 @@
#include "geometry_collection.hpp"
#include "../java/util.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
@@ -47,4 +47,4 @@ void GeometryCollection::registerNative(jni::JNIEnv& env) {
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,7 +4,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
@@ -24,4 +24,4 @@ public:
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -3,11 +3,11 @@
#include "util.hpp"
#include "../java/util.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
jni::Local<jni::Object<LineString>> LineString::New(jni::JNIEnv& env, const mbgl::LineString<double>& lineString) {
jni::Local<jni::Object<LineString>> LineString::New(jni::JNIEnv& env, const mln::LineString<double>& lineString) {
static auto& javaClass = jni::Class<LineString>::Singleton(env);
static auto method = javaClass.GetStaticMethod<jni::Object<LineString>(jni::Object<java::util::List>)>(
env, "fromLngLats");
@@ -55,4 +55,4 @@ void LineString::registerNative(jni::JNIEnv& env) {
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -9,7 +9,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
@@ -19,7 +19,7 @@ public:
static constexpr auto Name() { return "org/maplibre/geojson/LineString"; };
static constexpr auto Type() { return "LineString"; };
static jni::Local<jni::Object<LineString>> New(jni::JNIEnv&, const mbgl::LineString<double>&);
static jni::Local<jni::Object<LineString>> New(jni::JNIEnv&, const mln::LineString<double>&);
static mapbox::geojson::line_string convert(jni::JNIEnv&, const jni::Object<LineString>&);
@@ -32,4 +32,4 @@ public:
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -3,12 +3,12 @@
#include "line_string.hpp"
#include "util.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
jni::Local<jni::Object<MultiLineString>> MultiLineString::New(jni::JNIEnv& env,
const mbgl::MultiLineString<double>& multiLineString) {
const mln::MultiLineString<double>& multiLineString) {
static auto& javaClass = jni::Class<MultiLineString>::Singleton(env);
static auto method = javaClass.GetStaticMethod<jni::Object<MultiLineString>(jni::Object<java::util::List>)>(
env, "fromLngLats");
@@ -58,4 +58,4 @@ void MultiLineString::registerNative(jni::JNIEnv& env) {
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -8,7 +8,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
@@ -18,7 +18,7 @@ public:
static constexpr auto Name() { return "org/maplibre/geojson/MultiLineString"; };
static constexpr auto Type() { return "MultiLineString"; };
static jni::Local<jni::Object<MultiLineString>> New(jni::JNIEnv&, const mbgl::MultiLineString<double>&);
static jni::Local<jni::Object<MultiLineString>> New(jni::JNIEnv&, const mln::MultiLineString<double>&);
static mapbox::geojson::multi_line_string convert(jni::JNIEnv&, const jni::Object<MultiLineString>&);
@@ -32,4 +32,4 @@ public:
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,11 +4,11 @@
#include "util.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
jni::Local<jni::Object<MultiPoint>> MultiPoint::New(JNIEnv& env, const mbgl::MultiPoint<double>& multiPoint) {
jni::Local<jni::Object<MultiPoint>> MultiPoint::New(JNIEnv& env, const mln::MultiPoint<double>& multiPoint) {
static auto& javaClass = jni::Class<MultiPoint>::Singleton(env);
static auto method = javaClass.GetStaticMethod<jni::Object<MultiPoint>(jni::Object<java::util::List>)>(
env, "fromLngLats");
@@ -40,4 +40,4 @@ void MultiPoint::registerNative(jni::JNIEnv& env) {
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -9,7 +9,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
@@ -19,7 +19,7 @@ public:
static constexpr auto Name() { return "org/maplibre/geojson/MultiPoint"; };
static constexpr auto Type() { return "MultiPoint"; };
static jni::Local<jni::Object<MultiPoint>> New(jni::JNIEnv&, const mbgl::MultiPoint<double>&);
static jni::Local<jni::Object<MultiPoint>> New(jni::JNIEnv&, const mln::MultiPoint<double>&);
static mapbox::geojson::multi_point convert(jni::JNIEnv&, const jni::Object<MultiPoint>&);
@@ -30,4 +30,4 @@ public:
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -3,11 +3,11 @@
#include "polygon.hpp"
#include "util.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
jni::Local<jni::Object<MultiPolygon>> MultiPolygon::New(JNIEnv& env, const mbgl::MultiPolygon<double>& multiPolygon) {
jni::Local<jni::Object<MultiPolygon>> MultiPolygon::New(JNIEnv& env, const mln::MultiPolygon<double>& multiPolygon) {
static auto& javaClass = jni::Class<MultiPolygon>::Singleton(env);
static auto method = javaClass.GetStaticMethod<jni::Object<MultiPolygon>(jni::Object<java::util::List>)>(
env, "fromLngLats");
@@ -52,4 +52,4 @@ void MultiPolygon::registerNative(jni::JNIEnv& env) {
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -8,7 +8,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
@@ -18,7 +18,7 @@ public:
static constexpr auto Name() { return "org/maplibre/geojson/MultiPolygon"; };
static constexpr auto Type() { return "MultiPolygon"; };
static jni::Local<jni::Object<MultiPolygon>> New(jni::JNIEnv&, const mbgl::MultiPolygon<double>&);
static jni::Local<jni::Object<MultiPolygon>> New(jni::JNIEnv&, const mln::MultiPolygon<double>&);
static mapbox::geojson::multi_polygon convert(jni::JNIEnv&, const jni::Object<MultiPolygon>&);
@@ -29,4 +29,4 @@ public:
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,16 +1,16 @@
#include "point.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
jni::Local<jni::Object<Point>> Point::New(jni::JNIEnv& env, const mbgl::Point<double>& point) {
jni::Local<jni::Object<Point>> Point::New(jni::JNIEnv& env, const mln::Point<double>& point) {
static auto& javaClass = jni::Class<Point>::Singleton(env);
static auto method = javaClass.GetStaticMethod<jni::Object<Point>(jni::jdouble, jni::jdouble)>(env, "fromLngLat");
return javaClass.Call(env, method, point.x, point.y);
}
mbgl::Point<double> Point::convert(jni::JNIEnv& env, const jni::Object<Point>& jPoint) {
mln::Point<double> Point::convert(jni::JNIEnv& env, const jni::Object<Point>& jPoint) {
static auto& javaClass = jni::Class<Point>::Singleton(env);
static auto longitude = javaClass.GetMethod<jni::jdouble()>(env, "longitude");
static auto latitude = javaClass.GetMethod<jni::jdouble()>(env, "latitude");
@@ -28,4 +28,4 @@ void Point::registerNative(jni::JNIEnv& env) {
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -6,7 +6,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
@@ -16,12 +16,12 @@ public:
static constexpr auto Name() { return "org/maplibre/geojson/Point"; };
static constexpr auto Type() { return "Point"; };
static jni::Local<jni::Object<Point>> New(jni::JNIEnv&, const mbgl::Point<double>&);
static mbgl::Point<double> convert(jni::JNIEnv&, const jni::Object<Point>&);
static jni::Local<jni::Object<Point>> New(jni::JNIEnv&, const mln::Point<double>&);
static mln::Point<double> convert(jni::JNIEnv&, const jni::Object<Point>&);
static void registerNative(jni::JNIEnv&);
};
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,11 +4,11 @@
#include "util.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
jni::Local<jni::Object<Polygon>> Polygon::New(jni::JNIEnv& env, const mbgl::Polygon<double>& polygon) {
jni::Local<jni::Object<Polygon>> Polygon::New(jni::JNIEnv& env, const mln::Polygon<double>& polygon) {
static auto& javaClass = jni::Class<Polygon>::Singleton(env);
static auto method = javaClass.GetStaticMethod<jni::Object<Polygon>(jni::Object<java::util::List>)>(env,
"fromLngLats");
@@ -53,4 +53,4 @@ void Polygon::registerNative(jni::JNIEnv& env) {
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -8,7 +8,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
@@ -18,7 +18,7 @@ public:
static constexpr auto Name() { return "org/maplibre/geojson/Polygon"; };
static constexpr auto Type() { return "Polygon"; };
static jni::Local<jni::Object<Polygon>> New(jni::JNIEnv &, const mbgl::Polygon<double> &);
static jni::Local<jni::Object<Polygon>> New(jni::JNIEnv &, const mln::Polygon<double> &);
static mapbox::geojson::polygon convert(jni::JNIEnv &, const jni::Object<Polygon> &);
@@ -32,4 +32,4 @@ public:
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,7 +4,7 @@
#include <type_traits>
namespace mbgl {
namespace mln {
namespace android {
namespace geojson {
@@ -47,4 +47,4 @@ static jni::Local<jni::Object<java::util::List>> asPointsListsList(JNIEnv& env,
} // namespace geojson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,24 +1,24 @@
#include "lat_lng.hpp"
namespace mbgl {
namespace mln {
namespace android {
jni::Local<jni::Object<LatLng>> LatLng::New(jni::JNIEnv& env, const mbgl::LatLng& latLng) {
jni::Local<jni::Object<LatLng>> LatLng::New(jni::JNIEnv& env, const mln::LatLng& latLng) {
static auto& javaClass = jni::Class<LatLng>::Singleton(env);
static auto constructor = javaClass.GetConstructor<double, double>(env);
return javaClass.New(env, constructor, latLng.latitude(), latLng.longitude());
}
mbgl::Point<double> LatLng::getGeometry(jni::JNIEnv& env, const jni::Object<LatLng>& latLng) {
mln::Point<double> LatLng::getGeometry(jni::JNIEnv& env, const jni::Object<LatLng>& latLng) {
static auto& javaClass = jni::Class<LatLng>::Singleton(env);
static auto latitudeField = javaClass.GetField<jni::jdouble>(env, "latitude");
static auto longitudeField = javaClass.GetField<jni::jdouble>(env, "longitude");
return mbgl::Point<double>(latLng.Get(env, longitudeField), latLng.Get(env, latitudeField));
return mln::Point<double>(latLng.Get(env, longitudeField), latLng.Get(env, latitudeField));
}
mbgl::LatLng LatLng::getLatLng(jni::JNIEnv& env, const jni::Object<LatLng>& latLng) {
mln::LatLng LatLng::getLatLng(jni::JNIEnv& env, const jni::Object<LatLng>& latLng) {
auto point = LatLng::getGeometry(env, latLng);
return mbgl::LatLng(point.y, point.x);
return mln::LatLng(point.y, point.x);
}
void LatLng::registerNative(jni::JNIEnv& env) {
@@ -26,4 +26,4 @@ void LatLng::registerNative(jni::JNIEnv& env) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -6,21 +6,21 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
class LatLng : private mbgl::util::noncopyable {
class LatLng : private mln::util::noncopyable {
public:
static constexpr auto Name() { return "org/maplibre/android/geometry/LatLng"; };
static jni::Local<jni::Object<LatLng>> New(jni::JNIEnv&, const mbgl::LatLng&);
static jni::Local<jni::Object<LatLng>> New(jni::JNIEnv&, const mln::LatLng&);
static mbgl::Point<double> getGeometry(jni::JNIEnv&, const jni::Object<LatLng>&);
static mln::Point<double> getGeometry(jni::JNIEnv&, const jni::Object<LatLng>&);
static mbgl::LatLng getLatLng(jni::JNIEnv&, const jni::Object<LatLng>&);
static mln::LatLng getLatLng(jni::JNIEnv&, const jni::Object<LatLng>&);
static void registerNative(jni::JNIEnv&);
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,25 +1,25 @@
#include "lat_lng_bounds.hpp"
namespace mbgl {
namespace mln {
namespace android {
jni::Local<jni::Object<LatLngBounds>> LatLngBounds::New(jni::JNIEnv& env, mbgl::LatLngBounds bounds) {
jni::Local<jni::Object<LatLngBounds>> LatLngBounds::New(jni::JNIEnv& env, mln::LatLngBounds bounds) {
static auto& javaClass = jni::Class<LatLngBounds>::Singleton(env);
static auto constructor = javaClass.GetConstructor<double, double, double, double>(env);
return javaClass.New(env, constructor, bounds.north(), bounds.east(), bounds.south(), bounds.west());
}
mbgl::LatLngBounds LatLngBounds::getLatLngBounds(jni::JNIEnv& env, const jni::Object<LatLngBounds>& bounds) {
mln::LatLngBounds LatLngBounds::getLatLngBounds(jni::JNIEnv& env, const jni::Object<LatLngBounds>& bounds) {
static auto& javaClass = jni::Class<LatLngBounds>::Singleton(env);
static auto swLatField = javaClass.GetField<jni::jdouble>(env, "latitudeSouth");
static auto swLonField = javaClass.GetField<jni::jdouble>(env, "longitudeWest");
static auto neLatField = javaClass.GetField<jni::jdouble>(env, "latitudeNorth");
static auto neLonField = javaClass.GetField<jni::jdouble>(env, "longitudeEast");
mbgl::LatLng sw = {bounds.Get(env, swLatField), bounds.Get(env, swLonField)};
mbgl::LatLng ne = {bounds.Get(env, neLatField), bounds.Get(env, neLonField)};
mln::LatLng sw = {bounds.Get(env, swLatField), bounds.Get(env, swLonField)};
mln::LatLng ne = {bounds.Get(env, neLatField), bounds.Get(env, neLonField)};
return mbgl::LatLngBounds::hull(sw, ne);
return mln::LatLngBounds::hull(sw, ne);
}
void LatLngBounds::registerNative(jni::JNIEnv& env) {
@@ -27,4 +27,4 @@ void LatLngBounds::registerNative(jni::JNIEnv& env) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -6,19 +6,19 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
class LatLngBounds : private mbgl::util::noncopyable {
class LatLngBounds : private mln::util::noncopyable {
public:
static constexpr auto Name() { return "org/maplibre/android/geometry/LatLngBounds"; };
static jni::Local<jni::Object<LatLngBounds>> New(jni::JNIEnv&, mbgl::LatLngBounds);
static jni::Local<jni::Object<LatLngBounds>> New(jni::JNIEnv&, mln::LatLngBounds);
static mbgl::LatLngBounds getLatLngBounds(jni::JNIEnv&, const jni::Object<LatLngBounds>&);
static mln::LatLngBounds getLatLngBounds(jni::JNIEnv&, const jni::Object<LatLngBounds>&);
static void registerNative(jni::JNIEnv&);
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,10 +1,10 @@
#include "lat_lng_quad.hpp"
#include "lat_lng.hpp"
namespace mbgl {
namespace mln {
namespace android {
jni::Local<jni::Object<LatLngQuad>> LatLngQuad::New(jni::JNIEnv& env, std::array<mbgl::LatLng, 4> coordinates) {
jni::Local<jni::Object<LatLngQuad>> LatLngQuad::New(jni::JNIEnv& env, std::array<mln::LatLng, 4> coordinates) {
static auto& javaClass = jni::Class<LatLngQuad>::Singleton(env);
static auto quadConstructor =
javaClass.GetConstructor<jni::Object<LatLng>, jni::Object<LatLng>, jni::Object<LatLng>, jni::Object<LatLng>>(
@@ -17,17 +17,17 @@ jni::Local<jni::Object<LatLngQuad>> LatLngQuad::New(jni::JNIEnv& env, std::array
LatLng::New(env, coordinates[3]));
}
std::array<mbgl::LatLng, 4> LatLngQuad::getLatLngArray(jni::JNIEnv& env, const jni::Object<LatLngQuad>& quad) {
std::array<mln::LatLng, 4> LatLngQuad::getLatLngArray(jni::JNIEnv& env, const jni::Object<LatLngQuad>& quad) {
static auto& javaClass = jni::Class<LatLngQuad>::Singleton(env);
static auto topLeftField = javaClass.GetField<jni::Object<LatLng>>(env, "topLeft");
static auto topRightField = javaClass.GetField<jni::Object<LatLng>>(env, "topRight");
static auto bottomRightField = javaClass.GetField<jni::Object<LatLng>>(env, "bottomRight");
static auto bottomLeftField = javaClass.GetField<jni::Object<LatLng>>(env, "bottomLeft");
return std::array<mbgl::LatLng, 4>{{LatLng::getLatLng(env, quad.Get(env, topLeftField)),
LatLng::getLatLng(env, quad.Get(env, topRightField)),
LatLng::getLatLng(env, quad.Get(env, bottomRightField)),
LatLng::getLatLng(env, quad.Get(env, bottomLeftField))}};
return std::array<mln::LatLng, 4>{{LatLng::getLatLng(env, quad.Get(env, topLeftField)),
LatLng::getLatLng(env, quad.Get(env, topRightField)),
LatLng::getLatLng(env, quad.Get(env, bottomRightField)),
LatLng::getLatLng(env, quad.Get(env, bottomLeftField))}};
}
void LatLngQuad::registerNative(jni::JNIEnv& env) {
@@ -35,4 +35,4 @@ void LatLngQuad::registerNative(jni::JNIEnv& env) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -7,19 +7,19 @@
#include <jni/jni.hpp>
#include <array>
namespace mbgl {
namespace mln {
namespace android {
class LatLngQuad : private mbgl::util::noncopyable {
class LatLngQuad : private mln::util::noncopyable {
public:
static constexpr auto Name() { return "org/maplibre/android/geometry/LatLngQuad"; };
static jni::Local<jni::Object<LatLngQuad>> New(jni::JNIEnv&, std::array<mbgl::LatLng, 4>);
static jni::Local<jni::Object<LatLngQuad>> New(jni::JNIEnv&, std::array<mln::LatLng, 4>);
static std::array<mbgl::LatLng, 4> getLatLngArray(jni::JNIEnv&, const jni::Object<LatLngQuad>&);
static std::array<mln::LatLng, 4> getLatLngArray(jni::JNIEnv&, const jni::Object<LatLngQuad>&);
static void registerNative(jni::JNIEnv&);
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,6 +1,6 @@
#include "projected_meters.hpp"
namespace mbgl {
namespace mln {
namespace android {
jni::Local<jni::Object<ProjectedMeters>> ProjectedMeters::New(jni::JNIEnv& env, double northing, double easting) {
@@ -14,4 +14,4 @@ void ProjectedMeters::registerNative(jni::JNIEnv& env) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -5,10 +5,10 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
class ProjectedMeters : private mbgl::util::noncopyable {
class ProjectedMeters : private mln::util::noncopyable {
public:
static constexpr auto Name() { return "org/maplibre/android/geometry/ProjectedMeters"; };
@@ -18,4 +18,4 @@ public:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,7 +1,7 @@
#include <mbgl/util/geo.hpp>
#include "pointf.hpp"
namespace mbgl {
namespace mln {
namespace android {
jni::Local<jni::Object<PointF>> PointF::New(jni::JNIEnv& env, float x, float y) {
@@ -10,11 +10,11 @@ jni::Local<jni::Object<PointF>> PointF::New(jni::JNIEnv& env, float x, float y)
return javaClass.New(env, constructor, x, y);
}
mbgl::ScreenCoordinate PointF::getScreenCoordinate(jni::JNIEnv& env, const jni::Object<PointF>& point) {
mln::ScreenCoordinate PointF::getScreenCoordinate(jni::JNIEnv& env, const jni::Object<PointF>& point) {
static auto& javaClass = jni::Class<PointF>::Singleton(env);
static auto xField = javaClass.GetField<jni::jfloat>(env, "x");
static auto yField = javaClass.GetField<jni::jfloat>(env, "y");
return mbgl::ScreenCoordinate{point.Get(env, xField), point.Get(env, yField)};
return mln::ScreenCoordinate{point.Get(env, xField), point.Get(env, yField)};
}
void PointF::registerNative(jni::JNIEnv& env) {
@@ -22,4 +22,4 @@ void PointF::registerNative(jni::JNIEnv& env) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,19 +4,19 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
class PointF : private mbgl::util::noncopyable {
class PointF : private mln::util::noncopyable {
public:
static constexpr auto Name() { return "android/graphics/PointF"; };
static jni::Local<jni::Object<PointF>> New(jni::JNIEnv&, float, float);
static mbgl::ScreenCoordinate getScreenCoordinate(jni::JNIEnv&, const jni::Object<PointF>&);
static mln::ScreenCoordinate getScreenCoordinate(jni::JNIEnv&, const jni::Object<PointF>&);
static void registerNative(jni::JNIEnv&);
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,6 +1,6 @@
#include "rectf.hpp"
namespace mbgl {
namespace mln {
namespace android {
float RectF::getLeft(jni::JNIEnv& env, const jni::Object<RectF>& rectf) {
@@ -32,4 +32,4 @@ void RectF::registerNative(jni::JNIEnv& env) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,10 +4,10 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
class RectF : private mbgl::util::noncopyable {
class RectF : private mln::util::noncopyable {
public:
static constexpr auto Name() { return "android/graphics/RectF"; };
@@ -23,4 +23,4 @@ public:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,11 +1,11 @@
#include "json_array.hpp"
#include "json_element.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace gson {
jni::Local<jni::Object<JsonArray>> JsonArray::New(jni::JNIEnv& env, const std::vector<mbgl::Value>& values) {
jni::Local<jni::Object<JsonArray>> JsonArray::New(jni::JNIEnv& env, const std::vector<mln::Value>& values) {
static auto& javaClass = jni::Class<JsonArray>::Singleton(env);
static auto constructor = javaClass.GetConstructor(env);
static auto addMethod = javaClass.GetMethod<void(jni::Object<JsonElement>)>(env, "add");
@@ -19,8 +19,8 @@ jni::Local<jni::Object<JsonArray>> JsonArray::New(jni::JNIEnv& env, const std::v
return jsonArray;
}
std::vector<mbgl::Value> JsonArray::convert(jni::JNIEnv& env, const jni::Object<JsonArray>& jsonArray) {
std::vector<mbgl::Value> values;
std::vector<mln::Value> JsonArray::convert(jni::JNIEnv& env, const jni::Object<JsonArray>& jsonArray) {
std::vector<mln::Value> values;
if (jsonArray) {
static auto& javaClass = jni::Class<JsonArray>::Singleton(env);
@@ -47,4 +47,4 @@ void JsonArray::registerNative(jni::JNIEnv& env) {
} // namespace gson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,7 +4,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace gson {
@@ -13,12 +13,12 @@ public:
using SuperTag = JsonElement;
static constexpr auto Name() { return "com/google/gson/JsonArray"; };
static jni::Local<jni::Object<JsonArray>> New(jni::JNIEnv&, const std::vector<mbgl::Value>&);
static std::vector<mbgl::Value> convert(JNIEnv&, const jni::Object<JsonArray>&);
static jni::Local<jni::Object<JsonArray>> New(jni::JNIEnv&, const std::vector<mln::Value>&);
static std::vector<mln::Value> convert(JNIEnv&, const jni::Object<JsonArray>&);
static void registerNative(jni::JNIEnv&);
};
} // namespace gson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -3,18 +3,18 @@
#include "json_object.hpp"
#include "json_primitive.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace gson {
jni::Local<jni::Object<JsonElement>> JsonElement::New(jni::JNIEnv& env, const mbgl::Value& value) {
jni::Local<jni::Object<JsonElement>> JsonElement::New(jni::JNIEnv& env, const mln::Value& value) {
static auto& primitive = jni::Class<JsonPrimitive>::Singleton(env);
static auto stringConstructor = primitive.GetConstructor<jni::String>(env);
static auto numberConstructor = primitive.GetConstructor<jni::Number>(env);
static auto booleanConstructor = primitive.GetConstructor<jni::Boolean>(env);
return value.match(
[&](const mbgl::NullValue&) { return jni::Local<jni::Object<JsonElement>>(); },
[&](const mln::NullValue&) { return jni::Local<jni::Object<JsonElement>>(); },
[&](const std::string& value) {
return primitive.New(env, stringConstructor, jni::Make<jni::String>(env, value));
},
@@ -26,13 +26,13 @@ jni::Local<jni::Object<JsonElement>> JsonElement::New(jni::JNIEnv& env, const mb
[&](const bool value) {
return primitive.New(env, booleanConstructor, jni::Box(env, value ? jni::jni_true : jni::jni_false));
},
[&](const std::vector<mbgl::Value>& values) { return JsonArray::New(env, values); },
[&](const mbgl::PropertyMap& values) { return JsonObject::New(env, values); });
[&](const std::vector<mln::Value>& values) { return JsonArray::New(env, values); },
[&](const mln::PropertyMap& values) { return JsonObject::New(env, values); });
}
mbgl::Value JsonElement::convert(jni::JNIEnv& env, const jni::Object<JsonElement>& jsonElement) {
mln::Value JsonElement::convert(jni::JNIEnv& env, const jni::Object<JsonElement>& jsonElement) {
if (!jsonElement) {
return mbgl::NullValue();
return mln::NullValue();
}
static auto& elementClass = jni::Class<JsonElement>::Singleton(env);
@@ -57,14 +57,14 @@ mbgl::Value JsonElement::convert(jni::JNIEnv& env, const jni::Object<JsonElement
} else if (primitive.Call(env, isString)) {
return jni::Make<std::string>(env, primitive.Call(env, getAsString));
} else {
return mbgl::NullValue();
return mln::NullValue();
}
} else if (jsonElement.Call(env, isJsonObject)) {
return JsonObject::convert(env, jni::Cast(env, jni::Class<JsonObject>::Singleton(env), jsonElement));
} else if (jsonElement.Call(env, isJsonArray)) {
return JsonArray::convert(env, jni::Cast(env, jni::Class<JsonArray>::Singleton(env), jsonElement));
} else {
return mbgl::NullValue();
return mln::NullValue();
}
}
@@ -74,4 +74,4 @@ void JsonElement::registerNative(jni::JNIEnv& env) {
} // namespace gson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,7 +4,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace gson {
@@ -13,12 +13,12 @@ public:
using SuperTag = jni::ObjectTag;
static constexpr auto Name() { return "com/google/gson/JsonElement"; };
static jni::Local<jni::Object<JsonElement>> New(jni::JNIEnv&, const mbgl::Value&);
static mbgl::Value convert(JNIEnv&, const jni::Object<JsonElement>&);
static jni::Local<jni::Object<JsonElement>> New(jni::JNIEnv&, const mln::Value&);
static mln::Value convert(JNIEnv&, const jni::Object<JsonElement>&);
static void registerNative(jni::JNIEnv&);
};
} // namespace gson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,11 +4,11 @@
#include "../java/util.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace gson {
jni::Local<jni::Object<JsonObject>> JsonObject::New(jni::JNIEnv& env, const mbgl::PropertyMap& values) {
jni::Local<jni::Object<JsonObject>> JsonObject::New(jni::JNIEnv& env, const mln::PropertyMap& values) {
static auto& javaClass = jni::Class<JsonObject>::Singleton(env);
static auto constructor = javaClass.GetConstructor(env);
static auto addMethod = javaClass.GetMethod<void(jni::String, jni::Object<JsonElement>)>(env, "add");
@@ -40,8 +40,8 @@ static void iterateEntrySet(jni::JNIEnv& env, const jni::Object<JsonObject>& jso
}
}
mbgl::PropertyMap JsonObject::convert(jni::JNIEnv& env, const jni::Object<JsonObject>& jsonObject) {
mbgl::PropertyMap map;
mln::PropertyMap JsonObject::convert(jni::JNIEnv& env, const jni::Object<JsonObject>& jsonObject) {
mln::PropertyMap map;
if (jsonObject) {
iterateEntrySet(
@@ -59,4 +59,4 @@ void JsonObject::registerNative(jni::JNIEnv& env) {
} // namespace gson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,7 +4,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace gson {
@@ -13,12 +13,12 @@ public:
using SuperTag = JsonElement;
static constexpr auto Name() { return "com/google/gson/JsonObject"; };
static jni::Local<jni::Object<JsonObject>> New(jni::JNIEnv&, const mbgl::PropertyMap&);
static mbgl::PropertyMap convert(JNIEnv&, const jni::Object<JsonObject>&);
static jni::Local<jni::Object<JsonObject>> New(jni::JNIEnv&, const mln::PropertyMap&);
static mln::PropertyMap convert(JNIEnv&, const jni::Object<JsonObject>&);
static void registerNative(jni::JNIEnv&);
};
} // namespace gson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,6 +1,6 @@
#include "json_primitive.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace gson {
@@ -10,4 +10,4 @@ void JsonPrimitive::registerNative(jni::JNIEnv &env) {
} // namespace gson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,7 +4,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace gson {
@@ -18,4 +18,4 @@ public:
} // namespace gson
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -14,7 +14,7 @@
#include <jni/jni.hpp>
#include "attach_env.hpp"
namespace mbgl {
namespace mln {
class HTTPFileSource::Impl {
public:
@@ -241,4 +241,4 @@ ClientOptions HTTPFileSource::getClientOptions() {
return impl->getClientOptions();
}
} // namespace mbgl
} // namespace mln

View File

@@ -6,7 +6,7 @@
#include "attach_env.hpp"
#include "collator_jni.hpp"
namespace mbgl {
namespace mln {
namespace android {
void Collator::registerNative(jni::JNIEnv& env) {
@@ -192,4 +192,4 @@ std::string Collator::resolvedLocale() const {
}
} // namespace platform
} // namespace mbgl
} // namespace mln

View File

@@ -7,11 +7,11 @@
the JNI wrappers of
java/text/Collator and java/util/Locale
mbgl::Collator is the portable interface
mln::Collator is the portable interface
Both implementations are in collator.cpp
*/
namespace mbgl {
namespace mln {
namespace android {
class Locale {
@@ -55,4 +55,4 @@ public:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -6,7 +6,7 @@
#include "attach_env.hpp"
#include "number_format_jni.hpp"
namespace mbgl {
namespace mln {
namespace android {
void NumberFormat::registerNative(jni::JNIEnv& env) {
@@ -85,4 +85,4 @@ std::string formatNumber(double number,
}
} // namespace platform
} // namespace mbgl
} // namespace mln

View File

@@ -9,7 +9,7 @@
of java/text/NumberFormat.
*/
namespace mbgl {
namespace mln {
namespace android {
class NumberFormat {
@@ -26,4 +26,4 @@ public:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,6 +1,6 @@
#include "util.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace java {
namespace util {
@@ -16,4 +16,4 @@ void registerNative(jni::JNIEnv& env) {
} // namespace util
} // namespace java
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,12 +4,12 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace java {
namespace util {
class List : private mbgl::util::noncopyable {
class List : private mln::util::noncopyable {
public:
static constexpr auto Name() { return "java/util/List"; };
@@ -22,7 +22,7 @@ public:
};
};
class Arrays : private mbgl::util::noncopyable {
class Arrays : private mln::util::noncopyable {
public:
static constexpr auto Name() { return "java/util/Arrays"; };
@@ -36,7 +36,7 @@ public:
}
};
class Set : private mbgl::util::noncopyable {
class Set : private mln::util::noncopyable {
public:
static constexpr auto Name() { return "java/util/Set"; };
@@ -49,11 +49,11 @@ public:
};
};
class Map : private mbgl::util::noncopyable {
class Map : private mln::util::noncopyable {
public:
static constexpr auto Name() { return "java/util/Map"; };
class Entry : private mbgl::util::noncopyable {
class Entry : private mln::util::noncopyable {
public:
static constexpr auto Name() { return "java/util/Map$Entry"; };
@@ -78,4 +78,4 @@ void registerNative(jni::JNIEnv&);
} // namespace util
} // namespace java
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,6 +1,6 @@
#include "java_types.hpp"
namespace mbgl {
namespace mln {
namespace android {
namespace java {
@@ -46,4 +46,4 @@ void registerNatives(JNIEnv& env) {
} // namespace java
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -2,7 +2,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
namespace java {
@@ -40,4 +40,4 @@ struct Set {
void registerNatives(JNIEnv&);
} // namespace java
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -60,7 +60,7 @@
#include "text/local_glyph_rasterizer_jni.hpp"
#include "tile/tile_operation.hpp"
namespace mbgl {
namespace mln {
namespace android {
void RegisterNativeHTTPRequest(JNIEnv&);
@@ -176,4 +176,4 @@ void registerNatives(JavaVM* vm) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,10 +4,10 @@
#include "jni.hpp"
namespace mbgl {
namespace mln {
namespace android {
MBGL_EXPORT void registerNatives(JavaVM* vm);
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,7 +1,7 @@
#include "logger.hpp"
#include "java_types.hpp"
namespace mbgl {
namespace mln {
namespace android {
void Logger::registerNative(jni::JNIEnv& env) {
@@ -31,4 +31,4 @@ void Logger::log(jni::JNIEnv& env, EventSeverity severity, const std::string& ms
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,7 +4,7 @@
#include <jni/jni.hpp>
#include "bitmap.hpp"
namespace mbgl {
namespace mln {
namespace android {
class Logger {
@@ -16,4 +16,4 @@ public:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -3,11 +3,11 @@
#include "logger.hpp"
#include "attach_env.hpp"
namespace mbgl {
namespace mln {
void Log::platformRecord(EventSeverity severity, const std::string &msg) {
auto env{android::AttachEnv()};
android::Logger::log(*env, severity, msg);
}
} // namespace mbgl
} // namespace mln

View File

@@ -4,6 +4,6 @@
extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *) {
assert(vm != nullptr);
mbgl::android::registerNatives(vm);
mln::android::registerNatives(vm);
return JNI_VERSION_1_6;
}

View File

@@ -3,11 +3,11 @@
#include <mbgl/util/constants.hpp>
#include <mbgl/math/angles.hpp>
namespace mbgl {
namespace mln {
namespace android {
jni::Local<jni::Object<CameraPosition>> CameraPosition::New(jni::JNIEnv& env,
mbgl::CameraOptions options,
mln::CameraOptions options,
float pixelRatio) {
static auto& javaClass = jni::Class<CameraPosition>::Singleton(env);
static auto constructor = javaClass.GetConstructor<jni::Object<LatLng>,
@@ -60,9 +60,9 @@ jni::Local<jni::Object<CameraPosition>> CameraPosition::New(jni::JNIEnv& env,
padding);
}
mbgl::CameraOptions CameraPosition::getCameraOptions(jni::JNIEnv& env,
const jni::Object<CameraPosition>& position,
float pixelRatio) {
mln::CameraOptions CameraPosition::getCameraOptions(jni::JNIEnv& env,
const jni::Object<CameraPosition>& position,
float pixelRatio) {
static auto& javaClass = jni::Class<CameraPosition>::Singleton(env);
static auto bearing = javaClass.GetField<jni::jdouble>(env, "bearing");
static auto target = javaClass.GetField<jni::Object<LatLng>>(env, "target");
@@ -76,19 +76,19 @@ mbgl::CameraOptions CameraPosition::getCameraOptions(jni::JNIEnv& env,
auto padding = position.Get(env, paddingField);
auto center = LatLng::getLatLng(env, position.Get(env, target));
return mbgl::CameraOptions{center,
position.Get(env, centerAltitude),
padding && padding.Length(env) == 4 ? EdgeInsets{padding.Get(env, 1) * pixelRatio,
padding.Get(env, 0) * pixelRatio,
padding.Get(env, 3) * pixelRatio,
padding.Get(env, 2) * pixelRatio}
: (EdgeInsets){},
{},
position.Get(env, zoom),
position.Get(env, bearing),
position.Get(env, tilt),
position.Get(env, roll),
position.Get(env, fov)};
return mln::CameraOptions{center,
position.Get(env, centerAltitude),
padding && padding.Length(env) == 4 ? EdgeInsets{padding.Get(env, 1) * pixelRatio,
padding.Get(env, 0) * pixelRatio,
padding.Get(env, 3) * pixelRatio,
padding.Get(env, 2) * pixelRatio}
: (EdgeInsets){},
{},
position.Get(env, zoom),
position.Get(env, bearing),
position.Get(env, tilt),
position.Get(env, roll),
position.Get(env, fov)};
}
void CameraPosition::registerNative(jni::JNIEnv& env) {
@@ -96,4 +96,4 @@ void CameraPosition::registerNative(jni::JNIEnv& env) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -5,19 +5,19 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
class CameraPosition : private mbgl::util::noncopyable {
class CameraPosition : private mln::util::noncopyable {
public:
static constexpr auto Name() { return "org/maplibre/android/camera/CameraPosition"; };
static jni::Local<jni::Object<CameraPosition>> New(jni::JNIEnv&, mbgl::CameraOptions, float pixelRatio);
static jni::Local<jni::Object<CameraPosition>> New(jni::JNIEnv&, mln::CameraOptions, float pixelRatio);
static mbgl::CameraOptions getCameraOptions(jni::JNIEnv&, const jni::Object<CameraPosition>&, float pixelRatio);
static mln::CameraOptions getCameraOptions(jni::JNIEnv&, const jni::Object<CameraPosition>&, float pixelRatio);
static void registerNative(jni::JNIEnv&);
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -2,10 +2,10 @@
#include <mbgl/util/exception.hpp>
#include "image.hpp"
namespace mbgl {
namespace mln {
namespace android {
mbgl::style::Image Image::getImage(jni::JNIEnv& env, const jni::Object<Image>& image) {
mln::style::Image Image::getImage(jni::JNIEnv& env, const jni::Object<Image>& image) {
static auto& javaClass = jni::Class<Image>::Singleton(env);
static auto widthField = javaClass.GetField<jni::jint>(env, "width");
static auto heightField = javaClass.GetField<jni::jint>(env, "height");
@@ -29,9 +29,9 @@ mbgl::style::Image Image::getImage(jni::JNIEnv& env, const jni::Object<Image>& i
jni::NullCheck(env, pixels.get());
std::size_t size = pixels.Length(env);
mbgl::PremultipliedImage premultipliedImage({static_cast<uint32_t>(width), static_cast<uint32_t>(height)});
mln::PremultipliedImage premultipliedImage({static_cast<uint32_t>(width), static_cast<uint32_t>(height)});
if (premultipliedImage.bytes() != uint32_t(size)) {
throw mbgl::util::StyleImageException("Image pixel count mismatch");
throw mln::util::StyleImageException("Image pixel count mismatch");
}
jni::GetArrayRegion(env, *pixels, 0, size, reinterpret_cast<jbyte*>(premultipliedImage.data.get()));
@@ -54,16 +54,16 @@ mbgl::style::Image Image::getImage(jni::JNIEnv& env, const jni::Object<Image>& i
if (content) {
const style::ImageContent imageContent = style::ImageContent{
content.Get(env, 0), content.Get(env, 1), content.Get(env, 2), content.Get(env, 3)};
return mbgl::style::Image{name,
std::move(premultipliedImage),
pixelRatio,
sdf,
imageStretchesX,
imageStretchesY,
std::move(imageContent)};
return mln::style::Image{name,
std::move(premultipliedImage),
pixelRatio,
sdf,
imageStretchesX,
imageStretchesY,
std::move(imageContent)};
}
return mbgl::style::Image{name, std::move(premultipliedImage), pixelRatio, sdf, imageStretchesX, imageStretchesY};
return mln::style::Image{name, std::move(premultipliedImage), pixelRatio, sdf, imageStretchesX, imageStretchesY};
}
void Image::registerNative(jni::JNIEnv& env) {
@@ -71,4 +71,4 @@ void Image::registerNative(jni::JNIEnv& env) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -5,17 +5,17 @@
#include <jni/jni.hpp>
#include <mbgl/style/image.hpp>
namespace mbgl {
namespace mln {
namespace android {
class Image : private mbgl::util::noncopyable {
class Image : private mln::util::noncopyable {
public:
static constexpr auto Name() { return "org/maplibre/android/maps/Image"; };
static mbgl::style::Image getImage(jni::JNIEnv&, const jni::Object<Image>&);
static mln::style::Image getImage(jni::JNIEnv&, const jni::Object<Image>&);
static void registerNative(jni::JNIEnv&);
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -34,7 +34,7 @@ bool inEmulator() {
} // namespace
#endif
namespace mbgl {
namespace mln {
namespace android {
MapRenderer::MapRenderer(jni::JNIEnv& _env,
@@ -378,4 +378,4 @@ MapRenderer& MapRenderer::getNativePeer(JNIEnv& env, const jni::Object<MapRender
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -12,7 +12,7 @@
#include <jni/jni.hpp>
#include <android/native_window.h>
namespace mbgl {
namespace mln {
template <class>
class ActorRef;
@@ -167,4 +167,4 @@ private:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -2,7 +2,7 @@
#include <mbgl/util/logging.hpp>
namespace mbgl {
namespace mln {
namespace android {
MapRendererRunnable::MapRendererRunnable(jni::JNIEnv& env, std::function<void()> function_)
@@ -45,4 +45,4 @@ void MapRendererRunnable::registerNative(jni::JNIEnv& env) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -8,7 +8,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
/**
@@ -41,4 +41,4 @@ private:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,6 +1,6 @@
#include "maplibre.hpp"
namespace mbgl {
namespace mln {
namespace android {
jni::Local<jni::Object<AssetManager>> MapLibre::getAssetManager(jni::JNIEnv& env) {
@@ -20,4 +20,4 @@ void MapLibre::registerNative(jni::JNIEnv& env) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,7 +4,7 @@
#include <jni/jni.hpp>
namespace mbgl {
namespace mln {
namespace android {
class MapLibre {
@@ -16,4 +16,4 @@ public:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,6 +1,6 @@
#include "native_map_options.hpp"
namespace mbgl {
namespace mln {
namespace android {
void NativeMapOptions::registerNative(jni::JNIEnv &env) {
@@ -54,4 +54,4 @@ bool NativeMapOptions::fastPFOREnabled(jni::JNIEnv &env, const jni::Object<Nativ
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -4,7 +4,7 @@
#include <jni/jni.hpp>
#include <mbgl/util/action_journal_options.hpp>
namespace mbgl {
namespace mln {
namespace android {
class NativeMapOptions {
@@ -24,4 +24,4 @@ public:
};
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -58,7 +58,7 @@
#include "style/light.hpp"
#include "tile/tile_operation.hpp"
namespace mbgl {
namespace mln {
namespace android {
NativeMapView::NativeMapView(jni::JNIEnv& _env,
@@ -83,7 +83,7 @@ NativeMapView::NativeMapView(jni::JNIEnv& _env,
// Create Map options
MapOptions options;
options.withMapMode(MapMode::Continuous)
.withSize(mbgl::Size{static_cast<uint32_t>(width), static_cast<uint32_t>(height)})
.withSize(mln::Size{static_cast<uint32_t>(width), static_cast<uint32_t>(height)})
.withPixelRatio(pixelRatio)
.withConstrainMode(ConstrainMode::HeightOnly)
.withViewportMode(ViewportMode::Default)
@@ -91,13 +91,12 @@ NativeMapView::NativeMapView(jni::JNIEnv& _env,
.withFastPFOREnabled(NativeMapOptions::fastPFOREnabled(_env, jNativeMapOptions));
// Create the core map
map = std::make_unique<mbgl::Map>(
*rendererFrontend,
*this,
options,
mbgl::android::FileSource::getSharedResourceOptions(_env, jFileSource),
mbgl::android::FileSource::getSharedClientOptions(_env, jFileSource),
mbgl::android::NativeMapOptions::getActionJournalOptions(_env, jNativeMapOptions));
map = std::make_unique<mln::Map>(*rendererFrontend,
*this,
options,
mln::android::FileSource::getSharedResourceOptions(_env, jFileSource),
mln::android::FileSource::getSharedClientOptions(_env, jFileSource),
mln::android::NativeMapOptions::getActionJournalOptions(_env, jNativeMapOptions));
}
/**
@@ -262,7 +261,7 @@ void NativeMapView::onDidFinishLoadingStyle() {
}
}
void NativeMapView::onSourceChanged(mbgl::style::Source& source) {
void NativeMapView::onSourceChanged(mln::style::Source& source) {
assert(vm != nullptr);
android::UniqueEnv _env = android::AttachEnv();
@@ -326,12 +325,12 @@ void NativeMapView::setStyleJson(jni::JNIEnv& env, const jni::String& json) {
map->getStyle().loadJSON(jni::Make<std::string>(env, json));
}
void NativeMapView::setLatLngBounds(jni::JNIEnv& env, const jni::Object<mbgl::android::LatLngBounds>& jBounds) {
mbgl::BoundOptions bounds;
void NativeMapView::setLatLngBounds(jni::JNIEnv& env, const jni::Object<mln::android::LatLngBounds>& jBounds) {
mln::BoundOptions bounds;
if (jBounds) {
bounds.withLatLngBounds(mbgl::android::LatLngBounds::getLatLngBounds(env, jBounds));
bounds.withLatLngBounds(mln::android::LatLngBounds::getLatLngBounds(env, jBounds));
} else {
bounds.withLatLngBounds(mbgl::LatLngBounds());
bounds.withLatLngBounds(mln::LatLngBounds());
}
map->setBounds(bounds);
}
@@ -345,10 +344,10 @@ void NativeMapView::setGestureInProgress(jni::JNIEnv&, jni::jboolean inProgress)
}
void NativeMapView::moveBy(jni::JNIEnv&, jni::jdouble dx, jni::jdouble dy, jni::jlong duration) {
mbgl::AnimationOptions animationOptions;
mln::AnimationOptions animationOptions;
if (duration > 0) {
animationOptions.duration.emplace(mbgl::Milliseconds(duration));
animationOptions.easing.emplace(mbgl::util::UnitBezier{0.1, 0.4, 0.35, 1.0});
animationOptions.duration.emplace(mln::Milliseconds(duration));
animationOptions.easing.emplace(mln::util::UnitBezier{0.1, 0.4, 0.35, 1.0});
}
map->moveBy({dx, dy}, animationOptions);
}
@@ -360,14 +359,14 @@ void NativeMapView::jumpTo(jni::JNIEnv& env,
jni::jdouble pitch,
jni::jdouble zoom,
const jni::Array<jni::jdouble>& padding) {
mbgl::CameraOptions options;
mln::CameraOptions options;
if (bearing != -1) {
options.bearing = bearing;
}
options.center = mbgl::LatLng(latitude, longitude);
options.center = mln::LatLng(latitude, longitude);
if (padding) {
assert(padding.Length(env) == 4);
options.padding = mbgl::EdgeInsets{
options.padding = mln::EdgeInsets{
padding.Get(env, 0), padding.Get(env, 1), padding.Get(env, 2), padding.Get(env, 3)};
}
if (pitch != -1) {
@@ -389,14 +388,14 @@ void NativeMapView::easeTo(jni::JNIEnv& env,
jni::jdouble zoom,
const jni::Array<jni::jdouble>& padding,
jni::jboolean easing) {
mbgl::CameraOptions cameraOptions;
mln::CameraOptions cameraOptions;
if (bearing != -1) {
cameraOptions.bearing = bearing;
}
cameraOptions.center = mbgl::LatLng(latitude, longitude);
cameraOptions.center = mln::LatLng(latitude, longitude);
if (padding) {
assert(padding.Length(env) == 4);
cameraOptions.padding = mbgl::EdgeInsets{
cameraOptions.padding = mln::EdgeInsets{
padding.Get(env, 0), padding.Get(env, 1), padding.Get(env, 2), padding.Get(env, 3)};
}
if (pitch != -1) {
@@ -406,11 +405,11 @@ void NativeMapView::easeTo(jni::JNIEnv& env,
cameraOptions.zoom = zoom;
}
mbgl::AnimationOptions animationOptions;
animationOptions.duration.emplace(mbgl::Milliseconds(duration));
mln::AnimationOptions animationOptions;
animationOptions.duration.emplace(mln::Milliseconds(duration));
if (!easing) {
// add a linear interpolator instead of easing
animationOptions.easing.emplace(mbgl::util::UnitBezier{0, 0, 1, 1});
animationOptions.easing.emplace(mln::util::UnitBezier{0, 0, 1, 1});
}
map->easeTo(cameraOptions, animationOptions);
@@ -424,14 +423,14 @@ void NativeMapView::flyTo(jni::JNIEnv& env,
jni::jdouble pitch,
jni::jdouble zoom,
const jni::Array<jni::jdouble>& padding) {
mbgl::CameraOptions cameraOptions;
mln::CameraOptions cameraOptions;
if (bearing != -1) {
cameraOptions.bearing = bearing;
}
cameraOptions.center = mbgl::LatLng(latitude, longitude);
cameraOptions.center = mln::LatLng(latitude, longitude);
if (padding) {
assert(padding.Length(env) == 4);
cameraOptions.padding = mbgl::EdgeInsets{
cameraOptions.padding = mln::EdgeInsets{
padding.Get(env, 0), padding.Get(env, 1), padding.Get(env, 2), padding.Get(env, 3)};
}
if (pitch != -1) {
@@ -441,8 +440,8 @@ void NativeMapView::flyTo(jni::JNIEnv& env,
cameraOptions.zoom = zoom;
}
mbgl::AnimationOptions animationOptions;
animationOptions.duration.emplace(mbgl::Milliseconds(duration));
mln::AnimationOptions animationOptions;
animationOptions.duration.emplace(mln::Milliseconds(duration));
map->flyTo(cameraOptions, animationOptions);
}
@@ -455,14 +454,14 @@ void NativeMapView::setLatLng(jni::JNIEnv& env,
jni::jdouble longitude,
const jni::Array<jni::jdouble>& padding,
jni::jlong duration) {
mbgl::CameraOptions cameraOptions;
cameraOptions.center = mbgl::LatLng(latitude, longitude);
mln::CameraOptions cameraOptions;
cameraOptions.center = mln::LatLng(latitude, longitude);
if (padding) {
assert(padding.Length(env) == 4);
cameraOptions.padding = mbgl::EdgeInsets{
cameraOptions.padding = mln::EdgeInsets{
padding.Get(env, 0), padding.Get(env, 1), padding.Get(env, 2), padding.Get(env, 3)};
}
map->easeTo(cameraOptions, mbgl::AnimationOptions{mbgl::Milliseconds(duration)});
map->easeTo(cameraOptions, mln::AnimationOptions{mln::Milliseconds(duration)});
}
jni::Local<jni::Object<CameraPosition>> NativeMapView::getCameraForLatLngBounds(
@@ -474,10 +473,10 @@ jni::Local<jni::Object<CameraPosition>> NativeMapView::getCameraForLatLngBounds(
double right,
double bearing,
double tilt) {
mbgl::EdgeInsets padding = {top, left, bottom, right};
mln::EdgeInsets padding = {top, left, bottom, right};
return CameraPosition::New(
env,
map->cameraForLatLngBounds(mbgl::android::LatLngBounds::getLatLngBounds(env, jBounds), padding, bearing, tilt),
map->cameraForLatLngBounds(mln::android::LatLngBounds::getLatLngBounds(env, jBounds), padding, bearing, tilt),
pixelRatio);
}
@@ -491,18 +490,18 @@ jni::Local<jni::Object<CameraPosition>> NativeMapView::getCameraForGeometry(
double bearing,
double tilt) {
auto geometry = geojson::Geometry::convert(env, jGeometry);
mbgl::EdgeInsets padding = {top, left, bottom, right};
mln::EdgeInsets padding = {top, left, bottom, right};
return CameraPosition::New(env, map->cameraForGeometry(geometry, padding, bearing, tilt), pixelRatio);
}
void NativeMapView::setReachability(jni::JNIEnv&, jni::jboolean reachable) {
if (reachable) {
mbgl::NetworkStatus::Reachable();
mln::NetworkStatus::Reachable();
}
}
void NativeMapView::resetPosition(jni::JNIEnv&) {
map->jumpTo(mbgl::CameraOptions().withCenter(mbgl::LatLng{}).withZoom(0.0).withBearing(0.0).withPitch(0.0));
map->jumpTo(mln::CameraOptions().withCenter(mln::LatLng{}).withZoom(0.0).withBearing(0.0).withPitch(0.0));
}
jni::jdouble NativeMapView::getPitch(jni::JNIEnv&) {
@@ -510,12 +509,12 @@ jni::jdouble NativeMapView::getPitch(jni::JNIEnv&) {
}
void NativeMapView::setPitch(jni::JNIEnv&, jni::jdouble pitch, jni::jlong duration) {
map->easeTo(mbgl::CameraOptions().withPitch(pitch), mbgl::AnimationOptions{mbgl::Milliseconds(duration)});
map->easeTo(mln::CameraOptions().withPitch(pitch), mln::AnimationOptions{mln::Milliseconds(duration)});
}
void NativeMapView::setZoom(jni::JNIEnv&, jni::jdouble zoom, jni::jdouble x, jni::jdouble y, jni::jlong duration) {
map->easeTo(mbgl::CameraOptions().withZoom(zoom).withAnchor(mbgl::ScreenCoordinate{x, y}),
mbgl::AnimationOptions{mbgl::Milliseconds(duration)});
map->easeTo(mln::CameraOptions().withZoom(zoom).withAnchor(mln::ScreenCoordinate{x, y}),
mln::AnimationOptions{mln::Milliseconds(duration)});
}
jni::jdouble NativeMapView::getZoom(jni::JNIEnv&) {
@@ -523,7 +522,7 @@ jni::jdouble NativeMapView::getZoom(jni::JNIEnv&) {
}
void NativeMapView::resetZoom(jni::JNIEnv&) {
map->jumpTo(mbgl::CameraOptions().withZoom(0.0));
map->jumpTo(mln::CameraOptions().withZoom(0.0));
}
void NativeMapView::setMinZoom(jni::JNIEnv&, jni::jdouble zoom) {
@@ -560,20 +559,20 @@ jni::jdouble NativeMapView::getMaxPitch(jni::JNIEnv&) {
void NativeMapView::rotateBy(
jni::JNIEnv&, jni::jdouble sx, jni::jdouble sy, jni::jdouble ex, jni::jdouble ey, jni::jlong duration) {
mbgl::ScreenCoordinate first(sx, sy);
mbgl::ScreenCoordinate second(ex, ey);
map->rotateBy(first, second, mbgl::AnimationOptions{mbgl::Milliseconds(duration)});
mln::ScreenCoordinate first(sx, sy);
mln::ScreenCoordinate second(ex, ey);
map->rotateBy(first, second, mln::AnimationOptions{mln::Milliseconds(duration)});
}
void NativeMapView::setBearing(jni::JNIEnv&, jni::jdouble degrees, jni::jlong duration) {
map->easeTo(mbgl::CameraOptions().withBearing(degrees), mbgl::AnimationOptions{mbgl::Milliseconds(duration)});
map->easeTo(mln::CameraOptions().withBearing(degrees), mln::AnimationOptions{mln::Milliseconds(duration)});
}
void NativeMapView::setBearingXY(
jni::JNIEnv&, jni::jdouble degrees, jni::jdouble cx, jni::jdouble cy, jni::jlong duration) {
mbgl::ScreenCoordinate anchor(cx, cy);
map->easeTo(mbgl::CameraOptions().withBearing(degrees).withAnchor(anchor),
mbgl::AnimationOptions{mbgl::Milliseconds(duration)});
mln::ScreenCoordinate anchor(cx, cy);
map->easeTo(mln::CameraOptions().withBearing(degrees).withAnchor(anchor),
mln::AnimationOptions{mln::Milliseconds(duration)});
}
jni::jdouble NativeMapView::getBearing(jni::JNIEnv&) {
@@ -581,7 +580,7 @@ jni::jdouble NativeMapView::getBearing(jni::JNIEnv&) {
}
void NativeMapView::resetNorth(jni::JNIEnv&) {
map->easeTo(mbgl::CameraOptions().withBearing(0.0), mbgl::AnimationOptions{{mbgl::Milliseconds(500)}});
map->easeTo(mln::CameraOptions().withBearing(0.0), mln::AnimationOptions{{mln::Milliseconds(500)}});
}
void NativeMapView::setVisibleCoordinateBounds(JNIEnv& env,
@@ -592,27 +591,27 @@ void NativeMapView::setVisibleCoordinateBounds(JNIEnv& env,
NullCheck(env, &coordinates);
std::size_t count = coordinates.Length(env);
std::vector<mbgl::LatLng> latLngs;
std::vector<mln::LatLng> latLngs;
latLngs.reserve(count);
for (std::size_t i = 0; i < count; i++) {
latLngs.push_back(LatLng::getLatLng(env, coordinates.Get(env, i)));
}
mbgl::EdgeInsets mbglInsets = {RectF::getTop(env, padding),
RectF::getLeft(env, padding),
RectF::getBottom(env, padding),
RectF::getRight(env, padding)};
mbgl::CameraOptions cameraOptions = map->cameraForLatLngs(latLngs, mbglInsets);
mln::EdgeInsets mbglInsets = {RectF::getTop(env, padding),
RectF::getLeft(env, padding),
RectF::getBottom(env, padding),
RectF::getRight(env, padding)};
mln::CameraOptions cameraOptions = map->cameraForLatLngs(latLngs, mbglInsets);
if (direction >= 0) {
cameraOptions.bearing = direction;
}
mbgl::AnimationOptions animationOptions;
mln::AnimationOptions animationOptions;
if (duration > 0) {
animationOptions.duration.emplace(mbgl::Milliseconds(duration));
animationOptions.duration.emplace(mln::Milliseconds(duration));
// equivalent to kCAMediaTimingFunctionDefault in iOS
animationOptions.easing.emplace(mbgl::util::UnitBezier{0.25, 0.1, 0.25, 0.1});
animationOptions.easing.emplace(mln::util::UnitBezier{0.25, 0.1, 0.25, 0.1});
}
map->easeTo(cameraOptions, animationOptions);
@@ -666,7 +665,7 @@ void NativeMapView::updateMarker(
std::string iconId = jni::Make<std::string>(env, jid);
// Because Java only has int, not unsigned int, we need to bump the annotation id up to a long.
map->updateAnnotation(markerId, mbgl::SymbolAnnotation{mbgl::Point<double>(lon, lat), iconId});
map->updateAnnotation(markerId, mln::SymbolAnnotation{mln::Point<double>(lon, lat), iconId});
}
jni::Local<jni::Array<jni::jlong>> NativeMapView::addMarkers(jni::JNIEnv& env,
@@ -680,7 +679,7 @@ jni::Local<jni::Array<jni::jlong>> NativeMapView::addMarkers(jni::JNIEnv& env,
for (std::size_t i = 0; i < len; i++) {
auto marker = jmarkers.Get(env, i);
ids.push_back(map->addAnnotation(
mbgl::SymbolAnnotation{Marker::getPosition(env, marker), Marker::getIconId(env, marker)}));
mln::SymbolAnnotation{Marker::getPosition(env, marker), Marker::getIconId(env, marker)}));
}
auto result = jni::Array<jni::jlong>::New(env, len);
@@ -693,7 +692,7 @@ void NativeMapView::onLowMemory(JNIEnv&) {
rendererFrontend->reduceMemoryUse();
}
using DebugOptions = mbgl::MapDebugOptions;
using DebugOptions = mln::MapDebugOptions;
void NativeMapView::setDebug(JNIEnv&, jni::jboolean debug) {
DebugOptions debugOptions = debug ? DebugOptions::TileBorders | DebugOptions::ParseStatus | DebugOptions::Collision
@@ -751,25 +750,24 @@ jni::jboolean NativeMapView::isFullyLoaded(JNIEnv&) {
}
jni::jdouble NativeMapView::getMetersPerPixelAtLatitude(JNIEnv&, jni::jdouble lat, jni::jdouble zoom) {
return mbgl::Projection::getMetersPerPixelAtLatitude(lat, zoom);
return mln::Projection::getMetersPerPixelAtLatitude(lat, zoom);
}
jni::Local<jni::Object<ProjectedMeters>> NativeMapView::projectedMetersForLatLng(JNIEnv& env,
jni::jdouble latitude,
jni::jdouble longitude) {
mbgl::ProjectedMeters projectedMeters = mbgl::Projection::projectedMetersForLatLng(
mbgl::LatLng(latitude, longitude));
mln::ProjectedMeters projectedMeters = mln::Projection::projectedMetersForLatLng(mln::LatLng(latitude, longitude));
return ProjectedMeters::New(env, projectedMeters.northing(), projectedMeters.easting());
}
jni::Local<jni::Object<LatLng>> NativeMapView::latLngForProjectedMeters(JNIEnv& env,
jdouble northing,
jdouble easting) {
return LatLng::New(env, mbgl::Projection::latLngForProjectedMeters(mbgl::ProjectedMeters(northing, easting)));
return LatLng::New(env, mln::Projection::latLngForProjectedMeters(mln::ProjectedMeters(northing, easting)));
}
jni::Local<jni::Object<PointF>> NativeMapView::pixelForLatLng(JNIEnv& env, jdouble latitude, jdouble longitude) {
mbgl::ScreenCoordinate pixel = map->pixelForLatLng(mbgl::LatLng(latitude, longitude));
mln::ScreenCoordinate pixel = map->pixelForLatLng(mln::LatLng(latitude, longitude));
return PointF::New(env, static_cast<float>(pixel.x), static_cast<float>(pixel.y));
}
@@ -780,11 +778,11 @@ void NativeMapView::pixelsForLatLngs(JNIEnv& env,
jni::NullCheck(env, &input);
std::size_t len = input.Length(env);
std::vector<mbgl::LatLng> latLngs;
std::vector<mln::LatLng> latLngs;
latLngs.reserve(len);
for (std::size_t i = 0; i < len; i += 2) {
auto latLng = mbgl::LatLng(input.Get(env, i), input.Get(env, i + 1));
auto latLng = mln::LatLng(input.Get(env, i), input.Get(env, i + 1));
latLngs.push_back(latLng);
}
@@ -800,7 +798,7 @@ void NativeMapView::pixelsForLatLngs(JNIEnv& env,
}
jni::Local<jni::Object<LatLng>> NativeMapView::latLngForPixel(JNIEnv& env, jfloat x, jfloat y) {
return LatLng::New(env, map->latLngForPixel(mbgl::ScreenCoordinate(x, y)));
return LatLng::New(env, map->latLngForPixel(mln::ScreenCoordinate(x, y)));
}
void NativeMapView::latLngsForPixels(JNIEnv& env,
@@ -810,17 +808,17 @@ void NativeMapView::latLngsForPixels(JNIEnv& env,
jni::NullCheck(env, &input);
std::size_t len = input.Length(env);
std::vector<mbgl::ScreenCoordinate> coordinates;
std::vector<mln::ScreenCoordinate> coordinates;
coordinates.reserve(len);
for (std::size_t i = 0; i < len; i += 2) {
auto coordinate = mbgl::ScreenCoordinate(input.Get(env, i) / pixelRatio_, input.Get(env, i + 1) / pixelRatio_);
auto coordinate = mln::ScreenCoordinate(input.Get(env, i) / pixelRatio_, input.Get(env, i + 1) / pixelRatio_);
coordinates.push_back(coordinate);
}
std::vector<jdouble> buffer;
buffer.reserve(len);
std::vector<mbgl::LatLng> latLngs = map->latLngsForPixels(coordinates);
std::vector<mln::LatLng> latLngs = map->latLngsForPixels(coordinates);
for (std::size_t i = 0; i < len / 2; i++) {
buffer.push_back(latLngs[i].latitude());
buffer.push_back(latLngs[i].longitude());
@@ -838,7 +836,7 @@ jni::Local<jni::Array<jlong>> NativeMapView::addPolylines(JNIEnv& env,
ids.reserve(len);
for (std::size_t i = 0; i < len; i++) {
mbgl::LineAnnotation annotation = Polyline::toAnnotation(env, polylines.Get(env, i));
mln::LineAnnotation annotation = Polyline::toAnnotation(env, polylines.Get(env, i));
ids.push_back(map->addAnnotation(annotation));
}
@@ -857,7 +855,7 @@ jni::Local<jni::Array<jlong>> NativeMapView::addPolygons(JNIEnv& env,
ids.reserve(len);
for (std::size_t i = 0; i < len; i++) {
mbgl::FillAnnotation annotation = Polygon::toAnnotation(env, polygons.Get(env, i));
mln::FillAnnotation annotation = Polygon::toAnnotation(env, polygons.Get(env, i));
ids.push_back(map->addAnnotation(annotation));
}
@@ -868,12 +866,12 @@ jni::Local<jni::Array<jlong>> NativeMapView::addPolygons(JNIEnv& env,
}
void NativeMapView::updatePolyline(JNIEnv& env, jlong polylineId, const jni::Object<Polyline>& polyline) {
mbgl::LineAnnotation annotation = Polyline::toAnnotation(env, polyline);
mln::LineAnnotation annotation = Polyline::toAnnotation(env, polyline);
map->updateAnnotation(polylineId, annotation);
}
void NativeMapView::updatePolygon(JNIEnv& env, jlong polygonId, const jni::Object<Polygon>& polygon) {
mbgl::FillAnnotation annotation = Polygon::toAnnotation(env, polygon);
mln::FillAnnotation annotation = Polygon::toAnnotation(env, polygon);
map->updateAnnotation(polygonId, annotation);
}
@@ -898,14 +896,14 @@ void NativeMapView::addAnnotationIcon(
NullCheck(env, &jpixels);
std::size_t size = jpixels.Length(env);
mbgl::PremultipliedImage premultipliedImage({static_cast<uint32_t>(w), static_cast<uint32_t>(h)});
mln::PremultipliedImage premultipliedImage({static_cast<uint32_t>(w), static_cast<uint32_t>(h)});
if (premultipliedImage.bytes() != uint32_t(size)) {
throw mbgl::util::StyleImageException("Annotation icon image pixel count mismatch");
throw mln::util::StyleImageException("Annotation icon image pixel count mismatch");
}
jni::GetArrayRegion(env, *jpixels, 0, size, reinterpret_cast<jbyte*>(premultipliedImage.data.get()));
map->addAnnotationImage(
std::make_unique<mbgl::style::Image>(symbolName, std::move(premultipliedImage), static_cast<float>(scale)));
std::make_unique<mln::style::Image>(symbolName, std::move(premultipliedImage), static_cast<float>(scale)));
}
void NativeMapView::removeAnnotationIcon(JNIEnv& env, const jni::String& symbol) {
@@ -920,35 +918,35 @@ jdouble NativeMapView::getTopOffsetPixelsForAnnotationSymbol(JNIEnv& env, const
jni::Local<jni::Object<TransitionOptions>> NativeMapView::getTransitionOptions(JNIEnv& env) {
const auto transitionOptions = map->getStyle().getTransitionOptions();
const auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(
transitionOptions.duration.value_or(mbgl::Duration::zero()))
transitionOptions.duration.value_or(mln::Duration::zero()))
.count();
const auto delay = std::chrono::duration_cast<std::chrono::milliseconds>(
transitionOptions.delay.value_or(mbgl::Duration::zero()))
transitionOptions.delay.value_or(mln::Duration::zero()))
.count();
const auto enablePlacementTransitions = (jboolean)transitionOptions.enablePlacementTransitions;
return TransitionOptions::fromTransitionOptions(env, duration, delay, enablePlacementTransitions);
}
void NativeMapView::setTransitionOptions(JNIEnv& env, const jni::Object<TransitionOptions>& options) {
const mbgl::style::TransitionOptions transitionOptions(
Duration(mbgl::Milliseconds(TransitionOptions::getDuration(env, options))),
Duration(mbgl::Milliseconds(TransitionOptions::getDelay(env, options))),
const mln::style::TransitionOptions transitionOptions(
Duration(mln::Milliseconds(TransitionOptions::getDuration(env, options))),
Duration(mln::Milliseconds(TransitionOptions::getDelay(env, options))),
TransitionOptions::isEnablePlacementTransitions(env, options));
map->getStyle().setTransitionOptions(transitionOptions);
}
jni::Local<jni::Array<jlong>> NativeMapView::queryPointAnnotations(JNIEnv& env, const jni::Object<RectF>& rect) {
using namespace mbgl::style;
using namespace mbgl::style::conversion;
using namespace mln::style;
using namespace mln::style::conversion;
// Convert input
mbgl::ScreenBox box = {
mln::ScreenBox box = {
{RectF::getLeft(env, rect), RectF::getTop(env, rect)},
{RectF::getRight(env, rect), RectF::getBottom(env, rect)},
};
// Assume only points for now
mbgl::AnnotationIDs ids = rendererFrontend->queryPointAnnotations(box, annotationRequestTimeout);
mln::AnnotationIDs ids = rendererFrontend->queryPointAnnotations(box, annotationRequestTimeout);
// Convert result
std::vector<jlong> longIds(ids.begin(), ids.end());
@@ -959,16 +957,16 @@ jni::Local<jni::Array<jlong>> NativeMapView::queryPointAnnotations(JNIEnv& env,
}
jni::Local<jni::Array<jlong>> NativeMapView::queryShapeAnnotations(JNIEnv& env, const jni::Object<RectF>& rect) {
using namespace mbgl::style;
using namespace mbgl::style::conversion;
using namespace mln::style;
using namespace mln::style::conversion;
// Convert input
mbgl::ScreenBox box = {
mln::ScreenBox box = {
{RectF::getLeft(env, rect), RectF::getTop(env, rect)},
{RectF::getRight(env, rect), RectF::getBottom(env, rect)},
};
mbgl::AnnotationIDs ids = rendererFrontend->queryShapeAnnotations(box, annotationRequestTimeout);
mln::AnnotationIDs ids = rendererFrontend->queryShapeAnnotations(box, annotationRequestTimeout);
// Convert result
std::vector<jlong> longIds(ids.begin(), ids.end());
@@ -984,8 +982,8 @@ jni::Local<jni::Array<jni::Object<geojson::Feature>>> NativeMapView::queryRender
jni::jfloat y,
const jni::Array<jni::String>& layerIds,
const jni::Array<jni::Object<>>& jfilter) {
using namespace mbgl::android::conversion;
using namespace mbgl::android::geojson;
using namespace mln::android::conversion;
using namespace mln::android::geojson;
std::optional<std::vector<std::string>> layers;
if (layerIds && layerIds.Length(env) > 0) {
@@ -1004,8 +1002,8 @@ jni::Local<jni::Array<jni::Object<geojson::Feature>>> NativeMapView::queryRender
jni::jfloat bottom,
const jni::Array<jni::String>& layerIds,
const jni::Array<jni::Object<>>& jfilter) {
using namespace mbgl::android::conversion;
using namespace mbgl::android::geojson;
using namespace mln::android::conversion;
using namespace mln::android::geojson;
std::optional<std::vector<std::string>> layers;
if (layerIds && layerIds.Length(env) > 0) {
@@ -1071,7 +1069,7 @@ void NativeMapView::removeFeatureState(JNIEnv& env,
}
jni::Local<jni::Object<Light>> NativeMapView::getLight(JNIEnv& env) {
mbgl::style::Light* light = map->getStyle().getLight();
mln::style::Light* light = map->getStyle().getLight();
if (light) {
return Light::createJavaLightPeer(env, *map, *light);
} else {
@@ -1096,9 +1094,9 @@ jni::Local<jni::Array<jni::Object<Layer>>> NativeMapView::getLayers(JNIEnv& env)
jni::Local<jni::Object<Layer>> NativeMapView::getLayer(JNIEnv& env, const jni::String& layerId) {
// Find the layer
mbgl::style::Layer* coreLayer = map->getStyle().getLayer(jni::Make<std::string>(env, layerId));
mln::style::Layer* coreLayer = map->getStyle().getLayer(jni::Make<std::string>(env, layerId));
if (!coreLayer) {
mbgl::Log::Debug(mbgl::Event::JNI, "No layer found");
mln::Log::Debug(mln::Event::JNI, "No layer found");
return jni::Local<jni::Object<Layer>>();
}
@@ -1197,7 +1195,7 @@ jni::jboolean NativeMapView::removeLayerAt(JNIEnv& env, jni::jint index) {
return jni::jni_false;
}
std::unique_ptr<mbgl::style::Layer> coreLayer = map->getStyle().removeLayer(layers.at(index)->getID());
std::unique_ptr<mln::style::Layer> coreLayer = map->getStyle().removeLayer(layers.at(index)->getID());
if (coreLayer) {
jni::Local<jni::Object<Layer>> layerObj = LayerManagerAndroid::get()->createJavaLayerPeer(env,
std::move(coreLayer));
@@ -1215,14 +1213,14 @@ jni::jboolean NativeMapView::removeLayer(JNIEnv& env, jlong layerPtr) {
return jni::jni_false;
}
mbgl::android::Layer* layer = reinterpret_cast<mbgl::android::Layer*>(layerPtr);
mln::android::Layer* layer = reinterpret_cast<mln::android::Layer*>(layerPtr);
const auto layerId = jni::Make<std::string>(env, layer->getId(env));
if (layerId.empty()) {
Log::Warning(Event::JNI, "Cannot remove layer: layer reference is detached or invalid");
return jni::jni_false;
}
std::unique_ptr<mbgl::style::Layer> coreLayer = map->getStyle().removeLayer(layerId);
std::unique_ptr<mln::style::Layer> coreLayer = map->getStyle().removeLayer(layerId);
if (coreLayer) {
layer->setLayer(std::move(coreLayer));
return jni::jni_true;
@@ -1247,9 +1245,9 @@ jni::Local<jni::Array<jni::Object<Source>>> NativeMapView::getSources(JNIEnv& en
jni::Local<jni::Object<Source>> NativeMapView::getSource(JNIEnv& env, const jni::String& sourceId) {
// Find the source
mbgl::style::Source* coreSource = map->getStyle().getSource(jni::Make<std::string>(env, sourceId));
mln::style::Source* coreSource = map->getStyle().getSource(jni::Make<std::string>(env, sourceId));
if (!coreSource) {
mbgl::Log::Debug(mbgl::Event::JNI, "No source found");
mln::Log::Debug(mln::Event::JNI, "No source found");
return jni::Local<jni::Object<Source>>();
}
@@ -1272,7 +1270,7 @@ void NativeMapView::addSource(JNIEnv& env, const jni::Object<Source>& obj, jlong
jni::jboolean NativeMapView::removeSource(JNIEnv& env, const jni::Object<Source>& obj, jlong sourcePtr) {
assert(sourcePtr != 0);
mbgl::android::Source* source = reinterpret_cast<mbgl::android::Source*>(sourcePtr);
mln::android::Source* source = reinterpret_cast<mln::android::Source*>(sourcePtr);
if (source->removeFromMap(env, obj, *map)) {
source->releaseJavaPeer();
return jni::jni_true;
@@ -1284,19 +1282,19 @@ jni::jboolean NativeMapView::removeSource(JNIEnv& env, const jni::Object<Source>
void NativeMapView::addImage(
JNIEnv& env, const jni::String& name, const jni::Object<Bitmap>& bitmap, jni::jfloat scale, jni::jboolean sdf) {
jni::NullCheck(env, &bitmap);
mbgl::PremultipliedImage premultipliedImage = Bitmap::GetImage(env, bitmap);
mln::PremultipliedImage premultipliedImage = Bitmap::GetImage(env, bitmap);
map->getStyle().addImage(std::make_unique<mbgl::style::Image>(
map->getStyle().addImage(std::make_unique<mln::style::Image>(
jni::Make<std::string>(env, name), std::move(premultipliedImage), static_cast<float>(scale), sdf));
}
void NativeMapView::addImages(JNIEnv& env, const jni::Array<jni::Object<mbgl::android::Image>>& jimages) {
void NativeMapView::addImages(JNIEnv& env, const jni::Array<jni::Object<mln::android::Image>>& jimages) {
jni::NullCheck(env, &jimages);
std::size_t len = jimages.Length(env);
for (std::size_t i = 0; i < len; i++) {
auto image = mbgl::android::Image::getImage(env, jimages.Get(env, i));
map->getStyle().addImage(std::make_unique<mbgl::style::Image>(image));
auto image = mln::android::Image::getImage(env, jimages.Get(env, i));
map->getStyle().addImage(std::make_unique<mln::style::Image>(image));
}
}
@@ -1367,7 +1365,7 @@ jni::jdouble NativeMapView::getTileLodZoomShift(JNIEnv&) {
return jni::jdouble(map->getTileLodZoomShift());
}
mbgl::Map& NativeMapView::getMap() {
mln::Map& NativeMapView::getMap() {
return *map;
}
@@ -1387,10 +1385,10 @@ void NativeMapView::enableRenderingStatsView(JNIEnv&, jni::jboolean value) {
}
void NativeMapView::setFrustumOffset(JNIEnv& env, const jni::Object<RectF>& padding) {
mbgl::EdgeInsets offset = {RectF::getTop(env, padding),
RectF::getLeft(env, padding),
RectF::getBottom(env, padding),
RectF::getRight(env, padding)};
mln::EdgeInsets offset = {RectF::getTop(env, padding),
RectF::getLeft(env, padding),
RectF::getBottom(env, padding),
RectF::getRight(env, padding)};
map->setFrustumOffset(offset);
}
@@ -1642,19 +1640,19 @@ void NativeMapView::onGlyphsRequested(const FontStack& stack, const GlyphRange&
}
// Tile requests
void NativeMapView::onTileAction(mbgl::TileOperation op, const OverscaledTileID& id, const std::string& sourceID) {
void NativeMapView::onTileAction(mln::TileOperation op, const OverscaledTileID& id, const std::string& sourceID) {
assert(vm != nullptr);
android::UniqueEnv _env = android::AttachEnv();
static auto& javaClass = jni::Class<NativeMapView>::Singleton(*_env);
static auto onTileAction = javaClass.GetMethod<void(
jni::Object<mbgl::android::TileOperation>, jni::jint, jni::jint, jni::jint, jni::jint, jni::jint, jni::String)>(
jni::Object<mln::android::TileOperation>, jni::jint, jni::jint, jni::jint, jni::jint, jni::jint, jni::String)>(
*_env, "onTileAction");
auto weakReference = javaPeer.get(*_env);
if (weakReference) {
weakReference.Call(*_env,
onTileAction,
mbgl::android::TileOperation::Create(*_env, op),
mln::android::TileOperation::Create(*_env, op),
static_cast<jni::jint>(id.canonical.x),
static_cast<jni::jint>(id.canonical.y),
static_cast<jni::jint>(id.canonical.z),
@@ -1750,4 +1748,4 @@ void NativeMapView::onSymbolError(const std::string& message) {
}
} // namespace android
} // namespace mbgl
} // namespace mln

Some files were not shown because too many files have changed in this diff Show More