mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-01 16:58:05 +00:00
Whittle down tile.hpp to the things that actually related to tile.cpp
This commit is contained in:
parent
3662f1a66b
commit
ee97e6c307
16
decode.cpp
16
decode.cpp
@ -12,8 +12,8 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include "mvt.hpp"
|
||||
#include "tile.hpp"
|
||||
#include "projection.hpp"
|
||||
#include "geometry.hpp"
|
||||
|
||||
void printq(const char *s) {
|
||||
putchar('"');
|
||||
@ -29,12 +29,12 @@ void printq(const char *s) {
|
||||
putchar('"');
|
||||
}
|
||||
|
||||
struct draw {
|
||||
struct lonlat {
|
||||
int op;
|
||||
double lon;
|
||||
double lat;
|
||||
|
||||
draw(int op, double lon, double lat) {
|
||||
lonlat(int op, double lon, double lat) {
|
||||
this->op = op;
|
||||
this->lon = lon;
|
||||
this->lat = lat;
|
||||
@ -141,7 +141,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe) {
|
||||
|
||||
printf(" }, \"geometry\": { ");
|
||||
|
||||
std::vector<draw> ops;
|
||||
std::vector<lonlat> ops;
|
||||
|
||||
for (size_t g = 0; g < feat.geometry.size(); g++) {
|
||||
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;
|
||||
tile2latlon(wx, wy, 32, &lat, &lon);
|
||||
|
||||
ops.push_back(draw(op, lon, lat));
|
||||
ops.push_back(lonlat(op, lon, lat));
|
||||
} 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(" ] ]");
|
||||
}
|
||||
} else if (feat.type == VT_POLYGON) {
|
||||
std::vector<std::vector<draw> > rings;
|
||||
std::vector<std::vector<lonlat> > rings;
|
||||
std::vector<double> areas;
|
||||
|
||||
for (size_t i = 0; i < ops.size(); i++) {
|
||||
if (ops[i].op == VT_MOVETO) {
|
||||
rings.push_back(std::vector<draw>());
|
||||
rings.push_back(std::vector<lonlat>());
|
||||
areas.push_back(0);
|
||||
}
|
||||
|
||||
|
@ -19,12 +19,12 @@
|
||||
#include <stdarg.h>
|
||||
#include <sys/resource.h>
|
||||
#include <pthread.h>
|
||||
#include <vector>
|
||||
|
||||
extern "C" {
|
||||
#include "jsonpull.h"
|
||||
}
|
||||
|
||||
#include "tile.hpp"
|
||||
#include "pool.hpp"
|
||||
#include "mbtiles.hpp"
|
||||
#include "projection.hpp"
|
||||
@ -33,6 +33,7 @@ extern "C" {
|
||||
#include "serial.hpp"
|
||||
#include "main.hpp"
|
||||
#include "geojson.hpp"
|
||||
#include "geometry.hpp"
|
||||
|
||||
#define GEOM_POINT 0 /* array of positions */
|
||||
#define GEOM_MULTIPOINT 1 /* array of arrays of positions */
|
||||
|
@ -11,9 +11,9 @@
|
||||
#include <sqlite3.h>
|
||||
#include "geometry.hpp"
|
||||
#include "clipper/clipper.hpp"
|
||||
#include "tile.hpp"
|
||||
#include "projection.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 clip(double *x0, double *y0, double *x1, double *y1, double xmin, double ymin, double xmax, double ymax);
|
||||
|
13
geometry.hpp
13
geometry.hpp
@ -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 {
|
||||
signed char op;
|
||||
long long x;
|
||||
|
6
main.hpp
6
main.hpp
@ -7,3 +7,9 @@ struct index {
|
||||
};
|
||||
|
||||
void checkdisk(struct reader *r, int nreader);
|
||||
|
||||
extern int geometry_scale;
|
||||
extern int quiet;
|
||||
|
||||
extern int CPUS;
|
||||
extern int TEMP_FILES;
|
||||
|
@ -5,9 +5,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sqlite3.h>
|
||||
#include <vector>
|
||||
#include "pool.hpp"
|
||||
#include "tile.hpp"
|
||||
#include "mbtiles.hpp"
|
||||
#include "geometry.hpp"
|
||||
|
||||
sqlite3 *mbtiles_open(char *dbname, char **argv, int forcetable) {
|
||||
sqlite3 *outdb;
|
||||
|
37
options.hpp
Normal file
37
options.hpp
Normal file
@ -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,
|
||||
};
|
@ -10,10 +10,10 @@
|
||||
#include <zlib.h>
|
||||
#include <math.h>
|
||||
#include "mvt.hpp"
|
||||
#include "tile.hpp"
|
||||
#include "projection.hpp"
|
||||
#include "pool.hpp"
|
||||
#include "mbtiles.hpp"
|
||||
#include "geometry.hpp"
|
||||
|
||||
std::string dequote(std::string s);
|
||||
|
||||
|
2
tile.cpp
2
tile.cpp
@ -26,6 +26,8 @@
|
||||
#include "mbtiles.hpp"
|
||||
#include "projection.hpp"
|
||||
#include "serial.hpp"
|
||||
#include "options.hpp"
|
||||
#include "main.hpp"
|
||||
|
||||
#define CMD_BITS 3
|
||||
|
||||
|
59
tile.hpp
59
tile.hpp
@ -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);
|
||||
|
||||
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);
|
||||
|
||||
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,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user