Files
MapLibreParticleLab/src/node_map.hpp
Konstantin Käfer 8c6f71fdb2 adapt to static-render branch changes [skip ci]
still missing updated tests
2015-02-11 19:35:39 -08:00

61 lines
1.4 KiB
C++

#ifndef NODE_MBGL_NODE_MAP
#define NODE_MBGL_NODE_MAP
#include <mbgl/map/map.hpp>
#include <mbgl/platform/default/headless_view.hpp>
#include <node.h>
#include <nan.h>
#include <queue>
namespace node_mbgl {
class NodeFileSource;
class NodeMap : public node::ObjectWrap {
struct RenderOptions;
class RenderWorker;
////////////////////////////////////////////////////////////////////////////////////////////////
// Static Node Methods
public:
static void Init(v8::Handle<v8::Object> target);
static NAN_METHOD(New);
static NAN_METHOD(SetAccessToken);
static NAN_METHOD(Load);
static NAN_METHOD(Render);
void startRender(std::unique_ptr<NodeMap::RenderOptions> options);
void renderFinished();
static std::unique_ptr<NodeMap::RenderOptions> ParseOptions(v8::Local<v8::Object> obj);
static v8::Persistent<v8::FunctionTemplate> constructorTemplate;
////////////////////////////////////////////////////////////////////////////////////////////////
// Instance
private:
NodeMap(v8::Handle<v8::Object> source);
~NodeMap();
private:
// For retaining the FileSource object.
v8::Persistent<v8::Object> source;
mbgl::HeadlessView view;
NodeFileSource &fs;
mbgl::Map map;
std::unique_ptr<const mbgl::StillImage> image;
std::unique_ptr<NanCallback> callback;
// Async for delivering the notifications of render completion.
uv_async_t *async;
};
} // end ns node_mbgl
#endif