mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
More structure initializers
This commit is contained in:
@@ -17,9 +17,9 @@ enum mvt_operation {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct mvt_geometry {
|
struct mvt_geometry {
|
||||||
long long x;
|
long long x = 0;
|
||||||
long long y;
|
long long y = 0;
|
||||||
int /* mvt_operation */ op;
|
int /* mvt_operation */ op = 0;
|
||||||
|
|
||||||
mvt_geometry(int op, long long x, long long y);
|
mvt_geometry(int op, long long x, long long y);
|
||||||
|
|
||||||
@@ -43,11 +43,11 @@ enum mvt_geometry_type {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct mvt_feature {
|
struct mvt_feature {
|
||||||
std::vector<unsigned> tags;
|
std::vector<unsigned> tags = std::vector<unsigned>();
|
||||||
std::vector<mvt_geometry> geometry;
|
std::vector<mvt_geometry> geometry = std::vector<mvt_geometry>();
|
||||||
int /* mvt_geometry_type */ type;
|
int /* mvt_geometry_type */ type = 0;
|
||||||
unsigned long long id;
|
unsigned long long id = 0;
|
||||||
bool has_id;
|
bool has_id = false;
|
||||||
|
|
||||||
mvt_feature() {
|
mvt_feature() {
|
||||||
has_id = false;
|
has_id = false;
|
||||||
@@ -80,15 +80,21 @@ struct mvt_value {
|
|||||||
|
|
||||||
bool operator<(const mvt_value &o) const;
|
bool operator<(const mvt_value &o) const;
|
||||||
std::string toString();
|
std::string toString();
|
||||||
|
|
||||||
|
mvt_value() {
|
||||||
|
this->type = mvt_double;
|
||||||
|
this->string_value = "";
|
||||||
|
this->numeric_value.double_value = 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mvt_layer {
|
struct mvt_layer {
|
||||||
int version;
|
int version = 0;
|
||||||
std::string name;
|
std::string name = "";
|
||||||
std::vector<mvt_feature> features;
|
std::vector<mvt_feature> features = std::vector<mvt_feature>();
|
||||||
std::vector<std::string> keys;
|
std::vector<std::string> keys = std::vector<std::string>();
|
||||||
std::vector<mvt_value> values;
|
std::vector<mvt_value> values = std::vector<mvt_value>();
|
||||||
long long extent;
|
long long extent = 0;
|
||||||
|
|
||||||
// Add a key-value pair to a feature, using this layer's constant pool
|
// Add a key-value pair to a feature, using this layer's constant pool
|
||||||
void tag(mvt_feature &feature, std::string key, mvt_value value);
|
void tag(mvt_feature &feature, std::string key, mvt_value value);
|
||||||
|
|||||||
@@ -872,10 +872,10 @@ bool find_common_edges(std::vector<partial> &partials, int z, int line_detail, d
|
|||||||
// If necessary, merge some adjacent polygons into some other polygons
|
// If necessary, merge some adjacent polygons into some other polygons
|
||||||
|
|
||||||
struct merge_order {
|
struct merge_order {
|
||||||
ssize_t edge;
|
ssize_t edge = 0;
|
||||||
unsigned long long gap;
|
unsigned long long gap = 0;
|
||||||
size_t p1;
|
size_t p1 = 0;
|
||||||
size_t p2;
|
size_t p2 = 0;
|
||||||
|
|
||||||
bool operator<(const merge_order &m) const {
|
bool operator<(const merge_order &m) const {
|
||||||
return gap < m.gap;
|
return gap < m.gap;
|
||||||
@@ -1300,38 +1300,38 @@ serial_feature next_feature(FILE *geoms, long long *geompos_in, char *metabase,
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct run_prefilter_args {
|
struct run_prefilter_args {
|
||||||
FILE *geoms;
|
FILE *geoms = NULL;
|
||||||
long long *geompos_in;
|
long long *geompos_in = NULL;
|
||||||
char *metabase;
|
char *metabase = NULL;
|
||||||
long long *meta_off;
|
long long *meta_off = NULL;
|
||||||
int z;
|
int z = 0;
|
||||||
unsigned tx;
|
unsigned tx = 0;
|
||||||
unsigned ty;
|
unsigned ty = 0;
|
||||||
unsigned *initial_x;
|
unsigned *initial_x = 0;
|
||||||
unsigned *initial_y;
|
unsigned *initial_y = 0;
|
||||||
long long *original_features;
|
long long *original_features = 0;
|
||||||
long long *unclipped_features;
|
long long *unclipped_features = 0;
|
||||||
int nextzoom;
|
int nextzoom = 0;
|
||||||
int maxzoom;
|
int maxzoom = 0;
|
||||||
int minzoom;
|
int minzoom = 0;
|
||||||
int max_zoom_increment;
|
int max_zoom_increment = 0;
|
||||||
size_t pass;
|
size_t pass = 0;
|
||||||
size_t passes;
|
size_t passes = 0;
|
||||||
volatile long long *along;
|
volatile long long *along = 0;
|
||||||
long long alongminus;
|
long long alongminus = 0;
|
||||||
int buffer;
|
int buffer = 0;
|
||||||
int *within;
|
int *within = NULL;
|
||||||
bool *first_time;
|
bool *first_time = NULL;
|
||||||
FILE **geomfile;
|
FILE **geomfile = NULL;
|
||||||
long long *geompos;
|
long long *geompos = NULL;
|
||||||
volatile double *oprogress;
|
volatile double *oprogress = NULL;
|
||||||
double todo;
|
double todo = 0;
|
||||||
const char *fname;
|
const char *fname = 0;
|
||||||
int child_shards;
|
int child_shards = 0;
|
||||||
std::vector<std::vector<std::string>> *layer_unmaps;
|
std::vector<std::vector<std::string>> *layer_unmaps = NULL;
|
||||||
char *stringpool;
|
char *stringpool = NULL;
|
||||||
long long *pool_off;
|
long long *pool_off = NULL;
|
||||||
FILE *prefilter_fp;
|
FILE *prefilter_fp = NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
void *run_prefilter(void *v) {
|
void *run_prefilter(void *v) {
|
||||||
@@ -2091,8 +2091,8 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct task {
|
struct task {
|
||||||
int fileno;
|
int fileno = 0;
|
||||||
struct task *next;
|
struct task *next = NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
void *run_thread(void *vargs) {
|
void *run_thread(void *vargs) {
|
||||||
@@ -2278,12 +2278,17 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
|
|||||||
|
|
||||||
// Assign temporary files to threads
|
// Assign temporary files to threads
|
||||||
|
|
||||||
struct task tasks[TEMP_FILES];
|
std::vector<struct task> tasks;
|
||||||
|
tasks.resize(TEMP_FILES);
|
||||||
|
|
||||||
struct dispatch {
|
struct dispatch {
|
||||||
struct task *tasks;
|
struct task *tasks = NULL;
|
||||||
long long todo;
|
long long todo = 0;
|
||||||
struct dispatch *next;
|
struct dispatch *next = NULL;
|
||||||
} dispatches[threads];
|
};
|
||||||
|
std::vector<struct dispatch> dispatches;
|
||||||
|
dispatches.resize(threads);
|
||||||
|
|
||||||
struct dispatch *dispatch_head = &dispatches[0];
|
struct dispatch *dispatch_head = &dispatches[0];
|
||||||
for (size_t j = 0; j < threads; j++) {
|
for (size_t j = 0; j < threads; j++) {
|
||||||
dispatches[j].tasks = NULL;
|
dispatches[j].tasks = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user