@@ -541,6 +541,7 @@ struct simplification_worker_arg {
541
541
drawvec *shared_nodes;
542
542
node *shared_nodes_map;
543
543
size_t nodepos;
544
+ std::string const *shared_nodes_bloom;
544
545
};
545
546
546
547
// If a polygon has collapsed away to nothing during polygon cleaning,
@@ -590,7 +591,7 @@ static drawvec revive_polygon(drawvec &geom, double area, int z, int detail) {
590
591
// This simplifies the geometry of one feature. It is generally called from the feature_simplification_worker
591
592
// but is broken out here so that it can be called from earlier in write_tile if coalesced geometries build up
592
593
// too much in memory.
593
- static double simplify_feature (serial_feature *p, drawvec const &shared_nodes, node *shared_nodes_map, size_t nodepos) {
594
+ static double simplify_feature (serial_feature *p, drawvec const &shared_nodes, node *shared_nodes_map, size_t nodepos, std::string const &shared_nodes_bloom ) {
594
595
drawvec geom = p->geometry ;
595
596
signed char t = p->t ;
596
597
int z = p->z ;
@@ -637,13 +638,13 @@ static double simplify_feature(serial_feature *p, drawvec const &shared_nodes, n
637
638
}
638
639
639
640
// continues to simplify to line_detail even if we have extra detail
640
- drawvec ngeom = simplify_lines (geom, z, p->tx , p->ty , line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), p->simplification , t == VT_POLYGON ? 4 : 0 , shared_nodes, shared_nodes_map, nodepos);
641
+ drawvec ngeom = simplify_lines (geom, z, p->tx , p->ty , line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), p->simplification , t == VT_POLYGON ? 4 : 0 , shared_nodes, shared_nodes_map, nodepos, shared_nodes_bloom );
641
642
642
643
if (p->coalesced && prevent[P_SIMPLIFY_SHARED_NODES]) {
643
644
// do another simplification to eliminate collinearities
644
645
// that were left behind at the former corners between
645
646
// coalesced geometries
646
- ngeom = simplify_lines (ngeom, z, p->tx , p->ty , line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), 0.1 , t == VT_POLYGON ? 4 : 0 , shared_nodes, NULL , 0 );
647
+ ngeom = simplify_lines (ngeom, z, p->tx , p->ty , line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), 0.1 , t == VT_POLYGON ? 4 : 0 , shared_nodes, NULL , 0 , " " );
647
648
}
648
649
649
650
if (t != VT_POLYGON || ngeom.size () >= 3 ) {
@@ -671,7 +672,7 @@ static void *simplification_worker(void *v) {
671
672
for (size_t i = a->task ; i < (*features).size (); i += a->tasks ) {
672
673
double area = 0 ;
673
674
if (!a->trying_to_stop_early ) {
674
- area = simplify_feature (&((*features)[i]), *(a->shared_nodes ), a->shared_nodes_map , a->nodepos );
675
+ area = simplify_feature (&((*features)[i]), *(a->shared_nodes ), a->shared_nodes_map , a->nodepos , *(a-> shared_nodes_bloom ) );
675
676
}
676
677
677
678
signed char t = (*features)[i].t ;
@@ -896,6 +897,7 @@ struct write_tile_args {
896
897
bool compressed;
897
898
node *shared_nodes_map;
898
899
size_t nodepos;
900
+ std::string const *shared_nodes_bloom;
899
901
std::set<zxy> const *skip_children; // what is being skipped at this zoom
900
902
std::set<zxy> skip_children_out; // what will be skipped in the next zoom
901
903
};
@@ -1534,7 +1536,7 @@ void skip_tile(decompressor *geoms, std::atomic<long long> *geompos_in, bool com
1534
1536
}
1535
1537
}
1536
1538
1537
- long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, char *global_stringpool, int z, const unsigned tx, const unsigned ty, const int detail, int min_detail, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, compressor **geomfile, std::atomic<long long> *geompos, int minzoom, int maxzoom, double todo, std::atomic<long long> *along, long long alongminus, double gamma, int child_shards, long long *pool_off, unsigned *initial_x, unsigned *initial_y, std::atomic<int> *running, double simplification, std::vector<std::map<std::string, layermap_entry>> *layermaps, std::vector<std::vector<std::string>> *layer_unmaps, size_t tiling_seg, size_t pass, unsigned long long mingap, long long minextent, unsigned long long mindrop_sequence, const char *prefilter, const char *postfilter, json_object *filter, write_tile_args *arg, atomic_strategy *strategy_out, bool compressed_input, node *shared_nodes_map, size_t nodepos, std::vector<std::string> const &unidecode_data, long long estimated_complexity, std::set<zxy> &skip_children_out) {
1539
+ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, char *global_stringpool, int z, const unsigned tx, const unsigned ty, const int detail, int min_detail, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, compressor **geomfile, std::atomic<long long> *geompos, int minzoom, int maxzoom, double todo, std::atomic<long long> *along, long long alongminus, double gamma, int child_shards, long long *pool_off, unsigned *initial_x, unsigned *initial_y, std::atomic<int> *running, double simplification, std::vector<std::map<std::string, layermap_entry>> *layermaps, std::vector<std::vector<std::string>> *layer_unmaps, size_t tiling_seg, size_t pass, unsigned long long mingap, long long minextent, unsigned long long mindrop_sequence, const char *prefilter, const char *postfilter, json_object *filter, write_tile_args *arg, atomic_strategy *strategy_out, bool compressed_input, node *shared_nodes_map, size_t nodepos, std::string const &shared_nodes_bloom, std::vector<std::string> const &unidecode_data, long long estimated_complexity, std::set<zxy> &skip_children_out) {
1538
1540
double merge_fraction = 1 ;
1539
1541
double mingap_fraction = 1 ;
1540
1542
double minextent_fraction = 1 ;
@@ -2048,7 +2050,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
2048
2050
// may not be very effective for reducing memory usage.
2049
2051
2050
2052
for (; simplified_geometry_through < features.size (); simplified_geometry_through++) {
2051
- simplify_feature (&features[simplified_geometry_through], shared_nodes, shared_nodes_map, nodepos);
2053
+ simplify_feature (&features[simplified_geometry_through], shared_nodes, shared_nodes_map, nodepos, shared_nodes_bloom );
2052
2054
2053
2055
if (features[simplified_geometry_through].t == VT_POLYGON) {
2054
2056
drawvec to_clean = features[simplified_geometry_through].geometry ;
@@ -2247,6 +2249,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
2247
2249
args[i].shared_nodes = &shared_nodes;
2248
2250
args[i].shared_nodes_map = shared_nodes_map;
2249
2251
args[i].nodepos = nodepos;
2252
+ args[i].shared_nodes_bloom = &shared_nodes_bloom;
2250
2253
args[i].trying_to_stop_early = trying_to_stop_early;
2251
2254
2252
2255
if (tasks > 1 ) {
@@ -2326,7 +2329,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
2326
2329
if (!(prevent[P_SIMPLIFY] || (z == maxzoom && prevent[P_SIMPLIFY_LOW]))) {
2327
2330
// XXX revisit: why does this not take zoom into account?
2328
2331
layer_features[x].geometry = simplify_lines (layer_features[x].geometry , 32 , 0 , 0 , 0 ,
2329
- !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), simplification, layer_features[x].t == VT_POLYGON ? 4 : 0 , shared_nodes, NULL , 0 );
2332
+ !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), simplification, layer_features[x].t == VT_POLYGON ? 4 : 0 , shared_nodes, NULL , 0 , " " );
2330
2333
}
2331
2334
}
2332
2335
@@ -2777,7 +2780,7 @@ exit(EXIT_IMPOSSIBLE);
2777
2780
skip_tile (&dc, &geompos, arg->compressed );
2778
2781
len = 1 ;
2779
2782
} else {
2780
- len = write_tile (&dc, &geompos, arg->global_stringpool , z, x, y, z == arg->maxzoom ? arg->full_detail : arg->low_detail , arg->min_detail , arg->outdb , arg->outdir , arg->buffer , arg->fname , arg->geomfile , arg->geompos , arg->minzoom , arg->maxzoom , arg->todo , arg->along , geompos, arg->gamma , arg->child_shards , arg->pool_off , arg->initial_x , arg->initial_y , arg->running , arg->simplification , arg->layermaps , arg->layer_unmaps , arg->tiling_seg , arg->pass , arg->mingap , arg->minextent , arg->mindrop_sequence , arg->prefilter , arg->postfilter , arg->filter , arg, arg->strategy , arg->compressed , arg->shared_nodes_map , arg->nodepos , (*arg->unidecode_data ), estimated_complexity, arg->skip_children_out );
2783
+ len = write_tile (&dc, &geompos, arg->global_stringpool , z, x, y, z == arg->maxzoom ? arg->full_detail : arg->low_detail , arg->min_detail , arg->outdb , arg->outdir , arg->buffer , arg->fname , arg->geomfile , arg->geompos , arg->minzoom , arg->maxzoom , arg->todo , arg->along , geompos, arg->gamma , arg->child_shards , arg->pool_off , arg->initial_x , arg->initial_y , arg->running , arg->simplification , arg->layermaps , arg->layer_unmaps , arg->tiling_seg , arg->pass , arg->mingap , arg->minextent , arg->mindrop_sequence , arg->prefilter , arg->postfilter , arg->filter , arg, arg->strategy , arg->compressed , arg->shared_nodes_map , arg->nodepos , *(arg-> shared_nodes_bloom ), (*arg->unidecode_data ), estimated_complexity, arg->skip_children_out );
2781
2784
}
2782
2785
2783
2786
if (pthread_mutex_lock (&var_lock) != 0 ) {
@@ -2843,7 +2846,7 @@ exit(EXIT_IMPOSSIBLE);
2843
2846
return err_or_null;
2844
2847
}
2845
2848
2846
- int traverse_zooms (int *geomfd, off_t *geom_size, char *global_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>> &layermaps, const char *prefilter, const char *postfilter, std::unordered_map<std::string, attribute_op> const *attribute_accum, json_object *filter, std::vector<strategy> &strategies, int iz, node *shared_nodes_map, size_t nodepos, int basezoom, double droprate, std::vector<std::string> const &unidecode_data) {
2849
+ int traverse_zooms (int *geomfd, off_t *geom_size, char *global_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>> &layermaps, const char *prefilter, const char *postfilter, std::unordered_map<std::string, attribute_op> const *attribute_accum, json_object *filter, std::vector<strategy> &strategies, int iz, node *shared_nodes_map, size_t nodepos, std::string const &shared_nodes_bloom, int basezoom, double droprate, std::vector<std::string> const &unidecode_data) {
2847
2850
last_progress = 0 ;
2848
2851
2849
2852
// The existing layermaps are one table per input thread.
@@ -3060,6 +3063,7 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
3060
3063
args[thread].compressed = (z != iz);
3061
3064
args[thread].shared_nodes_map = shared_nodes_map;
3062
3065
args[thread].nodepos = nodepos;
3066
+ args[thread].shared_nodes_bloom = &shared_nodes_bloom;
3063
3067
args[thread].skip_children = &skip_children;
3064
3068
args[thread].skip_children_out .clear ();
3065
3069
0 commit comments