mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-04 09:25:41 +02:00
I'm not sure how this ever worked before
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
// Note that the fields are in a specific order so that `segment` and `t` will
|
||||
// packed together with `seq` so that the total structure size will be only 32 bytes
|
||||
// instead of 40. (Could we save a few more, perhaps, by tracking `len` instead of
|
||||
// `end` and limiting the size of individual features to 32 bits?)
|
||||
// `end` and limiting the size of individual features to 2^32 bytes?)
|
||||
|
||||
struct index {
|
||||
// first and last+1 byte of the feature in the geometry temp file
|
||||
@@ -25,7 +25,7 @@ struct index {
|
||||
unsigned short t : 2;
|
||||
|
||||
// sequence number (sometimes with gaps in numbering) of the feature in the original input file
|
||||
unsigned long long seq : (64 - 18); // pack with segment and t to stay in 32 bytes
|
||||
unsigned long long seq : (64 - 16 - 2); // pack with segment and t to stay in 32 bytes
|
||||
|
||||
index()
|
||||
: t(0),
|
||||
@@ -33,15 +33,33 @@ struct index {
|
||||
}
|
||||
};
|
||||
|
||||
// Each zoom level has a drop_state that is used to account for the fraction of
|
||||
// point features that are supposed to be dropped in that zoom level. As it goes
|
||||
// through the spatially-sorted features, it is basically doing a diffusion dither
|
||||
// to keep the density of features in each vicinity at each zoom level
|
||||
// approximately correct by including or excluding individual features
|
||||
// to maintain the balance.
|
||||
|
||||
struct drop_state {
|
||||
double gap;
|
||||
// the z-index or hilbert index of the last feature that was placed in this zoom level
|
||||
unsigned long long previndex;
|
||||
|
||||
// the preservation rate (1 or more) for features in this zoom level.
|
||||
// 1 would be to keep all the features; 2 would drop every other feature;
|
||||
// 4 every fourth feature, and so on.
|
||||
double interval;
|
||||
double seq; // floating point because interval is
|
||||
|
||||
// the current accumulated error in this zoom level:
|
||||
// positive if too many features have been dropped;
|
||||
// negative if not enough features have been dropped.
|
||||
//
|
||||
// this is floating-point because the interval is.
|
||||
double error;
|
||||
};
|
||||
|
||||
extern unsigned long long preserve_point_density_threshold;
|
||||
|
||||
int calc_feature_minzoom(struct index *ix, struct drop_state *ds, int maxzoom, double gamma);
|
||||
int calc_feature_minzoom(struct index *ix, struct drop_state ds[], int maxzoom, double gamma);
|
||||
void prep_drop_states(struct drop_state ds[], int maxzoom, int basezoom, double droprate);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user