mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-03-24 04:45:17 +00:00
Pack structures tighter to use a little less memory
This commit is contained in:
parent
cc4a2736ea
commit
c0edefa721
@ -767,7 +767,7 @@ drawvec simple_clip_poly(drawvec &geom, long long minx, long long miny, long lon
|
||||
}
|
||||
|
||||
drawvec simple_clip_poly(drawvec &geom, int z, int detail, int buffer) {
|
||||
long long area = area = 1LL << (32 - z);
|
||||
long long area = 1LL << (32 - z);
|
||||
long long clip_buffer = buffer * area / 256;
|
||||
|
||||
return simple_clip_poly(geom, -clip_buffer, -clip_buffer, area + clip_buffer, area + clip_buffer);
|
||||
|
@ -12,10 +12,10 @@
|
||||
#define VT_BOOLEAN 7
|
||||
|
||||
struct draw {
|
||||
signed char op;
|
||||
long long x;
|
||||
long long y;
|
||||
int necessary;
|
||||
signed char op;
|
||||
signed char necessary;
|
||||
|
||||
draw(int nop, long long nx, long long ny) {
|
||||
this->op = nop;
|
||||
|
6
mvt.hpp
6
mvt.hpp
@ -8,9 +8,9 @@ enum mvt_operation {
|
||||
};
|
||||
|
||||
struct mvt_geometry {
|
||||
int x;
|
||||
int y;
|
||||
int /* mvt_operation */ op;
|
||||
long long x;
|
||||
long long y;
|
||||
|
||||
mvt_geometry(int op, long long x, long long y);
|
||||
};
|
||||
@ -23,8 +23,8 @@ enum mvt_geometry_type {
|
||||
|
||||
struct mvt_feature {
|
||||
std::vector<unsigned> tags;
|
||||
int /* mvt_geometry_type */ type;
|
||||
std::vector<mvt_geometry> geometry;
|
||||
int /* mvt_geometry_type */ type;
|
||||
};
|
||||
|
||||
enum mvt_value_type {
|
||||
|
7
tile.cpp
7
tile.cpp
@ -855,8 +855,7 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < partials.size(); i++) {
|
||||
std::vector<drawvec> pgeoms = partials[i].geoms;
|
||||
partials[i].geoms.clear(); // avoid keeping two copies in memory
|
||||
std::vector<drawvec> &pgeoms = partials[i].geoms;
|
||||
long long layer = partials[i].layer;
|
||||
signed char t = partials[i].t;
|
||||
long long original_seq = partials[i].original_seq;
|
||||
@ -871,6 +870,7 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
||||
c.index = partials[i].index;
|
||||
c.index2 = partials[i].index2;
|
||||
c.geom = pgeoms[j];
|
||||
pgeoms[j].clear();
|
||||
c.coalesced = false;
|
||||
c.original_seq = original_seq;
|
||||
c.m = partials[i].m;
|
||||
@ -882,6 +882,8 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
||||
}
|
||||
}
|
||||
|
||||
partials.clear();
|
||||
|
||||
int j;
|
||||
for (j = 0; j < child_shards; j++) {
|
||||
if (within[j]) {
|
||||
@ -966,6 +968,7 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
||||
feature.type = features[k][x].type;
|
||||
feature.geometry = to_feature(features[k][x].geom);
|
||||
count += features[k][x].geom.size();
|
||||
features[k][x].geom.clear();
|
||||
|
||||
decode_meta(features[k][x].m, &features[k][x].meta, features[k][x].stringpool, layer, feature);
|
||||
layer.features.push_back(feature);
|
||||
|
Loading…
x
Reference in New Issue
Block a user