-
Notifications
You must be signed in to change notification settings - Fork 84
/
tile.hpp
69 lines (57 loc) · 2.77 KB
/
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
#ifndef TILE_HPP
#define TILE_HPP
#include <stdio.h>
#include <sqlite3.h>
#include <vector>
#include <atomic>
#include <map>
#include "mbtiles.hpp"
#include "serial.hpp"
#include "attribute.hpp"
#include "jsonpull/jsonpull.h"
struct atomic_strategy {
std::atomic<size_t> dropped_by_rate;
std::atomic<size_t> dropped_by_gamma;
std::atomic<size_t> dropped_as_needed;
std::atomic<size_t> coalesced_as_needed;
std::atomic<size_t> detail_reduced;
std::atomic<size_t> tiny_polygons;
std::atomic<size_t> truncated_zooms;
atomic_strategy()
: dropped_by_rate(0),
dropped_by_gamma(0),
dropped_as_needed(0),
coalesced_as_needed(0),
detail_reduced(0),
tiny_polygons(0),
truncated_zooms(0) {
}
void add_from(struct strategy const &src);
};
struct strategy {
size_t dropped_by_rate = 0;
size_t dropped_by_gamma = 0;
size_t dropped_as_needed = 0;
size_t coalesced_as_needed = 0;
size_t detail_reduced = 0;
size_t tiny_polygons = 0;
size_t truncated_zooms = 0;
size_t tile_size = 0;
size_t feature_count = 0;
strategy(const atomic_strategy &s, size_t ts, size_t fc) {
dropped_by_rate = s.dropped_by_rate;
dropped_by_gamma = s.dropped_by_gamma;
dropped_as_needed = s.dropped_as_needed;
coalesced_as_needed = s.coalesced_as_needed;
detail_reduced = s.detail_reduced;
tile_size = ts;
feature_count = fc;
tiny_polygons = s.tiny_polygons;
truncated_zooms = s.truncated_zooms;
}
strategy() = default;
};
// long long write_tile(char **geom, char *stringpool, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int min_detail, int basezoom, sqlite3 *outdb, const char *outdir, double droprate, int buffer, const char *fname, FILE **geomfile, int file_minzoom, int file_maxzoom, double todo, char *geomstart, long long along, double gamma, int nlayers, std::atomic<strategy> *strategy);
int traverse_zooms(int *geomfd, off_t *geom_size, char *stringpool, std::atomic<unsigned> *midx, std::atomic<unsigned> *midy, int &maxzoom, int minzoom, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *pool_off, unsigned *initial_x, unsigned *initial_y, double simplification, double maxzoom_simplification, std::vector<std::map<std::string, layermap_entry> > &layermap, const char *prefilter, const char *postfilter, std::unordered_map<std::string, attribute_op> const *attribute_accum, struct json_object *filter, std::vector<strategy> &strategies, int iz, struct node *shared_nodes_map, size_t nodepos, std::string const &shared_nodes_bloom, int basezoom, double droprate, std::vector<std::string> const &unidecode_data);
int manage_gap(unsigned long long index, unsigned long long *previndex, double scale, double gamma, double *gap);
#endif