/
mapnik_vector_tile.hpp
83 lines (76 loc) · 2.5 KB
/
mapnik_vector_tile.hpp
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef __NODE_MAPNIK_VECTOR_TILE_H__
#define __NODE_MAPNIK_VECTOR_TILE_H__
#include <v8.h>
#include <node_object_wrap.h>
#include "uv.h"
#include "vector_tile.pb.h"
using namespace v8;
class VectorTile: public node::ObjectWrap {
public:
static Persistent<FunctionTemplate> constructor;
static void Initialize(Handle<Object> target);
static Handle<Value> New(Arguments const&args);
static Handle<Value> getData(Arguments const& args);
static Handle<Value> render(Arguments const& args);
static Handle<Value> toJSON(Arguments const& args);
static Handle<Value> names(Arguments const& args);
static Handle<Value> toGeoJSON(Arguments const& args);
#ifdef PROTOBUF_FULL
static Handle<Value> toString(Arguments const& args);
#endif
static void EIO_RenderTile(uv_work_t* req);
static void EIO_AfterRenderTile(uv_work_t* req);
static Handle<Value> setData(Arguments const& args);
static void EIO_SetData(uv_work_t* req);
static void EIO_AfterSetData(uv_work_t* req);
static Handle<Value> setDataSync(Arguments const& args);
// methods common to mapnik.Image
static Handle<Value> width(Arguments const& args);
static Handle<Value> height(Arguments const& args);
static Handle<Value> painted(Arguments const& args);
static Handle<Value> clearSync(const Arguments& args);
static Handle<Value> clear(const Arguments& args);
static void EIO_Clear(uv_work_t* req);
static void EIO_AfterClear(uv_work_t* req);
static Handle<Value> isSolid(Arguments const& args);
static void EIO_IsSolid(uv_work_t* req);
static void EIO_AfterIsSolid(uv_work_t* req);
static Handle<Value> isSolidSync(Arguments const& args);
VectorTile(int z, int x, int y, unsigned w=256, unsigned h=256);
void clear() {
painted_ = false;
tiledata_.Clear();
}
mapnik::vector::tile & get_tile_nonconst() {
return tiledata_;
}
mapnik::vector::tile const& get_tile() const {
return tiledata_;
}
void painted(bool painted) {
painted_ = painted;
}
bool painted() const {
return painted_;
}
unsigned width() const {
return width_;
}
unsigned height() const {
return height_;
}
void _ref() { Ref(); }
void _unref() { Unref(); }
int z_;
int x_;
int y_;
private:
~VectorTile();
mapnik::vector::tile tiledata_;
unsigned width_;
unsigned height_;
bool painted_;
public:
int estimated_size_;
};
#endif // __NODE_MAPNIK_VECTOR_TILE_H__