#ifndef MBGL_ANDROID_NATIVE_MAP_VIEW #define MBGL_ANDROID_NATIVE_MAP_VIEW #include #include #include #include #include #include #include namespace mbgl { namespace android { class NativeMapView; class MBGLView: public mbgl::View, private mbgl::util::noncopyable { public: explicit MBGLView(NativeMapView& nativeView_) : nativeView(nativeView_) { } void make_active() override; void make_inactive() override; void swap() override; void notify() override; void notify_map_change(mbgl::MapChange change, mbgl::timestamp delay = 0) override; private: NativeMapView& nativeView; }; class NativeMapView : private mbgl::util::noncopyable { friend class MBGLView; public: NativeMapView(JNIEnv* env, jobject obj); ~NativeMapView(); mbgl::Map& getMap() { return map; } bool initializeDisplay(); void terminateDisplay(); bool initializeContext(); void terminateContext(); bool createSurface(ANativeWindow* window); void destroySurface(); void start(); void stop(); void resume(); void pause(bool wait_for_pause = false); void notifyMapChange(); private: EGLConfig chooseConfig(const EGLConfig configs[], EGLint num_configs); void loadExtensions(); private: JavaVM* vm = nullptr; jobject obj = nullptr; ANativeWindow* window = nullptr; MBGLView view; // Must be before map mbgl::Map map; EGLDisplay display = EGL_NO_DISPLAY; EGLSurface surface = EGL_NO_SURFACE; EGLContext context = EGL_NO_CONTEXT; EGLConfig config = nullptr; EGLint format = -1; std::string style_url; std::string api_key; bool first_time = false; bool using_depth24 = false; }; } } #endif