mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-06-05 09:10:46 +00:00
Clean up #includes and add fields for counting attributes
This commit is contained in:
parent
24a182772f
commit
65c095cc2b
@ -1,3 +1,10 @@
|
|||||||
|
#include <string>
|
||||||
|
|
||||||
|
#ifndef DIRTILES_HPP
|
||||||
|
#define DIRTILES_HPP
|
||||||
|
|
||||||
std::string dir_read_tile(std::string pbfPath);
|
std::string dir_read_tile(std::string pbfPath);
|
||||||
|
|
||||||
void dir_write_tile(const char *outdir, int z, int tx, int ty, std::string const &pbf);
|
void dir_write_tile(const char *outdir, int z, int tx, int ty, std::string const &pbf);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -24,11 +24,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#include "jsonpull/jsonpull.h"
|
#include "jsonpull/jsonpull.h"
|
||||||
}
|
|
||||||
|
|
||||||
#include "pool.hpp"
|
#include "pool.hpp"
|
||||||
#include "projection.hpp"
|
#include "projection.hpp"
|
||||||
#include "memfile.hpp"
|
#include "memfile.hpp"
|
||||||
|
12
geojson.hpp
12
geojson.hpp
@ -1,3 +1,13 @@
|
|||||||
|
#ifndef GEOJSON_HPP
|
||||||
|
#define GEOJSON_HPP
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <set>
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include "mbtiles.hpp"
|
||||||
|
#include "jsonpull/jsonpull.h"
|
||||||
|
|
||||||
struct parse_json_args {
|
struct parse_json_args {
|
||||||
json_pull *jp;
|
json_pull *jp;
|
||||||
const char *reading;
|
const char *reading;
|
||||||
@ -39,3 +49,5 @@ void json_end_map(struct json_pull *jp);
|
|||||||
|
|
||||||
void parse_json(json_pull *jp, const char *reading, volatile long long *layer_seq, volatile long long *progress_seq, long long *metapos, long long *geompos, long long *indexpos, std::set<std::string> *exclude, std::set<std::string> *include, int exclude_all, FILE *metafile, FILE *geomfile, FILE *indexfile, struct memfile *poolfile, struct memfile *treefile, char *fname, int basezoom, int layer, double droprate, long long *file_bbox, int segment, int *initialized, unsigned *initial_x, unsigned *initial_y, struct reader *readers, int maxzoom, std::map<std::string, layermap_entry> *layermap, std::string layername, bool uses_gamma, std::map<std::string, int> const *attribute_types, double *dist_sum, size_t *dist_count, bool want_dist);
|
void parse_json(json_pull *jp, const char *reading, volatile long long *layer_seq, volatile long long *progress_seq, long long *metapos, long long *geompos, long long *indexpos, std::set<std::string> *exclude, std::set<std::string> *include, int exclude_all, FILE *metafile, FILE *geomfile, FILE *indexfile, struct memfile *poolfile, struct memfile *treefile, char *fname, int basezoom, int layer, double droprate, long long *file_bbox, int segment, int *initialized, unsigned *initial_x, unsigned *initial_y, struct reader *readers, int maxzoom, std::map<std::string, layermap_entry> *layermap, std::string layername, bool uses_gamma, std::map<std::string, int> const *attribute_types, double *dist_sum, size_t *dist_count, bool want_dist);
|
||||||
void *run_parse_json(void *v);
|
void *run_parse_json(void *v);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
#ifndef GEOMETRY_HPP
|
||||||
|
#define GEOMETRY_HPP
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <sqlite3.h>
|
||||||
|
|
||||||
#define VT_POINT 1
|
#define VT_POINT 1
|
||||||
#define VT_LINE 2
|
#define VT_LINE 2
|
||||||
#define VT_POLYGON 3
|
#define VT_POLYGON 3
|
||||||
@ -68,3 +74,5 @@ std::vector<drawvec> chop_polygon(std::vector<drawvec> &geoms);
|
|||||||
void check_polygon(drawvec &geom, drawvec &before);
|
void check_polygon(drawvec &geom, drawvec &before);
|
||||||
double get_area(drawvec &geom, size_t i, size_t j);
|
double get_area(drawvec &geom, size_t i, size_t j);
|
||||||
double get_mp_area(drawvec &geom);
|
double get_mp_area(drawvec &geom);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
#ifndef JSONPULL_H
|
||||||
|
#define JSONPULL_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef enum json_type {
|
typedef enum json_type {
|
||||||
// These types can be returned by json_read()
|
// These types can be returned by json_read()
|
||||||
JSON_HASH,
|
JSON_HASH,
|
||||||
@ -65,3 +72,9 @@ void json_disconnect(json_object *j);
|
|||||||
json_object *json_hash_get(json_object *o, const char *s);
|
json_object *json_hash_get(json_object *o, const char *s);
|
||||||
|
|
||||||
char *json_stringify(json_object *o);
|
char *json_stringify(json_object *o);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
3
main.cpp
3
main.cpp
@ -36,10 +36,7 @@
|
|||||||
#include <sys/statfs.h>
|
#include <sys/statfs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#include "jsonpull/jsonpull.h"
|
#include "jsonpull/jsonpull.h"
|
||||||
}
|
|
||||||
|
|
||||||
#include "mbtiles.hpp"
|
#include "mbtiles.hpp"
|
||||||
#include "tile.hpp"
|
#include "tile.hpp"
|
||||||
#include "pool.hpp"
|
#include "pool.hpp"
|
||||||
|
7
main.hpp
7
main.hpp
@ -1,3 +1,8 @@
|
|||||||
|
#ifndef MAIN_HPP
|
||||||
|
#define MAIN_HPP
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
struct index {
|
struct index {
|
||||||
long long start;
|
long long start;
|
||||||
long long end;
|
long long end;
|
||||||
@ -18,3 +23,5 @@ extern size_t TEMP_FILES;
|
|||||||
extern size_t max_tile_size;
|
extern size_t max_tile_size;
|
||||||
|
|
||||||
#define MAX_ZOOM 24
|
#define MAX_ZOOM 24
|
||||||
|
|
||||||
|
#endif
|
||||||
|
14
mbtiles.hpp
14
mbtiles.hpp
@ -1,7 +1,18 @@
|
|||||||
|
#ifndef MBTILES_HPP
|
||||||
|
#define MBTILES_HPP
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include "mvt.hpp"
|
||||||
|
|
||||||
struct type_and_string {
|
struct type_and_string {
|
||||||
int type;
|
int type;
|
||||||
std::string string;
|
std::string string;
|
||||||
|
|
||||||
|
size_t attribute_count = 0;
|
||||||
|
std::vector<mvt_value> sample_values;
|
||||||
|
double min = INFINITY;
|
||||||
|
double max = -INFINITY;
|
||||||
|
|
||||||
bool operator<(const type_and_string &o) const;
|
bool operator<(const type_and_string &o) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -10,6 +21,7 @@ struct layermap_entry {
|
|||||||
std::set<type_and_string> file_keys;
|
std::set<type_and_string> file_keys;
|
||||||
int minzoom;
|
int minzoom;
|
||||||
int maxzoom;
|
int maxzoom;
|
||||||
|
size_t feature_count = 0;
|
||||||
|
|
||||||
layermap_entry(size_t _id) {
|
layermap_entry(size_t _id) {
|
||||||
id = _id;
|
id = _id;
|
||||||
@ -27,3 +39,5 @@ void mbtiles_close(sqlite3 *outdb, char **argv);
|
|||||||
void aprintf(std::string *buf, const char *format, ...);
|
void aprintf(std::string *buf, const char *format, ...);
|
||||||
|
|
||||||
std::map<std::string, layermap_entry> merge_layermaps(std::vector<std::map<std::string, layermap_entry> > const &maps);
|
std::map<std::string, layermap_entry> merge_layermaps(std::vector<std::map<std::string, layermap_entry> > const &maps);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#ifndef MEMFILE_HPP
|
||||||
|
#define MEMFILE_HPP
|
||||||
|
|
||||||
struct memfile {
|
struct memfile {
|
||||||
int fd;
|
int fd;
|
||||||
char *map;
|
char *map;
|
||||||
@ -9,3 +12,5 @@ struct memfile {
|
|||||||
struct memfile *memfile_open(int fd);
|
struct memfile *memfile_open(int fd);
|
||||||
int memfile_close(struct memfile *file);
|
int memfile_close(struct memfile *file);
|
||||||
int memfile_write(struct memfile *file, void *s, long long len);
|
int memfile_write(struct memfile *file, void *s, long long len);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
11
mvt.hpp
11
mvt.hpp
@ -1,3 +1,12 @@
|
|||||||
|
#ifndef MVT_HPP
|
||||||
|
#define MVT_HPP
|
||||||
|
|
||||||
|
#include <sqlite3.h>
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <set>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
struct mvt_value;
|
struct mvt_value;
|
||||||
struct mvt_layer;
|
struct mvt_layer;
|
||||||
|
|
||||||
@ -98,3 +107,5 @@ bool is_compressed(std::string const &data);
|
|||||||
int decompress(std::string const &input, std::string &output);
|
int decompress(std::string const &input, std::string &output);
|
||||||
int compress(std::string const &input, std::string &output);
|
int compress(std::string const &input, std::string &output);
|
||||||
int dezig(unsigned n);
|
int dezig(unsigned n);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#ifndef OPTIONS_HPP
|
||||||
|
#define OPTIONS_HPP
|
||||||
|
|
||||||
#define A_COALESCE ((int) 'c')
|
#define A_COALESCE ((int) 'c')
|
||||||
#define A_REVERSE ((int) 'r')
|
#define A_REVERSE ((int) 'r')
|
||||||
#define A_REORDER ((int) 'o')
|
#define A_REORDER ((int) 'o')
|
||||||
@ -30,3 +33,5 @@
|
|||||||
|
|
||||||
extern int prevent[256];
|
extern int prevent[256];
|
||||||
extern int additional[256];
|
extern int additional[256];
|
||||||
|
|
||||||
|
#endif
|
||||||
|
5
pool.hpp
5
pool.hpp
@ -1,3 +1,6 @@
|
|||||||
|
#ifndef POOL_HPP
|
||||||
|
#define POOL_HPP
|
||||||
|
|
||||||
struct stringpool {
|
struct stringpool {
|
||||||
long long left;
|
long long left;
|
||||||
long long right;
|
long long right;
|
||||||
@ -5,3 +8,5 @@ struct stringpool {
|
|||||||
};
|
};
|
||||||
|
|
||||||
long long addpool(struct memfile *poolfile, struct memfile *treefile, const char *s, char type);
|
long long addpool(struct memfile *poolfile, struct memfile *treefile, const char *s, char type);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#ifndef PROJECTION_HPP
|
||||||
|
#define PROJECTION_HPP
|
||||||
|
|
||||||
void lonlat2tile(double lon, double lat, int zoom, long long *x, long long *y);
|
void lonlat2tile(double lon, double lat, int zoom, long long *x, long long *y);
|
||||||
void epsg3857totile(double ix, double iy, int zoom, long long *x, long long *y);
|
void epsg3857totile(double ix, double iy, int zoom, long long *x, long long *y);
|
||||||
void tile2lonlat(long long x, long long y, int zoom, double *lon, double *lat);
|
void tile2lonlat(long long x, long long y, int zoom, double *lon, double *lat);
|
||||||
@ -15,3 +18,5 @@ struct projection {
|
|||||||
|
|
||||||
extern struct projection *projection;
|
extern struct projection *projection;
|
||||||
extern struct projection projections[];
|
extern struct projection projections[];
|
||||||
|
|
||||||
|
#endif
|
||||||
|
10
serial.hpp
10
serial.hpp
@ -1,3 +1,11 @@
|
|||||||
|
#ifndef SERIAL_HPP
|
||||||
|
#define SERIAL_HPP
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <vector>
|
||||||
|
#include "geometry.hpp"
|
||||||
|
|
||||||
size_t fwrite_check(const void *ptr, size_t size, size_t nitems, FILE *stream, const char *fname);
|
size_t fwrite_check(const void *ptr, size_t size, size_t nitems, FILE *stream, const char *fname);
|
||||||
|
|
||||||
void serialize_int(FILE *out, int n, long long *fpos, const char *fname);
|
void serialize_int(FILE *out, int n, long long *fpos, const char *fname);
|
||||||
@ -47,3 +55,5 @@ struct serial_feature {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void serialize_feature(FILE *geomfile, serial_feature *sf, long long *geompos, const char *fname, long long wx, long long wy, bool include_minzoom);
|
void serialize_feature(FILE *geomfile, serial_feature *sf, long long *geompos, const char *fname, long long wx, long long wy, bool include_minzoom);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
5
text.hpp
5
text.hpp
@ -1,3 +1,8 @@
|
|||||||
|
#ifndef TEXT_HPP
|
||||||
|
#define TEXT_HPP
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
std::string check_utf8(std::string text);
|
std::string check_utf8(std::string text);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -26,10 +26,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#include "jsonpull/jsonpull.h"
|
#include "jsonpull/jsonpull.h"
|
||||||
}
|
|
||||||
|
|
||||||
std::string dequote(std::string s);
|
std::string dequote(std::string s);
|
||||||
|
|
||||||
|
11
tile.hpp
11
tile.hpp
@ -1,5 +1,16 @@
|
|||||||
|
#ifndef TILE_HPP
|
||||||
|
#define TILE_HPP
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sqlite3.h>
|
||||||
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
#include "mbtiles.hpp"
|
||||||
|
|
||||||
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, sqlite3 *outdb, const char *outdir, 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);
|
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, sqlite3 *outdb, const char *outdir, 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 traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpool, unsigned *midx, unsigned *midy, int &maxzoom, int minzoom, int basezoom, sqlite3 *outdb, const char *outdir, double droprate, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *meta_off, long long *pool_off, unsigned *initial_x, unsigned *initial_y, double simplification, std::vector<std::map<std::string, layermap_entry> > &layermap);
|
int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpool, unsigned *midx, unsigned *midy, int &maxzoom, int minzoom, int basezoom, sqlite3 *outdb, const char *outdir, double droprate, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *meta_off, long long *pool_off, unsigned *initial_x, unsigned *initial_y, double simplification, std::vector<std::map<std::string, layermap_entry> > &layermap);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -1 +1,6 @@
|
|||||||
|
#ifndef VERSION_HPP
|
||||||
|
#define VERSION_HPP
|
||||||
|
|
||||||
#define VERSION "tippecanoe v1.20.0\n"
|
#define VERSION "tippecanoe v1.20.0\n"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user