#pragma once #include "node_file_source.hpp" #include #include #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wshadow" #include #pragma GCC diagnostic pop #include namespace node_mbgl { class NodeMap : public Nan::ObjectWrap { public: struct RenderOptions; class RenderWorker; static NAN_MODULE_INIT(Init); static NAN_METHOD(New); static NAN_METHOD(Load); static NAN_METHOD(Render); static NAN_METHOD(Release); void startRender(std::unique_ptr options); void renderFinished(); void release(); inline bool isLoaded() { return loaded; } inline bool isValid() { return valid; } static std::unique_ptr ParseOptions(v8::Local); static Nan::Persistent constructor; private: NodeMap(v8::Local); ~NodeMap(); mbgl::HeadlessView view; NodeFileSource fs; std::unique_ptr map; std::exception_ptr error; std::unique_ptr image; std::unique_ptr callback; // Async for delivering the notifications of render completion. uv_async_t *async; bool loaded = false; bool valid = true; }; }