mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Whittle down tile.hpp to the things that actually related to tile.cpp
This commit is contained in:
+8
-8
@@ -12,8 +12,8 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include "mvt.hpp"
|
#include "mvt.hpp"
|
||||||
#include "tile.hpp"
|
|
||||||
#include "projection.hpp"
|
#include "projection.hpp"
|
||||||
|
#include "geometry.hpp"
|
||||||
|
|
||||||
void printq(const char *s) {
|
void printq(const char *s) {
|
||||||
putchar('"');
|
putchar('"');
|
||||||
@@ -29,12 +29,12 @@ void printq(const char *s) {
|
|||||||
putchar('"');
|
putchar('"');
|
||||||
}
|
}
|
||||||
|
|
||||||
struct draw {
|
struct lonlat {
|
||||||
int op;
|
int op;
|
||||||
double lon;
|
double lon;
|
||||||
double lat;
|
double lat;
|
||||||
|
|
||||||
draw(int op, double lon, double lat) {
|
lonlat(int op, double lon, double lat) {
|
||||||
this->op = op;
|
this->op = op;
|
||||||
this->lon = lon;
|
this->lon = lon;
|
||||||
this->lat = lat;
|
this->lat = lat;
|
||||||
@@ -141,7 +141,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe) {
|
|||||||
|
|
||||||
printf(" }, \"geometry\": { ");
|
printf(" }, \"geometry\": { ");
|
||||||
|
|
||||||
std::vector<draw> ops;
|
std::vector<lonlat> ops;
|
||||||
|
|
||||||
for (size_t g = 0; g < feat.geometry.size(); g++) {
|
for (size_t g = 0; g < feat.geometry.size(); g++) {
|
||||||
int op = feat.geometry[g].op;
|
int op = feat.geometry[g].op;
|
||||||
@@ -156,9 +156,9 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe) {
|
|||||||
double lat, lon;
|
double lat, lon;
|
||||||
tile2latlon(wx, wy, 32, &lat, &lon);
|
tile2latlon(wx, wy, 32, &lat, &lon);
|
||||||
|
|
||||||
ops.push_back(draw(op, lon, lat));
|
ops.push_back(lonlat(op, lon, lat));
|
||||||
} else {
|
} else {
|
||||||
ops.push_back(draw(op, 0, 0));
|
ops.push_back(lonlat(op, 0, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,12 +212,12 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe) {
|
|||||||
printf(" ] ]");
|
printf(" ] ]");
|
||||||
}
|
}
|
||||||
} else if (feat.type == VT_POLYGON) {
|
} else if (feat.type == VT_POLYGON) {
|
||||||
std::vector<std::vector<draw> > rings;
|
std::vector<std::vector<lonlat> > rings;
|
||||||
std::vector<double> areas;
|
std::vector<double> areas;
|
||||||
|
|
||||||
for (size_t i = 0; i < ops.size(); i++) {
|
for (size_t i = 0; i < ops.size(); i++) {
|
||||||
if (ops[i].op == VT_MOVETO) {
|
if (ops[i].op == VT_MOVETO) {
|
||||||
rings.push_back(std::vector<draw>());
|
rings.push_back(std::vector<lonlat>());
|
||||||
areas.push_back(0);
|
areas.push_back(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -19,12 +19,12 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "jsonpull.h"
|
#include "jsonpull.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "tile.hpp"
|
|
||||||
#include "pool.hpp"
|
#include "pool.hpp"
|
||||||
#include "mbtiles.hpp"
|
#include "mbtiles.hpp"
|
||||||
#include "projection.hpp"
|
#include "projection.hpp"
|
||||||
@@ -33,6 +33,7 @@ extern "C" {
|
|||||||
#include "serial.hpp"
|
#include "serial.hpp"
|
||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
#include "geojson.hpp"
|
#include "geojson.hpp"
|
||||||
|
#include "geometry.hpp"
|
||||||
|
|
||||||
#define GEOM_POINT 0 /* array of positions */
|
#define GEOM_POINT 0 /* array of positions */
|
||||||
#define GEOM_MULTIPOINT 1 /* array of arrays of positions */
|
#define GEOM_MULTIPOINT 1 /* array of arrays of positions */
|
||||||
|
|||||||
+1
-1
@@ -11,9 +11,9 @@
|
|||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
#include "geometry.hpp"
|
#include "geometry.hpp"
|
||||||
#include "clipper/clipper.hpp"
|
#include "clipper/clipper.hpp"
|
||||||
#include "tile.hpp"
|
|
||||||
#include "projection.hpp"
|
#include "projection.hpp"
|
||||||
#include "serial.hpp"
|
#include "serial.hpp"
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
static int pnpoly(drawvec &vert, size_t start, size_t nvert, long long testx, long long testy);
|
static int pnpoly(drawvec &vert, size_t start, size_t nvert, long long testx, long long testy);
|
||||||
static int clip(double *x0, double *y0, double *x1, double *y1, double xmin, double ymin, double xmax, double ymax);
|
static int clip(double *x0, double *y0, double *x1, double *y1, double xmin, double ymin, double xmax, double ymax);
|
||||||
|
|||||||
@@ -1,3 +1,16 @@
|
|||||||
|
#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
|
||||||
|
|
||||||
|
#define VT_STRING 1
|
||||||
|
#define VT_NUMBER 2
|
||||||
|
#define VT_BOOLEAN 7
|
||||||
|
|
||||||
struct draw {
|
struct draw {
|
||||||
signed char op;
|
signed char op;
|
||||||
long long x;
|
long long x;
|
||||||
|
|||||||
@@ -7,3 +7,9 @@ struct index {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void checkdisk(struct reader *r, int nreader);
|
void checkdisk(struct reader *r, int nreader);
|
||||||
|
|
||||||
|
extern int geometry_scale;
|
||||||
|
extern int quiet;
|
||||||
|
|
||||||
|
extern int CPUS;
|
||||||
|
extern int TEMP_FILES;
|
||||||
|
|||||||
+2
-1
@@ -5,9 +5,10 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
|
#include <vector>
|
||||||
#include "pool.hpp"
|
#include "pool.hpp"
|
||||||
#include "tile.hpp"
|
|
||||||
#include "mbtiles.hpp"
|
#include "mbtiles.hpp"
|
||||||
|
#include "geometry.hpp"
|
||||||
|
|
||||||
sqlite3 *mbtiles_open(char *dbname, char **argv, int forcetable) {
|
sqlite3 *mbtiles_open(char *dbname, char **argv, int forcetable) {
|
||||||
sqlite3 *outdb;
|
sqlite3 *outdb;
|
||||||
|
|||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
static int additional_options[] = {
|
||||||
|
#define A_COALESCE ((int) 'c')
|
||||||
|
A_COALESCE,
|
||||||
|
#define A_REVERSE ((int) 'r')
|
||||||
|
A_REVERSE,
|
||||||
|
#define A_REORDER ((int) 'o')
|
||||||
|
A_REORDER,
|
||||||
|
#define A_LINE_DROP ((int) 'l')
|
||||||
|
A_LINE_DROP,
|
||||||
|
#define A_DEBUG_POLYGON ((int) 'd')
|
||||||
|
A_DEBUG_POLYGON,
|
||||||
|
#define A_POLYGON_DROP ((int) 'p')
|
||||||
|
A_POLYGON_DROP,
|
||||||
|
#define A_PREFER_RADIX_SORT ((int) 'R')
|
||||||
|
A_PREFER_RADIX_SORT,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int prevent_options[] = {
|
||||||
|
#define P_SIMPLIFY ((int) 's')
|
||||||
|
P_SIMPLIFY,
|
||||||
|
#define P_SIMPLIFY_LOW ((int) 'S')
|
||||||
|
P_SIMPLIFY_LOW,
|
||||||
|
#define P_FEATURE_LIMIT ((int) 'f')
|
||||||
|
P_FEATURE_LIMIT,
|
||||||
|
#define P_KILOBYTE_LIMIT ((int) 'k')
|
||||||
|
P_KILOBYTE_LIMIT,
|
||||||
|
#define P_DYNAMIC_DROP ((int) 'd')
|
||||||
|
P_DYNAMIC_DROP,
|
||||||
|
#define P_INPUT_ORDER ((int) 'i')
|
||||||
|
P_INPUT_ORDER,
|
||||||
|
#define P_POLYGON_SPLIT ((int) 'p')
|
||||||
|
P_POLYGON_SPLIT,
|
||||||
|
#define P_CLIPPING ((int) 'c')
|
||||||
|
P_CLIPPING,
|
||||||
|
#define P_DUPLICATION ((int) 'D')
|
||||||
|
P_DUPLICATION,
|
||||||
|
};
|
||||||
+1
-1
@@ -10,10 +10,10 @@
|
|||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "mvt.hpp"
|
#include "mvt.hpp"
|
||||||
#include "tile.hpp"
|
|
||||||
#include "projection.hpp"
|
#include "projection.hpp"
|
||||||
#include "pool.hpp"
|
#include "pool.hpp"
|
||||||
#include "mbtiles.hpp"
|
#include "mbtiles.hpp"
|
||||||
|
#include "geometry.hpp"
|
||||||
|
|
||||||
std::string dequote(std::string s);
|
std::string dequote(std::string s);
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
#include "mbtiles.hpp"
|
#include "mbtiles.hpp"
|
||||||
#include "projection.hpp"
|
#include "projection.hpp"
|
||||||
#include "serial.hpp"
|
#include "serial.hpp"
|
||||||
|
#include "options.hpp"
|
||||||
|
#include "main.hpp"
|
||||||
|
|
||||||
#define CMD_BITS 3
|
#define CMD_BITS 3
|
||||||
|
|
||||||
|
|||||||
@@ -1,64 +1,5 @@
|
|||||||
#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
|
|
||||||
|
|
||||||
#define VT_STRING 1
|
|
||||||
#define VT_NUMBER 2
|
|
||||||
#define VT_BOOLEAN 7
|
|
||||||
|
|
||||||
struct pool;
|
|
||||||
|
|
||||||
long long write_tile(char **geom, char *metabase, char *stringpool, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int min_detail, int basezoom, struct pool **file_keys, char **layernames, sqlite3 *outdb, 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, int *prevent, int *additional);
|
long long write_tile(char **geom, char *metabase, char *stringpool, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int min_detail, int basezoom, struct pool **file_keys, char **layernames, sqlite3 *outdb, 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, int *prevent, int *additional);
|
||||||
|
|
||||||
int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpool, struct pool **file_keys, unsigned *midx, unsigned *midy, char **layernames, int maxzoom, int minzoom, int basezoom, sqlite3 *outdb, double droprate, int buffer, const char *fname, const char *tmpdir, double gamma, int nlayers, int *prevent, int *additional, int full_detail, int low_detail, int min_detail, long long *meta_off, long long *pool_off, unsigned *initial_x, unsigned *initial_y);
|
int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpool, struct pool **file_keys, unsigned *midx, unsigned *midy, char **layernames, int maxzoom, int minzoom, int basezoom, sqlite3 *outdb, double droprate, int buffer, const char *fname, const char *tmpdir, double gamma, int nlayers, int *prevent, int *additional, int full_detail, int low_detail, int min_detail, long long *meta_off, long long *pool_off, unsigned *initial_x, unsigned *initial_y);
|
||||||
|
|
||||||
int manage_gap(unsigned long long index, unsigned long long *previndex, double scale, double gamma, double *gap);
|
int manage_gap(unsigned long long index, unsigned long long *previndex, double scale, double gamma, double *gap);
|
||||||
|
|
||||||
extern int geometry_scale;
|
|
||||||
extern int quiet;
|
|
||||||
|
|
||||||
extern int CPUS;
|
|
||||||
extern int TEMP_FILES;
|
|
||||||
|
|
||||||
static int additional_options[] = {
|
|
||||||
#define A_COALESCE ((int) 'c')
|
|
||||||
A_COALESCE,
|
|
||||||
#define A_REVERSE ((int) 'r')
|
|
||||||
A_REVERSE,
|
|
||||||
#define A_REORDER ((int) 'o')
|
|
||||||
A_REORDER,
|
|
||||||
#define A_LINE_DROP ((int) 'l')
|
|
||||||
A_LINE_DROP,
|
|
||||||
#define A_DEBUG_POLYGON ((int) 'd')
|
|
||||||
A_DEBUG_POLYGON,
|
|
||||||
#define A_POLYGON_DROP ((int) 'p')
|
|
||||||
A_POLYGON_DROP,
|
|
||||||
#define A_PREFER_RADIX_SORT ((int) 'R')
|
|
||||||
A_PREFER_RADIX_SORT,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int prevent_options[] = {
|
|
||||||
#define P_SIMPLIFY ((int) 's')
|
|
||||||
P_SIMPLIFY,
|
|
||||||
#define P_SIMPLIFY_LOW ((int) 'S')
|
|
||||||
P_SIMPLIFY_LOW,
|
|
||||||
#define P_FEATURE_LIMIT ((int) 'f')
|
|
||||||
P_FEATURE_LIMIT,
|
|
||||||
#define P_KILOBYTE_LIMIT ((int) 'k')
|
|
||||||
P_KILOBYTE_LIMIT,
|
|
||||||
#define P_DYNAMIC_DROP ((int) 'd')
|
|
||||||
P_DYNAMIC_DROP,
|
|
||||||
#define P_INPUT_ORDER ((int) 'i')
|
|
||||||
P_INPUT_ORDER,
|
|
||||||
#define P_POLYGON_SPLIT ((int) 'p')
|
|
||||||
P_POLYGON_SPLIT,
|
|
||||||
#define P_CLIPPING ((int) 'c')
|
|
||||||
P_CLIPPING,
|
|
||||||
#define P_DUPLICATION ((int) 'D')
|
|
||||||
P_DUPLICATION,
|
|
||||||
};
|
|
||||||
|
|||||||
Reference in New Issue
Block a user