mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 16:35:40 +02:00
* Add an option to extend zooms if still dropping, but with a limit * At least when to overzoom, even if not actually doing it yet * Refactor to give tile-join access to overzoom() * Didn't work, but *might* have worked * OK, it did something now * Ah, there's the bug! * Hook up pmtiles and dirtiles as overzooming sources * Add command line option to enable or disable overzooming * Add (currently broken) test of overzooming in tile-join * Slightly more abstraction for the tile-join readers * Factor out duplicated code * Move construction into a constructor * More changing accessors to methods * Reduce magic * Start tracking a list of the tiles at maxzoom * I think it worked? * Add missing #include * Fix sequence of overzoomed tiles (Y sorts backwards for TMS) * Don't spend memory on overzooming when we aren't going to use it * Diff rather than cmp, in the hope of figuring out this broken test * Keep full coordinate precision if we might extend zooms * Try a slightly different byte limit * Make drop-densest more consistent across tile boundaries * Also affects this test * Does it behave any differently if it can extend forever? * I think the discrepancy is a thread-safety problem here * Revert "Does it behave any differently if it can extend forever?" This reverts commit0dff0a0acc. * Lost this change to the test * This time for sure! * Revert "Also affects this test" This reverts commitcd1f7c2e78. * Revert "Make drop-densest more consistent across tile boundaries" This reverts commit563f7d2bc2. * Revert "Try a slightly different byte limit" This reverts commit2e271213d6. * Add some more explanatory comments * Amend the join-test to detect my current bug * Allow overzooming to complete the zoom if it ever starts * Forgot to correct the test * Update changelog and version * Cleanups from code review * Remove version number from fixture to fix test
97 lines
3.2 KiB
C++
97 lines
3.2 KiB
C++
#ifndef GEOMETRY_HPP
|
|
#define GEOMETRY_HPP
|
|
|
|
#include <vector>
|
|
#include <atomic>
|
|
#include <set>
|
|
#include <string>
|
|
#include <sqlite3.h>
|
|
#include <stdio.h>
|
|
|
|
#define VT_POINT 1
|
|
#define VT_LINE 2
|
|
#define VT_POLYGON 3
|
|
|
|
#define VT_END 0
|
|
#define VT_MOVETO 1
|
|
#define VT_LINETO 2
|
|
#define VT_CLOSEPATH 7
|
|
|
|
// The bitfield is to make sizeof(draw) be 16 instead of 24
|
|
// at the cost, apparently, of a 0.7% increase in running time
|
|
// for packing and unpacking.
|
|
struct draw {
|
|
long long x : 40;
|
|
signed char op;
|
|
long long y : 40;
|
|
signed char necessary;
|
|
|
|
draw(int nop, long long nx, long long ny)
|
|
: x(nx),
|
|
op(nop),
|
|
y(ny),
|
|
necessary(0) {
|
|
}
|
|
|
|
draw()
|
|
: x(0),
|
|
op(0),
|
|
y(0),
|
|
necessary(0) {
|
|
}
|
|
|
|
bool operator<(draw const &s) const {
|
|
if (y < s.y || (y == s.y && x < s.x)) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
bool operator==(draw const &s) const {
|
|
return y == s.y && x == s.x;
|
|
}
|
|
|
|
bool operator!=(draw const &s) const {
|
|
return y != s.y || x != s.x;
|
|
}
|
|
};
|
|
|
|
typedef std::vector<draw> drawvec;
|
|
struct serial_feature;
|
|
|
|
drawvec decode_geometry(char **meta, int z, unsigned tx, unsigned ty, long long *bbox, unsigned initial_x, unsigned initial_y);
|
|
void to_tile_scale(drawvec &geom, int z, int detail);
|
|
drawvec from_tile_scale(drawvec const &geom, int z, int detail);
|
|
drawvec remove_noop(drawvec geom, int type, int shift);
|
|
drawvec clip_point(drawvec &geom, int z, long long buffer);
|
|
drawvec clean_or_clip_poly(drawvec &geom, int z, int buffer, bool clip);
|
|
drawvec simple_clip_poly(drawvec &geom, int z, int buffer);
|
|
drawvec close_poly(drawvec &geom);
|
|
drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double *accum_area, serial_feature *this_feature, serial_feature *tiny_feature);
|
|
int clip(double *x0, double *y0, double *x1, double *y1, double xmin, double ymin, double xmax, double ymax);
|
|
drawvec clip_lines(drawvec &geom, int z, long long buffer);
|
|
drawvec stairstep(drawvec &geom, int z, int detail);
|
|
bool point_within_tile(long long x, long long y, int z);
|
|
int quick_check(long long *bbox, int z, long long buffer);
|
|
drawvec simplify_lines(drawvec &geom, int z, int detail, bool mark_tile_bounds, double simplification, size_t retain, drawvec const &shared_nodes);
|
|
drawvec reorder_lines(drawvec &geom);
|
|
drawvec fix_polygon(drawvec &geom);
|
|
std::vector<drawvec> chop_polygon(std::vector<drawvec> &geoms);
|
|
void check_polygon(drawvec &geom);
|
|
double get_area(const drawvec &geom, size_t i, size_t j);
|
|
double get_mp_area(drawvec &geom);
|
|
drawvec polygon_to_anchor(const drawvec &geom);
|
|
drawvec checkerboard_anchors(drawvec const &geom, int tx, int ty, int z, unsigned long long label_point);
|
|
|
|
drawvec simple_clip_poly(drawvec &geom, long long x1, long long y1, long long x2, long long y2);
|
|
drawvec clip_lines(drawvec &geom, long long x1, long long y1, long long x2, long long y2);
|
|
drawvec clip_point(drawvec &geom, long long x1, long long y1, long long x2, long long y2);
|
|
void visvalingam(drawvec &ls, size_t start, size_t end, double threshold, size_t retain);
|
|
int pnpoly(const drawvec &vert, size_t start, size_t nvert, long long testx, long long testy);
|
|
|
|
std::string overzoom(std::string s, int oz, int ox, int oy, int nz, int nx, int ny,
|
|
int detail, int buffer, std::set<std::string> const &keep);
|
|
|
|
#endif
|