blob: 614eab2803421cb1030987f0c64b64bac2939465 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#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
|