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

@@ -208,7 +208,7 @@ Note: this release has some changes to how icon offsets behave on pitched maps.
### 🐞 Bug fixes
- [vulkan] Prevent member variable shadowing in `mbgl::vulkan::ShaderProgram` ([#3886](https://github.com/maplibre/maplibre-native/pull/3886)).
- [vulkan] Prevent member variable shadowing in `mln::vulkan::ShaderProgram` ([#3886](https://github.com/maplibre/maplibre-native/pull/3886)).
- Add padding support to MapSnapshotter Android ([#3882](https://github.com/maplibre/maplibre-native/pull/3882)).
- Fix `requestRenderAndNotify` continuous callback ([#3913](https://github.com/maplibre/maplibre-native/pull/3913)).
- Add null check to Projection.getContentPadding() ([#3937](https://github.com/maplibre/maplibre-native/pull/3937)).
@@ -1911,7 +1911,7 @@ Please see https://github.com/square/okhttp/issues/2679 for more information.
- SymbolBucket, use single map for paint properties data [#13724](https://github.com/mapbox/mapbox-gl-native/pull/13724)
- Avoid NullPointerException when quickly closing activity for attribution click handling [#13723](https://github.com/mapbox/mapbox-gl-native/pull/13723)
- Return constexpr strings from functions to avoid ODR compile failures [#13720](https://github.com/mapbox/mapbox-gl-native/pull/13720)
- Split layer type specific code in mbgl::Programs [#13577](https://github.com/mapbox/mapbox-gl-native/pull/13577)
- Split layer type specific code in mln::Programs [#13577](https://github.com/mapbox/mapbox-gl-native/pull/13577)
- Shader program must always match bucket in render symbol layer [#13667](https://github.com/mapbox/mapbox-gl-native/pull/13667)
- Implement Google benchmark runner for Android platform [#13628](https://github.com/mapbox/mapbox-gl-native/pull/13628)
- Avoid leaking attribution dialog when hosting context is stopped [#13673](https://github.com/mapbox/mapbox-gl-native/pull/13673)

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

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